@veloceapps/api 11.0.0-1 → 11.0.0-10

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.
@@ -3,8 +3,8 @@ import { HttpParams, HttpHeaders, HttpErrorResponse, HttpClientModule } from '@a
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, NgModule } from '@angular/core';
5
5
  import * as i1 from '@veloceapps/core';
6
- import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, Expression, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, 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';
6
+ import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, Expression, Operator, isApexError, isCanvasError, ModelTranslatorUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
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)),
@@ -1785,19 +1798,6 @@ class ProductModelApiService {
1785
1798
  return linkedModels;
1786
1799
  }));
1787
1800
  }
1788
- /**
1789
- *
1790
- * @deprecated
1791
- * Will be removed in next major release
1792
- */
1793
- load(id, version) {
1794
- return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1795
- const container = new ProductModelsContainer(model, linkedModels ?? []);
1796
- ModelUtils.override(container.main, container.linked);
1797
- ModelTranslatorUtils.toLocalModel(container.main, container.linked);
1798
- return container;
1799
- }));
1800
- }
1801
1801
  getPML(modelId, version) {
1802
1802
  let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
1803
1803
  if (version) {
@@ -1984,18 +1984,7 @@ class QuoteApiService {
1984
1984
  this.SERVICE_URL = '/quotes';
1985
1985
  }
1986
1986
  /**
1987
- * @deprecated Use getQuoteState instead
1988
- */
1989
- getQuoteDraft(objectId, params, errorHandler) {
1990
- return this.httpService.api({
1991
- method: 'get',
1992
- url: `${this.SERVICE_URL}/${objectId}`,
1993
- params,
1994
- errorHandler,
1995
- });
1996
- }
1997
- /**
1998
- * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
1987
+ * This endpoint doesn't include orders and assets
1999
1988
  * @param objectId quoteId | accountId | opportunityId | orderId
2000
1989
  * @param params Query params
2001
1990
  * @param options Request options
@@ -2201,7 +2190,6 @@ class RlmApiService {
2201
2190
  this.baseHttpService = baseHttpService;
2202
2191
  this.serviceUrl = '/rlm';
2203
2192
  }
2204
- // TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
2205
2193
  fetchContextDefinitions$() {
2206
2194
  return this.baseHttpService
2207
2195
  .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
@@ -2459,13 +2447,6 @@ class SalesforceApiService {
2459
2447
  ...options,
2460
2448
  });
2461
2449
  }
2462
- /**
2463
- * @deprecated
2464
- */
2465
- describe(objectName, fieldName, options) {
2466
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
2467
- return this.httpService.api({ url: methodUrl, ...options });
2468
- }
2469
2450
  describeObject(objectName, options) {
2470
2451
  const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2471
2452
  return this.httpService.api({ url: methodUrl, ...options });
@@ -2751,6 +2732,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2751
2732
  class UIDefinitionsApiService {
2752
2733
  constructor(baseHttpService) {
2753
2734
  this.baseHttpService = baseHttpService;
2735
+ this.serviceUrl = '/uidefinitions';
2754
2736
  }
2755
2737
  fetch$(modelId, version) {
2756
2738
  const serviceUrl = this.getServiceUrl(modelId);
@@ -2770,6 +2752,11 @@ class UIDefinitionsApiService {
2770
2752
  const serviceUrl = this.getServiceUrl(modelId);
2771
2753
  const dto = {
2772
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,
2773
2760
  sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2774
2761
  };
2775
2762
  return this.baseHttpService
@@ -2810,6 +2797,46 @@ class UIDefinitionsApiService {
2810
2797
  getServiceUrl(modelId) {
2811
2798
  return `/models/${modelId}/uidefinitions`;
2812
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
+ }
2813
2840
  }
2814
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 });
2815
2842
  UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });