bx-rest 0.0.20 → 0.0.22

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.
@@ -1,8 +1,504 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable } from '@angular/core';
3
- import { Observable } from 'rxjs';
2
+ import { Injectable, NgModule, inject, Component, ViewEncapsulation, Inject } from '@angular/core';
3
+ import { map, catchError, tap, mergeMap as mergeMap$1, first } from 'rxjs/operators';
4
+ import { Subscription, filter, take, of, throwError, forkJoin, mergeMap } from 'rxjs';
5
+ import clone from 'just-clone';
6
+ import * as i1$1 from '@angular/material/snack-bar';
7
+ import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
8
+ import * as i2 from '@angular/material/icon';
9
+ import { MatIconModule } from '@angular/material/icon';
10
+ import * as i1 from '@angular/material/button';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import * as i1$2 from '@ngrx/store';
13
+ import { createAction, props, createReducer, on } from '@ngrx/store';
4
14
  import { DateTime } from 'luxon';
5
- import { map } from 'rxjs/operators';
15
+ import * as i2$1 from '@angular/router';
16
+ import flatten from 'just-flatten-it';
17
+ import * as i1$3 from '@angular/common/http';
18
+ import { HttpParams } from '@angular/common/http';
19
+
20
+ const $get = 'get';
21
+ const $add = 'add';
22
+ const $set = 'set';
23
+ const $event = 'event';
24
+ const $update = 'update';
25
+ const $user = 'user';
26
+ const $task = 'task';
27
+ const $calendar = 'calendar';
28
+ const $meeting = 'meeting';
29
+ const $list = 'list';
30
+ const $search = 'search';
31
+ const $accessibility = 'accessibility';
32
+ const $delete = 'delete';
33
+ const $nearest = 'nearest';
34
+ const $params = 'params';
35
+ const $status = 'status';
36
+ const $resource = 'resource';
37
+ const $booking = 'booking';
38
+ const $section = 'section';
39
+ const $settings = 'settings';
40
+ const $tasks = 'tasks';
41
+ const $elapseditem = 'elapseditem';
42
+ const $getlist = 'getlist';
43
+ const $approve = 'approve';
44
+ const $complete = 'complete';
45
+ const $counters = 'counters';
46
+ const $deger = 'deger';
47
+ const $delegate = 'delegate';
48
+ const $disapprove = 'disapprove';
49
+ const $favorite = 'favorite';
50
+ const $files = 'files';
51
+ const $file = 'file';
52
+ const $attach = 'attach';
53
+ const $field = 'field';
54
+ const $getFields = 'get' + $field + 's';
55
+ const $getaccess = 'getaccess';
56
+ const $history = 'history';
57
+ const $pause = 'pause';
58
+ const $renew = 'renew';
59
+ const $start = 'start';
60
+ const $result = 'result';
61
+ const $planner = 'planner';
62
+ const $disk = 'disk';
63
+ const $rename = 'rename';
64
+ const $markdeleted = 'markdeleted';
65
+ const $restore = 'restore';
66
+ const $folder = 'folder';
67
+ const $getchildren = 'getchildren';
68
+ const $copyto = 'copyto';
69
+ const $moveto = 'moveto';
70
+ const $uploadfile = 'uploadfile';
71
+ const $storage = 'storage';
72
+ const $getTypes = 'getTypes';
73
+ const $stages = 'stages';
74
+ const $getmanifest = 'getmanifest';
75
+ const $isactionallowed = 'isactionallowed';
76
+ const $commentitem = 'commentitem';
77
+ const $department = 'department';
78
+ const $sonet_group = 'sonet_group';
79
+ const $create = 'create';
80
+ const $feature = 'feature';
81
+ const $access = 'access';
82
+ const $request = 'request';
83
+ const $socialnetwork = 'socialnetwork';
84
+ const $api = 'api';
85
+ const $workgroup = 'workgroup';
86
+ const $log = 'log';
87
+ const $blogpost = 'blogpost';
88
+ const $lists = 'lists';
89
+ const $iblock = 'iblock';
90
+ const $type = 'type';
91
+ const $id = 'id';
92
+ const $element = 'element';
93
+ const $url = 'url';
94
+
95
+ class BXRestListsElement {
96
+ constructor(http, mapResult) {
97
+ this.http = http;
98
+ this.mapResult = mapResult;
99
+ this.url = {
100
+ add: [$lists, $element, $add],
101
+ delete: [$lists, $element, $delete],
102
+ get: [$lists, $element, $get],
103
+ update: [$lists, $element, $update],
104
+ getFileUrl: [$lists, $element, $get, $file, $url] // Метод возвращает путь к файлу
105
+ };
106
+ }
107
+ get(pram) {
108
+ return this.http.post(this.url.get, pram)
109
+ .pipe(map(v => (v && v.result)
110
+ ? Object.assign(v, { result: v.result.map(i => this.mapResult.get(i)) })
111
+ : undefined));
112
+ }
113
+ }
114
+
115
+ class BXRestLists {
116
+ constructor(element) {
117
+ this.element = element;
118
+ this.url = {
119
+ add: [$lists, $add],
120
+ delete: [$lists, $delete],
121
+ get: [$lists, $get],
122
+ update: [$lists, $update],
123
+ getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
124
+ };
125
+ }
126
+ }
127
+ BXRestLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, deps: [{ token: BXRestListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
128
+ BXRestLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, providedIn: 'root' });
129
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, decorators: [{
130
+ type: Injectable,
131
+ args: [{
132
+ providedIn: 'root'
133
+ }]
134
+ }], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
135
+
136
+ class BxRestModule {
137
+ }
138
+ BxRestModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
139
+ BxRestModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, imports: [MatIconModule,
140
+ MatButtonModule], exports: [MatButtonModule,
141
+ MatIconModule] });
142
+ BxRestModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, imports: [MatIconModule,
143
+ MatButtonModule, MatButtonModule,
144
+ MatIconModule] });
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, decorators: [{
146
+ type: NgModule,
147
+ args: [{
148
+ declarations: [],
149
+ imports: [
150
+ MatIconModule,
151
+ MatButtonModule
152
+ ],
153
+ exports: [
154
+ MatButtonModule,
155
+ MatIconModule
156
+ ]
157
+ }]
158
+ }] });
159
+
160
+ class ToastMessageComponent {
161
+ constructor(data) {
162
+ this.data = data;
163
+ this.snackBarRef = inject(MatSnackBarRef);
164
+ }
165
+ getClass() {
166
+ switch (this.data.type) {
167
+ case 'error':
168
+ case 'warning':
169
+ case 'success':
170
+ return this.data.type + '-message';
171
+ }
172
+ return '';
173
+ }
174
+ }
175
+ ToastMessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ToastMessageComponent, deps: [{ token: MAT_SNACK_BAR_DATA }], target: i0.ɵɵFactoryTarget.Component });
176
+ ToastMessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ToastMessageComponent, isStandalone: true, selector: "app-view", ngImport: i0, template: "<div class=\"w-100 d-flex\">\n <span matSnackBarLabel [class]=\"getClass()\">\n {{ data.message }}\n</span>\n <span matSnackBarActions [class]=\"getClass()\">\n <button mat-button matSnackBarAction (click)=\"snackBarRef.dismissWithAction()\">\n <mat-icon>\n close\n </mat-icon>\n </button>\n</span>\n</div>\n\n", styles: [":host{display:flex;background-color:red}:host .mdc-snackbar__surface{padding:0;margin:0}:host .error-message{color:red}:host.error-box{background-color:#eec1c1}:host.error-box .error-message{color:red}mat-snack-bar-container.mdc-snackbar.error-box .mdc-snackbar__surface{background-color:#eec1c1}mat-snack-bar-container.mdc-snackbar.error-box .error-message{color:red}mat-snack-bar-container.mdc-snackbar.warning-box .mdc-snackbar__surface{background-color:#f0f2b9}mat-snack-bar-container.mdc-snackbar.warning-box .warning-message{color:#15140f}mat-snack-bar-container.mdc-snackbar.success-box .mdc-snackbar__surface{background-color:#daf7d1}mat-snack-bar-container.mdc-snackbar.success-box .success-message{color:#423f31}\n"], dependencies: [{ kind: "ngmodule", type: BxRestModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], encapsulation: i0.ViewEncapsulation.None });
177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ToastMessageComponent, decorators: [{
178
+ type: Component,
179
+ args: [{ selector: 'app-view', encapsulation: ViewEncapsulation.None, standalone: true, imports: [BxRestModule], template: "<div class=\"w-100 d-flex\">\n <span matSnackBarLabel [class]=\"getClass()\">\n {{ data.message }}\n</span>\n <span matSnackBarActions [class]=\"getClass()\">\n <button mat-button matSnackBarAction (click)=\"snackBarRef.dismissWithAction()\">\n <mat-icon>\n close\n </mat-icon>\n </button>\n</span>\n</div>\n\n", styles: [":host{display:flex;background-color:red}:host .mdc-snackbar__surface{padding:0;margin:0}:host .error-message{color:red}:host.error-box{background-color:#eec1c1}:host.error-box .error-message{color:red}mat-snack-bar-container.mdc-snackbar.error-box .mdc-snackbar__surface{background-color:#eec1c1}mat-snack-bar-container.mdc-snackbar.error-box .error-message{color:red}mat-snack-bar-container.mdc-snackbar.warning-box .mdc-snackbar__surface{background-color:#f0f2b9}mat-snack-bar-container.mdc-snackbar.warning-box .warning-message{color:#15140f}mat-snack-bar-container.mdc-snackbar.success-box .mdc-snackbar__surface{background-color:#daf7d1}mat-snack-bar-container.mdc-snackbar.success-box .success-message{color:#423f31}\n"] }]
180
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
181
+ type: Inject,
182
+ args: [MAT_SNACK_BAR_DATA]
183
+ }] }]; } });
184
+
185
+ /**
186
+ * Сервис для вывода сообщений пользователю
187
+ * TODO: логирование
188
+ */
189
+ class SnackBarService {
190
+ constructor(snackBar) {
191
+ this.snackBar = snackBar;
192
+ }
193
+ error(message, sec = 12) {
194
+ this.standardMessage(message, sec, 'error');
195
+ }
196
+ warning(message, sec = 7) {
197
+ this.standardMessage(message, sec, 'warning');
198
+ }
199
+ success(message, sec = 7) {
200
+ this.standardMessage(message, sec, 'success');
201
+ }
202
+ standardMessage(message, sec = 5, name = 'error') {
203
+ this.snackBar.open(message);
204
+ this.snackBar.openFromComponent(ToastMessageComponent, {
205
+ duration: sec * 1000,
206
+ data: {
207
+ message: message,
208
+ type: name
209
+ },
210
+ panelClass: name + '-box'
211
+ });
212
+ }
213
+ }
214
+ SnackBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SnackBarService, deps: [{ token: i1$1.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
215
+ SnackBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SnackBarService, providedIn: 'root' });
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SnackBarService, decorators: [{
217
+ type: Injectable,
218
+ args: [{
219
+ providedIn: 'root'
220
+ }]
221
+ }], ctorParameters: function () { return [{ type: i1$1.MatSnackBar }]; } });
222
+
223
+ // Generate an internal UID to make the regexp pattern harder to guess.
224
+ const UID_LENGTH = 16;
225
+ const UID = generateUID();
226
+ const PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|A|U|I|B|L)-' + UID + '-(\\d+)__@"', 'g');
227
+ const IS_NATIVE_CODE_REGEXP = /\{\s*\[native code]\s*}/g;
228
+ const IS_PURE_FUNCTION = /function.*?\(/;
229
+ const IS_ARROW_FUNCTION = /.*?=>.*?/;
230
+ const UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
231
+ const RESERVED_SYMBOLS = ['*', 'async'];
232
+ // Mapping of unsafe HTML and invalid JavaScript line terminator chars to their
233
+ // Unicode char counterparts which are safe to use in JavaScript strings.
234
+ const ESCAPED_CHARS = {
235
+ '<': '\\u003C',
236
+ '>': '\\u003E',
237
+ '/': '\\u002F',
238
+ '\u2028': '\\u2028',
239
+ '\u2029': '\\u2029'
240
+ };
241
+ function escapeUnsafeChars(unsafeChar) {
242
+ return (ESCAPED_CHARS.hasOwnProperty(unsafeChar)) ? ESCAPED_CHARS[unsafeChar] : '';
243
+ }
244
+ function generateUID() {
245
+ let bytes = window.crypto.getRandomValues(new Uint32Array(UID_LENGTH));
246
+ let result = '';
247
+ for (let i = 0; i < UID_LENGTH; ++i) {
248
+ result += bytes[i].toString(16);
249
+ }
250
+ return result;
251
+ }
252
+ function deleteFunctions(obj) {
253
+ let functionKeys = [];
254
+ for (let key in obj) {
255
+ if (typeof obj[key] === "function") {
256
+ functionKeys.push(key);
257
+ }
258
+ }
259
+ for (let i = 0; i < functionKeys.length; i++) {
260
+ delete obj[functionKeys[i]];
261
+ }
262
+ }
263
+ function serialize(obj, options = {}) {
264
+ // Backwards-compatibility for `space` as the second argument.
265
+ if (typeof options === 'number' || typeof options === 'string') {
266
+ options = { space: options };
267
+ }
268
+ let functions = [];
269
+ let regexps = [];
270
+ let dates = [];
271
+ let maps = [];
272
+ let sets = [];
273
+ let arrays = [];
274
+ let undefs = [];
275
+ let infinities = [];
276
+ let bigInts = [];
277
+ let urls = [];
278
+ // Returns placeholders for functions and regexps (identified by index)
279
+ // which are later replaced by their string representation.
280
+ function replacer(key, value) {
281
+ // For nested function
282
+ if (options.ignoreFunction) {
283
+ deleteFunctions(value);
284
+ }
285
+ if (!value && value !== undefined) {
286
+ return value;
287
+ }
288
+ // let origValue: any = this[key];
289
+ let origValue = value;
290
+ let type = typeof origValue;
291
+ switch (type) {
292
+ case 'object':
293
+ if (origValue instanceof RegExp) {
294
+ return '@__R-' + UID + '-' + (regexps.push(origValue) - 1) + '__@';
295
+ }
296
+ else if (origValue instanceof Date) {
297
+ return '@__D-' + UID + '-' + (dates.push(origValue) - 1) + '__@';
298
+ }
299
+ else if (origValue instanceof Map) {
300
+ return '@__M-' + UID + '-' + (maps.push(origValue) - 1) + '__@';
301
+ }
302
+ else if (origValue instanceof Set) {
303
+ return '@__S-' + UID + '-' + (sets.push(origValue) - 1) + '__@';
304
+ }
305
+ if (origValue instanceof Array) {
306
+ let isSparse = origValue.filter(function () {
307
+ return true;
308
+ }).length !== origValue.length;
309
+ if (isSparse) {
310
+ return '@__A-' + UID + '-' + (arrays.push(origValue) - 1) + '__@';
311
+ }
312
+ }
313
+ if (origValue instanceof URL) {
314
+ return '@__L-' + UID + '-' + (urls.push(origValue) - 1) + '__@';
315
+ }
316
+ break;
317
+ case 'function':
318
+ return '@__F-' + UID + '-' + (functions.push(origValue) - 1) + '__@';
319
+ case 'undefined':
320
+ return '@__U-' + UID + '-' + (undefs.push(origValue) - 1) + '__@';
321
+ case 'number':
322
+ return '@__I-' + UID + '-' + (infinities.push(origValue) - 1) + '__@';
323
+ case 'bigint':
324
+ return '@__B-' + UID + '-' + (bigInts.push(origValue) - 1) + '__@';
325
+ }
326
+ return value;
327
+ }
328
+ function serializeFunc(fn) {
329
+ let serializedFn = fn.toString();
330
+ if (IS_NATIVE_CODE_REGEXP.test(serializedFn)) {
331
+ throw new TypeError('Serializing native function: ' + fn.name);
332
+ }
333
+ // pure functions, example: {key: function() {}}
334
+ if (IS_PURE_FUNCTION.test(serializedFn)) {
335
+ return serializedFn;
336
+ }
337
+ // arrow functions, example: arg1 => arg1+5
338
+ if (IS_ARROW_FUNCTION.test(serializedFn)) {
339
+ return serializedFn;
340
+ }
341
+ let argsStartsAt = serializedFn.indexOf('(');
342
+ let def = serializedFn.slice(0, argsStartsAt)
343
+ .trim()
344
+ .split(' ')
345
+ .filter(function (val) {
346
+ return val.length > 0;
347
+ });
348
+ let nonReservedSymbols = def.filter(function (val) {
349
+ return RESERVED_SYMBOLS.indexOf(val) === -1;
350
+ });
351
+ // enhanced literal objects, example: {key() {}}
352
+ if (nonReservedSymbols.length > 0) {
353
+ return (def.indexOf('async') > -1 ? 'async ' : '') + 'function'
354
+ + (def.join('').indexOf('*') > -1 ? '*' : '')
355
+ + serializedFn.slice(argsStartsAt);
356
+ }
357
+ // arrow functions
358
+ return serializedFn;
359
+ }
360
+ // Check if the parameter is function
361
+ if (options.ignoreFunction && typeof obj === "function") {
362
+ obj = undefined;
363
+ }
364
+ // Protects against `JSON.stringify()` returning `undefined`, by serializing
365
+ // to the literal string: "undefined".
366
+ if (obj === undefined) {
367
+ return String(obj);
368
+ }
369
+ let str = '';
370
+ // Creates a JSON string representation of the value.
371
+ // NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args.
372
+ if (options.isJSON && !options.space) {
373
+ str = JSON.stringify(obj);
374
+ }
375
+ else {
376
+ str = JSON.stringify(obj, options.isJSON ? undefined : replacer, options.space);
377
+ }
378
+ // Replace unsafe HTML and invalid JavaScript line terminator chars with
379
+ // their safe Unicode char counterpart. This _must_ happen before the
380
+ // regexps and functions are serialized and added back to the string.
381
+ if (options.unsafe !== true) {
382
+ str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars);
383
+ }
384
+ if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && arrays.length === 0 && undefs.length === 0 && infinities.length === 0 && bigInts.length === 0 && urls.length === 0) {
385
+ return str;
386
+ }
387
+ // Replaces all occurrences of function, regexp, date, map and set placeholders in the
388
+ // JSON string with their string representations. If the original value can
389
+ // not be found, then `undefined` is used.
390
+ return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) {
391
+ // The placeholder may not be preceded by a backslash. This is to prevent
392
+ // replacing things like `"a\"@__R-<UID>-0__@"` and thus outputting
393
+ // invalid JS.
394
+ if (backSlash) {
395
+ return match;
396
+ }
397
+ switch (type) {
398
+ case 'D':
399
+ return "new Date(\"" + dates[valueIndex].toISOString() + "\")";
400
+ case 'R':
401
+ return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")";
402
+ case 'M':
403
+ return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")";
404
+ case 'S':
405
+ return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")";
406
+ case 'A':
407
+ return "Array.prototype.slice.call(" + serialize(Object.assign({ length: arrays[valueIndex].length }, arrays[valueIndex]), options) + ")";
408
+ case 'U':
409
+ return 'undefined';
410
+ case 'I':
411
+ return infinities[valueIndex];
412
+ case 'B':
413
+ return "BigInt(\"" + bigInts[valueIndex] + "\")";
414
+ case 'L':
415
+ return "new URL(\"" + urls[valueIndex].toString() + "\")";
416
+ }
417
+ let fn = functions[valueIndex];
418
+ return serializeFunc(fn);
419
+ });
420
+ }
421
+
422
+ class JSONServices {
423
+ static deserialize(data) {
424
+ return eval('(' + data + ')');
425
+ }
426
+ static serialize(data) {
427
+ return serialize(data);
428
+ }
429
+ }
430
+ JSONServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: JSONServices, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
431
+ JSONServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: JSONServices, providedIn: 'root' });
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: JSONServices, decorators: [{
433
+ type: Injectable,
434
+ args: [{
435
+ providedIn: 'root'
436
+ }]
437
+ }] });
438
+
439
+ class CookiesServices {
440
+ static get(name) {
441
+ const results = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
442
+ if (results)
443
+ return results[2];
444
+ else
445
+ return '';
446
+ }
447
+ static set(name, value, age = 0) {
448
+ let string = name + '=' + value + ';';
449
+ if (age) {
450
+ string += ' max-age=' + age;
451
+ }
452
+ string += '; SameSite=None; Secure';
453
+ document.cookie = string;
454
+ }
455
+ static setObj(name, value, age = 0) {
456
+ let string = name + '=' + JSONServices.serialize(value) + ';';
457
+ if (age) {
458
+ string += ' max-age=' + age;
459
+ }
460
+ string += '; SameSite=None; Secure';
461
+ document.cookie = string;
462
+ }
463
+ static getObj(name) {
464
+ const results = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
465
+ if (results) {
466
+ return JSONServices.deserialize(results[2]);
467
+ }
468
+ return false;
469
+ }
470
+ }
471
+ CookiesServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookiesServices, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
472
+ CookiesServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookiesServices, providedIn: 'root' });
473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookiesServices, decorators: [{
474
+ type: Injectable,
475
+ args: [{
476
+ providedIn: 'root'
477
+ }]
478
+ }] });
479
+
480
+ const save$1 = createAction('[Auth Component] Save', props());
481
+ const saveAccessToken = createAction('[Auth Component] SaveAccessToken', props());
482
+ const initialState$1 = {
483
+ access_token: '',
484
+ client_endpoint: '',
485
+ domain: '',
486
+ expires: 0,
487
+ expires_in: 0,
488
+ member_id: '',
489
+ refresh_token: '',
490
+ scope: '',
491
+ server_endpoint: '',
492
+ status: '',
493
+ user_id: 0
494
+ };
495
+ const _authReducer = createReducer(initialState$1, on(saveAccessToken, (s, data) => {
496
+ let copy = clone(s);
497
+ return Object.assign(copy, data);
498
+ }));
499
+ function authReducer(state = initialState$1, action) {
500
+ return _authReducer(state, action);
501
+ }
6
502
 
