rez_core 2.2.154 → 2.2.156
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/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/constant/global.constant.d.ts +1 -1
- package/dist/constant/global.constant.js +1 -1
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/module/auth/strategies/google.strategy.js +1 -1
- package/dist/module/auth/strategies/google.strategy.js.map +1 -1
- package/dist/module/communication/communication.module.d.ts +2 -0
- package/dist/module/communication/communication.module.js +69 -0
- package/dist/module/communication/communication.module.js.map +1 -0
- package/dist/module/communication/controller/communication.controller.d.ts +54 -0
- package/dist/module/communication/controller/communication.controller.js +148 -0
- package/dist/module/communication/controller/communication.controller.js.map +1 -0
- package/dist/module/communication/dto/create-config.dto.d.ts +91 -0
- package/dist/module/communication/dto/create-config.dto.js +243 -0
- package/dist/module/communication/dto/create-config.dto.js.map +1 -0
- package/dist/module/communication/entity/communication-config.entity.d.ts +44 -0
- package/dist/module/communication/entity/communication-config.entity.js +45 -0
- package/dist/module/communication/entity/communication-config.entity.js.map +1 -0
- package/dist/module/communication/entity/communication-hub.entity.d.ts +20 -0
- package/dist/module/communication/entity/communication-hub.entity.js +105 -0
- package/dist/module/communication/entity/communication-hub.entity.js.map +1 -0
- package/dist/module/communication/examples/usage.example.d.ts +11 -0
- package/dist/module/communication/examples/usage.example.js +89 -0
- package/dist/module/communication/examples/usage.example.js.map +1 -0
- package/dist/module/communication/factories/base.factory.d.ts +9 -0
- package/dist/module/communication/factories/base.factory.js +3 -0
- package/dist/module/communication/factories/base.factory.js.map +1 -0
- package/dist/module/communication/factories/communication.factory.d.ts +33 -0
- package/dist/module/communication/factories/communication.factory.js +104 -0
- package/dist/module/communication/factories/communication.factory.js.map +1 -0
- package/dist/module/communication/factories/email.factory.d.ts +19 -0
- package/dist/module/communication/factories/email.factory.js +61 -0
- package/dist/module/communication/factories/email.factory.js.map +1 -0
- package/dist/module/communication/factories/sms.factory.d.ts +15 -0
- package/dist/module/communication/factories/sms.factory.js +49 -0
- package/dist/module/communication/factories/sms.factory.js.map +1 -0
- package/dist/module/communication/factories/telephone.factory.d.ts +13 -0
- package/dist/module/communication/factories/telephone.factory.js +43 -0
- package/dist/module/communication/factories/telephone.factory.js.map +1 -0
- package/dist/module/communication/factories/whatsapp.factory.d.ts +13 -0
- package/dist/module/communication/factories/whatsapp.factory.js +43 -0
- package/dist/module/communication/factories/whatsapp.factory.js.map +1 -0
- package/dist/module/communication/service/communication.service.d.ts +111 -0
- package/dist/module/communication/service/communication.service.js +726 -0
- package/dist/module/communication/service/communication.service.js.map +1 -0
- package/dist/module/communication/service/oauth.service.d.ts +18 -0
- package/dist/module/communication/service/oauth.service.js +185 -0
- package/dist/module/communication/service/oauth.service.js.map +1 -0
- package/dist/module/communication/strategies/communication.strategy.d.ts +17 -0
- package/dist/module/communication/strategies/communication.strategy.js +3 -0
- package/dist/module/communication/strategies/communication.strategy.js.map +1 -0
- package/dist/module/communication/strategies/email/gmail-api.strategy.d.ts +7 -0
- package/dist/module/communication/strategies/email/gmail-api.strategy.js +135 -0
- package/dist/module/communication/strategies/email/gmail-api.strategy.js.map +1 -0
- package/dist/module/communication/strategies/email/gmail-smtp.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/email/gmail-smtp.strategy.js +49 -0
- package/dist/module/communication/strategies/email/gmail-smtp.strategy.js.map +1 -0
- package/dist/module/communication/strategies/email/outlook-api.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/email/outlook-api.strategy.js +44 -0
- package/dist/module/communication/strategies/email/outlook-api.strategy.js.map +1 -0
- package/dist/module/communication/strategies/gmail-smtp.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/gmail-smtp.strategy.js +61 -0
- package/dist/module/communication/strategies/gmail-smtp.strategy.js.map +1 -0
- package/dist/module/communication/strategies/gmail.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/gmail.strategy.js +71 -0
- package/dist/module/communication/strategies/gmail.strategy.js.map +1 -0
- package/dist/module/communication/strategies/knowlarity.strategy.d.ts +6 -0
- package/dist/module/communication/strategies/knowlarity.strategy.js +115 -0
- package/dist/module/communication/strategies/knowlarity.strategy.js.map +1 -0
- package/dist/module/communication/strategies/outlook-smtp.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/outlook-smtp.strategy.js +66 -0
- package/dist/module/communication/strategies/outlook-smtp.strategy.js.map +1 -0
- package/dist/module/communication/strategies/outlook.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/outlook.strategy.js +64 -0
- package/dist/module/communication/strategies/outlook.strategy.js.map +1 -0
- package/dist/module/communication/strategies/sms/knowlarity.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/sms/knowlarity.strategy.js +44 -0
- package/dist/module/communication/strategies/sms/knowlarity.strategy.js.map +1 -0
- package/dist/module/communication/strategies/sms/twilio.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/sms/twilio.strategy.js +44 -0
- package/dist/module/communication/strategies/sms/twilio.strategy.js.map +1 -0
- package/dist/module/communication/strategies/sms.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/sms.strategy.js +50 -0
- package/dist/module/communication/strategies/sms.strategy.js.map +1 -0
- package/dist/module/communication/strategies/telephone/knowlarity-voice.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/telephone/knowlarity-voice.strategy.js +44 -0
- package/dist/module/communication/strategies/telephone/knowlarity-voice.strategy.js.map +1 -0
- package/dist/module/communication/strategies/whatsapp/whatsapp-cloud.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/whatsapp/whatsapp-cloud.strategy.js +47 -0
- package/dist/module/communication/strategies/whatsapp/whatsapp-cloud.strategy.js.map +1 -0
- package/dist/module/communication/strategies/whatsapp.strategy.d.ts +5 -0
- package/dist/module/communication/strategies/whatsapp.strategy.js +58 -0
- package/dist/module/communication/strategies/whatsapp.strategy.js.map +1 -0
- package/dist/module/meta/entity.module.js +2 -1
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/user/controller/login.controller.d.ts +4 -2
- package/dist/module/user/controller/login.controller.js +26 -4
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/workflow/service/populate-workflow.service.js +2 -2
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -1
- package/dist/module/workflow/service/stage.service.js +1 -1
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -1
- package/src/app.module.ts +2 -0
- package/src/constant/global.constant.ts +1 -1
- package/src/module/auth/strategies/google.strategy.ts +1 -1
- package/src/module/communication/communication.module.ts +77 -0
- package/src/module/communication/controller/communication.controller.ts +122 -0
- package/src/module/communication/dto/create-config.dto.ts +234 -0
- package/src/module/communication/entity/communication-config.entity.ts +80 -0
- package/src/module/communication/entity/communication-hub.entity.ts +77 -0
- package/src/module/communication/examples/usage.example.ts +169 -0
- package/src/module/communication/factories/base.factory.ts +7 -0
- package/src/module/communication/factories/communication.factory.ts +103 -0
- package/src/module/communication/factories/email.factory.ts +51 -0
- package/src/module/communication/factories/sms.factory.ts +41 -0
- package/src/module/communication/factories/telephone.factory.ts +34 -0
- package/src/module/communication/factories/whatsapp.factory.ts +34 -0
- package/src/module/communication/service/communication.service.ts +1118 -0
- package/src/module/communication/service/oauth.service.ts +203 -0
- package/src/module/communication/strategies/communication.strategy.ts +23 -0
- package/src/module/communication/strategies/email/gmail-api.strategy.ts +161 -0
- package/src/module/communication/strategies/email/gmail-smtp.strategy.ts +51 -0
- package/src/module/communication/strategies/email/outlook-api.strategy.ts +44 -0
- package/src/module/communication/strategies/gmail-smtp.strategy.ts +64 -0
- package/src/module/communication/strategies/gmail.strategy.ts +68 -0
- package/src/module/communication/strategies/knowlarity.strategy.ts +124 -0
- package/src/module/communication/strategies/outlook-smtp.strategy.ts +69 -0
- package/src/module/communication/strategies/outlook.strategy.ts +57 -0
- package/src/module/communication/strategies/sms/knowlarity.strategy.ts +44 -0
- package/src/module/communication/strategies/sms/twilio.strategy.ts +44 -0
- package/src/module/communication/strategies/sms.strategy.ts +44 -0
- package/src/module/communication/strategies/telephone/knowlarity-voice.strategy.ts +44 -0
- package/src/module/communication/strategies/whatsapp/whatsapp-cloud.strategy.ts +49 -0
- package/src/module/communication/strategies/whatsapp.strategy.ts +53 -0
- package/src/module/meta/entity.module.ts +2 -1
- package/src/module/user/controller/login.controller.ts +34 -3
- package/src/module/workflow/service/populate-workflow.service.ts +3 -3
- package/src/module/workflow/service/stage.service.ts +1 -1
- package/src/resources/dev.properties.yaml +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CommunicationFactory = exports.CommunicationMode = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const email_factory_1 = require("./email.factory");
|
|
15
|
+
const sms_factory_1 = require("./sms.factory");
|
|
16
|
+
const whatsapp_factory_1 = require("./whatsapp.factory");
|
|
17
|
+
const telephone_factory_1 = require("./telephone.factory");
|
|
18
|
+
var CommunicationMode;
|
|
19
|
+
(function (CommunicationMode) {
|
|
20
|
+
CommunicationMode["EMAIL"] = "EMAIL";
|
|
21
|
+
CommunicationMode["SMS"] = "SMS";
|
|
22
|
+
CommunicationMode["WA"] = "WA";
|
|
23
|
+
CommunicationMode["TELEPHONE"] = "TELEPHONE";
|
|
24
|
+
})(CommunicationMode || (exports.CommunicationMode = CommunicationMode = {}));
|
|
25
|
+
let CommunicationFactory = class CommunicationFactory {
|
|
26
|
+
constructor(emailFactory, smsFactory, whatsappFactory, telephoneFactory) {
|
|
27
|
+
this.emailFactory = emailFactory;
|
|
28
|
+
this.smsFactory = smsFactory;
|
|
29
|
+
this.whatsappFactory = whatsappFactory;
|
|
30
|
+
this.telephoneFactory = telephoneFactory;
|
|
31
|
+
this.modeFactoryMap = new Map();
|
|
32
|
+
this.initializeFactoryMap();
|
|
33
|
+
}
|
|
34
|
+
initializeFactoryMap() {
|
|
35
|
+
this.modeFactoryMap.set(CommunicationMode.EMAIL, this.emailFactory);
|
|
36
|
+
this.modeFactoryMap.set(CommunicationMode.SMS, this.smsFactory);
|
|
37
|
+
this.modeFactoryMap.set(CommunicationMode.WA, this.whatsappFactory);
|
|
38
|
+
this.modeFactoryMap.set(CommunicationMode.TELEPHONE, this.telephoneFactory);
|
|
39
|
+
}
|
|
40
|
+
create(mode, service, provider) {
|
|
41
|
+
const communicationMode = mode.toUpperCase();
|
|
42
|
+
if (!Object.values(CommunicationMode).includes(communicationMode)) {
|
|
43
|
+
throw new Error(`Unsupported communication mode: ${mode}`);
|
|
44
|
+
}
|
|
45
|
+
const factory = this.modeFactoryMap.get(communicationMode);
|
|
46
|
+
if (!factory) {
|
|
47
|
+
throw new Error(`Factory not found for mode: ${mode}`);
|
|
48
|
+
}
|
|
49
|
+
return factory.createProvider(service, provider);
|
|
50
|
+
}
|
|
51
|
+
getAllSupportedCombinations() {
|
|
52
|
+
const combinations = [];
|
|
53
|
+
this.modeFactoryMap.forEach((factory, mode) => {
|
|
54
|
+
const factoryCombinations = factory.getSupportedCombinations();
|
|
55
|
+
factoryCombinations.forEach(combo => {
|
|
56
|
+
combinations.push({
|
|
57
|
+
mode: mode,
|
|
58
|
+
service: combo.service,
|
|
59
|
+
provider: combo.provider
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return combinations;
|
|
64
|
+
}
|
|
65
|
+
getSupportedCombinationsForMode(mode) {
|
|
66
|
+
const communicationMode = mode.toUpperCase();
|
|
67
|
+
const factory = this.modeFactoryMap.get(communicationMode);
|
|
68
|
+
if (!factory) {
|
|
69
|
+
throw new Error(`Factory not found for mode: ${mode}`);
|
|
70
|
+
}
|
|
71
|
+
return factory.getSupportedCombinations();
|
|
72
|
+
}
|
|
73
|
+
validateCombination(mode, service, provider) {
|
|
74
|
+
try {
|
|
75
|
+
const communicationMode = mode.toUpperCase();
|
|
76
|
+
const factory = this.modeFactoryMap.get(communicationMode);
|
|
77
|
+
if (!factory) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return factory.validateCombination(service, provider);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
getAvailableModes() {
|
|
87
|
+
return Object.values(CommunicationMode);
|
|
88
|
+
}
|
|
89
|
+
getProvidersByModeAndService(mode, service) {
|
|
90
|
+
const combinations = this.getSupportedCombinationsForMode(mode);
|
|
91
|
+
return combinations
|
|
92
|
+
.filter(combo => combo.service.toLowerCase() === service.toLowerCase())
|
|
93
|
+
.map(combo => combo.provider);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.CommunicationFactory = CommunicationFactory;
|
|
97
|
+
exports.CommunicationFactory = CommunicationFactory = __decorate([
|
|
98
|
+
(0, common_1.Injectable)(),
|
|
99
|
+
__metadata("design:paramtypes", [email_factory_1.EmailFactory,
|
|
100
|
+
sms_factory_1.SmsFactory,
|
|
101
|
+
whatsapp_factory_1.WhatsAppFactory,
|
|
102
|
+
telephone_factory_1.TelephoneFactory])
|
|
103
|
+
], CommunicationFactory);
|
|
104
|
+
//# sourceMappingURL=communication.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"communication.factory.js","sourceRoot":"","sources":["../../../../src/module/communication/factories/communication.factory.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFactory } from './base.factory';
|
|
2
|
+
import { CommunicationStrategy } from '../strategies/communication.strategy';
|
|
3
|
+
import { GmailStrategy } from '../strategies/gmail.strategy';
|
|
4
|
+
import { OutlookStrategy } from '../strategies/outlook.strategy';
|
|
5
|
+
import { GmailSMTPStrategy } from '../strategies/gmail-smtp.strategy';
|
|
6
|
+
import { OutlookSMTPStrategy } from '../strategies/outlook-smtp.strategy';
|
|
7
|
+
export declare class EmailFactory implements BaseFactory {
|
|
8
|
+
private gmailStrategy;
|
|
9
|
+
private outlookStrategy;
|
|
10
|
+
private gmailSMTPStrategy;
|
|
11
|
+
private outlookSMTPStrategy;
|
|
12
|
+
constructor(gmailStrategy: GmailStrategy, outlookStrategy: OutlookStrategy, gmailSMTPStrategy: GmailSMTPStrategy, outlookSMTPStrategy: OutlookSMTPStrategy);
|
|
13
|
+
createProvider(service: string, provider: string): CommunicationStrategy;
|
|
14
|
+
getSupportedCombinations(): Array<{
|
|
15
|
+
service: string;
|
|
16
|
+
provider: string;
|
|
17
|
+
}>;
|
|
18
|
+
validateCombination(service: string, provider: string): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EmailFactory = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const gmail_strategy_1 = require("../strategies/gmail.strategy");
|
|
15
|
+
const outlook_strategy_1 = require("../strategies/outlook.strategy");
|
|
16
|
+
const gmail_smtp_strategy_1 = require("../strategies/gmail-smtp.strategy");
|
|
17
|
+
const outlook_smtp_strategy_1 = require("../strategies/outlook-smtp.strategy");
|
|
18
|
+
let EmailFactory = class EmailFactory {
|
|
19
|
+
constructor(gmailStrategy, outlookStrategy, gmailSMTPStrategy, outlookSMTPStrategy) {
|
|
20
|
+
this.gmailStrategy = gmailStrategy;
|
|
21
|
+
this.outlookStrategy = outlookStrategy;
|
|
22
|
+
this.gmailSMTPStrategy = gmailSMTPStrategy;
|
|
23
|
+
this.outlookSMTPStrategy = outlookSMTPStrategy;
|
|
24
|
+
}
|
|
25
|
+
createProvider(service, provider) {
|
|
26
|
+
const key = `${service.toLowerCase()}_${provider.toLowerCase()}`;
|
|
27
|
+
switch (key) {
|
|
28
|
+
case 'api_gmail':
|
|
29
|
+
return this.gmailStrategy;
|
|
30
|
+
case 'api_outlook':
|
|
31
|
+
return this.outlookStrategy;
|
|
32
|
+
case 'smtp_gmail':
|
|
33
|
+
return this.gmailSMTPStrategy;
|
|
34
|
+
case 'smtp_outlook':
|
|
35
|
+
return this.outlookSMTPStrategy;
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unsupported EMAIL service/provider: ${service}/${provider}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
getSupportedCombinations() {
|
|
41
|
+
return [
|
|
42
|
+
{ service: 'API', provider: 'gmail' },
|
|
43
|
+
{ service: 'API', provider: 'outlook' },
|
|
44
|
+
{ service: 'SMTP', provider: 'gmail' },
|
|
45
|
+
{ service: 'SMTP', provider: 'outlook' },
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
validateCombination(service, provider) {
|
|
49
|
+
return this.getSupportedCombinations().some(combo => combo.service.toLowerCase() === service.toLowerCase() &&
|
|
50
|
+
combo.provider.toLowerCase() === provider.toLowerCase());
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.EmailFactory = EmailFactory;
|
|
54
|
+
exports.EmailFactory = EmailFactory = __decorate([
|
|
55
|
+
(0, common_1.Injectable)(),
|
|
56
|
+
__metadata("design:paramtypes", [gmail_strategy_1.GmailStrategy,
|
|
57
|
+
outlook_strategy_1.OutlookStrategy,
|
|
58
|
+
gmail_smtp_strategy_1.GmailSMTPStrategy,
|
|
59
|
+
outlook_smtp_strategy_1.OutlookSMTPStrategy])
|
|
60
|
+
], EmailFactory);
|
|
61
|
+
//# sourceMappingURL=email.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.factory.js","sourceRoot":"","sources":["../../../../src/module/communication/factories/email.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,iEAA6D;AAC7D,qEAAiE;AACjE,2EAAsE;AACtE,+EAA0E;AAGnE,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YACU,aAA4B,EAC5B,eAAgC,EAChC,iBAAoC,EACpC,mBAAwC;QAHxC,kBAAa,GAAb,aAAa,CAAe;QAC5B,oBAAe,GAAf,eAAe,CAAiB;QAChC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAC/C,CAAC;IAEJ,cAAc,CAAC,OAAe,EAAE,QAAgB;QAC9C,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAEjE,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,WAAW;gBACd,OAAO,IAAI,CAAC,aAAa,CAAC;YAC5B,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,eAAe,CAAC;YAC9B,KAAK,YAAY;gBACf,OAAO,IAAI,CAAC,iBAAiB,CAAC;YAChC,KAAK,cAAc;gBACjB,OAAO,IAAI,CAAC,mBAAmB,CAAC;YAElC;gBACE,MAAM,IAAI,KAAK,CAAC,uCAAuC,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,wBAAwB;QACtB,OAAO;YACL,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE;YACrC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE;YACvC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;YACtC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE;SACzC,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,OAAe,EAAE,QAAgB;QACnD,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CACzC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE;YACrD,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CACjE,CAAC;IACJ,CAAC;CACF,CAAA;AAzCY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAGc,8BAAa;QACX,kCAAe;QACb,uCAAiB;QACf,2CAAmB;GALvC,YAAY,CAyCxB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseFactory } from './base.factory';
|
|
2
|
+
import { CommunicationStrategy } from '../strategies/communication.strategy';
|
|
3
|
+
import { SmsStrategy } from '../strategies/sms.strategy';
|
|
4
|
+
import { KnowlarityStrategy } from '../strategies/knowlarity.strategy';
|
|
5
|
+
export declare class SmsFactory implements BaseFactory {
|
|
6
|
+
private twilioStrategy;
|
|
7
|
+
private knowlarityStrategy;
|
|
8
|
+
constructor(twilioStrategy: SmsStrategy, knowlarityStrategy: KnowlarityStrategy);
|
|
9
|
+
createProvider(service: string, provider: string): CommunicationStrategy;
|
|
10
|
+
getSupportedCombinations(): Array<{
|
|
11
|
+
service: string;
|
|
12
|
+
provider: string;
|
|
13
|
+
}>;
|
|
14
|
+
validateCombination(service: string, provider: string): boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SmsFactory = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const sms_strategy_1 = require("../strategies/sms.strategy");
|
|
15
|
+
const knowlarity_strategy_1 = require("../strategies/knowlarity.strategy");
|
|
16
|
+
let SmsFactory = class SmsFactory {
|
|
17
|
+
constructor(twilioStrategy, knowlarityStrategy) {
|
|
18
|
+
this.twilioStrategy = twilioStrategy;
|
|
19
|
+
this.knowlarityStrategy = knowlarityStrategy;
|
|
20
|
+
}
|
|
21
|
+
createProvider(service, provider) {
|
|
22
|
+
const key = `${service.toLowerCase()}_${provider.toLowerCase()}`;
|
|
23
|
+
switch (key) {
|
|
24
|
+
case 'third_party_twilio':
|
|
25
|
+
return this.twilioStrategy;
|
|
26
|
+
case 'third_party_knowlarity':
|
|
27
|
+
return this.knowlarityStrategy;
|
|
28
|
+
default:
|
|
29
|
+
throw new Error(`Unsupported SMS service/provider: ${service}/${provider}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
getSupportedCombinations() {
|
|
33
|
+
return [
|
|
34
|
+
{ service: 'THIRD_PARTY', provider: 'twilio' },
|
|
35
|
+
{ service: 'THIRD_PARTY', provider: 'knowlarity' },
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
validateCombination(service, provider) {
|
|
39
|
+
return this.getSupportedCombinations().some(combo => combo.service.toLowerCase() === service.toLowerCase() &&
|
|
40
|
+
combo.provider.toLowerCase() === provider.toLowerCase());
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.SmsFactory = SmsFactory;
|
|
44
|
+
exports.SmsFactory = SmsFactory = __decorate([
|
|
45
|
+
(0, common_1.Injectable)(),
|
|
46
|
+
__metadata("design:paramtypes", [sms_strategy_1.SmsStrategy,
|
|
47
|
+
knowlarity_strategy_1.KnowlarityStrategy])
|
|
48
|
+
], SmsFactory);
|
|
49
|
+
//# sourceMappingURL=sms.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms.factory.js","sourceRoot":"","sources":["../../../../src/module/communication/factories/sms.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,6DAAyD;AACzD,2EAAuE;AAGhE,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,YACU,cAA2B,EAC3B,kBAAsC;QADtC,mBAAc,GAAd,cAAc,CAAa;QAC3B,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC7C,CAAC;IAEJ,cAAc,CAAC,OAAe,EAAE,QAAgB;QAC9C,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAEjE,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,oBAAoB;gBACvB,OAAO,IAAI,CAAC,cAAc,CAAC;YAC7B,KAAK,wBAAwB;gBAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAEjC;gBACE,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,wBAAwB;QACtB,OAAO;YACL,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE;YAC9C,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE;SACnD,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,OAAe,EAAE,QAAgB;QACnD,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CACzC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE;YACrD,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CACjE,CAAC;IACJ,CAAC;CACF,CAAA;AAjCY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;qCAGe,0BAAW;QACP,wCAAkB;GAHrC,UAAU,CAiCtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseFactory } from './base.factory';
|
|
2
|
+
import { CommunicationStrategy } from '../strategies/communication.strategy';
|
|
3
|
+
import { KnowlarityStrategy } from '../strategies/knowlarity.strategy';
|
|
4
|
+
export declare class TelephoneFactory implements BaseFactory {
|
|
5
|
+
private knowlarityStrategy;
|
|
6
|
+
constructor(knowlarityStrategy: KnowlarityStrategy);
|
|
7
|
+
createProvider(service: string, provider: string): CommunicationStrategy;
|
|
8
|
+
getSupportedCombinations(): Array<{
|
|
9
|
+
service: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
}>;
|
|
12
|
+
validateCombination(service: string, provider: string): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TelephoneFactory = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const knowlarity_strategy_1 = require("../strategies/knowlarity.strategy");
|
|
15
|
+
let TelephoneFactory = class TelephoneFactory {
|
|
16
|
+
constructor(knowlarityStrategy) {
|
|
17
|
+
this.knowlarityStrategy = knowlarityStrategy;
|
|
18
|
+
}
|
|
19
|
+
createProvider(service, provider) {
|
|
20
|
+
const key = `${service.toLowerCase()}_${provider.toLowerCase()}`;
|
|
21
|
+
switch (key) {
|
|
22
|
+
case 'third_party_knowlarity':
|
|
23
|
+
return this.knowlarityStrategy;
|
|
24
|
+
default:
|
|
25
|
+
throw new Error(`Unsupported Telephone service/provider: ${service}/${provider}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
getSupportedCombinations() {
|
|
29
|
+
return [
|
|
30
|
+
{ service: 'THIRD_PARTY', provider: 'knowlarity' },
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
validateCombination(service, provider) {
|
|
34
|
+
return this.getSupportedCombinations().some(combo => combo.service.toLowerCase() === service.toLowerCase() &&
|
|
35
|
+
combo.provider.toLowerCase() === provider.toLowerCase());
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.TelephoneFactory = TelephoneFactory;
|
|
39
|
+
exports.TelephoneFactory = TelephoneFactory = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
__metadata("design:paramtypes", [knowlarity_strategy_1.KnowlarityStrategy])
|
|
42
|
+
], TelephoneFactory);
|
|
43
|
+
//# sourceMappingURL=telephone.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telephone.factory.js","sourceRoot":"","sources":["../../../../src/module/communication/factories/telephone.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,2EAAuE;AAGhE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAE9D,cAAc,CAAC,OAAe,EAAE,QAAgB;QAC9C,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAEjE,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,wBAAwB;gBAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAEjC;gBACE,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;IAED,wBAAwB;QACtB,OAAO;YACL,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE;SACnD,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,OAAe,EAAE,QAAgB;QACnD,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CACzC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE;YACrD,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CACjE,CAAC;IACJ,CAAC;CACF,CAAA;AA3BY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAE6B,wCAAkB;GAD/C,gBAAgB,CA2B5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseFactory } from './base.factory';
|
|
2
|
+
import { CommunicationStrategy } from '../strategies/communication.strategy';
|
|
3
|
+
import { WhatsAppStrategy } from '../strategies/whatsapp.strategy';
|
|
4
|
+
export declare class WhatsAppFactory implements BaseFactory {
|
|
5
|
+
private whatsappStrategy;
|
|
6
|
+
constructor(whatsappStrategy: WhatsAppStrategy);
|
|
7
|
+
createProvider(service: string, provider: string): CommunicationStrategy;
|
|
8
|
+
getSupportedCombinations(): Array<{
|
|
9
|
+
service: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
}>;
|
|
12
|
+
validateCombination(service: string, provider: string): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WhatsAppFactory = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const whatsapp_strategy_1 = require("../strategies/whatsapp.strategy");
|
|
15
|
+
let WhatsAppFactory = class WhatsAppFactory {
|
|
16
|
+
constructor(whatsappStrategy) {
|
|
17
|
+
this.whatsappStrategy = whatsappStrategy;
|
|
18
|
+
}
|
|
19
|
+
createProvider(service, provider) {
|
|
20
|
+
const key = `${service.toLowerCase()}_${provider.toLowerCase()}`;
|
|
21
|
+
switch (key) {
|
|
22
|
+
case 'api_whatsapp':
|
|
23
|
+
return this.whatsappStrategy;
|
|
24
|
+
default:
|
|
25
|
+
throw new Error(`Unsupported WhatsApp service/provider: ${service}/${provider}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
getSupportedCombinations() {
|
|
29
|
+
return [
|
|
30
|
+
{ service: 'API', provider: 'whatsapp' },
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
validateCombination(service, provider) {
|
|
34
|
+
return this.getSupportedCombinations().some(combo => combo.service.toLowerCase() === service.toLowerCase() &&
|
|
35
|
+
combo.provider.toLowerCase() === provider.toLowerCase());
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.WhatsAppFactory = WhatsAppFactory;
|
|
39
|
+
exports.WhatsAppFactory = WhatsAppFactory = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
__metadata("design:paramtypes", [whatsapp_strategy_1.WhatsAppStrategy])
|
|
42
|
+
], WhatsAppFactory);
|
|
43
|
+
//# sourceMappingURL=whatsapp.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsapp.factory.js","sourceRoot":"","sources":["../../../../src/module/communication/factories/whatsapp.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,uEAAmE;AAG5D,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAAoB,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAAG,CAAC;IAE1D,cAAc,CAAC,OAAe,EAAE,QAAgB;QAC9C,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAEjE,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,cAAc;gBACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;YAE/B;gBACE,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED,wBAAwB;QACtB,OAAO;YACL,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE;SACzC,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,OAAe,EAAE,QAAgB;QACnD,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CACzC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE;YACrD,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CACjE,CAAC;IACJ,CAAC;CACF,CAAA;AA3BY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAE2B,oCAAgB;GAD3C,eAAe,CA2B3B"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { CommunicationHub, CommunicationConfigType } from '../entity/communication-hub.entity';
|
|
4
|
+
import { CommunicationConfig } from '../entity/communication-config.entity';
|
|
5
|
+
import { CommunicationFactory } from '../factories/communication.factory';
|
|
6
|
+
import { CommunicationResult } from '../strategies/communication.strategy';
|
|
7
|
+
import { GmailApiStrategy } from '../strategies/email/gmail-api.strategy';
|
|
8
|
+
export interface SendMessageDto {
|
|
9
|
+
levelId: number;
|
|
10
|
+
levelType: string;
|
|
11
|
+
to: string;
|
|
12
|
+
message: string;
|
|
13
|
+
mode?: CommunicationConfigType;
|
|
14
|
+
priority?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface GenericMessageDto {
|
|
17
|
+
levelId: number;
|
|
18
|
+
levelType: string;
|
|
19
|
+
to: string | string[];
|
|
20
|
+
message: string;
|
|
21
|
+
subject?: string;
|
|
22
|
+
type?: 'EMAIL' | 'SMS' | 'WA' | 'TELEPHONE';
|
|
23
|
+
priority?: 'high' | 'medium' | 'low';
|
|
24
|
+
cc?: string | string[];
|
|
25
|
+
bcc?: string | string[];
|
|
26
|
+
html?: string;
|
|
27
|
+
attachments?: any[];
|
|
28
|
+
mediaUrl?: string;
|
|
29
|
+
templateId?: string;
|
|
30
|
+
variables?: Record<string, any>;
|
|
31
|
+
}
|
|
32
|
+
export interface BulkMessageDto {
|
|
33
|
+
levelId: number;
|
|
34
|
+
levelType: string;
|
|
35
|
+
recipients: string[];
|
|
36
|
+
message: string;
|
|
37
|
+
subject?: string;
|
|
38
|
+
type?: 'EMAIL' | 'SMS' | 'WA' | 'TELEPHONE';
|
|
39
|
+
priority?: 'high' | 'medium' | 'low';
|
|
40
|
+
html?: string;
|
|
41
|
+
templateId?: string;
|
|
42
|
+
variables?: Record<string, any>;
|
|
43
|
+
batchSize?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface CommunicationHubWithConfig extends CommunicationHub {
|
|
46
|
+
config: CommunicationConfig;
|
|
47
|
+
}
|
|
48
|
+
export interface GmailSSOResult {
|
|
49
|
+
hubId: number;
|
|
50
|
+
configId: number;
|
|
51
|
+
}
|
|
52
|
+
export declare class CommunicationService {
|
|
53
|
+
private readonly hubRepository;
|
|
54
|
+
private readonly configRepository;
|
|
55
|
+
private readonly communicationFactory;
|
|
56
|
+
private readonly gmailApiStrategy;
|
|
57
|
+
private readonly configService;
|
|
58
|
+
private readonly logger;
|
|
59
|
+
private readonly gmailOAuthStates;
|
|
60
|
+
constructor(hubRepository: Repository<CommunicationHub>, configRepository: Repository<CommunicationConfig>, communicationFactory: CommunicationFactory, gmailApiStrategy: GmailApiStrategy, configService: ConfigService);
|
|
61
|
+
sendMessage({ levelId, levelType, to, message, mode, priority, }: SendMessageDto): Promise<CommunicationResult>;
|
|
62
|
+
getActiveHubs(levelId: number, levelType: string, mode?: CommunicationConfigType): Promise<CommunicationHubWithConfig[]>;
|
|
63
|
+
private sortHubsByPriority;
|
|
64
|
+
private sendViaHub;
|
|
65
|
+
createCommunicationConfig(levelId: number, levelType: string, configType: CommunicationConfigType, service: string, provider: string, config: any, priority?: number, is_default?: boolean): Promise<CommunicationHub | {
|
|
66
|
+
authUrl: string;
|
|
67
|
+
state: string;
|
|
68
|
+
message: string;
|
|
69
|
+
}>;
|
|
70
|
+
getSupportedCombinations(): Promise<{
|
|
71
|
+
mode: string;
|
|
72
|
+
service: string;
|
|
73
|
+
provider: string;
|
|
74
|
+
}[]>;
|
|
75
|
+
getLevelConfigs(levelId: number, levelType: string): Promise<CommunicationHub[]>;
|
|
76
|
+
updateConfigStatus(hubId: number, status: number): Promise<void>;
|
|
77
|
+
sendGenericMessage(messageDto: GenericMessageDto): Promise<CommunicationResult>;
|
|
78
|
+
sendBulkMessage(bulkDto: BulkMessageDto): Promise<{
|
|
79
|
+
results: CommunicationResult[];
|
|
80
|
+
summary: any;
|
|
81
|
+
}>;
|
|
82
|
+
scheduleMessage(scheduledDto: any): Promise<{
|
|
83
|
+
scheduled: boolean;
|
|
84
|
+
scheduleId?: string;
|
|
85
|
+
}>;
|
|
86
|
+
sendTemplateMessage(templateDto: any): Promise<CommunicationResult>;
|
|
87
|
+
private detectCommunicationType;
|
|
88
|
+
private sortHubsByPriorityAndDefault;
|
|
89
|
+
private processTemplate;
|
|
90
|
+
private getTemplate;
|
|
91
|
+
private chunkArray;
|
|
92
|
+
initGmailOAuth(levelId: number, levelType: string, email?: string): Promise<{
|
|
93
|
+
authUrl: string;
|
|
94
|
+
state: string;
|
|
95
|
+
}>;
|
|
96
|
+
handleGmailOAuthCallback(code: string, state: string): Promise<GmailSSOResult>;
|
|
97
|
+
handleGmailTokensCallback(email: string, accessToken: string, refreshToken: string, state: string): Promise<GmailSSOResult>;
|
|
98
|
+
testGmailConfig(hubId: number): Promise<{
|
|
99
|
+
success: boolean;
|
|
100
|
+
error?: string;
|
|
101
|
+
}>;
|
|
102
|
+
private generateSecureState;
|
|
103
|
+
private requiresOAuthFlow;
|
|
104
|
+
private generateOAuthUrl;
|
|
105
|
+
private createDirectConfig;
|
|
106
|
+
initOutlookOAuth(levelId: number, levelType: string, email?: string): Promise<{
|
|
107
|
+
authUrl: string;
|
|
108
|
+
state: string;
|
|
109
|
+
}>;
|
|
110
|
+
handleOutlookOAuthCallback(code: string, state: string): Promise<GmailSSOResult>;
|
|
111
|
+
}
|