@veloceapps/api 11.0.0-4 → 11.0.0-5

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ import * as i0 from '@angular/core';
4
4
  import { Injectable, NgModule } from '@angular/core';
5
5
  import * as i1 from '@veloceapps/core';
6
6
  import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, Expression, Operator, isApexError, isCanvasError, ModelTranslatorUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { noop, throwError, of, map as map$1, from, catchError as catchError$1, forkJoin, switchMap } from 'rxjs';
7
+ import { noop, throwError, switchMap, of, map as map$1, from, catchError as catchError$1, forkJoin } from 'rxjs';
8
8
  import { map, catchError, tap } from 'rxjs/operators';
9
9
  import * as i1$2 from 'primeng/api';
10
10
  import { isArray, omit } from 'lodash';
@@ -428,13 +428,26 @@ class ConfigurationApiService {
428
428
  }
429
429
  }));
430
430
  }
431
- getRuntimeDataByProductId(productId, offeringId) {
431
+ getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
432
432
  return this.httpService
433
433
  .api({
434
434
  method: 'get',
435
435
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
436
436
  })
437
- .pipe(map(runtimeData => {
437
+ .pipe(switchMap(runtimeData => {
438
+ if (requiredUIDefinitionId) {
439
+ return this.httpService.api({ method: 'get', url: `/uidefinitions/${requiredUIDefinitionId}` }).pipe(map(uiDefinition => {
440
+ return { ...runtimeData, uiDefinitions: [uiDefinition] };
441
+ }));
442
+ }
443
+ const params = { productId };
444
+ if (defaultUIDefinitionId) {
445
+ params['defaultUIDefinitionId'] = defaultUIDefinitionId;
446
+ }
447
+ return this.httpService.api({ method: 'get', url: `/uidefinitions`, params }).pipe(map(uiDefinitions => {
448
+ return { ...runtimeData, uiDefinitions };
449
+ }));
450
+ }), map(runtimeData => {
438
451
  return {
439
452
  ...runtimeData,
440
453
  uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)),
@@ -2719,6 +2732,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2719
2732
  class UIDefinitionsApiService {
2720
2733
  constructor(baseHttpService) {
2721
2734
  this.baseHttpService = baseHttpService;
2735
+ this.serviceUrl = '/uidefinitions';
2722
2736
  }
2723
2737
  fetch$(modelId, version) {
2724
2738
  const serviceUrl = this.getServiceUrl(modelId);
@@ -2738,6 +2752,11 @@ class UIDefinitionsApiService {
2738
2752
  const serviceUrl = this.getServiceUrl(modelId);
2739
2753
  const dto = {
2740
2754
  ...omit(uiDefinitionContainer, 'source'),
2755
+ name: uiDefinitionContainer.source.name,
2756
+ modelId: uiDefinitionContainer.source.modelId,
2757
+ templateName: uiDefinitionContainer.source.uiTemplateData?.TEMPLATE_NAME,
2758
+ rootType: uiDefinitionContainer.source.uiTemplateData?.ROOT_TYPE,
2759
+ defaultFlag: uiDefinitionContainer.source.primary,
2741
2760
  sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2742
2761
  };
2743
2762
  return this.baseHttpService
@@ -2778,6 +2797,46 @@ class UIDefinitionsApiService {
2778
2797
  getServiceUrl(modelId) {
2779
2798
  return `/models/${modelId}/uidefinitions`;
2780
2799
  }
2800
+ fetchUIDefinitions$() {
2801
+ return this.baseHttpService.api({
2802
+ method: 'get',
2803
+ url: this.serviceUrl,
2804
+ });
2805
+ }
2806
+ fetchUIDefinition$(id) {
2807
+ return this.baseHttpService
2808
+ .api({
2809
+ method: 'get',
2810
+ url: `${this.serviceUrl}/${id}`,
2811
+ })
2812
+ .pipe(map$1(container => uiDefinitionFromDTO({ ...container, id })), map$1(uiDefinition => {
2813
+ const result = uiDefinition;
2814
+ if (!uiDefinition.modelId && uiDefinition.source.modelId) {
2815
+ result['modelId'] = uiDefinition.source.modelId;
2816
+ }
2817
+ return result;
2818
+ }));
2819
+ }
2820
+ createUIDefinition$(body) {
2821
+ return this.baseHttpService.api({
2822
+ method: 'post',
2823
+ url: this.serviceUrl,
2824
+ body,
2825
+ });
2826
+ }
2827
+ updateUIDefinition$(uiDefinition) {
2828
+ return this.baseHttpService.api({
2829
+ method: 'put',
2830
+ url: `${this.serviceUrl}/${uiDefinition.id}`,
2831
+ body: uiDefinition,
2832
+ });
2833
+ }
2834
+ deleteUIDefinition$(id) {
2835
+ return this.baseHttpService.api({
2836
+ method: 'delete',
2837
+ url: `${this.serviceUrl}/${id}`,
2838
+ });
2839
+ }
2781
2840
  }
2782
2841
  UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2783
2842
  UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });