@veloceapps/api 8.0.0-196 → 8.0.0-197
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.
- package/esm2020/lib/services/org-info-api.service.mjs +19 -6
- package/esm2020/lib/services/sandbox-manager-api.service.mjs +72 -45
- package/esm2020/lib/utils/canvas.utils.mjs +33 -0
- package/fesm2015/veloceapps-api.mjs +120 -54
- package/fesm2015/veloceapps-api.mjs.map +1 -1
- package/fesm2020/veloceapps-api.mjs +120 -53
- package/fesm2020/veloceapps-api.mjs.map +1 -1
- package/lib/services/org-info-api.service.d.ts +9 -0
- package/lib/services/sandbox-manager-api.service.d.ts +15 -13
- package/lib/utils/canvas.utils.d.ts +18 -0
- package/package.json +1 -1
@@ -3,13 +3,13 @@ import { HttpParams, HttpHeaders, HttpErrorResponse, HttpClientModule } from '@a
|
|
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 { uiDefinitionFromDTO, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
|
6
|
+
import { uiDefinitionFromDTO, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
|
7
7
|
import { noop, throwError, of, zip, forkJoin, map as map$1, from, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
|
8
8
|
import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
|
9
|
-
import * as
|
9
|
+
import * as i1$2 from 'primeng/api';
|
10
10
|
import { CurrencyPipe } from '@angular/common';
|
11
11
|
import * as _ from 'lodash';
|
12
|
-
import { omit } from 'lodash';
|
12
|
+
import { isArray, omit } from 'lodash';
|
13
13
|
import moment from 'moment';
|
14
14
|
|
15
15
|
class AccountApiService {
|
@@ -630,11 +630,11 @@ class ConfigurationSettingsApiService {
|
|
630
630
|
});
|
631
631
|
}
|
632
632
|
}
|
633
|
-
ConfigurationSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, deps: [{ token: i1.BaseHttpService }, { token:
|
633
|
+
ConfigurationSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, deps: [{ token: i1.BaseHttpService }, { token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
634
634
|
ConfigurationSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService });
|
635
635
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, decorators: [{
|
636
636
|
type: Injectable
|
637
|
-
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type:
|
637
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1$2.MessageService }]; } });
|
638
638
|
|
639
639
|
class ContextApiService {
|
640
640
|
constructor(httpService) {
|
@@ -1552,11 +1552,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1552
1552
|
type: Injectable
|
1553
1553
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1554
1554
|
|
1555
|
+
/**
|
1556
|
+
* Parses the response from Canvas and checks for errors.
|
1557
|
+
* - If an error is found, publishes an error message and returns the failover value.
|
1558
|
+
* - If no error is found, returns the parsed response.
|
1559
|
+
*
|
1560
|
+
* Note! The API call first goes to APEX before reaching the Canvas, so errors can originate from either APEX or Canvas.
|
1561
|
+
*
|
1562
|
+
* @param {string} response - The JSON string response from the Canvas call.
|
1563
|
+
* @param {T} failover - The value to return in case of error.
|
1564
|
+
* @returns {T | K} The parsed response or the failover value.
|
1565
|
+
*
|
1566
|
+
* @template T The expected type of the parsed response.
|
1567
|
+
* @template K The type of the failover value.
|
1568
|
+
*
|
1569
|
+
* @remarks If there's an Apex error, the response data can be an array.
|
1570
|
+
* In such cases, the function extracts the first element of the array.
|
1571
|
+
*/
|
1572
|
+
const handleCanvasResponse = (response, failover, errorPublisher) => {
|
1573
|
+
const parsed = JSON.parse(response);
|
1574
|
+
const errorCandidate = isArray(parsed) ? parsed[0] : parsed;
|
1575
|
+
if (isApexError(errorCandidate)) {
|
1576
|
+
errorPublisher(errorCandidate.message);
|
1577
|
+
return failover;
|
1578
|
+
}
|
1579
|
+
if (isCanvasError(errorCandidate)) {
|
1580
|
+
errorPublisher(errorCandidate.error);
|
1581
|
+
return failover;
|
1582
|
+
}
|
1583
|
+
return parsed;
|
1584
|
+
};
|
1585
|
+
|
1555
1586
|
class OrgInfoApiService {
|
1587
|
+
constructor(messageService) {
|
1588
|
+
this.messageService = messageService;
|
1589
|
+
/**
|
1590
|
+
* Shows an error message using the message service.
|
1591
|
+
*
|
1592
|
+
* @param {string} message - the error message to be published.
|
1593
|
+
*/
|
1594
|
+
this.publishErrorMessage = (message) => {
|
1595
|
+
this.messageService.add({ severity: 'error', summary: message, sticky: true });
|
1596
|
+
};
|
1597
|
+
}
|
1556
1598
|
getOrgInfo$() {
|
1557
1599
|
try {
|
1558
1600
|
return window.doCanvasCall && window.ORGANIZATION_ID
|
1559
|
-
? from(window.doCanvasCall(`org-info/${window.ORGANIZATION_ID}
|
1601
|
+
? from(window.doCanvasCall(`org-info/${window.ORGANIZATION_ID}`, null)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
1560
1602
|
: of(undefined);
|
1561
1603
|
}
|
1562
1604
|
catch {
|
@@ -1566,7 +1608,7 @@ class OrgInfoApiService {
|
|
1566
1608
|
getAvailableVersionsInfo$() {
|
1567
1609
|
try {
|
1568
1610
|
return window.doCanvasCall && window.ORGANIZATION_ID
|
1569
|
-
? from(window.doCanvasCall('versions/available', 'include_all=true')).pipe(map$1(
|
1611
|
+
? from(window.doCanvasCall('versions/available', 'include_all=true')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
1570
1612
|
: of(undefined);
|
1571
1613
|
}
|
1572
1614
|
catch {
|
@@ -1576,7 +1618,7 @@ class OrgInfoApiService {
|
|
1576
1618
|
upgradeVersion$(targetVersion) {
|
1577
1619
|
try {
|
1578
1620
|
return window.doCanvasCall && window.ORGANIZATION_ID
|
1579
|
-
? from(window.doCanvasCall('versions/upgrade', `target_version=${targetVersion}`)).pipe(map$1(
|
1621
|
+
? from(window.doCanvasCall('versions/upgrade', `target_version=${targetVersion}`)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
1580
1622
|
: of(undefined);
|
1581
1623
|
}
|
1582
1624
|
catch {
|
@@ -1584,11 +1626,11 @@ class OrgInfoApiService {
|
|
1584
1626
|
}
|
1585
1627
|
}
|
1586
1628
|
}
|
1587
|
-
OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1629
|
+
OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1588
1630
|
OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
|
1589
1631
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
|
1590
1632
|
type: Injectable
|
1591
|
-
}] });
|
1633
|
+
}], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
|
1592
1634
|
|
1593
1635
|
class PicklistsApiService {
|
1594
1636
|
constructor(baseHttpService) {
|
@@ -3262,68 +3304,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
3262
3304
|
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
3263
3305
|
|
3264
3306
|
class SandboxManagerApiService {
|
3265
|
-
constructor(
|
3266
|
-
this.
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3307
|
+
constructor(messageService) {
|
3308
|
+
this.messageService = messageService;
|
3309
|
+
/**
|
3310
|
+
* Shows an error message using the message service.
|
3311
|
+
*
|
3312
|
+
* @param {string} message - the error message to be published.
|
3313
|
+
*/
|
3314
|
+
this.publishErrorMessage = (message) => {
|
3315
|
+
this.messageService.add({ severity: 'error', summary: message, sticky: true });
|
3316
|
+
};
|
3270
3317
|
}
|
3271
3318
|
getSalesforceOrganizations$() {
|
3272
|
-
|
3273
|
-
|
3274
|
-
'
|
3275
|
-
|
3276
|
-
}
|
3319
|
+
try {
|
3320
|
+
return window.doSandboxCall
|
3321
|
+
? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
|
3322
|
+
: of([]);
|
3323
|
+
}
|
3324
|
+
catch {
|
3325
|
+
return of([]);
|
3326
|
+
}
|
3277
3327
|
}
|
3278
3328
|
getAvailableSalesforceOrganizationSizes$() {
|
3279
|
-
|
3280
|
-
|
3281
|
-
'
|
3282
|
-
|
3283
|
-
}
|
3329
|
+
try {
|
3330
|
+
return window.doSandboxCall
|
3331
|
+
? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
|
3332
|
+
: of({});
|
3333
|
+
}
|
3334
|
+
catch {
|
3335
|
+
return of({});
|
3336
|
+
}
|
3284
3337
|
}
|
3285
3338
|
createSalesforceOrganization$(payload) {
|
3286
|
-
|
3287
|
-
|
3288
|
-
'
|
3289
|
-
|
3290
|
-
}
|
3339
|
+
try {
|
3340
|
+
return window.doSandboxCall
|
3341
|
+
? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3342
|
+
: of(undefined);
|
3343
|
+
}
|
3344
|
+
catch (err) {
|
3345
|
+
return of(undefined);
|
3346
|
+
}
|
3291
3347
|
}
|
3292
3348
|
updateSalesforceOrganization$(payload) {
|
3293
|
-
|
3294
|
-
|
3295
|
-
'
|
3296
|
-
|
3297
|
-
}
|
3349
|
+
try {
|
3350
|
+
return window.doSandboxCall
|
3351
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3352
|
+
: of(undefined);
|
3353
|
+
}
|
3354
|
+
catch {
|
3355
|
+
return of(undefined);
|
3356
|
+
}
|
3298
3357
|
}
|
3299
3358
|
deleteSalesforceOrganization$(payload) {
|
3300
|
-
|
3301
|
-
|
3302
|
-
'
|
3303
|
-
|
3304
|
-
}
|
3359
|
+
try {
|
3360
|
+
return window.doSandboxCall
|
3361
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3362
|
+
: of(undefined);
|
3363
|
+
}
|
3364
|
+
catch {
|
3365
|
+
return of(undefined);
|
3366
|
+
}
|
3305
3367
|
}
|
3306
3368
|
activateSalesforceOrganization$(payload) {
|
3307
|
-
|
3308
|
-
|
3309
|
-
'
|
3310
|
-
|
3311
|
-
}
|
3369
|
+
try {
|
3370
|
+
return window.doSandboxCall
|
3371
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3372
|
+
: of(undefined);
|
3373
|
+
}
|
3374
|
+
catch {
|
3375
|
+
return of(undefined);
|
3376
|
+
}
|
3312
3377
|
}
|
3313
3378
|
deactivateSalesforceOrganization$(payload) {
|
3314
|
-
|
3315
|
-
|
3316
|
-
'
|
3317
|
-
|
3318
|
-
}
|
3379
|
+
try {
|
3380
|
+
return window.doSandboxCall
|
3381
|
+
? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
|
3382
|
+
: of(undefined);
|
3383
|
+
}
|
3384
|
+
catch {
|
3385
|
+
return of(undefined);
|
3386
|
+
}
|
3319
3387
|
}
|
3320
3388
|
}
|
3321
|
-
SandboxManagerApiService
|
3322
|
-
SandboxManagerApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
3389
|
+
SandboxManagerApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
3323
3390
|
SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
|
3324
3391
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
|
3325
3392
|
type: Injectable
|
3326
|
-
}], ctorParameters: function () { return [{ type: i1$
|
3393
|
+
}], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
|
3327
3394
|
|
3328
3395
|
class ApiModule {
|
3329
3396
|
}
|