7
503
  const time = {
8
504
  oneDayMilliseconds: 1000 * 60 * 60 * 24
@@ -177,6 +673,704 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
177
673
  }]
178
674
  }] });
179
675
 
676
+ class LocalStorageServices {
677
+ static get(name) {
678
+ return localStorage.getItem(name);
679
+ }
680
+ static getObj(name) {
681
+ return JSONServices.deserialize(localStorage.getItem(name));
682
+ }
683
+ static set(name, value) {
684
+ localStorage.setItem(name, value);
685
+ }
686
+ static setObj(name, value) {
687
+ let get = this.get(name);
688
+ if (get && typeof get === 'object') {
689
+ localStorage.setItem(name, JSONServices.serialize(Object.assign(get, value)));
690
+ }
691
+ else {
692
+ localStorage.setItem(name, JSONServices.serialize(value));
693
+ }
694
+ }
695
+ static del(name) {
696
+ localStorage.removeItem(name);
697
+ }
698
+ }
699
+ LocalStorageServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageServices, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
700
+ LocalStorageServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageServices, providedIn: 'root' });
701
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageServices, decorators: [{
702
+ type: Injectable,
703
+ args: [{
704
+ providedIn: 'root'
705
+ }]
706
+ }] });
707
+
708
+ class RestServices {
709
+ constructor() {
710
+ this.BX24 = false;
711
+ // @ts-ignore
712
+ this.BX24 = (window.BX24) ? window.BX24 : false;
713
+ }
714
+ init(callBack) {
715
+ return (this.BX24) ? this.BX24.init(callBack) : false;
716
+ }
717
+ }
718
+ RestServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RestServices, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
719
+ RestServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RestServices, providedIn: 'root' });
720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RestServices, decorators: [{
721
+ type: Injectable,
722
+ args: [{
723
+ providedIn: 'root'
724
+ }]
725
+ }], ctorParameters: function () { return []; } });
726
+
727
+ class SessionKeyServices extends BaseServices {
728
+ constructor(store, route, BxApiLib) {
729
+ super();
730
+ this.store = store;
731
+ this.route = route;
732
+ this.BxApiLib = BxApiLib;
733
+ this.authHave = false;
734
+ this.subscribe = {
735
+ authData: new Subscription()
736
+ };
737
+ this.authData$ = this.store.select('auth');
738
+ this.authData$.subscribe(authData => {
739
+ if ((authData && !authData.access_token.length) || !authData) {
740
+ // получаем токен по собственным каналом (в битриксе приложение trace:apps.trace)
741
+ window.addEventListener('message', (event) => {
742
+ if (event.origin !== window.origin) { // проверяем что это не наше сообщение (с текущего приложения)
743
+ if (event.data && event.data.param) {
744
+ if (typeof event.data.param === 'string') {
745
+ event.data.param = JSON.parse(event.data.param);
746
+ }
747
+ let save = {};
748
+ if (event.data.param.access_token) {
749
+ let param = event.data.param;
750
+ save.access_token = event.data.param.access_token;
751
+ save = {
752
+ access_token: (param.access_token) ? param.access_token : undefined,
753
+ client_endpoint: (param.client_endpoint) ? param.client_endpoint : undefined,
754
+ domain: (param.domain) ? param.domain : undefined,
755
+ expires: (param.expires) ? param.expires : undefined,
756
+ expires_in: (param.expires_in) ? param.expires_in : undefined,
757
+ member_id: (param.member_id) ? param.member_id : undefined,
758
+ refresh_token: (param.refresh_token) ? param.refresh_token : undefined,
759
+ scope: (param.scope) ? param.scope : undefined,
760
+ server_endpoint: (param.server_endpoint) ? param.server_endpoint : undefined,
761
+ status: (param.status) ? param.status : undefined,
762
+ user_id: (param.user_id) ? param.user_id : undefined,
763
+ type: (param.type) ? param.type : undefined,
764
+ };
765
+ }
766
+ if (Object.keys(save).length && save.access_token) {
767
+ this.store.dispatch(saveAccessToken(save));
768
+ this.subscribeAll();
769
+ }
770
+ }
771
+ }
772
+ });
773
+ this.subscribe.authData = this.route.queryParamMap
774
+ .pipe(filter(param => param.has('AUTH_ID')
775
+ || param.has('access_token')
776
+ || param.has('REFRESH_ID')
777
+ || param.has('DOMAIN')))
778
+ .subscribe((param) => {
779
+ let save = {};
780
+ if (param.has('AUTH_ID') && !authData.access_token.length) {
781
+ const get = param.get('AUTH_ID');
782
+ if (get) {
783
+ CookiesServices.set('auth', get); // потом убрать
784
+ save.access_token = get;
785
+ }
786
+ }
787
+ if (param.has('access_token') && !authData.access_token.length) {
788
+ const get = param.get('access_token');
789
+ if (get) {
790
+ CookiesServices.set('auth', get); // потом убрать
791
+ save.access_token = get;
792
+ }
793
+ }
794
+ if (param.has('REFRESH_ID') && !authData.refresh_token.length) {
795
+ const get = param.get('REFRESH_ID');
796
+ if (get) {
797
+ save.refresh_token = get;
798
+ }
799
+ }
800
+ if (param.has('DOMAIN') && !authData.domain.length) {
801
+ const get = param.get('DOMAIN');
802
+ if (get) {
803
+ save.domain = get;
804
+ }
805
+ }
806
+ if (Object.keys(save).length && save.access_token) {
807
+ this.store.dispatch(saveAccessToken(save));
808
+ this.subscribeAll();
809
+ }
810
+ else {
811
+ // если битрикс не шлёт нужные мне параметры на прямую
812
+ // просим их мне отдать так как описано это в документации
813
+ let f = () => {
814
+ if (this.BxApiLib.BX24) {
815
+ const initDate = this.BxApiLib.BX24.getAuth();
816
+ this.store.dispatch(saveAccessToken(initDate));
817
+ }
818
+ };
819
+ this.BxApiLib.init(f);
820
+ }
821
+ });
822
+ }
823
+ else if (this.getAuth().length) {
824
+ this.authHave = true;
825
+ }
826
+ this.authData = authData;
827
+ });
828
+ }
829
+ subscribeAll() {
830
+ this.subscribe.authData.unsubscribe();
831
+ }
832
+ getAuth() {
833
+ if (window.BX && window.BX.bitrix_sessid()) {
834
+ return window.BX.bitrix_sessid();
835
+ }
836
+ else if (this.getSessid().length) {
837
+ let str = this.getSessid();
838
+ return (str) ? str : '';
839
+ }
840
+ else {
841
+ return CookiesServices.get('auth');
842
+ }
843
+ }
844
+ getKeyAuth() {
845
+ if (window.BX && window.BX.bitrix_sessid()
846
+ || this.getSessid().length) {
847
+ return 'sessid';
848
+ }
849
+ else {
850
+ return 'auth';
851
+ }
852
+ }
853
+ getSessid() {
854
+ const check = new URLSearchParams(document.location.search).get('sessid');
855
+ if (check) {
856
+ LocalStorageServices.set('sessid', check);
857
+ return check;
858
+ }
859
+ else if (LocalStorageServices.get('sessid')) {
860
+ return LocalStorageServices.get('sessid');
861
+ }
862
+ return '';
863
+ }
864
+ setAuthParams(params) {
865
+ const keyAuth = this.getKeyAuth();
866
+ if (params[keyAuth]) {
867
+ return true;
868
+ }
869
+ else if (keyAuth) {
870
+ params[keyAuth] = this.getAuth();
871
+ return true;
872
+ }
873
+ return false;
874
+ }
875
+ getAuthParams() {
876
+ // if (env.production && !env.component) {
877
+ return this.authData$.pipe(take(1), map(v => (v) ? v.access_token : undefined));
878
+ // } else {
879
+ // return of(this.getAuth())
880
+ // }
881
+ }
882
+ getBaseUrl() {
883
+ return this.authData$.pipe(map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain, 'b24.trace-studio.com') : undefined));
884
+ }
885
+ }
886
+ 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 });
887
+ SessionKeyServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, providedIn: 'root' });
888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, decorators: [{
889
+ type: Injectable,
890
+ args: [{
891
+ providedIn: 'root'
892
+ }]
893
+ }], ctorParameters: function () { return [{ type: i1$2.Store }, { type: i2$1.ActivatedRoute }, { type: RestServices }]; } });
894
+
895
+ class HttpData extends BaseServices {
896
+ constructor() {
897
+ super(...arguments);
898
+ this.defSettings = {
899
+ timeZone: {
900
+ calc: true,
901
+ levelOut: false
902
+ }
903
+ };
904
+ }
905
+ getHttpParamsGet(// не так уж и сложно сделать сложенный HttpParams, да гугл?
906
+ obj, sendHttpParams = new HttpParams(), thisArray = false, nesting = [],
907
+ // settings = this.defSettings
908
+ _ = this.defSettings) {
909
+ for (const key in obj) {
910
+ let setKey = '';
911
+ if (nesting.length) {
912
+ let first = nesting[0];
913
+ setKey = (nesting.length > 1)
914
+ ? first + '[' + nesting.slice(1).join('][') + '][' + key + ']'
915
+ : first + '[' + key + ']';
916
+ }
917
+ else {
918
+ setKey = key;
919
+ }
920
+ switch (typeof obj[key]) {
921
+ case 'string':
922
+ sendHttpParams = sendHttpParams.set(setKey, obj[key]);
923
+ break;
924
+ case 'symbol':
925
+ case 'number':
926
+ case 'bigint':
927
+ case 'boolean':
928
+ sendHttpParams = sendHttpParams.set(setKey, String(obj[key]));
929
+ break;
930
+ case 'object':
931
+ nesting.push(key);
932
+ sendHttpParams = this.getHttpParamsGet(obj[key], sendHttpParams, false, nesting);
933
+ nesting.pop();
934
+ break;
935
+ case 'function':
936
+ case 'undefined':
937
+ default:
938
+ console.error('Ты отправил что-то не то', obj[key], typeof obj[key], typeof obj);
939
+ }
940
+ }
941
+ return sendHttpParams;
942
+ }
943
+ getHttpParamsPost(obj, sendHttpParams = new FormData(), thisArray = false, nesting = [], settings = this.defSettings) {
944
+ if (obj instanceof Blob) {
945
+ let first = nesting[0];
946
+ let setKey = (nesting.length > 1)
947
+ ? first + '[' + nesting.slice(1).join('][') + ']'
948
+ : first;
949
+ sendHttpParams.set(setKey, obj);
950
+ return sendHttpParams;
951
+ }
952
+ else if (obj instanceof Date) {
953
+ let first = nesting[0];
954
+ let tzoffset = (settings.timeZone.calc) ? obj.getTimezoneOffset() * 60000 : 0; // вычисляем влияние часового пояса
955
+ let levelOut = (settings.timeZone.levelOut) ? obj.getTimezoneOffset() * 60000 : 0; // вычисляем влияние часового пояса
956
+ let setKey = (nesting.length > 1)
957
+ ? first + '[' + nesting.slice(1).join('][') + ']'
958
+ : first;
959
+ sendHttpParams.set(setKey, (new Date(obj.valueOf() + tzoffset - levelOut)).toISOString());
960
+ return sendHttpParams;
961
+ }
962
+ else {
963
+ for (const key in obj) {
964
+ let setKey = '';
965
+ if (nesting.length) {
966
+ let first = nesting[0];
967
+ setKey = (nesting.length > 1)
968
+ ? first + '[' + nesting.slice(1).join('][') + '][' + key + ']'
969
+ : first + '[' + key + ']';
970
+ }
971
+ else {
972
+ setKey = key;
973
+ }
974
+ switch (typeof obj[key]) {
975
+ case 'string':
976
+ sendHttpParams.set(setKey, obj[key]);
977
+ break;
978
+ case 'symbol':
979
+ case 'number':
980
+ case 'bigint':
981
+ case 'boolean':
982
+ sendHttpParams.set(setKey, String(obj[key]));
983
+ break;
984
+ case 'object':
985
+ nesting.push(key);
986
+ sendHttpParams = this.getHttpParamsPost(obj[key], sendHttpParams, false, nesting, settings);
987
+ nesting.pop();
988
+ break;
989
+ case 'function':
990
+ case 'undefined':
991
+ default:
992
+ console.error('Ты отправил что-то не то', obj[key], typeof obj[key], typeof obj);
993
+ }
994
+ }
995
+ }
996
+ return sendHttpParams;
997
+ }
998
+ mapResult(v) {
999
+ if (v && (v.result || typeof v.result === 'boolean')) {
1000
+ return v.result;
1001
+ }
1002
+ return undefined;
1003
+ }
1004
+ sliceArrayIntoChunks(arr, chunkSize) {
1005
+ const res = [];
1006
+ for (let i = 0; i < arr.length; i += chunkSize) {
1007
+ const chunk = arr.slice(i, i + chunkSize);
1008
+ res.push(chunk);
1009
+ }
1010
+ return res;
1011
+ }
1012
+ removingMultipleSlashes(str) {
1013
+ return str.replace(/\/{2,}/g, '/');
1014
+ }
1015
+ }
1016
+
1017
+ class BaseHttp extends HttpData {
1018
+ constructor(http, snackBar) {
1019
+ super();
1020
+ this.http = http;
1021
+ this.snackBar = snackBar;
1022
+ }
1023
+ handleError(result, textError = 'получения данных') {
1024
+ return (error) => {
1025
+ console.error(`failed: ${error.message}`);
1026
+ this.snackBar.error('Ошибка: ' + textError);
1027
+ return of(result);
1028
+ };
1029
+ }
1030
+ }
1031
+ BaseHttp.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, deps: [{ token: i1$3.HttpClient }, { token: SnackBarService }], target: i0.ɵɵFactoryTarget.Injectable });
1032
+ BaseHttp.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, providedIn: 'root' });
1033
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, decorators: [{
1034
+ type: Injectable,
1035
+ args: [{
1036
+ providedIn: 'root'
1037
+ }]
1038
+ }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: SnackBarService }]; } });
1039
+
1040
+ class BaseHttpServices extends BaseHttp {
1041
+ httpGet(url, params = {}, textError = '', settings = this.defSettings) {
1042
+ return this.http.get(url, {
1043
+ params: this.getHttpParamsGet(params, new HttpParams(), false, [], settings)
1044
+ }).pipe(catchError(err => {
1045
+ if (!textError.length && err.error.error_description) {
1046
+ textError = err.error.error_description;
1047
+ }
1048
+ this.snackBar.error('Ошибка: ' + textError);
1049
+ return throwError(() => err);
1050
+ }));
1051
+ }
1052
+ httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1053
+ return this.http.post(url, this.getHttpParamsPost(params, new FormData(), false, [], settings)).pipe(catchError(err => {
1054
+ if (!textError.length && err.error.error_description) {
1055
+ textError = err.error.error_description;
1056
+ }
1057
+ this.snackBar.error('Ошибка: ' + textError);
1058
+ console.error(err);
1059
+ return throwError(() => err);
1060
+ }));
1061
+ }
1062
+ }
1063
+
1064
+ class HttpServices extends BaseHttpServices {
1065
+ constructor(http, snackBar, session) {
1066
+ super(http, snackBar);
1067
+ this.session = session;
1068
+ }
1069
+ timeNowOnServer() {
1070
+ return this.httpGet('server.time').pipe(map(v => {
1071
+ if (v && v.result) {
1072
+ return new Date(v.result);
1073
+ }
1074
+ return undefined;
1075
+ }));
1076
+ }
1077
+ /**
1078
+ * Это пиздец а не метод
1079
+ * @param param
1080
+ */
1081
+ branch(param) {
1082
+ let prepareParam = Object.entries(this.prepareBatch(param));
1083
+ const size = 50; // больше не отдаст
1084
+ let subarray = []; //массив в который будет выведен результат.
1085
+ for (let i = 0; i < Math.ceil(prepareParam.length / size); i++) {
1086
+ subarray[i] = prepareParam.slice((i * size), (i * size) + size);
1087
+ }
1088
+ return forkJoin(subarray.map(i => {
1089
+ return this.httpPost('batch.json', {
1090
+ halt: 0,
1091
+ cmd: Object.assign({}, ...i.map(x => {
1092
+ return { [x[0]]: x[1] };
1093
+ }))
1094
+ });
1095
+ }));
1096
+ }
1097
+ prepareBatch(param) {
1098
+ let res = Object.keys(param).reduce((obj, key) => {
1099
+ obj[key] = '';
1100
+ return obj;
1101
+ }, {});
1102
+ for (let key in param) {
1103
+ if (typeof key === 'string' || typeof key === 'number' && param[key].param) {
1104
+ res[key] = param[key].name + '?' + this.getHttpParamsGet(param[key].param).toString();
1105
+ }
1106
+ }
1107
+ return res;
1108
+ }
1109
+ mapBranchResult(res) {
1110
+ return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined));
1111
+ }
1112
+ mapBranchResultWithoutKey(res) {
1113
+ return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
1114
+ }
1115
+ post(name, params = {}, textError = '', settings = this.defSettings) {
1116
+ return this.httpPost(this.getNameMethod(name), params, textError, settings);
1117
+ }
1118
+ get(name, params = {}, textError = '', settings = this.defSettings) {
1119
+ return this.httpGet(this.getNameMethod(name), params, textError, settings);
1120
+ }
1121
+ httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1122
+ return this.session.getAuthParams().pipe(mergeMap(auth => {
1123
+ if (auth) {
1124
+ const paramsClone = clone(params);
1125
+ paramsClone[this.session.getKeyAuth()] = auth;
1126
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1127
+ if (v) {
1128
+ return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings))
1129
+ .pipe(take(1), catchError(err => {
1130
+ if (!textError.length && err.error.error_description) {
1131
+ textError = err.error.error_description;
1132
+ }
1133
+ this.snackBar.error('Ошибка: ' + textError);
1134
+ return throwError(() => err);
1135
+ }));
1136
+ }
1137
+ return throwError(() => 'get base url error');
1138
+ }));
1139
+ }
1140
+ else {
1141
+ this.snackBar.error('Error: Auth not get');
1142
+ return throwError(() => 'auth not get');
1143
+ }
1144
+ }));
1145
+ }
1146
+ httpGet(url, params = {}, textError = '', settings = this.defSettings) {
1147
+ return this.session.getAuthParams().pipe(mergeMap(auth => {
1148
+ if (auth) {
1149
+ if (params === null) {
1150
+ params = {};
1151
+ }
1152
+ const paramsClone = clone(params);
1153
+ paramsClone[this.session.getKeyAuth()] = auth;
1154
+ let options = {
1155
+ params: this.getHttpParamsGet(paramsClone)
1156
+ };
1157
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1158
+ if (v) {
1159
+ return this.http.get(this.prepareBaseAddress(v) + url, options).pipe(take(1), catchError(err => {
1160
+ if (!textError.length && err.error.error_description) {
1161
+ textError = err.error.error_description;
1162
+ }
1163
+ this.snackBar.error('Ошибка: ' + textError);
1164
+ return throwError(() => err);
1165
+ }));
1166
+ }
1167
+ return throwError(() => 'get base url error');
1168
+ }));
1169
+ }
1170
+ else {
1171
+ this.snackBar.error('Error: Auth not get');
1172
+ return throwError(() => 'auth not get');
1173
+ }
1174
+ }));
1175
+ }
1176
+ getNameMethod(arr) {
1177
+ return arr.join('.');
1178
+ }
1179
+ }
1180
+ HttpServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, deps: [{ token: i1$3.HttpClient }, { token: SnackBarService }, { token: SessionKeyServices }], target: i0.ɵɵFactoryTarget.Injectable });
1181
+ HttpServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, providedIn: 'root' });
1182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, decorators: [{
1183
+ type: Injectable,
1184
+ args: [{
1185
+ providedIn: 'root'
1186
+ }]
1187
+ }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: SnackBarService }, { type: SessionKeyServices }]; } });
1188
+
1189
+ class HttpBXServices extends HttpServices {
1190
+ timeNowOnServer() {
1191
+ return this.httpGet('server.time').pipe(map(v => {
1192
+ if (v && v.result) {
1193
+ return new Date(v.result);
1194
+ }
1195
+ return undefined;
1196
+ }));
1197
+ }
1198
+ /**
1199
+ * Это пиздец а не метод
1200
+ * @param param
1201
+ */
1202
+ branch(param) {
1203
+ let prepareParam = Object.entries(this.prepareBatch(param));
1204
+ const size = 50; // больше не отдаст
1205
+ let subarray = []; //массив в который будет выведен результат.
1206
+ for (let i = 0; i < Math.ceil(prepareParam.length / size); i++) {
1207
+ subarray[i] = prepareParam.slice((i * size), (i * size) + size);
1208
+ }
1209
+ return forkJoin(subarray.map(i => {
1210
+ return this.httpPost('batch.json', {
1211
+ halt: 0,
1212
+ cmd: Object.assign({}, ...i.map(x => {
1213
+ return { [x[0]]: x[1] };
1214
+ }))
1215
+ });
1216
+ }));
1217
+ }
1218
+ prepareBatch(param) {
1219
+ let res = Object.keys(param).reduce((obj, key) => {
1220
+ obj[key] = '';
1221
+ return obj;
1222
+ }, {});
1223
+ for (let key in param) {
1224
+ if (typeof key === 'string' || typeof key === 'number' && param[key].param) {
1225
+ res[key] = param[key].name + '?' + this.getHttpParamsGet(param[key].param).toString();
1226
+ }
1227
+ }
1228
+ return res;
1229
+ }
1230
+ mapBranchResult(res) {
1231
+ return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined));
1232
+ }
1233
+ mapBranchResultWithoutKey(res) {
1234
+ return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
1235
+ }
1236
+ post(name, params = {}, textError = '', settings = this.defSettings) {
1237
+ return this.httpPost(this.getNameMethod(name), params, textError, settings);
1238
+ }
1239
+ get(name, params = {}, textError = '', settings = this.defSettings) {
1240
+ return this.httpGet(this.getNameMethod(name), params, textError, settings);
1241
+ }
1242
+ httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1243
+ return this.session.getAuthParams().pipe(mergeMap(auth => {
1244
+ if (auth) {
1245
+ const paramsClone = clone(params);
1246
+ paramsClone[this.session.getKeyAuth()] = auth;
1247
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1248
+ if (v) {
1249
+ return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings))
1250
+ .pipe(take(1), catchError(err => {
1251
+ if (!textError.length && err.error.error_description) {
1252
+ textError = err.error.error_description;
1253
+ }
1254
+ this.snackBar.error('Ошибка: ' + textError);
1255
+ return throwError(() => err);
1256
+ }));
1257
+ }
1258
+ return throwError(() => 'get base url error');
1259
+ }));
1260
+ }
1261
+ else {
1262
+ this.snackBar.error('Error: Auth not get');
1263
+ return throwError(() => 'auth not get');
1264
+ }
1265
+ }));
1266
+ }
1267
+ httpGet(url, params = {}, textError = '', settings = this.defSettings) {
1268
+ return this.session.getAuthParams().pipe(mergeMap(auth => {
1269
+ if (auth) {
1270
+ if (params === null) {
1271
+ params = {};
1272
+ }
1273
+ const paramsClone = clone(params);
1274
+ paramsClone[this.session.getKeyAuth()] = auth;
1275
+ let options = {
1276
+ params: this.getHttpParamsGet(paramsClone)
1277
+ };
1278
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1279
+ if (v) {
1280
+ return this.http.get(this.prepareBaseAddress(v) + url, options).pipe(take(1), catchError(err => {
1281
+ if (!textError.length && err.error.error_description) {
1282
+ textError = err.error.error_description;
1283
+ }
1284
+ this.snackBar.error('Ошибка: ' + textError);
1285
+ return throwError(() => err);
1286
+ }));
1287
+ }
1288
+ return throwError(() => 'get base url error');
1289
+ }));
1290
+ }
1291
+ else {
1292
+ this.snackBar.error('Error: Auth not get');
1293
+ return throwError(() => 'auth not get');
1294
+ }
1295
+ }));
1296
+ }
1297
+ getNameMethod(arr) {
1298
+ return arr.join('.');
1299
+ }
1300
+ }
1301
+ HttpBXServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpBXServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1302
+ HttpBXServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpBXServices, providedIn: 'root' });
1303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpBXServices, decorators: [{
1304
+ type: Injectable,
1305
+ args: [{
1306
+ providedIn: 'root'
1307
+ }]
1308
+ }] });
1309
+
1310
+ const save = createAction('[Users Component] Save', props());
1311
+ const saveArr = createAction('[Users Component] Save Arr', props());
1312
+ const update = createAction('[Users Component] Update', props());
1313
+ const loadAll = createAction('[Users Component] loadAll', props());
1314
+ const saveSelf = createAction('[Users Component] saveSelf', props());
1315
+ const saveIDLoadedDepartment = createAction('[Users Component] saveIDLoadedDepartment', props());
1316
+ const initialState = {
1317
+ load: {
1318
+ all: false,
1319
+ department: []
1320
+ },
1321
+ self: undefined,
1322
+ data: []
1323
+ };
1324
+ const _usersReducer = createReducer(initialState, on(saveIDLoadedDepartment, (s, data) => {
1325
+ let copy = clone(s);
1326
+ copy.load.department = [...copy.load.department, ...data.id];
1327
+ return copy;
1328
+ }), on(save, (s, data) => {
1329
+ const find = s.data.find(v => v.ID === data.ID);
1330
+ if (!find) {
1331
+ const copy = clone(s);
1332
+ copy.data.push(data);
1333
+ return copy;
1334
+ }
1335
+ return s;
1336
+ }), on(saveArr, (s, data) => {
1337
+ const copy = clone(s);
1338
+ if (copy.data && copy.data.length) {
1339
+ for (const user of data.arr) {
1340
+ const find = copy.data.find(v => v.ID === user.ID);
1341
+ if (!find) {
1342
+ copy.data.push(user);
1343
+ }
1344
+ }
1345
+ }
1346
+ else {
1347
+ copy.data = [...data.arr];
1348
+ }
1349
+ return copy;
1350
+ }), on(update, (s, data) => {
1351
+ const copy = clone(s);
1352
+ let find = copy.data.findIndex(v => v.ID === data.ID);
1353
+ if (find !== -1) {
1354
+ const copy = clone(s);
1355
+ copy.data.splice(find, 1, data);
1356
+ // copy.data.push(data)
1357
+ return copy;
1358
+ }
1359
+ return s;
1360
+ }), on(loadAll, (s, data) => {
1361
+ if (data.load !== s.load.all) {
1362
+ const copy = clone(s);
1363
+ copy.load.all = data.load;
1364
+ return copy;
1365
+ }
1366
+ return s;
1367
+ }), on(saveSelf, (s, data) => {
1368
+ return { ...s, self: data.self };
1369
+ }));
1370
+ function usersReducer(state = initialState, action) {
1371
+ return _usersReducer(state, action);
1372
+ }
1373
+
180
1374
  class BaseMapServices extends BaseServices {
181
1375
  }
