@veloceapps/api 7.0.2-6 → 7.0.2-61

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 });
@@ -1134,6 +1177,16 @@ class GuidedSellingApiService {
1134
1177
  body: expression || {},
1135
1178
  });
1136
1179
  }
1180
+ searchById$(id, searchParams) {
1181
+ const params = new HttpParams({ fromObject: { ...searchParams } });
1182
+ const expression = new Expression(undefined, [{ key: 'id', operator: Operator.EQ, value: id }]);
1183
+ return this.http.api({
1184
+ method: 'post',
1185
+ url: `${this.serviceUrl}/search`,
1186
+ params,
1187
+ body: expression || {},
1188
+ });
1189
+ }
1137
1190
  }
1138
1191
  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
1192
  GuidedSellingApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: GuidedSellingApiService });
@@ -1394,6 +1447,13 @@ class ProceduresApiService {
1394
1447
  body,
1395
1448
  });
1396
1449
  }
1450
+ catalogExecute$(body) {
1451
+ return this.baseHttpService.api({
1452
+ url: `${this.SERVICE_URL}/catalog/execute`,
1453
+ method: 'post',
1454
+ body,
1455
+ });
1456
+ }
1397
1457
  /**
1398
1458
  * Run active procedure against QuoteDraft
1399
1459
  * @param body
@@ -1662,6 +1722,11 @@ class ProductModelApiService {
1662
1722
  return linkedModels;
1663
1723
  }));
1664
1724
  }
1725
+ /**
1726
+ *
1727
+ * @deprecated
1728
+ * Will be removed in next major release
1729
+ */
1665
1730
  load(id, version) {
1666
1731
  return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1667
1732
  const container = new ProductModelsContainer(model, linkedModels ?? []);
@@ -2090,6 +2155,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2090
2155
  type: Injectable
2091
2156
  }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2092
2157
 
