@veloceapps/api 7.0.2-6 → 7.0.2-60

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 });
@@ -1394,6 +1437,13 @@ class ProceduresApiService {
1394
1437
  body,
1395
1438
  });
1396
1439
  }
1440
+ catalogExecute$(body) {
1441
+ return this.baseHttpService.api({
1442
+ url: `${this.SERVICE_URL}/catalog/execute`,
1443
+ method: 'post',
1444
+ body,
1445
+ });
1446
+ }
1397
1447
  /**
1398
1448
  * Run active procedure against QuoteDraft
1399
1449
  * @param body
@@ -1662,6 +1712,11 @@ class ProductModelApiService {
1662
1712
  return linkedModels;
1663
1713
  }));
1664
1714
  }
1715
+ /**
1716
+ *
1717
+ * @deprecated
1718
+ * Will be removed in next major release
1719
+ */
1665
1720
  load(id, version) {
1666
1721
  return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1667
1722
  const container = new ProductModelsContainer(model, linkedModels ?? []);
@@ -2090,6 +2145,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2090
2145
  type: Injectable
2091
2146
  }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2092
2147
 
2148
+ class UIDefinitionsApiService {
2149
+ constructor(baseHttpService) {
2150
+ this.baseHttpService = baseHttpService;
2151
+ }
2152
+ fetch$(modelId, version) {
2153
+ const serviceUrl = this.getServiceUrl(modelId);
2154
+ let params = new HttpParams();
2155
+ if (version != null) {
2156
+ params = params.set('modelVersion', version);
2157
+ }
2158
+ return this.baseHttpService
2159
+ .api({
2160
+ method: 'get',
2161
+ url: serviceUrl,
2162
+ params: params,
2163
+ })
2164
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2165
+ }
2166
+ create$(modelId, uiDefinitionContainer) {
2167
+ const serviceUrl = this.getServiceUrl(modelId);
2168
+ const dto = {
2169
+ ...omit(uiDefinitionContainer, 'source'),
2170
+ sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2171
+ };
2172
+ return this.baseHttpService
2173
+ .api({
2174
+ method: 'post',
2175
+ url: serviceUrl,
2176
+ body: dto,
2177
+ })
2178
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2179
+ }
2180
+ get$(modelId, uiDefinitionId) {
2181
+ const serviceUrl = this.getServiceUrl(modelId);
2182
+ return this.baseHttpService
2183
+ .api({
2184
+ method: 'get',
2185
+ url: `${serviceUrl}/${uiDefinitionId}`,
2186
+ })
2187
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2188
+ }
2189
+ update$(uiDefinitionContainer) {
2190
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2191
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
2192
+ return this.baseHttpService
2193
+ .api({
2194
+ method: 'put',
2195
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2196
+ body: dto,
2197
+ })
2198
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2199
+ }
2200
+ delete$(uiDefinitionContainer) {
2201
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2202
+ return this.baseHttpService.api({
2203
+ method: 'delete',
2204
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2205
+ });
2206
+ }
2207
+ getServiceUrl(modelId) {
2208
+ return `/models/${modelId}/uidefinitions`;
2209
+ }
2210
+ }
2211
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2212
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService });
2213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
2214
+ type: Injectable
2215
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2216
+
2093
2217
  const fromUIComponentStoryDTO = (dto, attachments) => {
2094
2218
  return {
2095
2219
  id: dto.id,
@@ -2378,6 +2502,82 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2378
2502
  type: Injectable
2379
2503
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2380
2504
 
2505
+ class VeloceObjectsApiService {
2506
+ constructor(baseHttpService) {
2507
+ this.baseHttpService = baseHttpService;
2508
+ this.serviceUrl = '/veloceobjects';
2509
+ this.updateCategory$ = (category) => {
2510
+ return this.baseHttpService.api({
2511
+ method: 'put',
2512
+ url: `${this.serviceUrl}/categories/${category.id}`,
2513
+ body: category,
2514
+ });
2515
+ };
2516
+ this.deleteCategory$ = (id) => {
2517
+ return this.baseHttpService.api({
2518
+ method: 'delete',
2519
+ url: `${this.serviceUrl}/categories/${id}`,
2520
+ });
2521
+ };
2522
+ this.searchObjects$ = (searchParams, expression) => {
2523
+ const params = new HttpParams({ fromObject: { ...searchParams } });
2524
+ return this.baseHttpService.api({
2525
+ method: 'post',
2526
+ url: `${this.serviceUrl}/search`,
2527
+ params,
2528
+ body: expression || {},
2529
+ });
2530
+ };
2531
+ this.deleteObject$ = (id) => {
2532
+ return this.baseHttpService.api({
2533
+ method: 'delete',
2534
+ url: `${this.serviceUrl}/${id}`,
2535
+ });
2536
+ };
2537
+ this.restoreObject$ = (id) => {
2538
+ return this.baseHttpService.api({
2539
+ method: 'patch',
2540
+ url: `${this.serviceUrl}/${id}/restore`,
2541
+ });
2542
+ };
2543
+ }
2544
+ fetchCategories$() {
2545
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/categories` });
2546
+ }
2547
+ createCategory$(category) {
2548
+ return this.baseHttpService.api({
2549
+ method: 'post',
2550
+ url: `${this.serviceUrl}/categories`,
2551
+ body: category,
2552
+ });
2553
+ }
2554
+ fetchObjects$() {
2555
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2556
+ }
2557
+ fetchObject$(id) {
2558
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2559
+ }
2560
+ createObject$(object) {
2561
+ return this.baseHttpService.api({
2562
+ method: 'post',
2563
+ url: `${this.serviceUrl}`,
2564
+ body: object,
2565
+ });
2566
+ }
2567
+ updateObject$(object) {
2568
+ return this.baseHttpService.api({
2569
+ method: 'put',
2570
+ url: `${this.serviceUrl}/${object.id}`,
2571
+ body: object,
2572
+ });
2573
+ }
2574
+ }
2575
+ VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2576
+ VeloceObjectsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService });
2577
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: VeloceObjectsApiService, decorators: [{
2578
+ type: Injectable
2579
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2580
+
2381
2581
  class ApiModule {
2382
2582
  }
2383
2583
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -2413,6 +2613,8 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2413
2613
  EndpointsApiService,
2414
2614
  OrgInfoApiService,
2415
2615
  OffersApiService,
2616
+ UIDefinitionsApiService,
2617
+ VeloceObjectsApiService,
2416
2618
  ], imports: [HttpClientModule] });
2417
2619
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, decorators: [{
2418
2620
  type: NgModule,
@@ -2449,6 +2651,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2449
2651
  EndpointsApiService,
2450
2652
  OrgInfoApiService,
2451
2653
  OffersApiService,
2654
+ UIDefinitionsApiService,
2655
+ VeloceObjectsApiService,
2452
2656
  ],
2453
2657
  }]
2454
2658
  }] });
@@ -2457,5 +2661,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2457
2661
  * Generated bundle index. Do not edit.
2458
2662
  */
2459
2663
 
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 };
2664
+ 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
2665
  //# sourceMappingURL=veloceapps-api.mjs.map