@veloceapps/api 7.0.2-7 → 7.0.2-71

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,12 +3,13 @@ import { HttpParams, HttpErrorResponse, HttpClientModule } from '@angular/common
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 { ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, Operator, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { throwError, of, zip, forkJoin, map as map$1, noop, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
6
+ import { uiDefinitionFromDTO, isLegacyUIDefinition, ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, Operator, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
+ import { noop, throwError, of, zip, forkJoin, map as map$1, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
8
8
  import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
9
9
  import * as i2 from 'primeng/api';
10
10
  import { CurrencyPipe } from '@angular/common';
11
11
  import * as _ from 'lodash';
12
+ import { omit } from 'lodash';
12
13
  import moment from 'moment';
13
14
 
14
15
  class AccountApiService {
@@ -240,6 +241,32 @@ class CatalogAdminApiService {
240
241
  });
241
242
  };
242
243
  }
244
+ attachImage$(catalogId, categoryId, file) {
245
+ const data = new FormData();
246
+ data.append('image', file);
247
+ return this.baseHttpService.upload({
248
+ method: 'post',
249
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
250
+ body: data,
251
+ });
252
+ }
253
+ removeImage$(catalogId, categoryId) {
254
+ return this.baseHttpService.api({
255
+ method: 'delete',
256
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
257
+ });
258
+ }
259
+ fetchImage$(catalogId, categoryId) {
260
+ return this.baseHttpService.api({
261
+ url: this.getImageUrl(catalogId, categoryId),
262
+ method: 'get',
263
+ responseType: 'blob',
264
+ errorHandler: noop,
265
+ });
266
+ }
267
+ getImageUrl(catalogId, categoryId) {
268
+ return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
269
+ }
243
270
  }
244
271
  CatalogAdminApiService.MAX_RESULTS = 60;
245
272
  CatalogAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -298,7 +325,7 @@ class CatalogApiService {
298
325
  body: context,
299
326
  });
300
327
  }
301
- searchCategoryProducts$(catalogId, categoryId, searchParams, searchCriteria, context) {
328
+ searchCategoryProducts$(catalogId, categoryId, searchParams, searchRequest, context) {
302
329
  const params = new HttpParams({ fromObject: searchParams });
303
330
  return this.service.api({
304
331
  method: 'post',
@@ -306,7 +333,7 @@ class CatalogApiService {
306
333
  params,
307
334
  body: {
308
335
  configurationContext: context,
309
- request: { searchCriteria },
336
+ request: searchRequest,
310
337
  },
311
338
  });
312
339
  }
@@ -366,11 +393,16 @@ class ConfigurationApiService {
366
393
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
367
394
  })
368
395
  .pipe(map(runtimeData => {
369
- runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
370
- runtimeData.uiDefinitions.forEach(uiDefinition => {
371
- ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
372
- });
373
- return runtimeData;
396
+ return {
397
+ ...runtimeData,
398
+ uiDefinitions: runtimeData.uiDefinitions.map(dto => {
399
+ const uiDefinitionContainer = uiDefinitionFromDTO(dto);
400
+ if (isLegacyUIDefinition(uiDefinitionContainer.source)) {
401
+ ModelTranslatorUtils.toLocalUIDefinition(uiDefinitionContainer.source);
402
+ }
403
+ return uiDefinitionContainer;
404
+ }),
405
+ };
374
406
  }));
375
407
  }
376
408
  getRuntimeDataByModelId(modelId) {
@@ -651,10 +683,21 @@ class SalesforceApiService {
651
683
  ...options,
652
684
  });
653
685
  }
686
+ /**
687
+ * @deprecated
688
+ */
654
689
  describe(objectName, fieldName, options) {
655
690
  const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
656
691
  return this.httpService.api({ url: methodUrl, ...options });
657
692
  }
693
+ describeObject(objectName, options) {
694
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
695
+ return this.httpService.api({ url: methodUrl, ...options });
696
+ }
697
+ describeField(objectName, fieldName, options) {
698
+ const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
699
+ return this.httpService.api({ url: methodUrl, ...options });
700
+ }
658
701
  describe2(objectName, fields, options) {
659
702
  const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
660
703
  return this.httpService.api({ method: 'post', url: methodUrl, body: fields, ...options });
@@ -670,6 +713,18 @@ class SalesforceApiService {
670
713
  ...options,
671
714
  });
672
715
  }
716
+ getGlobalPicklists() {
717
+ return this.httpService.api({
718
+ method: 'get',
719
+ url: `${this.SERVICE_URL}/globalvalueset`,
720
+ });
721
+ }
722
+ getGlobalPicklistValues(id) {
723
+ return this.httpService.api({
724
+ method: 'get',
725
+ url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
726
+ });
727
+ }
673
728
  }
674
729
  SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
675
730
  SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SalesforceApiService });
@@ -1134,6 +1189,16 @@ class GuidedSellingApiService {
1134
1189
  body: expression || {},
1135
1190
  });
1136
1191
  }
1192
+ searchById$(id, searchParams) {
1193
+ const params = new HttpParams({ fromObject: { ...searchParams } });
1194
+ const expression = new Expression(undefined, [{ key: 'id', operator: Operator.EQ, value: id }]);
1195
+ return this.http.api({
1196
+ method: 'post',
1197
+ url: `${this.serviceUrl}/search`,
1198
+ params,
1199
+ body: expression || {},
1200
+ });
1201
+ }
1137
1202
  }
1138
1203
  GuidedSellingApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: GuidedSellingApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1139
1204
  GuidedSellingApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: GuidedSellingApiService });
@@ -1669,6 +1734,11 @@ class ProductModelApiService {
1669
1734
  return linkedModels;
1670
1735
  }));
1671
1736
  }
1737
+ /**
1738
+ *
1739
+ * @deprecated
1740
+ * Will be removed in next major release
1741
+ */
1672
1742
  load(id, version) {
1673
1743
  return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1674
1744
  const container = new ProductModelsContainer(model, linkedModels ?? []);
@@ -2097,6 +2167,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2097
2167
  type: Injectable
2098
2168
  }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2099
2169
 
2170
+ class UIDefinitionsApiService {
2171
+ constructor(baseHttpService) {
2172
+ this.baseHttpService = baseHttpService;
2173
+ }
2174
+ fetch$(modelId, version) {
2175
+ const serviceUrl = this.getServiceUrl(modelId);
2176
+ let params = new HttpParams();
2177
+ if (version != null) {
2178
+ params = params.set('modelVersion', version);
2179
+ }
2180
+ return this.baseHttpService
2181
+ .api({
2182
+ method: 'get',
2183
+ url: serviceUrl,
2184
+ params: params,
2185
+ })
2186
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2187
+ }
2188
+ create$(modelId, uiDefinitionContainer) {
2189
+ const serviceUrl = this.getServiceUrl(modelId);
2190
+ const dto = {
2191
+ ...omit(uiDefinitionContainer, 'source'),
2192
+ sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2193
+ };
2194
+ return this.baseHttpService
2195
+ .api({
2196
+ method: 'post',
2197
+ url: serviceUrl,
2198
+ body: dto,
2199
+ })
2200
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2201
+ }
2202
+ get$(modelId, uiDefinitionId) {
2203
+ const serviceUrl = this.getServiceUrl(modelId);
2204
+ return this.baseHttpService
2205
+ .api({
2206
+ method: 'get',
2207
+ url: `${serviceUrl}/${uiDefinitionId}`,
2208
+ })
2209
+ .pipe(map$1(container => uiDefinitionFromDTO({ ...container, id: uiDefinitionId })));
2210
+ }
2211
+ update$(uiDefinitionContainer) {
2212
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2213
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
2214
+ return this.baseHttpService
2215
+ .api({
2216
+ method: 'put',
2217
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2218
+ body: dto,
2219
+ })
2220
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2221
+ }
2222
+ delete$(uiDefinitionContainer) {
2223
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2224
+ return this.baseHttpService.api({
2225
+ method: 'delete',
2226
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2227
+ });
2228
+ }
2229
+ getServiceUrl(modelId) {
2230
+ return `/models/${modelId}/uidefinitions`;
2231
+ }
2232
+ }
2233
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2234
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService });
2235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
2236
+ type: Injectable
2237
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2238
+
2100
2239
  const fromUIComponentStoryDTO = (dto, attachments) => {
2101
2240
  return {
2102
2241
  id: dto.id,
@@ -2385,6 +2524,82 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2385
2524
  type: Injectable
2386
2525
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2387
2526
 
2527
+ class VeloceObjectsApiService {
2528
+ constructor(baseHttpService) {
2529
+ this.baseHttpService = baseHttpService;
2530
+ this.serviceUrl = '/veloceobjects';
2531
+ this.updateCategory$ = (category) => {
2532
+ return this.baseHttpService.api({
2533
+ method: 'put',
2534
+ url: `${this.serviceUrl}/categories/${category.id}`,
2535
+ body: category,
2536
+ });
2537
+ };
2538
+ this.deleteCategory$ = (id) => {
2539
+ return this.baseHttpService.api({
2540
+ method: 'delete',
2541
+ url: `${this.serviceUrl}/categories/${id}`,
2542
+ });
2543
+ };
2544
+ this.searchObjects$ = (searchParams, expression) => {
2545
+ const params = new HttpParams({ fromObject: { ...searchParams } });
2546
+ return this.baseHttpService.api({
2547
+ method: 'post',
2548
+ url: `${this.serviceUrl}/search`,
2549
+ params,
2550
+ body: expression || {},
2551
+ });
2552
+ };
2553
+ this.deleteObject$ = (id) => {
2554
+ return this.baseHttpService.api({
2555
+ method: 'delete',
2556
+ url: `${this.serviceUrl}/${id}`,
2557
+ });
2558
+ };
2559
+ this.restoreObject$ = (id) => {
2560
+ return this.baseHttpService.api({
2561
+ method: 'patch',
2562
+ url: `${this.serviceUrl}/${id}/restore`,
2563
+ });
2564
+ };
2565
+ }
2566
+ fetchCategories$() {
2567
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/categories` });
2568
+ }
2569
+ createCategory$(category) {
2570
+ return this.baseHttpService.api({
2571
+ method: 'post',
2572
+ url: `${this.serviceUrl}/categories`,
2573
+ body: category,
2574
+ });
2575
+ }
2576
+ fetchObjects$() {
2577
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2578
+ }
2579
+ fetchObject$(id) {
2580
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2581
+ }
2582
+ createObject$(object) {
2583
+ return this.baseHttpService.api({
2584
+ method: 'post',
2585
+ url: `${this.serviceUrl}`,
2586
+ body: object,
2587
+ });
2588
+ }
2589
+ updateObject$(object) {
2590
+ return this.baseHttpService.api({
2591
+ method: 'put',
2592
+ url: `${this.serviceUrl}/${object.id}`,
2593
+ body: object,
2594
+ });
2595
+ }
2596
+ }
2597
+ VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2598
+ VeloceObjectsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService });
2599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, decorators: [{
2600
+ type: Injectable
2601
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2602
+
2388
2603
  class ApiModule {
2389
2604
  }
2390
2605
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -2420,6 +2635,8 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2420
2635
  EndpointsApiService,
2421
2636
  OrgInfoApiService,
2422
2637
  OffersApiService,
2638
+ UIDefinitionsApiService,
2639
+ VeloceObjectsApiService,
2423
2640
  ], imports: [HttpClientModule] });
2424
2641
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, decorators: [{
2425
2642
  type: NgModule,
@@ -2456,6 +2673,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2456
2673
  EndpointsApiService,
2457
2674
  OrgInfoApiService,
2458
2675
  OffersApiService,
2676
+ UIDefinitionsApiService,
2677
+ VeloceObjectsApiService,
2459
2678
  ],
2460
2679
  }]
2461
2680
  }] });
@@ -2464,5 +2683,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2464
2683
  * Generated bundle index. Do not edit.
2465
2684
  */
2466
2685
 
2467
- export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationSettingsApiService, ContextApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, QuoteApiService, RampApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, ShoppingCartSettingsApiService, UITemplatesApiService };
2686
+ export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationSettingsApiService, ContextApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, QuoteApiService, RampApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, ShoppingCartSettingsApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceObjectsApiService };
2468
2687
  //# sourceMappingURL=veloceapps-api.mjs.map