@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
 
10
10
  class CacheApiService {
@@ -26,6 +26,279 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
26
26
  type: Injectable
27
27
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
28
28
 
29
+ class CatalogAdminApiService {
30
+ constructor(baseHttpService) {
31
+ this.baseHttpService = baseHttpService;
32
+ this.serviceUrl = '/v2/catalogs';
33
+ this.fetchCatalogs$ = (searchParams) => {
34
+ const params = new HttpParams({ fromObject: { ...searchParams } });
35
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
36
+ };
37
+ this.searchCatalogs$ = (searchParams, expression) => {
38
+ const params = new HttpParams({ fromObject: { ...searchParams } });
39
+ return this.baseHttpService.api({
40
+ method: 'post',
41
+ url: `${this.serviceUrl}/search`,
42
+ params,
43
+ body: expression || {},
44
+ });
45
+ };
46
+ this.fetchCategories$ = (catalogId) => {
47
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories` });
48
+ };
49
+ this.searchProducts$ = (catalogId, categoryId) => {
50
+ return this.baseHttpService.api({
51
+ method: 'post',
52
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
53
+ body: {},
54
+ });
55
+ };
56
+ this.fetchAttributes$ = (catalogId, categoryId) => {
57
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes` });
58
+ };
59
+ this.createNewCatalog$ = (catalogData) => {
60
+ return this.baseHttpService.api({
61
+ url: `${this.serviceUrl}`,
62
+ method: 'post',
63
+ body: catalogData,
64
+ });
65
+ };
66
+ this.duplicateCatalog$ = (cloneRequest) => {
67
+ return this.baseHttpService.api({
68
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
69
+ method: 'post',
70
+ body: cloneRequest,
71
+ });
72
+ };
73
+ this.updateCatalog$ = (data) => {
74
+ return this.baseHttpService.api({
75
+ url: `${this.serviceUrl}/${data.id}`,
76
+ method: 'put',
77
+ body: data,
78
+ });
79
+ };
80
+ this.removeCatalog$ = (id) => {
81
+ return this.baseHttpService.api({
82
+ url: `${this.serviceUrl}/${id}`,
83
+ method: 'delete',
84
+ });
85
+ };
86
+ this.restoreCatalog$ = (id) => {
87
+ return this.baseHttpService.api({
88
+ url: `${this.serviceUrl}/${id}/restore`,
89
+ method: 'patch',
90
+ });
91
+ };
92
+ this.createNewCategory$ = (categoryData) => {
93
+ return this.baseHttpService.api({
94
+ url: `${this.serviceUrl}/${categoryData.catalogId}/categories`,
95
+ method: 'post',
96
+ body: categoryData,
97
+ });
98
+ };
99
+ this.updateCategory$ = (category) => {
100
+ return this.baseHttpService.api({
101
+ url: `${this.serviceUrl}/${category.catalogId}/categories/${category.id}`,
102
+ method: 'put',
103
+ body: category,
104
+ });
105
+ };
106
+ this.duplicateCategory$ = (catalogId, cloneRequest) => {
107
+ return this.baseHttpService.api({
108
+ url: `${this.serviceUrl}/${catalogId}/categories/${cloneRequest.id}/clone`,
109
+ method: 'post',
110
+ body: cloneRequest,
111
+ });
112
+ };
113
+ this.removeCategory$ = (id, catalogId) => {
114
+ return this.baseHttpService.api({
115
+ url: `${this.serviceUrl}/${catalogId}/categories/${id}`,
116
+ method: 'delete',
117
+ });
118
+ };
119
+ this.restoreCategory$ = (id, catalogId) => {
120
+ return this.baseHttpService.api({
121
+ url: `${this.serviceUrl}/${catalogId}/categories/${id}/restore`,
122
+ method: 'patch',
123
+ });
124
+ };
125
+ this.removeAttribute$ = ({ catalogId, categoryId, data, }) => {
126
+ return this.baseHttpService.api({
127
+ method: 'delete',
128
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
129
+ body: data,
130
+ });
131
+ };
132
+ this.restoreAttribute$ = ({ catalogId, categoryId, data, }) => {
133
+ return this.baseHttpService.api({
134
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}/restore`,
135
+ method: 'patch',
136
+ });
137
+ };
138
+ this.createNewAttribute$ = ({ catalogId, categoryId, data, }) => {
139
+ return this.baseHttpService.api({
140
+ method: 'post',
141
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes`,
142
+ body: data,
143
+ });
144
+ };
145
+ this.updateAttribute$ = ({ catalogId, categoryId, data, }) => {
146
+ return this.baseHttpService.api({
147
+ method: 'put',
148
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
149
+ body: data,
150
+ });
151
+ };
152
+ this.searchProductCandidates$ = (catalogId, categoryId, expression, searchParams) => {
153
+ const params = new HttpParams({ fromObject: { ...searchParams } });
154
+ return this.baseHttpService.api({
155
+ method: 'post',
156
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/candidates/search`,
157
+ params,
158
+ body: expression,
159
+ });
160
+ };
161
+ this.addProduct$ = (product, catalogId, categoryId) => {
162
+ return this.baseHttpService.api({
163
+ method: 'post',
164
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
165
+ body: product,
166
+ });
167
+ };
168
+ this.updateProduct$ = (product, catalogId, categoryId) => {
169
+ return this.baseHttpService.api({
170
+ method: 'put',
171
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${product.id}`,
172
+ body: product,
173
+ });
174
+ };
175
+ this.removeProduct$ = ({ catalogId, categoryId, data, }) => {
176
+ return this.baseHttpService.api({
177
+ method: 'delete',
178
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${data.id}`,
179
+ });
180
+ };
181
+ }
182
+ attachImage$(catalogId, categoryId, file) {
183
+ const data = new FormData();
184
+ data.append('image', file);
185
+ return this.baseHttpService.upload({
186
+ method: 'post',
187
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
188
+ body: data,
189
+ });
190
+ }
191
+ removeImage$(catalogId, categoryId) {
192
+ return this.baseHttpService.api({
193
+ method: 'delete',
194
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
195
+ });
196
+ }
197
+ fetchImage$(catalogId, categoryId) {
198
+ return this.baseHttpService.api({
199
+ url: this.getImageUrl(catalogId, categoryId),
200
+ method: 'get',
201
+ responseType: 'blob',
202
+ errorHandler: noop,
203
+ });
204
+ }
205
+ getImageUrl(catalogId, categoryId) {
206
+ return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
207
+ }
208
+ }
209
+ CatalogAdminApiService.MAX_RESULTS = 60;
210
+ CatalogAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
211
+ CatalogAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService });
212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService, decorators: [{
213
+ type: Injectable
214
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
215
+
216
+ class CatalogApiService {
217
+ constructor(service) {
218
+ this.service = service;
219
+ this.serviceUrl = '/v2/product-catalogs';
220
+ }
221
+ fetchCatalogs$() {
222
+ return this.service.api({
223
+ method: 'get',
224
+ url: `${this.serviceUrl}`,
225
+ });
226
+ }
227
+ searchCatalogs$(searchParams, expression) {
228
+ const params = new HttpParams({ fromObject: searchParams });
229
+ return this.service.api({
230
+ method: 'post',
231
+ url: `${this.serviceUrl}/search`,
232
+ params,
233
+ body: expression,
234
+ });
235
+ }
236
+ getCatalog$(id) {
237
+ return this.service.api({
238
+ method: 'get',
239
+ url: `${this.serviceUrl}/${id}`,
240
+ });
241
+ }
242
+ fetchCategories$(catalogId) {
243
+ return this.service.api({
244
+ method: 'get',
245
+ url: `${this.serviceUrl}/${catalogId}/categories`,
246
+ });
247
+ }
248
+ fetchCatalogProducts$(catalogId, searchParams, context) {
249
+ const params = new HttpParams({ fromObject: searchParams });
250
+ return this.service.api({
251
+ method: 'post',
252
+ url: `${this.serviceUrl}/${catalogId}/products`,
253
+ params,
254
+ body: context,
255
+ });
256
+ }
257
+ fetchCategoryProducts$(catalogId, categoryId, searchParams, context) {
258
+ const params = new HttpParams({ fromObject: searchParams });
259
+ return this.service.api({
260
+ method: 'post',
261
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
262
+ params,
263
+ body: context,
264
+ });
265
+ }
266
+ searchCategoryProducts$(catalogId, categoryId, searchParams, searchRequest, context) {
267
+ const params = new HttpParams({ fromObject: searchParams });
268
+ return this.service.api({
269
+ method: 'post',
270
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
271
+ params,
272
+ body: {
273
+ configurationContext: context,
274
+ request: searchRequest,
275
+ },
276
+ });
277
+ }
278
+ fetchEligibleProducts$(searchParams, context) {
279
+ const params = new HttpParams({ fromObject: searchParams });
280
+ return this.service.api({
281
+ method: 'post',
282
+ url: `${this.serviceUrl}/products`,
283
+ params: params,
284
+ body: context,
285
+ });
286
+ }
287
+ fetchProducts$(searchParams) {
288
+ const params = new HttpParams({ fromObject: searchParams });
289
+ return this.service.api({
290
+ method: 'get',
291
+ url: `${this.serviceUrl}/products`,
292
+ params: params,
293
+ });
294
+ }
295
+ }
296
+ CatalogApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
297
+ CatalogApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService });
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService, decorators: [{
299
+ type: Injectable
300
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
301
+
29
302
  class ConfigurationProcessorsApiService {
30
303
  constructor(baseHttpService) {
31
304
  this.baseHttpService = baseHttpService;
@@ -226,6 +499,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
226
499
  type: Injectable
227
500
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
228
501
 
502
+ class DocumentAttachmentApiService {
503
+ constructor(httpService, fileDownloadService) {
504
+ this.httpService = httpService;
505
+ this.fileDownloadService = fileDownloadService;
506
+ this.SERVICE_URL = '/v2/attachments';
507
+ }
508
+ getAttachments(searchRequest) {
509
+ return this.httpService.api({
510
+ url: `${this.SERVICE_URL}/search`,
511
+ method: 'post',
512
+ body: searchRequest,
513
+ });
514
+ }
515
+ createAttachment(attachment, file, reportProgress) {
516
+ const formData = new FormData();
517
+ if (file) {
518
+ formData.append('file', file, file.name);
519
+ }
520
+ formData.append('attachment', new Blob([JSON.stringify(attachment)], {
521
+ type: 'application/json',
522
+ }));
523
+ return this.httpService.upload({
524
+ url: `${this.SERVICE_URL}`,
525
+ body: formData,
526
+ method: 'post',
527
+ observe: reportProgress ? 'events' : undefined,
528
+ reportProgress,
529
+ });
530
+ }
531
+ updateAttachment(id, attachment) {
532
+ return this.httpService.api({
533
+ url: `${this.SERVICE_URL}/${id}`,
534
+ body: attachment,
535
+ method: 'put',
536
+ });
537
+ }
538
+ getAttachmentFile(id, isPreventDownload) {
539
+ return this.httpService
540
+ .api({
541
+ url: `${this.SERVICE_URL}/${id}/file`,
542
+ responseType: isPreventDownload ? 'arraybuffer' : 'blob',
543
+ observe: isPreventDownload ? 'body' : 'response',
544
+ })
545
+ .pipe(tap(response => {
546
+ if (!isPreventDownload) {
547
+ this.fileDownloadService.processDownload(response);
548
+ }
549
+ }), map(response => (isPreventDownload ? new Blob([response.body || response]) : response.body || response)));
550
+ }
551
+ removeAttachment(id) {
552
+ return this.httpService.api({
553
+ url: `${this.SERVICE_URL}/${id}`,
554
+ method: 'delete',
555
+ });
556
+ }
557
+ }
558
+ 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 });
559
+ DocumentAttachmentApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService });
560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService, decorators: [{
561
+ type: Injectable
562
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
563
+
229
564
  class EndpointsAdminApiService {
230
565
  constructor(baseHttpService) {
231
566
  this.baseHttpService = baseHttpService;
@@ -657,7 +992,7 @@ class PCMApiService {
657
992
  this.sfApiService = sfApiService;
658
993
  }
659
994
  fetchPCMByProductId(productId) {
660
- return this.sfApiService.restGetRequest(`/connect/pcm/products/${productId}`, new HttpParams()).pipe(tap(response => {
995
+ return this.sfApiService.restGetRequest(`/connect/pcm/products/${productId}`, new HttpParams()).pipe(tap$1(response => {
661
996
  if (response.status.code !== '200') {
662
997
  throw new Error(response.status.message);
663
998
  }
@@ -1417,9 +1752,12 @@ ApiV2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
1417
1752
  ApiV2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, providers: [
1418
1753
  BaseHttpService,
1419
1754
  CacheApiService,
1755
+ CatalogAdminApiService,
1756
+ CatalogApiService,
1420
1757
  ConfigurationProcessorsApiService,
1421
1758
  ConfigurationSettingsApiService,
1422
1759
  ContextDefinitionAdminApiService,
1760
+ DocumentAttachmentApiService,
1423
1761
  EndpointsAdminApiService,
1424
1762
  FlowsApiService,
1425
1763
  FunctionGroupsAdminApiService,
@@ -1445,9 +1783,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1445
1783
  providers: [
1446
1784
  BaseHttpService,
1447
1785
  CacheApiService,
1786
+ CatalogAdminApiService,
1787
+ CatalogApiService,
1448
1788
  ConfigurationProcessorsApiService,
1449
1789
  ConfigurationSettingsApiService,
1450
1790
  ContextDefinitionAdminApiService,
1791
+ DocumentAttachmentApiService,
1451
1792
  EndpointsAdminApiService,
1452
1793
  FlowsApiService,
1453
1794
  FunctionGroupsAdminApiService,
@@ -1473,5 +1814,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1473
1814
  * Generated bundle index. Do not edit.
1474
1815
  */
1475
1816
 
1476
- export { ApiV2Module, CacheApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextDefinitionAdminApiService, EndpointsAdminApiService, FlowsApiService, FunctionGroupsAdminApiService, FunctionsAdminApiService, OrchestrationsAdminApiService, OrchestrationsApiService, PCMApiService, PicklistsAdminApiService, ProductsAdminApiService, SalesTransactionApiService, SalesforceApiService, ScriptsAdminApiService, ShoppingCartSettingsApiService, UIDefinitionsAdminApiService, UITemplatesAdminApiService, VeloceObjectsAdminApiService };
1817
+ 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 };
1477
1818
  //# sourceMappingURL=veloceapps-api-v2.mjs.map