bx-rest 0.0.27 → 0.0.29
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/functions/mapResult.mjs +7 -0
- package/esm2020/request/lists/element.mjs +1 -1
- package/esm2020/rest.mjs +35 -4
- package/fesm2015/bx-rest.mjs +39 -4
- package/fesm2015/bx-rest.mjs.map +1 -1
- package/fesm2020/bx-rest.mjs +39 -4
- package/fesm2020/bx-rest.mjs.map +1 -1
- package/functions/mapResult.d.ts +2 -0
- package/package.json +1 -1
- package/request/lists/element.d.ts +1 -3
- package/rest.d.ts +7 -1
package/fesm2020/bx-rest.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
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
|
-
import { Subscription, filter, take, of, throwError, forkJoin, mergeMap } from 'rxjs';
|
|
4
|
+
import { Subscription, filter, take, of, throwError, forkJoin, mergeMap, Observable } from 'rxjs';
|
|
5
5
|
import clone from 'just-clone';
|
|
6
6
|
import * as i1$1 from '@angular/material/snack-bar';
|
|
7
7
|
import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
|
|
@@ -1362,6 +1362,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1362
1362
|
}]
|
|
1363
1363
|
}], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
|
|
1364
1364
|
|
|
1365
|
+
function mapResult(v) {
|
|
1366
|
+
if (v && (v.result || typeof v.result === 'boolean')) {
|
|
1367
|
+
return v.result;
|
|
1368
|
+
}
|
|
1369
|
+
return undefined;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1365
1372
|
const save = createAction('[Users Component] Save', props());
|
|
1366
1373
|
const saveArr = createAction('[Users Component] Save Arr', props());
|
|
1367
1374
|
const update = createAction('[Users Component] Update', props());
|
|
@@ -1718,20 +1725,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1718
1725
|
// import BXRestListsElementMap from './map/lists/element'
|
|
1719
1726
|
// import { map } from 'rxjs/operators'
|
|
1720
1727
|
// import { mapResult } from './functions/mapResult'
|
|
1721
|
-
class
|
|
1728
|
+
class BXRestBase {
|
|
1722
1729
|
constructor(user, lists) {
|
|
1723
1730
|
this.user = user;
|
|
1724
1731
|
this.lists = lists;
|
|
1725
1732
|
}
|
|
1726
1733
|
}
|
|
1727
|
-
|
|
1734
|
+
BXRestBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBase, deps: [{ token: BXRestUser }, { token: BXRestLists }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1735
|
+
BXRestBase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBase, providedIn: 'root' });
|
|
1736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBase, decorators: [{
|
|
1737
|
+
type: Injectable,
|
|
1738
|
+
args: [{
|
|
1739
|
+
providedIn: 'root'
|
|
1740
|
+
}]
|
|
1741
|
+
}], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }]; } });
|
|
1742
|
+
class BXRest extends new Proxy(BXRestBase, {
|
|
1743
|
+
get(target, prop, receiver) {
|
|
1744
|
+
const res = Reflect.get(target, prop, receiver);
|
|
1745
|
+
console.log('res', res);
|
|
1746
|
+
if (res in Observable) {
|
|
1747
|
+
// let mapRes = new BXRestListsElementMap()
|
|
1748
|
+
// console.log('res', res)
|
|
1749
|
+
return Reflect.get(target, prop, receiver).pipe(
|
|
1750
|
+
// @ts-ignore
|
|
1751
|
+
map(v => (v && v.result)
|
|
1752
|
+
// @ts-ignore
|
|
1753
|
+
? Object.assign(v, { result: v.result.map(i => mapRes.get(i)) })
|
|
1754
|
+
: undefined),
|
|
1755
|
+
// @ts-ignore
|
|
1756
|
+
map(v => mapResult(v)));
|
|
1757
|
+
}
|
|
1758
|
+
return res;
|
|
1759
|
+
}
|
|
1760
|
+
}) {
|
|
1761
|
+
}
|
|
1762
|
+
BXRest.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1728
1763
|
BXRest.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, providedIn: 'root' });
|
|
1729
1764
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, decorators: [{
|
|
1730
1765
|
type: Injectable,
|
|
1731
1766
|
args: [{
|
|
1732
1767
|
providedIn: 'root'
|
|
1733
1768
|
}]
|
|
1734
|
-
}]
|
|
1769
|
+
}] });
|
|
1735
1770
|
|
|
1736
1771
|
/*
|
|
1737
1772
|
* Public API Surface of bx-rest
|