@veloceapps/api 11.0.0-37 → 11.0.0-39

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.
Files changed (29) hide show
  1. package/esm2020/src/index.mjs +1 -4
  2. package/esm2020/src/lib/api.module.mjs +1 -10
  3. package/esm2020/v2/api-v2.module.mjs +8 -2
  4. package/esm2020/v2/services/catalog-admin-api.service.mjs +192 -0
  5. package/esm2020/v2/services/catalog-api.service.mjs +90 -0
  6. package/esm2020/v2/services/document-attachment-api.service.mjs +66 -0
  7. package/esm2020/v2/services/index.mjs +4 -1
  8. package/esm2020/v2/types/attachment.types.mjs +2 -0
  9. package/esm2020/v2/types/index.mjs +2 -1
  10. package/fesm2015/veloceapps-api-v2.mjs +346 -5
  11. package/fesm2015/veloceapps-api-v2.mjs.map +1 -1
  12. package/fesm2015/veloceapps-api.mjs +17 -359
  13. package/fesm2015/veloceapps-api.mjs.map +1 -1
  14. package/fesm2020/veloceapps-api-v2.mjs +346 -5
  15. package/fesm2020/veloceapps-api-v2.mjs.map +1 -1
  16. package/fesm2020/veloceapps-api.mjs +17 -359
  17. package/fesm2020/veloceapps-api.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/src/index.d.ts +0 -3
  20. package/{src/lib → v2}/services/document-attachment-api.service.d.ts +1 -1
  21. package/v2/services/index.d.ts +3 -0
  22. package/v2/types/index.d.ts +1 -0
  23. package/esm2020/src/lib/services/catalog-admin-api.service.mjs +0 -192
  24. package/esm2020/src/lib/services/catalog-api.service.mjs +0 -90
  25. package/esm2020/src/lib/services/document-attachment-api.service.mjs +0 -66
  26. package/esm2020/src/lib/types/attachment.types.mjs +0 -2
  27. /package/{src/lib → v2}/services/catalog-admin-api.service.d.ts +0 -0
  28. /package/{src/lib → v2}/services/catalog-api.service.d.ts +0 -0
  29. /package/{src/lib → v2}/types/attachment.types.d.ts +0 -0
@@ -1,10 +1,10 @@
1
- import { HttpErrorResponse, HttpParams, HttpClientModule } from '@angular/common/http';
1
+ import { HttpParams, HttpErrorResponse, HttpClientModule } from '@angular/common/http';
2
2
  import * as i0 from '@angular/core';
3
3
  import { Injectable, NgModule } from '@angular/core';
4
4
  import * as i1 from '@veloceapps/core';
5
5
  import { Expression, RuleGroupTypes, parseJsonSafely, parseJsonStringAsObject, BaseHttpService, XrayService } from '@veloceapps/core';
6
- import { of, map as map$1, tap, noop, catchError as catchError$1, forkJoin, switchMap } from 'rxjs';
7
- import { map, catchError } from 'rxjs/operators';
6
+ import { noop, of, map as map$1, tap as tap$1, catchError as catchError$1, forkJoin, switchMap } from 'rxjs';
7
+ import { map, catchError, tap } from 'rxjs/operators';
8
8
  import * as i2 from 'primeng/api';
9
9
  import { __rest } from 'tslib';
10
10
 
@@ -23,6 +23,279 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
23
23
  type: Injectable
24
24
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
25
25
 
26
+ class CatalogAdminApiService {
27
+ constructor(baseHttpService) {
28
+ this.baseHttpService = baseHttpService;
29
+ this.serviceUrl = '/v2/catalogs';
30
+ this.fetchCatalogs$ = (searchParams) => {
31
+ const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
32
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
33
+ };
34
+ this.searchCatalogs$ = (searchParams, expression) => {
35
+ const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
36
+ return this.baseHttpService.api({
37
+ method: 'post',
38
+ url: `${this.serviceUrl}/search`,
39
+ params,
40
+ body: expression || {},
41
+ });
42
+ };
43
+ this.fetchCategories$ = (catalogId) => {
44
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories` });
45
+ };
46
+ this.searchProducts$ = (catalogId, categoryId) => {
47
+ return this.baseHttpService.api({
48
+ method: 'post',
49
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
50
+ body: {},
51
+ });
52
+ };
53
+ this.fetchAttributes$ = (catalogId, categoryId) => {
54
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes` });
55
+ };
56
+ this.createNewCatalog$ = (catalogData) => {
57
+ return this.baseHttpService.api({
58
+ url: `${this.serviceUrl}`,
59
+ method: 'post',
60
+ body: catalogData,
61
+ });
62
+ };
63
+ this.duplicateCatalog$ = (cloneRequest) => {
64
+ return this.baseHttpService.api({
65
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
66
+ method: 'post',
67
+ body: cloneRequest,
68
+ });
69
+ };
70
+ this.updateCatalog$ = (data) => {
71
+ return this.baseHttpService.api({
72
+ url: `${this.serviceUrl}/${data.id}`,
73
+ method: 'put',
74
+ body: data,
75
+ });
76
+ };
77
+ this.removeCatalog$ = (id) => {
78
+ return this.baseHttpService.api({
79
+ url: `${this.serviceUrl}/${id}`,
80
+ method: 'delete',
81
+ });
82
+ };
83
+ this.restoreCatalog$ = (id) => {
84
+ return this.baseHttpService.api({
85
+ url: `${this.serviceUrl}/${id}/restore`,
86
+ method: 'patch',
87
+ });
88
+ };
89
+ this.createNewCategory$ = (categoryData) => {
90
+ return this.baseHttpService.api({
91
+ url: `${this.serviceUrl}/${categoryData.catalogId}/categories`,
92
+ method: 'post',
93
+ body: categoryData,
94
+ });
95
+ };
96
+ this.updateCategory$ = (category) => {
97
+ return this.baseHttpService.api({
98
+ url: `${this.serviceUrl}/${category.catalogId}/categories/${category.id}`,
99
+ method: 'put',
100
+ body: category,
101
+ });
102
+ };
103
+ this.duplicateCategory$ = (catalogId, cloneRequest) => {
104
+ return this.baseHttpService.api({
105
+ url: `${this.serviceUrl}/${catalogId}/categories/${cloneRequest.id}/clone`,
106
+ method: 'post',
107
+ body: cloneRequest,
108
+ });
109
+ };
110
+ this.removeCategory$ = (id, catalogId) => {
111
+ return this.baseHttpService.api({
112
+ url: `${this.serviceUrl}/${catalogId}/categories/${id}`,
113
+ method: 'delete',
114
+ });
115
+ };
116
+ this.restoreCategory$ = (id, catalogId) => {
117
+ return this.baseHttpService.api({
118
+ url: `${this.serviceUrl}/${catalogId}/categories/${id}/restore`,
119
+ method: 'patch',
120
+ });
121
+ };
122
+ this.removeAttribute$ = ({ catalogId, categoryId, data, }) => {
123
+ return this.baseHttpService.api({
124
+ method: 'delete',
125
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
126
+ body: data,
127
+ });
128
+ };
129
+ this.restoreAttribute$ = ({ catalogId, categoryId, data, }) => {
130
+ return this.baseHttpService.api({
131
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}/restore`,
132
+ method: 'patch',
133
+ });
134
+ };
135
+ this.createNewAttribute$ = ({ catalogId, categoryId, data, }) => {
136
+ return this.baseHttpService.api({
137
+ method: 'post',
138
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes`,
139
+ body: data,
140
+ });
141
+ };
142
+ this.updateAttribute$ = ({ catalogId, categoryId, data, }) => {
143
+ return this.baseHttpService.api({
144
+ method: 'put',
145
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
146
+ body: data,
147
+ });
148
+ };
149
+ this.searchProductCandidates$ = (catalogId, categoryId, expression, searchParams) => {
150
+ const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
151
+ return this.baseHttpService.api({
152
+ method: 'post',
153
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/candidates/search`,
154
+ params,
155
+ body: expression,
156
+ });
157
+ };
158
+ this.addProduct$ = (product, catalogId, categoryId) => {
159
+ return this.baseHttpService.api({
160
+ method: 'post',
161
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
162
+ body: product,
163
+ });
164
+ };
165
+ this.updateProduct$ = (product, catalogId, categoryId) => {
166
+ return this.baseHttpService.api({
167
+ method: 'put',
168
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${product.id}`,
169
+ body: product,
170
+ });
171
+ };
172
+ this.removeProduct$ = ({ catalogId, categoryId, data, }) => {
173
+ return this.baseHttpService.api({
174
+ method: 'delete',
175
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${data.id}`,
176
+ });
177
+ };
178
+ }
179
+ attachImage$(catalogId, categoryId, file) {
180
+ const data = new FormData();
181
+ data.append('image', file);
182
+ return this.baseHttpService.upload({
183
+ method: 'post',
184
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
185
+ body: data,
186
+ });
187
+ }
188
+ removeImage$(catalogId, categoryId) {
189
+ return this.baseHttpService.api({
190
+ method: 'delete',
191
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
192
+ });
193
+ }
194
+ fetchImage$(catalogId, categoryId) {
195
+ return this.baseHttpService.api({
196
+ url: this.getImageUrl(catalogId, categoryId),
197
+ method: 'get',
198
+ responseType: 'blob',
199
+ errorHandler: noop,
200
+ });
201
+ }
202
+ getImageUrl(catalogId, categoryId) {
203
+ return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
204
+ }
205
+ }
206
+ CatalogAdminApiService.MAX_RESULTS = 60;
207
+ CatalogAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
208
+ CatalogAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService });
209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService, decorators: [{
210
+ type: Injectable
211
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
212
+
213
+ class CatalogApiService {
214
+ constructor(service) {
215
+ this.service = service;
216
+ this.serviceUrl = '/v2/product-catalogs';
217
+ }
218
+ fetchCatalogs$() {
219
+ return this.service.api({
220
+ method: 'get',
221
+ url: `${this.serviceUrl}`,
222
+ });
223
+ }
224
+ searchCatalogs$(searchParams, expression) {
225
+ const params = new HttpParams({ fromObject: searchParams });
226
+ return this.service.api({
227
+ method: 'post',
228
+ url: `${this.serviceUrl}/search`,
229
+ params,
230
+ body: expression,
231
+ });
232
+ }
233
+ getCatalog$(id) {
234
+ return this.service.api({
235
+ method: 'get',
236
+ url: `${this.serviceUrl}/${id}`,
237
+ });
238
+ }
239
+ fetchCategories$(catalogId) {
240
+ return this.service.api({
241
+ method: 'get',
242
+ url: `${this.serviceUrl}/${catalogId}/categories`,
243
+ });
244
+ }
245
+ fetchCatalogProducts$(catalogId, searchParams, context) {
246
+ const params = new HttpParams({ fromObject: searchParams });
247
+ return this.service.api({
248
+ method: 'post',
249
+ url: `${this.serviceUrl}/${catalogId}/products`,
250
+ params,
251
+ body: context,
252
+ });
253
+ }
254
+ fetchCategoryProducts$(catalogId, categoryId, searchParams, context) {
255
+ const params = new HttpParams({ fromObject: searchParams });
256
+ return this.service.api({
257
+ method: 'post',
258
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
259
+ params,
260
+ body: context,
261
+ });
262
+ }
263
+ searchCategoryProducts$(catalogId, categoryId, searchParams, searchRequest, context) {
264
+ const params = new HttpParams({ fromObject: searchParams });
265
+ return this.service.api({
266
+ method: 'post',
267
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
268
+ params,
269
+ body: {
270
+ configurationContext: context,
271
+ request: searchRequest,
272
+ },
273
+ });
274
+ }
275
+ fetchEligibleProducts$(searchParams, context) {
276
+ const params = new HttpParams({ fromObject: searchParams });
277
+ return this.service.api({
278
+ method: 'post',
279
+ url: `${this.serviceUrl}/products`,
280
+ params: params,
281
+ body: context,
282
+ });
283
+ }
284
+ fetchProducts$(searchParams) {
285
+ const params = new HttpParams({ fromObject: searchParams });
286
+ return this.service.api({
287
+ method: 'get',
288
+ url: `${this.serviceUrl}/products`,
289
+ params: params,
290
+ });
291
+ }
292
+ }
293
+ CatalogApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
294
+ CatalogApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService });
295
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService, decorators: [{
296
+ type: Injectable
297
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
298
+
26
299
  class ConfigurationProcessorsApiService {
27
300
  constructor(baseHttpService) {
28
301
  this.baseHttpService = baseHttpService;
@@ -194,6 +467,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
194
467
  type: Injectable
195
468
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
196
469
 
470
+ class DocumentAttachmentApiService {
471
+ constructor(httpService, fileDownloadService) {
472
+ this.httpService = httpService;
473
+ this.fileDownloadService = fileDownloadService;
474
+ this.SERVICE_URL = '/v2/attachments';
475
+ }
476
+ getAttachments(searchRequest) {
477
+ return this.httpService.api({
478
+ url: `${this.SERVICE_URL}/search`,
479
+ method: 'post',
480
+ body: searchRequest,
481
+ });
482
+ }
483
+ createAttachment(attachment, file, reportProgress) {
484
+ const formData = new FormData();
485
+ if (file) {
486
+ formData.append('file', file, file.name);
487
+ }
488
+ formData.append('attachment', new Blob([JSON.stringify(attachment)], {
489
+ type: 'application/json',
490
+ }));
491
+ return this.httpService.upload({
492
+ url: `${this.SERVICE_URL}`,
493
+ body: formData,
494
+ method: 'post',
495
+ observe: reportProgress ? 'events' : undefined,
496
+ reportProgress,
497
+ });
498
+ }
499
+ updateAttachment(id, attachment) {
500
+ return this.httpService.api({
501
+ url: `${this.SERVICE_URL}/${id}`,
502
+ body: attachment,
503
+ method: 'put',
504
+ });
505
+ }
506
+ getAttachmentFile(id, isPreventDownload) {
507
+ return this.httpService
508
+ .api({
509
+ url: `${this.SERVICE_URL}/${id}/file`,
510
+ responseType: isPreventDownload ? 'arraybuffer' : 'blob',
511
+ observe: isPreventDownload ? 'body' : 'response',
512
+ })
513
+ .pipe(tap(response => {
514
+ if (!isPreventDownload) {
515
+ this.fileDownloadService.processDownload(response);
516
+ }
517
+ }), map(response => (isPreventDownload ? new Blob([response.body || response]) : response.body || response)));
518
+ }
519
+ removeAttachment(id) {
520
+ return this.httpService.api({
521
+ url: `${this.SERVICE_URL}/${id}`,
522
+ method: 'delete',
523
+ });
524
+ }
525
+ }
526
+ DocumentAttachmentApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService, deps: [{ token: i1.BaseHttpService }, { token: i1.FileDownloadService }], target: i0.ɵɵFactoryTarget.Injectable });
527
+ DocumentAttachmentApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService });
528
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService, decorators: [{
529
+ type: Injectable
530
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
531
+
197
532
  class EndpointsAdminApiService {
198
533
  constructor(baseHttpService) {
199
534
  this.baseHttpService = baseHttpService;
@@ -602,7 +937,7 @@ class PCMApiService {
602
937
  this.sfApiService = sfApiService;
603
938
  }
604
939
  fetchPCMByProductId(productId) {
605
- return this.sfApiService.restGetRequest(`/connect/pcm/products/${productId}`, new HttpParams()).pipe(tap(response => {
940
+ return this.sfApiService.restGetRequest(`/connect/pcm/products/${productId}`, new HttpParams()).pipe(tap$1(response => {
606
941
  if (response.status.code !== '200') {
607
942
  throw new Error(response.status.message);
608
943
  }
@@ -1345,9 +1680,12 @@ ApiV2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
1345
1680
  ApiV2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, providers: [
1346
1681
  BaseHttpService,
1347
1682
  CacheApiService,
1683
+ CatalogAdminApiService,
1684
+ CatalogApiService,
1348
1685
  ConfigurationProcessorsApiService,
1349
1686
  ConfigurationSettingsApiService,
1350
1687
  ContextDefinitionAdminApiService,
1688
+ DocumentAttachmentApiService,
1351
1689
  EndpointsAdminApiService,
1352
1690
  FlowsApiService,
1353
1691
  FunctionGroupsAdminApiService,
@@ -1373,9 +1711,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1373
1711
  providers: [
1374
1712
  BaseHttpService,
1375
1713
  CacheApiService,
1714
+ CatalogAdminApiService,
1715
+ CatalogApiService,
1376
1716
  ConfigurationProcessorsApiService,
1377
1717
  ConfigurationSettingsApiService,
1378
1718
  ContextDefinitionAdminApiService,
1719
+ DocumentAttachmentApiService,
1379
1720
  EndpointsAdminApiService,
1380
1721
  FlowsApiService,
1381
1722
  FunctionGroupsAdminApiService,
@@ -1401,5 +1742,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1401
1742
  * Generated bundle index. Do not edit.
1402
1743
  */
1403
1744
 
1404
- export { ApiV2Module, CacheApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextDefinitionAdminApiService, EndpointsAdminApiService, FlowsApiService, FunctionGroupsAdminApiService, FunctionsAdminApiService, OrchestrationsAdminApiService, OrchestrationsApiService, PCMApiService, PicklistsAdminApiService, ProductsAdminApiService, SalesTransactionApiService, SalesforceApiService, ScriptsAdminApiService, ShoppingCartSettingsApiService, UIDefinitionsAdminApiService, UITemplatesAdminApiService, VeloceObjectsAdminApiService };
1745
+ export { ApiV2Module, CacheApiService, CatalogAdminApiService, CatalogApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextDefinitionAdminApiService, DocumentAttachmentApiService, EndpointsAdminApiService, FlowsApiService, FunctionGroupsAdminApiService, FunctionsAdminApiService, OrchestrationsAdminApiService, OrchestrationsApiService, PCMApiService, PicklistsAdminApiService, ProductsAdminApiService, SalesTransactionApiService, SalesforceApiService, ScriptsAdminApiService, ShoppingCartSettingsApiService, UIDefinitionsAdminApiService, UITemplatesAdminApiService, VeloceObjectsAdminApiService };
1405
1746
  //# sourceMappingURL=veloceapps-api-v2.mjs.map