bx-rest 0.0.22 → 0.0.24
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/esm2020/request/lists/element.mjs +13 -1
- package/esm2020/services/http/sessionKey.mjs +10 -8
- package/esm2020/settings.mjs +8 -0
- package/esm2020/typification/settings.mjs +2 -0
- package/fesm2015/bx-rest.mjs +94 -47
- package/fesm2015/bx-rest.mjs.map +1 -1
- package/fesm2020/bx-rest.mjs +94 -47
- package/fesm2020/bx-rest.mjs.map +1 -1
- package/package.json +1 -1
- package/request/lists/element.d.ts +3 -0
- package/services/http/sessionKey.d.ts +1 -1
- package/settings.d.ts +2 -0
- package/typification/settings.d.ts +7 -0
package/fesm2020/bx-rest.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { NgModule, inject, Component, ViewEncapsulation, Inject, Injectable } from '@angular/core';
|
|
3
3
|
import { map, catchError, tap, mergeMap as mergeMap$1, first } from 'rxjs/operators';
|
|
4
4
|
import { Subscription, filter, take, of, throwError, forkJoin, mergeMap } from 'rxjs';
|
|
5
5
|
import clone from 'just-clone';
|
|
@@ -92,47 +92,6 @@ const $id = 'id';
|
|
|
92
92
|
const $element = 'element';
|
|
93
93
|
const $url = 'url';
|
|
94
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
95
|
class BxRestModule {
|
|
137
96
|
}
|
|
138
97
|
BxRestModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -705,6 +664,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
705
664
|
}]
|
|
706
665
|
}] });
|
|
707
666
|
|
|
667
|
+
const REST_SETTINGS = {
|
|
668
|
+
support: {
|
|
669
|
+
map: true,
|
|
670
|
+
result: true
|
|
671
|
+
},
|
|
672
|
+
auth: 'cookies'
|
|
673
|
+
};
|
|
674
|
+
|
|
708
675
|
class RestServices {
|
|
709
676
|
constructor() {
|
|
710
677
|
this.BX24 = false;
|
|
@@ -873,11 +840,12 @@ class SessionKeyServices extends BaseServices {
|
|
|
873
840
|
return false;
|
|
874
841
|
}
|
|
875
842
|
getAuthParams() {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
843
|
+
switch (REST_SETTINGS.auth) {
|
|
844
|
+
case 'cookies':
|
|
845
|
+
return of(this.getAuth());
|
|
846
|
+
default:
|
|
847
|
+
return this.authData$.pipe(take(1), map(v => (v) ? v.access_token : undefined));
|
|
848
|
+
}
|
|
881
849
|
}
|
|
882
850
|
getBaseUrl() {
|
|
883
851
|
return this.authData$.pipe(map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain, 'b24.trace-studio.com') : undefined));
|
|
@@ -1307,6 +1275,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1307
1275
|
}]
|
|
1308
1276
|
}] });
|
|
1309
1277
|
|
|
1278
|
+
let BaseMapServices$1 = class BaseMapServices extends BaseServices {
|
|
1279
|
+
};
|
|
1280
|
+
BaseMapServices$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1281
|
+
BaseMapServices$1.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, providedIn: 'root' });
|
|
1282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, decorators: [{
|
|
1283
|
+
type: Injectable,
|
|
1284
|
+
args: [{
|
|
1285
|
+
providedIn: 'root'
|
|
1286
|
+
}]
|
|
1287
|
+
}] });
|
|
1288
|
+
|
|
1289
|
+
class BXRestListsElementMap extends BaseMapServices$1 {
|
|
1290
|
+
get(item) {
|
|
1291
|
+
return Object.assign(item, {
|
|
1292
|
+
BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
|
|
1293
|
+
CREATED_BY: this.toNum(item.CREATED_BY),
|
|
1294
|
+
IBLOCK_ID: this.toNum(item.IBLOCK_ID),
|
|
1295
|
+
ID: this.toNum(item.ID)
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
BXRestListsElementMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1300
|
+
BXRestListsElementMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, providedIn: 'root' });
|
|
1301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, decorators: [{
|
|
1302
|
+
type: Injectable,
|
|
1303
|
+
args: [{
|
|
1304
|
+
providedIn: 'root'
|
|
1305
|
+
}]
|
|
1306
|
+
}] });
|
|
1307
|
+
|
|
1308
|
+
class BXRestListsElement {
|
|
1309
|
+
constructor(http, mapResult) {
|
|
1310
|
+
this.http = http;
|
|
1311
|
+
this.mapResult = mapResult;
|
|
1312
|
+
this.url = {
|
|
1313
|
+
add: [$lists, $element, $add],
|
|
1314
|
+
delete: [$lists, $element, $delete],
|
|
1315
|
+
get: [$lists, $element, $get],
|
|
1316
|
+
update: [$lists, $element, $update],
|
|
1317
|
+
getFileUrl: [$lists, $element, $get, $file, $url] // Метод возвращает путь к файлу
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
get(pram) {
|
|
1321
|
+
return this.http.post(this.url.get, pram)
|
|
1322
|
+
.pipe(map(v => (v && v.result)
|
|
1323
|
+
? Object.assign(v, { result: v.result.map(i => this.mapResult.get(i)) })
|
|
1324
|
+
: undefined));
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: [{ token: HttpBXServices }, { token: BXRestListsElementMap }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1328
|
+
BXRestListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, providedIn: 'root' });
|
|
1329
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, decorators: [{
|
|
1330
|
+
type: Injectable,
|
|
1331
|
+
args: [{
|
|
1332
|
+
providedIn: 'root'
|
|
1333
|
+
}]
|
|
1334
|
+
}], ctorParameters: function () { return [{ type: HttpBXServices }, { type: BXRestListsElementMap }]; } });
|
|
1335
|
+
|
|
1336
|
+
class BXRestLists {
|
|
1337
|
+
constructor(element) {
|
|
1338
|
+
this.element = element;
|
|
1339
|
+
this.url = {
|
|
1340
|
+
add: [$lists, $add],
|
|
1341
|
+
delete: [$lists, $delete],
|
|
1342
|
+
get: [$lists, $get],
|
|
1343
|
+
update: [$lists, $update],
|
|
1344
|
+
getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
BXRestLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, deps: [{ token: BXRestListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1349
|
+
BXRestLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, providedIn: 'root' });
|
|
1350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, decorators: [{
|
|
1351
|
+
type: Injectable,
|
|
1352
|
+
args: [{
|
|
1353
|
+
providedIn: 'root'
|
|
1354
|
+
}]
|
|
1355
|
+
}], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
|
|
1356
|
+
|
|
1310
1357
|
const save = createAction('[Users Component] Save', props());
|
|
1311
1358
|
const saveArr = createAction('[Users Component] Save Arr', props());
|
|
1312
1359
|
const update = createAction('[Users Component] Update', props());
|