2158
+ class UIDefinitionsApiService {
2159
+ constructor(baseHttpService) {
2160
+ this.baseHttpService = baseHttpService;
2161
+ }
2162
+ fetch$(modelId, version) {
2163
+ const serviceUrl = this.getServiceUrl(modelId);
2164
+ let params = new HttpParams();
2165
+ if (version != null) {
2166
+ params = params.set('modelVersion', version);
2167
+ }
2168
+ return this.baseHttpService
2169
+ .api({
2170
+ method: 'get',
2171
+ url: serviceUrl,
2172
+ params: params,
2173
+ })
2174
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2175
+ }
2176
+ create$(modelId, uiDefinitionContainer) {
2177
+ const serviceUrl = this.getServiceUrl(modelId);
2178
+ const dto = {
2179
+ ...omit(uiDefinitionContainer, 'source'),
2180
+ sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2181
+ };
2182
+ return this.baseHttpService
2183
+ .api({
2184
+ method: 'post',
2185
+ url: serviceUrl,
2186
+ body: dto,
2187
+ })
2188
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2189
+ }
2190
+ get$(modelId, uiDefinitionId) {
2191
+ const serviceUrl = this.getServiceUrl(modelId);
2192
+ return this.baseHttpService
2193
+ .api({
2194
+ method: 'get',
2195
+ url: `${serviceUrl}/${uiDefinitionId}`,
2196
+ })
2197
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2198
+ }
2199
+ update$(uiDefinitionContainer) {
2200
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2201
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
2202
+ return this.baseHttpService
2203
+ .api({
2204
+ method: 'put',
2205
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2206
+ body: dto,
2207
+ })
2208
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2209
+ }
2210
+ delete$(uiDefinitionContainer) {
2211
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2212
+ return this.baseHttpService.api({
2213
+ method: 'delete',
2214
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2215
+ });
2216
+ }
2217
+ getServiceUrl(modelId) {
2218
+ return `/models/${modelId}/uidefinitions`;
2219
+ }
2220
+ }
2221
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2222
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService });
2223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
2224
+ type: Injectable
2225
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2226
+
2093
2227
  const fromUIComponentStoryDTO = (dto, attachments) => {
2094
2228
  return {
2095
2229
  id: dto.id,
@@ -2378,6 +2512,82 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2378
2512
  type: Injectable
2379
2513
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2380
2514
 
2515
+ class VeloceObjectsApiService {
2516
+ constructor(baseHttpService) {
2517
+ this.baseHttpService = baseHttpService;
2518
+ this.serviceUrl = '/veloceobjects';
2519
+ this.updateCategory$ = (category) => {
2520
+ return this.baseHttpService.api({
2521
+ method: 'put',
2522
+ url: `${this.serviceUrl}/categories/${category.id}`,
2523
+ body: category,
2524
+ });
2525
+ };
2526
+ this.deleteCategory$ = (id) => {
2527
+ return this.baseHttpService.api({
2528
+ method: 'delete',
2529
+ url: `${this.serviceUrl}/categories/${id}`,
2530
+ });
2531
+ };
2532
+ this.searchObjects$ = (searchParams, expression) => {
2533
+ const params = new HttpParams({ fromObject: { ...searchParams } });
2534
+ return this.baseHttpService.api({
2535
+ method: 'post',
2536
+ url: `${this.serviceUrl}/search`,
2537
+ params,
2538
+ body: expression || {},
2539
+ });
2540
+ };
2541
+ this.deleteObject$ = (id) => {
2542
+ return this.baseHttpService.api({
2543
+ method: 'delete',
2544
+ url: `${this.serviceUrl}/${id}`,
2545
+ });
2546
+ };
2547
+ this.restoreObject$ = (id) => {
2548
+ return this.baseHttpService.api({
2549
+ method: 'patch',
2550
+ url: `${this.serviceUrl}/${id}/restore`,
2551
+ });
2552
+ };
2553
+ }
2554
+ fetchCategories$() {
2555
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/categories` });
2556
+ }
2557
+ createCategory$(category) {
2558
+ return this.baseHttpService.api({
2559
+ method: 'post',
2560
+ url: `${this.serviceUrl}/categories`,
2561
+ body: category,
2562
+ });
2563
+ }
2564
+ fetchObjects$() {
2565
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2566
+ }
2567
+ fetchObject$(id) {
2568
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2569
+ }
2570
+ createObject$(object) {
2571
+ return this.baseHttpService.api({
2572
+ method: 'post',
2573
+ url: `${this.serviceUrl}`,
2574
+ body: object,
2575
+ });
2576
+ }
2577
+ updateObject$(object) {
2578
+ return this.baseHttpService.api({
2579
+ method: 'put',
2580
+ url: `${this.serviceUrl}/${object.id}`,
2581
+ body: object,
2582
+ });
2583
+ }
2584
+ }
2585
+ VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2586
+ VeloceObjectsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService });
2587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, decorators: [{
2588
+ type: Injectable
2589
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2590
+
2381
2591
  class ApiModule {
2382
2592
  }
2383
2593
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -2413,6 +2623,8 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2413
2623
  EndpointsApiService,
2414
2624
  OrgInfoApiService,
2415
2625
  OffersApiService,
2626
+ UIDefinitionsApiService,
2627
+ VeloceObjectsApiService,
2416
2628
  ], imports: [HttpClientModule] });
2417
2629
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, decorators: [{
2418
2630
  type: NgModule,
@@ -2449,6 +2661,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2449
2661
  EndpointsApiService,
2450
2662
  OrgInfoApiService,
2451
2663
  OffersApiService,
2664
+ UIDefinitionsApiService,
2665
+ VeloceObjectsApiService,
2452
2666
  ],
2453
2667
  }]
2454
2668
  }] });
@@ -2457,5 +2671,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2457
2671
  * Generated bundle index. Do not edit.
2458
2672
  */
2459
2673
 
2460
- 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 };
2674
+ 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 };
2461
2675
  //# sourceMappingURL=veloceapps-api.mjs.map