@servicelabsco/slabs-access-manager 0.1.140 → 0.1.141
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/dist/access/libraries/process.app.integration.d.ts +1 -0
- package/dist/access/libraries/process.app.integration.js +11 -10
- package/dist/access/libraries/process.app.integration.js.map +1 -1
- package/dist/access/services/access.business.service.d.ts +3 -2
- package/dist/access/services/access.business.service.js +6 -6
- package/dist/access/services/access.business.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export declare class ProcessAppIntegration {
|
|
|
12
12
|
constructor(business: AccessBusinessEntity, propertyService: PropertyService, res: Response);
|
|
13
13
|
process(integrationId: number): Promise<void | BusinessAppIntegrationEntity>;
|
|
14
14
|
validate(id: number): Promise<void>;
|
|
15
|
+
initializeWhatsapp(): Promise<BusinessAppIntegrationEntity>;
|
|
15
16
|
initializeSlack(): Promise<void>;
|
|
16
17
|
initializeZoho(): Promise<void>;
|
|
17
18
|
}
|
|
@@ -14,16 +14,14 @@ class ProcessAppIntegration {
|
|
|
14
14
|
}
|
|
15
15
|
async process(integrationId) {
|
|
16
16
|
await this.validate(integrationId);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
throw new nestjs_utility_services_1.OperationException('No integration found');
|
|
26
|
-
}
|
|
17
|
+
const identifier = this.integration.integration_identifier;
|
|
18
|
+
if (identifier === integration_type_constant_1.IntegrationIdentifierConstants.zoho)
|
|
19
|
+
return this.initializeZoho();
|
|
20
|
+
if (identifier === integration_type_constant_1.IntegrationIdentifierConstants.slack)
|
|
21
|
+
return this.initializeSlack();
|
|
22
|
+
if (identifier === integration_type_constant_1.IntegrationIdentifierConstants.whatsapp)
|
|
23
|
+
return this.initializeWhatsapp();
|
|
24
|
+
throw new nestjs_utility_services_1.OperationException('No integration found');
|
|
27
25
|
}
|
|
28
26
|
async validate(id) {
|
|
29
27
|
const integration = await app_integration_entity_1.AppIntegrationEntity.findOne({ where: { id, active: true } });
|
|
@@ -37,6 +35,9 @@ class ProcessAppIntegration {
|
|
|
37
35
|
this.integration = integration;
|
|
38
36
|
this.user = nestjs_utility_services_1.Auth.user();
|
|
39
37
|
}
|
|
38
|
+
async initializeWhatsapp() {
|
|
39
|
+
return new process_whatsapp_integration_1.ProcessWhatsappIntegration(this.business).handle(this.integration.id);
|
|
40
|
+
}
|
|
40
41
|
async initializeSlack() {
|
|
41
42
|
const clientId = await this.propertyService.get('slack.client.id');
|
|
42
43
|
const scope = await this.propertyService.get('slack.access.scope');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.app.integration.js","sourceRoot":"","sources":["../../../src/access/libraries/process.app.integration.ts"],"names":[],"mappings":";;;AAAA,oFAAkH;AAElH,sFAAwF;AAExF,+EAA0E;AAC1E,iGAA2F;AAC3F,iFAA4E;AAO5E,MAAa,qBAAqB;IAI9B,YACuB,QAA8B,EAC9B,eAAgC,EAChC,GAAa;QAFb,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,oBAAe,GAAf,eAAe,CAAiB;QAChC,QAAG,GAAH,GAAG,CAAU;IACjC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,aAAqB;QAC/B,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"process.app.integration.js","sourceRoot":"","sources":["../../../src/access/libraries/process.app.integration.ts"],"names":[],"mappings":";;;AAAA,oFAAkH;AAElH,sFAAwF;AAExF,+EAA0E;AAC1E,iGAA2F;AAC3F,iFAA4E;AAO5E,MAAa,qBAAqB;IAI9B,YACuB,QAA8B,EAC9B,eAAgC,EAChC,GAAa;QAFb,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,oBAAe,GAAf,eAAe,CAAiB;QAChC,QAAG,GAAH,GAAG,CAAU;IACjC,CAAC;IAEJ,KAAK,CAAC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B,CAAC;QACzJ,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACJ;AA7DD,sDA6DC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AccessService, PropertyService } from '@servicelabsco/nestjs-utility-services';
|
|
1
|
+
import { AccessService, PropertyService, SqlService } from '@servicelabsco/nestjs-utility-services';
|
|
2
2
|
import { AccessBusinessEntity } from '../entities/access.business.entity';
|
|
3
3
|
export declare class AccessBusinessService {
|
|
4
4
|
private readonly accessService;
|
|
5
5
|
private readonly propertyService;
|
|
6
|
-
|
|
6
|
+
private readonly sqlService;
|
|
7
|
+
constructor(accessService: AccessService, propertyService: PropertyService, sqlService: SqlService);
|
|
7
8
|
validateAccess(): Promise<AccessBusinessEntity>;
|
|
8
9
|
hasRoles(roles: string[]): Promise<AccessBusinessEntity>;
|
|
9
10
|
validateRoles(roles: string[]): Promise<void>;
|
|
@@ -14,9 +14,10 @@ const common_1 = require("@nestjs/common");
|
|
|
14
14
|
const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
|
|
15
15
|
const access_business_entity_1 = require("../entities/access.business.entity");
|
|
16
16
|
let AccessBusinessService = class AccessBusinessService {
|
|
17
|
-
constructor(accessService, propertyService) {
|
|
17
|
+
constructor(accessService, propertyService, sqlService) {
|
|
18
18
|
this.accessService = accessService;
|
|
19
19
|
this.propertyService = propertyService;
|
|
20
|
+
this.sqlService = sqlService;
|
|
20
21
|
}
|
|
21
22
|
async validateAccess() {
|
|
22
23
|
const user = nestjs_utility_services_1.Auth.user();
|
|
@@ -41,10 +42,8 @@ let AccessBusinessService = class AccessBusinessService {
|
|
|
41
42
|
throw new nestjs_utility_services_1.AccessException(`You don't have appropriate role to do this operation`);
|
|
42
43
|
}
|
|
43
44
|
async getFrontendUrl(business_id) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
return;
|
|
47
|
-
const url = business.attributes?.url;
|
|
45
|
+
const business_url = await this.sqlService.read(`select a.attributes->>'url' as url from bz_business_details a where a.id = ${business_id} and a.deleted_at is null`);
|
|
46
|
+
const url = business_url[0]?.url;
|
|
48
47
|
if (url)
|
|
49
48
|
return url;
|
|
50
49
|
const defaultUrl = `https://client.finnoto.in`;
|
|
@@ -55,6 +54,7 @@ exports.AccessBusinessService = AccessBusinessService;
|
|
|
55
54
|
exports.AccessBusinessService = AccessBusinessService = __decorate([
|
|
56
55
|
(0, common_1.Injectable)(),
|
|
57
56
|
__metadata("design:paramtypes", [nestjs_utility_services_1.AccessService,
|
|
58
|
-
nestjs_utility_services_1.PropertyService
|
|
57
|
+
nestjs_utility_services_1.PropertyService,
|
|
58
|
+
nestjs_utility_services_1.SqlService])
|
|
59
59
|
], AccessBusinessService);
|
|
60
60
|
//# sourceMappingURL=access.business.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.business.service.js","sourceRoot":"","sources":["../../../src/access/services/access.business.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"access.business.service.js","sourceRoot":"","sources":["../../../src/access/services/access.business.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAA2H;AAC3H,+EAA0E;AAGnE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAC9B,YACqB,aAA4B,EAC5B,eAAgC,EAChC,UAAsB;QAFtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,oBAAe,GAAf,eAAe,CAAiB;QAChC,eAAU,GAAV,UAAU,CAAY;IACxC,CAAC;IAEJ,KAAK,CAAC,cAAc;QAChB,MAAM,IAAI,GAAG,8BAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,MAAM,UAAU,GAAG,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC;QACtD,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,yCAAe,EAAE,CAAC;QAE7C,MAAM,QAAQ,GAAG,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