182
1376
  BaseMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -188,66 +1382,301 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
188
1382
  }]
189
1383
  }] });
190
1384
 
191
- class BXRestListsElementMap extends BaseMapServices {
192
- get(item) {
193
- return Object.assign(item, {
194
- BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
195
- CREATED_BY: this.toNum(item.CREATED_BY),
196
- IBLOCK_ID: this.toNum(item.IBLOCK_ID),
197
- ID: this.toNum(item.ID)
1385
+ class BitrixApiUserMapServices extends BaseMapServices {
1386
+ HttpToBX(user) {
1387
+ let res = Object.assign(clone(user), {
1388
+ ID: this.toNum(user.ID),
1389
+ IS_ONLINE: this.toBool(user.IS_ONLINE),
1390
+ DATE_REGISTER: this.toDate(user.DATE_REGISTER),
1391
+ PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
1392
+ });
1393
+ if (user.LAST_LOGIN) {
1394
+ res.LAST_LOGIN = this.toDate(user.LAST_LOGIN);
1395
+ }
1396
+ return res;
1397
+ }
1398
+ BXtoHttp(user) {
1399
+ return Object.assign(clone(user), {
1400
+ ID: this.toStr(user.ID),
1401
+ IS_ONLINE: this.toBXYorN(user.IS_ONLINE),
1402
+ DATE_REGISTER: this.getBXStrTime(user.DATE_REGISTER),
1403
+ PERSONAL_BIRTHDAY: this.toStr(user.PERSONAL_BIRTHDAY),
1404
+ LAST_LOGIN: this.toStr(user.LAST_LOGIN)
198
1405
  });
199
1406
  }
1407
+ getFIO(user) {
1408
+ let res = '';
1409
+ if (!user.LAST_NAME) {
1410
+ const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1411
+ const NAME = (user.NAME) ? user.NAME : '';
1412
+ res = NAME + ' ' + SECOND_NAME;
1413
+ }
1414
+ else if (!user.NAME) {
1415
+ res = user.LAST_NAME;
1416
+ }
1417
+ else if (!user.SECOND_NAME) {
1418
+ res = user.LAST_NAME + ' ' + user.NAME;
1419
+ }
1420
+ else {
1421
+ res = user.LAST_NAME + ' ' + user.NAME + ' ' + user.SECOND_NAME;
1422
+ }
1423
+ return res.trim();
1424
+ }
1425
+ getFI(user) {
1426
+ let res = '';
1427
+ if (!user.LAST_NAME) {
1428
+ const NAME = (user.NAME) ? user.NAME : '';
1429
+ res = NAME;
1430
+ }
1431
+ else if (!user.NAME) {
1432
+ res = user.LAST_NAME;
1433
+ }
1434
+ else {
1435
+ res = user.LAST_NAME + ' ' + user.NAME;
1436
+ }
1437
+ return res.trim();
1438
+ }
1439
+ getFIOShort(user) {
1440
+ let res = '';
1441
+ if (!user.LAST_NAME) {
1442
+ const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1443
+ const NAME = (user.NAME) ? user.NAME : '';
1444
+ res = NAME + ' ' + SECOND_NAME;
1445
+ }
1446
+ else if (!user.NAME) {
1447
+ res = user.LAST_NAME;
1448
+ }
1449
+ else if (!user.SECOND_NAME) {
1450
+ res = user.LAST_NAME + ' ' + user.NAME.charAt(0).toUpperCase() + '.';
1451
+ }
1452
+ else {
1453
+ res =
1454
+ user.LAST_NAME + ' ' +
1455
+ user.NAME.charAt(0).toUpperCase() + '.' +
1456
+ user.SECOND_NAME.charAt(0).toUpperCase() + '.';
1457
+ }
1458
+ return res.trim();
1459
+ }
200
1460
  }
201
- BXRestListsElementMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
202
- BXRestListsElementMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, providedIn: 'root' });
203
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, decorators: [{
1461
+ BitrixApiUserMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1462
+ BitrixApiUserMapServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, providedIn: 'root' });
1463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, decorators: [{
204
1464
  type: Injectable,
205
1465
  args: [{
206
1466
  providedIn: 'root'
207
1467
  }]
208
1468
  }] });
209
1469
 
210
- function mapResult(v) {
211
- if (v && (v.result || typeof v.result === 'boolean')) {
212
- return v.result;
1470
+ class BXRestUser {
1471
+ constructor(http, snackBar,
1472
+ // private img: ImgServices,
1473
+ //private dateTrace: DateTrace,
1474
+ store, userMap) {
1475
+ this.http = http;
1476
+ this.snackBar = snackBar;
1477
+ this.store = store;
1478
+ this.userMap = userMap;
1479
+ this.url = {
1480
+ admin: [$user, 'admin'],
1481
+ get: [$user, $get],
1482
+ current: [$user, 'current'],
1483
+ update: [$user, $update],
1484
+ search: [$user, $search],
1485
+ access: [$user, 'access'],
1486
+ // AU - все авторизованные пользователи
1487
+ // D1 - подразделение с id=1
1488
+ // G1 - группа с id=1
1489
+ fields: [$user, 'fields'],
1490
+ userfield: {
1491
+ list: [$user, 'userfield', $list]
1492
+ }
1493
+ };
1494
+ this.def = {
1495
+ params: { ACTIVE: 1, start: 0 }
1496
+ };
1497
+ this.user$ = this.store.select('users');
213
1498
  }
214
- return undefined;
215
- }
1499
+ admin() {
1500
+ return this.http.get(this.url.admin);
1501
+ }
1502
+ get(params = {}) {
1503
+ let copyParams = clone(params);
1504
+ this.setDefParam(copyParams);
1505
+ return this.http.post(this.url.get, copyParams, 'Не удалось получить пользователей')
1506
+ .pipe(tap(v => {
1507
+ if (v && v.result) {
1508
+ this.saveArrUser(v.result);
1509
+ }
1510
+ }));
1511
+ }
1512
+ current(update = false) {
1513
+ if (update) {
1514
+ return this.getSelfHttp();
1515
+ }
1516
+ else {
1517
+ return this.user$.pipe(mergeMap$1(v => {
1518
+ if (v && v.self) {
1519
+ return of(v.self);
1520
+ }
1521
+ else {
1522
+ return this.getSelfHttp();
1523
+ }
1524
+ }), first());
1525
+ }
1526
+ }
1527
+ getSelfHttp() {
1528
+ return this.http.get(this.url.current, {}, 'Не удалось получить пользователя')
1529
+ .pipe(map(v => {
1530
+ if (v && v.result) {
1531
+ return this.userMap.HttpToBX(v.result);
1532
+ }
1533
+ return undefined;
1534
+ }), tap(v => {
1535
+ if (v) {
1536
+ this.store.dispatch(saveSelf({ self: v }));
1537
+ }
1538
+ }));
1539
+ }
1540
+ access(access, textError = 'Не удалось получить права') {
1541
+ return this.http.get(this.url.access, { ACCESS: access }, textError);
1542
+ }
1543
+ // getAll(params: iBXGetParam = {}): Observable<iBXRestUser [] | undefined> {
1544
+ // if (!Object.keys(params).length) {
1545
+ // params = clone(this.def.params)
1546
+ // }
1547
+ //
1548
+ // const saveAllUser = compare(params, this.def.params)
1549
+ // return this.user$.pipe(
1550
+ // take(1),
1551
+ // mergeMap(v => {
1552
+ // if (v.load.all) {
1553
+ // if (compare(this.def.params, params)) {
1554
+ // return of(clone(v.data))
1555
+ // }
1556
+ // }
1557
+ //
1558
+ // return this.getEndArray(params).pipe(
1559
+ // take(1),
1560
+ // map(v => {
1561
+ // if (v && v.result) {
1562
+ // let cl = clone(v.result)
1563
+ // return this.saveArrUser(cl)
1564
+ // }
1565
+ // return undefined
1566
+ // }),
1567
+ // )
1568
+ // }),
1569
+ // tap(v => {
1570
+ // if (v && v.length && saveAllUser) {
1571
+ // this.store.dispatch(loadAll({load: true}))
1572
+ // }
1573
+ // params.start = this.def.params.start
1574
+ // })
1575
+ // )
1576
+ // }
1577
+ saveArrUser(users) {
1578
+ let result = [];
1579
+ for (const user of users) {
1580
+ result.push(this.userMap.HttpToBX(user));
1581
+ }
1582
+ this.store.dispatch(saveArr({ arr: result }));
1583
+ return result;
1584
+ }
1585
+ search(params) {
1586
+ if (typeof params === 'string') {
1587
+ params = { FIND: params };
1588
+ }
1589
+ if (typeof params.ACTIVE !== 'boolean') {
1590
+ params.ACTIVE = true;
1591
+ }
1592
+ return this.http.get(this.url.search, params, 'Сервер не отвечает на запрос поиска');
1593
+ }
1594
+ fields() {
1595
+ return this.http.get(this.url.fields);
1596
+ }
1597
+ update(user, fieldUpdate) {
1598
+ if (fieldUpdate && fieldUpdate.length) {
1599
+ let sendData = {
1600
+ ID: user.ID,
1601
+ };
1602
+ const userBX = this.userMap.BXtoHttp(user);
1603
+ for (const field of fieldUpdate) {
1604
+ if (userBX[field]) {
1605
+ sendData[field] = userBX[field];
1606
+ }
1607
+ else {
1608
+ this.snackBar.error('Одно из указанных полей отправлено не верно');
1609
+ }
1610
+ }
1611
+ return this.http.post(this.url.update, sendData, 'Не удалось обновить пользователя с ID' + user.ID);
1612
+ }
1613
+ else {
1614
+ this.snackBar.error('Не указано ни одно поле для редактирования пользователя');
1615
+ return of({});
1616
+ }
1617
+ }
1618
+ // getEndArray(params: UserFilter = {}): Observable<iHttpAnswerBX<iBXRestUserHttp[]> | undefined> {
1619
+ // return this.get(params).pipe(
1620
+ // mergeMap(items => {
1621
+ // if (items && items.result && typeof items.result === 'object') {
1622
+ // if (items.next) {
1623
+ // params.start = items.next
1624
+ // return this.getEndArray(params).pipe(map(vEnd => {
1625
+ // if (vEnd && items.result && vEnd.result) {
1626
+ // return {result: [...items.result, ...vEnd.result]}
1627
+ // }
1628
+ // return (items) ? items : undefined
1629
+ // }))
1630
+ // }
1631
+ // return of(items)
1632
+ // } else {
1633
+ // return of(undefined)
1634
+ // }
1635
+ // }),
1636
+ // )
1637
+ // }
1638
+ setDefParam(params) {
1639
+ if (!params.hasOwnProperty('ACTIVE')) {
1640
+ params.ACTIVE = this.def.params.ACTIVE;
1641
+ }
1642
+ if (params.ACTIVE && params.ACTIVE === 2) {
1643
+ delete params.ACTIVE;
1644
+ }
1645
+ if (!params.hasOwnProperty('start')) {
1646
+ params.start = this.def.params.start;
1647
+ }
1648
+ if (params.UF_DEPARTMENT && !params.UF_DEPARTMENT.length) {
1649
+ delete params.UF_DEPARTMENT;
1650
+ }
1651
+ }
1652
+ }
1653
+ 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 });
1654
+ BXRestUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, providedIn: 'root' });
1655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, decorators: [{
1656
+ type: Injectable,
1657
+ args: [{
1658
+ providedIn: 'root'
1659
+ }]
1660
+ }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }, { type: i1$2.Store }, { type: BitrixApiUserMapServices }]; } });
216
1661
 
