@veloceapps/api 11.0.0-1 → 11.0.0-11

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';
@@ -389,13 +389,26 @@ class ConfigurationApiService {
389
389
  }
390
390
  }));
391
391
  }
392
- getRuntimeDataByProductId(productId, offeringId) {
392
+ getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
393
393
  return this.httpService
394
394
  .api({
395
395
  method: 'get',
396
396
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
397
397
  })
398
- .pipe(map(runtimeData => {
398
+ .pipe(switchMap(runtimeData => {
399
+ if (requiredUIDefinitionId) {
400
+ return this.httpService.api({ method: 'get', url: `/uidefinitions/${requiredUIDefinitionId}` }).pipe(map(uiDefinition => {
401
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: [uiDefinition] });
402
+ }));
403
+ }
404
+ const params = { productId };
405
+ if (defaultUIDefinitionId) {
406
+ params['defaultUIDefinitionId'] = defaultUIDefinitionId;
407
+ }
408
+ return this.httpService.api({ method: 'get', url: `/uidefinitions`, params }).pipe(map(uiDefinitions => {
409
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions });
410
+ }));
411
+ }), map(runtimeData => {
399
412
  return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)) });
400
413
  }));
401
414
  }
@@ -1699,19 +1712,6 @@ class ProductModelApiService {
1699
1712
  return linkedModels;
1700
1713
  }));
1701
1714
  }
1702
- /**
1703
- *
1704
- * @deprecated
1705
- * Will be removed in next major release
1706
- */
1707
- load(id, version) {
1708
- return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1709
- const container = new ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
1710
- ModelUtils.override(container.main, container.linked);
1711
- ModelTranslatorUtils.toLocalModel(container.main, container.linked);
1712
- return container;
1713
- }));
1714
- }
1715
1715
  getPML(modelId, version) {
1716
1716
  let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
1717
1717
  if (version) {
@@ -1898,18 +1898,7 @@ class QuoteApiService {
1898
1898
  this.SERVICE_URL = '/quotes';
1899
1899
  }
1900
1900
  /**
1901
- * @deprecated Use getQuoteState instead
1902
- */
1903
- getQuoteDraft(objectId, params, errorHandler) {
1904
- return this.httpService.api({
1905
- method: 'get',
1906
- url: `${this.SERVICE_URL}/${objectId}`,
1907
- params,
1908
- errorHandler,
1909
- });
1910
- }
1911
- /**
1912
- * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
1901
+ * This endpoint doesn't include orders and assets
1913
1902
  * @param objectId quoteId | accountId | opportunityId | orderId
1914
1903
  * @param params Query params
1915
1904
  * @param options Request options
@@ -2090,7 +2079,6 @@ class RlmApiService {
2090
2079
  this.baseHttpService = baseHttpService;
2091
2080
  this.serviceUrl = '/rlm';
2092
2081
  }
2093
- // TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
2094
2082
  fetchContextDefinitions$() {
2095
2083
  return this.baseHttpService
2096
2084
  .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
@@ -2332,13 +2320,6 @@ class SalesforceApiService {
2332
2320
  search(req, options) {
2333
2321
  return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/rest/search`, params: { q: req.searchString } }, options));
2334
2322
  }
2335
- /**
2336
- * @deprecated
2337
- */
2338
- describe(objectName, fieldName, options) {
2339
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
2340
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
2341
- }
2342
2323
  describeObject(objectName, options) {
2343
2324
  const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2344
2325
  return this.httpService.api(Object.assign({ url: methodUrl }, options));
@@ -2619,6 +2600,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2619
2600
  class UIDefinitionsApiService {
2620
2601
  constructor(baseHttpService) {
2621
2602
  this.baseHttpService = baseHttpService;
2603
+ this.serviceUrl = '/uidefinitions';
2622
2604
  }
2623
2605
  fetch$(modelId, version) {
2624
2606
  const serviceUrl = this.getServiceUrl(modelId);
@@ -2635,8 +2617,9 @@ class UIDefinitionsApiService {
2635
2617
  .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2636
2618
  }
2637
2619
  create$(modelId, uiDefinitionContainer) {
2620
+ var _a, _b;
2638
2621
  const serviceUrl = this.getServiceUrl(modelId);
2639
- const dto = Object.assign(Object.assign({}, omit(uiDefinitionContainer, 'source')), { sourceBlob: JSON.stringify(uiDefinitionContainer.source) });
2622
+ const dto = Object.assign(Object.assign({}, omit(uiDefinitionContainer, 'source')), { name: uiDefinitionContainer.source.name, modelId: uiDefinitionContainer.source.modelId, templateName: (_a = uiDefinitionContainer.source.uiTemplateData) === null || _a === void 0 ? void 0 : _a.TEMPLATE_NAME, rootType: (_b = uiDefinitionContainer.source.uiTemplateData) === null || _b === void 0 ? void 0 : _b.ROOT_TYPE, defaultFlag: uiDefinitionContainer.source.primary, sourceBlob: JSON.stringify(uiDefinitionContainer.source) });
2640
2623
  return this.baseHttpService
2641
2624
  .api({
2642
2625
  method: 'post',
@@ -2675,6 +2658,46 @@ class UIDefinitionsApiService {
2675
2658
  getServiceUrl(modelId) {
2676
2659
  return `/models/${modelId}/uidefinitions`;
2677
2660
  }
2661
+ fetchUIDefinitions$() {
2662
+ return this.baseHttpService.api({
2663
+ method: 'get',
2664
+ url: this.serviceUrl,
2665
+ });
2666
+ }
2667
+ fetchUIDefinition$(id) {
2668
+ return this.baseHttpService
2669
+ .api({
2670
+ method: 'get',
2671
+ url: `${this.serviceUrl}/${id}`,
2672
+ })
2673
+ .pipe(map$1(container => uiDefinitionFromDTO(Object.assign(Object.assign({}, container), { id }))), map$1(uiDefinition => {
2674
+ const result = uiDefinition;
2675
+ if (!uiDefinition.modelId && uiDefinition.source.modelId) {
2676
+ result['modelId'] = uiDefinition.source.modelId;
2677
+ }
2678
+ return result;
2679
+ }));
2680
+ }
2681
+ createUIDefinition$(body) {
2682
+ return this.baseHttpService.api({
2683
+ method: 'post',
2684
+ url: this.serviceUrl,
2685
+ body,
2686
+ });
2687
+ }
2688
+ updateUIDefinition$(uiDefinition) {
2689
+ return this.baseHttpService.api({
2690
+ method: 'put',
2691
+ url: `${this.serviceUrl}/${uiDefinition.id}`,
2692
+ body: uiDefinition,
2693
+ });
2694
+ }
2695
+ deleteUIDefinition$(id) {
2696
+ return this.baseHttpService.api({
2697
+ method: 'delete',
2698
+ url: `${this.serviceUrl}/${id}`,
2699
+ });
2700
+ }
2678
2701
  }
2679
2702
  UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2680
2703
  UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });