monkey-front-core 0.0.221 → 0.0.224

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.
@@ -2131,6 +2131,37 @@ class MonkeyEcxRequestPagedHandling {
2131
2131
  }
2132
2132
  }
2133
2133
 
2134
+ class Link {
2135
+ constructor(data) {
2136
+ this.href = data?.href;
2137
+ this.type = data?.type;
2138
+ this.templated = data?.templated;
2139
+ }
2140
+ }
2141
+ class MonkeyEcxModel {
2142
+ getAction(type, replaceOptions) {
2143
+ const { _links } = this;
2144
+ if (!_links)
2145
+ return null;
2146
+ let link = _links[type.toLowerCase()];
2147
+ link = new Link(link);
2148
+ if (link && replaceOptions && link?.templated) {
2149
+ const { from, to } = replaceOptions;
2150
+ link = new Link({
2151
+ ...link,
2152
+ href: `${link.href}`.replace(from, to),
2153
+ });
2154
+ }
2155
+ return link;
2156
+ }
2157
+ }
2158
+
2159
+ class LinksModel extends MonkeyEcxModel {
2160
+ constructor(data) {
2161
+ super();
2162
+ this._links = data?._links;
2163
+ }
2164
+ }
2134
2165
  class MonkeyEcxCommonsService {
2135
2166
  constructor(monkeyecxService, tokenStorage, otherArgs) {
2136
2167
  this.monkeyecxService = monkeyecxService;
@@ -2440,6 +2471,16 @@ class MonkeyEcxCommonsService {
2440
2471
  throwError(err);
2441
2472
  });
2442
2473
  }
2474
+ async getGenericData(data, action) {
2475
+ const { monkeyecxService } = this;
2476
+ if (!monkeyecxService)
2477
+ return null;
2478
+ const { href, type } = new LinksModel(data)?.getAction(action) || {
2479
+ href: '', type: 'get'
2480
+ };
2481
+ return monkeyecxService[type.toLowerCase()](href)
2482
+ .pipe(take(1)).toPromise();
2483
+ }
2443
2484
  geti18n(translateService, keys) {
2444
2485
  translateService.onDefaultLangChange.subscribe(() => {
2445
2486
  this.__i18n = translateService.instant(keys);
@@ -2465,7 +2506,7 @@ class MonkeyEcxCommonsService {
2465
2506
  doPaginationv2(type, callback) {
2466
2507
  if (!this.__onLoadingInProgress$.value) {
2467
2508
  if (callback) {
2468
- callback();
2509
+ callback(type);
2469
2510
  }
2470
2511
  }
2471
2512
  }
@@ -2503,7 +2544,14 @@ __decorate([
2503
2544
  showProgress: true
2504
2545
  }
2505
2546
  })
2506
- ], MonkeyEcxCommonsService.prototype, "genericMethod", null);
2547
+ ], MonkeyEcxCommonsService.prototype, "genericMethod", null);
2548
+ __decorate([
2549
+ MonkeyEcxCoreService({
2550
+ requestInProgress: {
2551
+ showProgress: true
2552
+ }
2553
+ })
2554
+ ], MonkeyEcxCommonsService.prototype, "getGenericData", null);
2507
2555
 
2508
2556
  /* eslint-disable max-len */
2509
2557
  class MonkeyEcxHandlingService {
@@ -4864,31 +4912,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4864
4912
  }]
4865
4913
  }] });
4866
4914
 
4867
- class Link {
4868
- constructor(data) {
4869
- this.href = data?.href;
4870
- this.type = data?.type;
4871
- this.templated = data?.templated;
4872
- }
4873
- }
4874
- class MonkeyEcxModel {
4875
- getAction(type, replaceOptions) {
4876
- const { _links } = this;
4877
- if (!_links)
4878
- return null;
4879
- let link = _links[type.toLowerCase()];
4880
- link = new Link(link);
4881
- if (link && replaceOptions && link?.templated) {
4882
- const { from, to } = replaceOptions;
4883
- link = new Link({
4884
- ...link,
4885
- href: `${link.href}`.replace(from, to),
4886
- });
4887
- }
4888
- return link;
4889
- }
4890
- }
4891
-
4892
4915
  /* eslint-disable no-unused-vars */
4893
4916
  var OpSearch;
4894
4917
  (function (OpSearch) {