217
- class BXRestBase {
1662
+ // import { Observable } from 'rxjs'
1663
+ // import BXRestListsElementMap from './map/lists/element'
1664
+ // import { map } from 'rxjs/operators'
1665
+ // import { mapResult } from './functions/mapResult'
1666
+ class BXRest {
218
1667
  constructor(user, lists) {
219
1668
  this.user = user;
220
1669
  this.lists = lists;
221
1670
  }
222
1671
  }
223
- class BXRest extends new Proxy(BXRestBase, {
224
- get(target, prop, receiver) {
225
- const res = Reflect.get(target, prop, receiver);
226
- console.log('res', res);
227
- if (res in Observable) {
228
- let mapRes = new BXRestListsElementMap();
229
- console.log('res', res);
230
- return Reflect.get(target, prop, receiver).pipe(
231
- // @ts-ignore
232
- map(v => (v && v.result)
233
- // @ts-ignore
234
- ? Object.assign(v, { result: v.result.map(i => mapRes.get(i)) })
235
- : undefined),
236
- // @ts-ignore
237
- map(v => mapResult(v)));
238
- }
239
- return res;
240
- }
241
- }) {
242
- }
243
- BXRest.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1672
+ 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 });
244
1673
  BXRest.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, providedIn: 'root' });
245
1674
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, decorators: [{
246
1675
  type: Injectable,
247
1676
  args: [{
248
1677
  providedIn: 'root'
249
1678
  }]
250
- }] });
1679
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }]; } });
251
1680
 
252
1681
  /*
253
1682
  * Public API Surface of bx-rest