bx-rest 0.2.5 → 0.2.7
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/esm2022/map/task/elapseditem.mjs +1 -1
- package/esm2022/request/task/elapseditem.mjs +1 -1
- package/esm2022/request/user.mjs +6 -6
- package/esm2022/request-navvy/task/elapseditem.mjs +7 -5
- package/esm2022/request-navvy/task/operation/elapseditem.mjs +21 -2
- package/esm2022/request-navvy/user.mjs +6 -5
- package/esm2022/services/http/HttpBX.mjs +24 -14
- package/esm2022/typification/rest/task/elapseditem/get.mjs +1 -1
- package/esm2022/typification/rest/task/elapseditem/item.mjs +1 -1
- package/fesm2022/bx-rest.mjs +56 -27
- package/fesm2022/bx-rest.mjs.map +1 -1
- package/map/task/elapseditem.d.ts +3 -3
- package/package.json +1 -1
- package/request/task/elapseditem.d.ts +2 -2
- package/request-navvy/task/elapseditem.d.ts +4 -2
- package/request-navvy/task/operation/elapseditem.d.ts +8 -2
- package/request-navvy/user.d.ts +1 -1
- package/services/http/HttpBX.d.ts +16 -1
- package/typification/rest/task/elapseditem/get.d.ts +1 -1
- package/typification/rest/task/elapseditem/item.d.ts +3 -3
package/fesm2022/bx-rest.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { NgModule, inject, Component, ViewEncapsulation, Inject, Injectable } from '@angular/core';
|
|
3
3
|
import { Subscription, of, mergeMap, throwError, forkJoin, share, ReplaySubject, last, shareReplay, concat, from, concatMap, tap } from 'rxjs';
|
|
4
|
-
import { map, catchError, mergeMap as mergeMap$1 } from 'rxjs/operators';
|
|
5
4
|
import clone from 'just-clone';
|
|
6
5
|
import * as i1$1 from '@angular/material/snack-bar';
|
|
7
6
|
import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
|
|
@@ -11,7 +10,9 @@ import * as i1 from '@angular/material/button';
|
|
|
11
10
|
import { MatButtonModule } from '@angular/material/button';
|
|
12
11
|
import { DateTime } from 'luxon';
|
|
13
12
|
import * as i1$2 from '@angular/common/http';
|
|
14
|
-
import { HttpParams } from '@angular/common/http';
|
|
13
|
+
import { HttpParams, HttpHeaders } from '@angular/common/http';
|
|
14
|
+
import flatten from 'just-flatten-it';
|
|
15
|
+
import { map, catchError, mergeMap as mergeMap$1 } from 'rxjs/operators';
|
|
15
16
|
|
|
16
17
|
const BX_REST_SETTINGS = {
|
|
17
18
|
auth: {
|
|
@@ -1118,16 +1119,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
|
1118
1119
|
|
|
1119
1120
|
// type TransformFunction<T, R> = (input: T) => R;
|
|
1120
1121
|
class HttpBXServices extends HttpServices {
|
|
1121
|
-
timeNowOnServer() {
|
|
1122
|
-
return this.httpGet('server.time').pipe(map(v => {
|
|
1123
|
-
if (v && v.result) {
|
|
1124
|
-
return new Date(v.result);
|
|
1125
|
-
}
|
|
1126
|
-
return undefined;
|
|
1127
|
-
}));
|
|
1128
|
-
}
|
|
1129
1122
|
/**
|
|
1130
1123
|
* Это пиздец а не метод
|
|
1124
|
+
* TODO: Удалить данный метод после реализации его в разделе Navvy
|
|
1131
1125
|
* @param param
|
|
1132
1126
|
*/
|
|
1133
1127
|
branch(param) {
|
|
@@ -1164,12 +1158,26 @@ class HttpBXServices extends HttpServices {
|
|
|
1164
1158
|
// }
|
|
1165
1159
|
// }
|
|
1166
1160
|
//
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1161
|
+
mapBranchResultWithoutKey(res) {
|
|
1162
|
+
return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Основной метод для запросов
|
|
1166
|
+
*
|
|
1167
|
+
* @param name
|
|
1168
|
+
* @param params
|
|
1169
|
+
* @param settings
|
|
1170
|
+
*/
|
|
1170
1171
|
post(name, params = {}, settings = this.defSettings) {
|
|
1171
1172
|
return this.httpPost(this.getNameMethod(name), params, settings);
|
|
1172
1173
|
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Второстепенный метод для запросов. По возможности лучше не использовать
|
|
1176
|
+
*
|
|
1177
|
+
* @param name
|
|
1178
|
+
* @param params
|
|
1179
|
+
* @param settings
|
|
1180
|
+
*/
|
|
1173
1181
|
get(name, params = {}, settings = this.defSettings) {
|
|
1174
1182
|
return this.httpGet(this.getNameMethod(name), params, settings);
|
|
1175
1183
|
}
|
|
@@ -1180,7 +1188,8 @@ class HttpBXServices extends HttpServices {
|
|
|
1180
1188
|
paramsClone[this.session.getKeyAuth()] = auth;
|
|
1181
1189
|
return this.session.getBaseUrl().pipe(mergeMap(v => {
|
|
1182
1190
|
if (v) {
|
|
1183
|
-
|
|
1191
|
+
// это более быстрый способ запроса чем отправка Form Data
|
|
1192
|
+
return this.http.post(this.prepareBaseAddress(v) + url, JSON.stringify(paramsClone), { headers: new HttpHeaders().set('Content-Type', 'application/json') });
|
|
1184
1193
|
}
|
|
1185
1194
|
return throwError(() => 'get base url error');
|
|
1186
1195
|
}));
|
|
@@ -1199,6 +1208,7 @@ class HttpBXServices extends HttpServices {
|
|
|
1199
1208
|
paramsClone[this.session.getKeyAuth()] = auth;
|
|
1200
1209
|
let options = {
|
|
1201
1210
|
params: this.getHttpParamsGet(paramsClone)
|
|
1211
|
+
// params: JSON.stringify(paramsClone)
|
|
1202
1212
|
};
|
|
1203
1213
|
return this.session.getBaseUrl().pipe(mergeMap(v => {
|
|
1204
1214
|
if (v) {
|
|
@@ -1262,13 +1272,13 @@ class BXRestUser {
|
|
|
1262
1272
|
};
|
|
1263
1273
|
}
|
|
1264
1274
|
admin() {
|
|
1265
|
-
return this.http.
|
|
1275
|
+
return this.http.post(this.url.admin);
|
|
1266
1276
|
}
|
|
1267
1277
|
get(params = {}) {
|
|
1268
1278
|
return this.http.post(this.url.get, params);
|
|
1269
1279
|
}
|
|
1270
1280
|
current(update = false) {
|
|
1271
|
-
let request = this.http.
|
|
1281
|
+
let request = this.http.post(this.url.current, {});
|
|
1272
1282
|
if (update) {
|
|
1273
1283
|
return request;
|
|
1274
1284
|
}
|
|
@@ -1280,13 +1290,13 @@ class BXRestUser {
|
|
|
1280
1290
|
return this.http.post(this.url.update, user);
|
|
1281
1291
|
}
|
|
1282
1292
|
search(params) {
|
|
1283
|
-
return this.http.
|
|
1293
|
+
return this.http.post(this.url.search, params);
|
|
1284
1294
|
}
|
|
1285
1295
|
access(access) {
|
|
1286
|
-
return this.http.
|
|
1296
|
+
return this.http.post(this.url.access, { ACCESS: access });
|
|
1287
1297
|
}
|
|
1288
1298
|
fields() {
|
|
1289
|
-
return this.http.
|
|
1299
|
+
return this.http.post(this.url.fields);
|
|
1290
1300
|
}
|
|
1291
1301
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: BXRestUser, deps: [{ token: HttpBXServices }, { token: BXRestUserUserfield }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1292
1302
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: BXRestUser, providedIn: 'root' }); }
|
|
@@ -2576,7 +2586,8 @@ class BXRestNavvyUser {
|
|
|
2576
2586
|
return this.Navvy.PagNav(this.BXRestUser.get, copyParams, 'Не удалось получить пользователей', this.BXRestUserMap.get);
|
|
2577
2587
|
}
|
|
2578
2588
|
current(update = false) {
|
|
2579
|
-
|
|
2589
|
+
const navvy = new Navvy(this, this.BXRestUserMap);
|
|
2590
|
+
return navvy.simpleWithArg(this.self, update, '', this.BXRestUserMap.current);
|
|
2580
2591
|
}
|
|
2581
2592
|
/*
|
|
2582
2593
|
update(user: iBXRestUser, fieldUpdate: string[]) {
|
|
@@ -2628,7 +2639,7 @@ class BXRestNavvyUser {
|
|
|
2628
2639
|
else {
|
|
2629
2640
|
let self = SessionStorage.getItem(this.constructor.name + this.self.name);
|
|
2630
2641
|
if (self) {
|
|
2631
|
-
return of(
|
|
2642
|
+
return of(self);
|
|
2632
2643
|
}
|
|
2633
2644
|
return this.BXRestUser.current(update)
|
|
2634
2645
|
.pipe(map(v => {
|
|
@@ -2636,7 +2647,7 @@ class BXRestNavvyUser {
|
|
|
2636
2647
|
return v;
|
|
2637
2648
|
}
|
|
2638
2649
|
return undefined;
|
|
2639
|
-
}), tap(v => {
|
|
2650
|
+
}), shareReplay(1), tap(v => {
|
|
2640
2651
|
if (v) {
|
|
2641
2652
|
SessionStorage.setItem(this.constructor.name + this.self.name, v);
|
|
2642
2653
|
}
|
|
@@ -2940,8 +2951,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
|
2940
2951
|
}] });
|
|
2941
2952
|
|
|
2942
2953
|
class BXRestNavvyOperationElapseditem {
|
|
2943
|
-
constructor(BXRestNavvyElapseditem) {
|
|
2954
|
+
constructor(http, BXRestNavvyElapseditem, BXRestMapElapseditem) {
|
|
2955
|
+
this.http = http;
|
|
2944
2956
|
this.BXRestNavvyElapseditem = BXRestNavvyElapseditem;
|
|
2957
|
+
this.BXRestMapElapseditem = BXRestMapElapseditem;
|
|
2945
2958
|
}
|
|
2946
2959
|
getByInterval(idsUsers, dateStart, dateEnd) {
|
|
2947
2960
|
const param = {
|
|
@@ -2956,6 +2969,21 @@ class BXRestNavvyOperationElapseditem {
|
|
|
2956
2969
|
};
|
|
2957
2970
|
return this.BXRestNavvyElapseditem.getList(param);
|
|
2958
2971
|
}
|
|
2972
|
+
getListByIDTask(ids) {
|
|
2973
|
+
return this.http.branch(ids.map(i => {
|
|
2974
|
+
return {
|
|
2975
|
+
name: this.http.getNameMethod([$task, $elapseditem, $getlist]),
|
|
2976
|
+
param: {
|
|
2977
|
+
TASKID: i
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
})).pipe(map(v => {
|
|
2981
|
+
if (v && v.length) {
|
|
2982
|
+
return this.http.mapBranchResultWithoutKey(v).map(i => this.BXRestMapElapseditem.getList(i));
|
|
2983
|
+
}
|
|
2984
|
+
return undefined;
|
|
2985
|
+
}));
|
|
2986
|
+
}
|
|
2959
2987
|
}
|
|
2960
2988
|
|
|
2961
2989
|
class BXRestMapTasksTask extends BaseMapServices {
|
|
@@ -3341,13 +3369,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
|
3341
3369
|
}] });
|
|
3342
3370
|
|
|
3343
3371
|
class BXRestNavvyElapseditem {
|
|
3344
|
-
constructor(BXRestElapseditem, BXRestNavvyUser, BXRestNavvyTasks, BXRestMapElapseditem) {
|
|
3372
|
+
constructor(BXRestElapseditem, BXRestNavvyUser, BXRestNavvyTasks, BXRestMapElapseditem, http) {
|
|
3345
3373
|
this.BXRestElapseditem = BXRestElapseditem;
|
|
3346
3374
|
this.BXRestNavvyUser = BXRestNavvyUser;
|
|
3347
3375
|
this.BXRestNavvyTasks = BXRestNavvyTasks;
|
|
3348
3376
|
this.BXRestMapElapseditem = BXRestMapElapseditem;
|
|
3377
|
+
this.http = http;
|
|
3349
3378
|
this.Navvy = new Navvy(this.BXRestElapseditem, this.BXRestMapElapseditem);
|
|
3350
|
-
this.operation = new BXRestNavvyOperationElapseditem(this);
|
|
3379
|
+
this.operation = new BXRestNavvyOperationElapseditem(this.http, this, this.BXRestMapElapseditem);
|
|
3351
3380
|
}
|
|
3352
3381
|
/*
|
|
3353
3382
|
call(methodName: string, ...args: any[]){
|
|
@@ -3589,7 +3618,7 @@ class BXRestNavvyElapseditem {
|
|
|
3589
3618
|
}
|
|
3590
3619
|
})), 'Не удалось удалить элемент списка', v => (v === null));
|
|
3591
3620
|
}
|
|
3592
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: BXRestNavvyElapseditem, deps: [{ token: BXRestElapseditem }, { token: BXRestNavvyUser }, { token: BXRestNavvyTasks }, { token: BXRestMapTaskElapseditem }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3621
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: BXRestNavvyElapseditem, deps: [{ token: BXRestElapseditem }, { token: BXRestNavvyUser }, { token: BXRestNavvyTasks }, { token: BXRestMapTaskElapseditem }, { token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3593
3622
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: BXRestNavvyElapseditem, providedIn: 'root' }); }
|
|
3594
3623
|
}
|
|
3595
3624
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImport: i0, type: BXRestNavvyElapseditem, decorators: [{
|
|
@@ -3597,7 +3626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
|
3597
3626
|
args: [{
|
|
3598
3627
|
providedIn: 'root'
|
|
3599
3628
|
}]
|
|
3600
|
-
}], ctorParameters: function () { return [{ type: BXRestElapseditem }, { type: BXRestNavvyUser }, { type: BXRestNavvyTasks }, { type: BXRestMapTaskElapseditem }]; } });
|
|
3629
|
+
}], ctorParameters: function () { return [{ type: BXRestElapseditem }, { type: BXRestNavvyUser }, { type: BXRestNavvyTasks }, { type: BXRestMapTaskElapseditem }, { type: HttpBXServices }]; } });
|
|
3601
3630
|
|
|
3602
3631
|
class BXRestNavvyTask {
|
|
3603
3632
|
constructor(elapseditem) {
|