monkey-front-core 0.0.44 → 0.0.48
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/lib/core/decorators/monkeyecx-decorators.mjs +3 -5
- package/esm2020/lib/core/interfaces/index.mjs +2 -1
- package/esm2020/lib/core/interfaces/monkeyecx-config.mjs +1 -1
- package/esm2020/lib/core/interfaces/monkeyecx-response-links.mjs +2 -0
- package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +8 -3
- package/esm2020/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.mjs +13 -6
- package/esm2020/lib/core/services/storage/monkeyecx-token-storage.service.mjs +8 -8
- package/fesm2015/monkey-front-core.mjs +26 -15
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +28 -18
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/interfaces/index.d.ts +1 -0
- package/lib/core/interfaces/monkeyecx-config.d.ts +14 -0
- package/lib/core/interfaces/monkeyecx-response-links.d.ts +11 -0
- package/lib/core/services/commons/monkeyecx-commons.service.d.ts +2 -1
- package/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.d.ts +3 -2
- package/monkey-front-core-0.0.48.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.44.tgz +0 -0
|
@@ -1401,8 +1401,6 @@ function MonkeyEcxCoreService(params) {
|
|
|
1401
1401
|
const method = propertyDescriptor.value;
|
|
1402
1402
|
propertyDescriptor.value = function (...args) {
|
|
1403
1403
|
const context = this;
|
|
1404
|
-
console.log('context');
|
|
1405
|
-
console.log(context);
|
|
1406
1404
|
if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
|
|
1407
1405
|
context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
|
|
1408
1406
|
context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
|
|
@@ -1427,7 +1425,7 @@ function MonkeyEcxCoreServicePaged(params) {
|
|
|
1427
1425
|
context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
|
|
1428
1426
|
context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials({
|
|
1429
1427
|
...params,
|
|
1430
|
-
...(requestPaged || null)
|
|
1428
|
+
...(requestPaged || null),
|
|
1431
1429
|
});
|
|
1432
1430
|
}
|
|
1433
1431
|
const result = method.apply(context, args);
|
|
@@ -1448,7 +1446,7 @@ function MonkeyEcxCoreServiceQueue(name, description, params) {
|
|
|
1448
1446
|
}
|
|
1449
1447
|
context?.monkeyecxService.monkeyecxHandlingService.setMonkeyEcxRequestQueue(buildQueuePropertys({
|
|
1450
1448
|
name,
|
|
1451
|
-
description
|
|
1449
|
+
description,
|
|
1452
1450
|
}));
|
|
1453
1451
|
}
|
|
1454
1452
|
const result = method.apply(context, args);
|
|
@@ -1711,11 +1709,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1711
1709
|
}] } });
|
|
1712
1710
|
|
|
1713
1711
|
class MonkeyEcxRequestPagedHandling {
|
|
1714
|
-
constructor(_url, _pagedParams) {
|
|
1712
|
+
constructor(_url, _pagedParams, _links) {
|
|
1715
1713
|
this.url = _url;
|
|
1716
1714
|
this.pagedParams = _pagedParams || {
|
|
1717
|
-
page: {}
|
|
1715
|
+
page: {},
|
|
1718
1716
|
};
|
|
1717
|
+
this.links = _links;
|
|
1719
1718
|
}
|
|
1720
1719
|
handlePagedValuesFromApi(url = '') {
|
|
1721
1720
|
if (url.search('\\?') < 0)
|
|
@@ -1723,8 +1722,11 @@ class MonkeyEcxRequestPagedHandling {
|
|
|
1723
1722
|
const params = url.substring(url.search('\\?') + 1, url.length);
|
|
1724
1723
|
url = url.substring(0, url.search('\\?'));
|
|
1725
1724
|
return `${url}?${new HttpParams({
|
|
1726
|
-
fromString: params
|
|
1727
|
-
})
|
|
1725
|
+
fromString: params,
|
|
1726
|
+
})
|
|
1727
|
+
.delete('size')
|
|
1728
|
+
.delete('page')
|
|
1729
|
+
.toString()}`;
|
|
1728
1730
|
}
|
|
1729
1731
|
getUrlParams(url) {
|
|
1730
1732
|
const { pagedParams } = this;
|
|
@@ -1733,7 +1735,10 @@ class MonkeyEcxRequestPagedHandling {
|
|
|
1733
1735
|
return `${!hasInitialQueryParams ? '?' : '&'}page=${number || 0}&size=${size || 20}`;
|
|
1734
1736
|
}
|
|
1735
1737
|
getRequestWithPagedParams() {
|
|
1736
|
-
const { url } = this;
|
|
1738
|
+
const { url, links } = this;
|
|
1739
|
+
if (links && links.next) {
|
|
1740
|
+
return links.next.href;
|
|
1741
|
+
}
|
|
1737
1742
|
const handled = this.handlePagedValuesFromApi(url);
|
|
1738
1743
|
return `${handled}${this.getUrlParams(handled)}`;
|
|
1739
1744
|
}
|
|
@@ -1748,6 +1753,7 @@ class MonkeyEcxCommonsService {
|
|
|
1748
1753
|
this.__error = null;
|
|
1749
1754
|
this.__handledError = null;
|
|
1750
1755
|
this.__page = null;
|
|
1756
|
+
this.__links = null;
|
|
1751
1757
|
this.__requestPaged = null;
|
|
1752
1758
|
this.__onSearchChanged$ = new BehaviorSubject(null);
|
|
1753
1759
|
this.__onDataChanged$ = new BehaviorSubject(null);
|
|
@@ -1840,6 +1846,9 @@ class MonkeyEcxCommonsService {
|
|
|
1840
1846
|
return this;
|
|
1841
1847
|
}
|
|
1842
1848
|
nextPage() {
|
|
1849
|
+
if (this.__links) {
|
|
1850
|
+
return !!this.__links?.next;
|
|
1851
|
+
}
|
|
1843
1852
|
if (!this.__requestPaged)
|
|
1844
1853
|
return false;
|
|
1845
1854
|
const { page } = this.__requestPaged;
|
|
@@ -1861,8 +1870,8 @@ class MonkeyEcxCommonsService {
|
|
|
1861
1870
|
return _embedded ? _embedded[field] : null;
|
|
1862
1871
|
}
|
|
1863
1872
|
getNormalizedUrl(url) {
|
|
1864
|
-
const { __requestPaged } = this;
|
|
1865
|
-
return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}).getRequestWithPagedParams();
|
|
1873
|
+
const { __requestPaged, __links } = this;
|
|
1874
|
+
return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}, __links).getRequestWithPagedParams();
|
|
1866
1875
|
}
|
|
1867
1876
|
clear(clearData) {
|
|
1868
1877
|
if (clearData) {
|
|
@@ -1870,6 +1879,7 @@ class MonkeyEcxCommonsService {
|
|
|
1870
1879
|
this.__requestPaged = null;
|
|
1871
1880
|
this.__params = null;
|
|
1872
1881
|
this.__page = null;
|
|
1882
|
+
this.__links = null;
|
|
1873
1883
|
if (this.__schedule) {
|
|
1874
1884
|
const { queue } = this.__schedule;
|
|
1875
1885
|
if (queue) {
|
|
@@ -2593,8 +2603,8 @@ class MonkeyEcxTokenStorageService {
|
|
|
2593
2603
|
programType: '',
|
|
2594
2604
|
role: '',
|
|
2595
2605
|
_clearIgnore: {
|
|
2596
|
-
ignore: ['username', 'program']
|
|
2597
|
-
}
|
|
2606
|
+
ignore: ['username', 'program'],
|
|
2607
|
+
},
|
|
2598
2608
|
};
|
|
2599
2609
|
this.token$ = new BehaviorSubject(null);
|
|
2600
2610
|
this.me$ = new BehaviorSubject(null);
|
|
@@ -2614,7 +2624,7 @@ class MonkeyEcxTokenStorageService {
|
|
|
2614
2624
|
getAllTokens() {
|
|
2615
2625
|
const { token, config } = this;
|
|
2616
2626
|
const handledToken = {
|
|
2617
|
-
...token
|
|
2627
|
+
...token,
|
|
2618
2628
|
};
|
|
2619
2629
|
Object.entries(token || {}).forEach(([key, value]) => {
|
|
2620
2630
|
handledToken[key] = localStorage.getItem(key);
|
|
@@ -2626,12 +2636,12 @@ class MonkeyEcxTokenStorageService {
|
|
|
2626
2636
|
}
|
|
2627
2637
|
setAllMe(me) {
|
|
2628
2638
|
const { me$ } = this;
|
|
2629
|
-
let previousMe = JSON.parse(localStorage?.getItem('me') || '');
|
|
2639
|
+
let previousMe = JSON.parse(localStorage?.getItem('me') || '{}');
|
|
2630
2640
|
Object.entries(me).forEach(([key, value]) => {
|
|
2631
2641
|
if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
|
|
2632
2642
|
previousMe = {
|
|
2633
2643
|
...previousMe,
|
|
2634
|
-
[key]: value
|
|
2644
|
+
[key]: value,
|
|
2635
2645
|
};
|
|
2636
2646
|
}
|
|
2637
2647
|
});
|
|
@@ -2640,7 +2650,7 @@ class MonkeyEcxTokenStorageService {
|
|
|
2640
2650
|
}
|
|
2641
2651
|
getAllMe() {
|
|
2642
2652
|
const me = localStorage.getItem('me');
|
|
2643
|
-
return JSON.parse(me || '');
|
|
2653
|
+
return JSON.parse(me || '{}');
|
|
2644
2654
|
}
|
|
2645
2655
|
tokenHasChanged() {
|
|
2646
2656
|
return this.token$.asObservable();
|
|
@@ -2692,7 +2702,7 @@ MonkeyEcxTokenStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "
|
|
|
2692
2702
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxTokenStorageService, decorators: [{
|
|
2693
2703
|
type: Injectable,
|
|
2694
2704
|
args: [{
|
|
2695
|
-
providedIn: 'root'
|
|
2705
|
+
providedIn: 'root',
|
|
2696
2706
|
}]
|
|
2697
2707
|
}], ctorParameters: function () { return [{ type: MonkeyEcxConfigService }]; } });
|
|
2698
2708
|
|