rez_core 2.2.258 → 2.2.259
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 -2
- package/dist/app.module.js.map +1 -1
- package/dist/module/integration/controller/calender-event.controller.js.map +1 -0
- package/dist/module/integration/controller/integration.controller.d.ts +113 -0
- package/dist/module/{communication/controller/communication.controller.js → integration/controller/integration.controller.js} +197 -75
- package/dist/module/integration/controller/integration.controller.js.map +1 -0
- package/dist/module/{communication → integration}/controller/wrapper.controller.d.ts +1 -1
- package/dist/module/integration/controller/wrapper.controller.js.map +1 -0
- package/dist/module/{communication → integration}/dto/create-config.dto.d.ts +48 -4
- package/dist/module/{communication → integration}/dto/create-config.dto.js +96 -18
- package/dist/module/integration/dto/create-config.dto.js.map +1 -0
- package/dist/module/{communication/entity/communication-config.entity.d.ts → integration/entity/integration-config.entity.d.ts} +11 -1
- package/dist/module/integration/entity/integration-config.entity.js +78 -0
- package/dist/module/integration/entity/integration-config.entity.js.map +1 -0
- package/dist/module/{communication → integration}/entity/integration-source.entity.d.ts +1 -1
- package/dist/module/{communication → integration}/entity/integration-source.entity.js +8 -8
- package/dist/module/integration/entity/integration-source.entity.js.map +1 -0
- package/dist/module/integration/entity/user-integration.entity.d.ts +23 -0
- package/dist/module/integration/entity/user-integration.entity.js +70 -0
- package/dist/module/integration/entity/user-integration.entity.js.map +1 -0
- package/dist/module/integration/examples/usage.example.d.ts +16 -0
- package/dist/module/integration/examples/usage.example.js +217 -0
- package/dist/module/integration/examples/usage.example.js.map +1 -0
- package/dist/module/{communication → integration}/factories/base.factory.d.ts +2 -2
- package/dist/module/integration/factories/base.factory.js.map +1 -0
- package/dist/module/{communication → integration}/factories/email.factory.d.ts +3 -7
- package/dist/module/{communication → integration}/factories/email.factory.js +1 -13
- package/dist/module/integration/factories/email.factory.js.map +1 -0
- package/dist/module/{communication/factories/communication.factory.d.ts → integration/factories/integration.factory.d.ts} +4 -4
- package/dist/module/{communication/factories/communication.factory.js → integration/factories/integration.factory.js} +26 -26
- package/dist/module/integration/factories/integration.factory.js.map +1 -0
- package/dist/module/integration/factories/sms.factory.d.ts +9 -0
- package/dist/module/integration/factories/sms.factory.js +26 -0
- package/dist/module/integration/factories/sms.factory.js.map +1 -0
- package/dist/module/{communication → integration}/factories/telephone.factory.d.ts +3 -5
- package/dist/module/{communication → integration}/factories/telephone.factory.js +11 -17
- package/dist/module/integration/factories/telephone.factory.js.map +1 -0
- package/dist/module/{communication → integration}/factories/whatsapp.factory.d.ts +2 -2
- package/dist/module/integration/factories/whatsapp.factory.js.map +1 -0
- package/dist/module/integration/integration.module.d.ts +2 -0
- package/dist/module/{communication/communication.module.js → integration/integration.module.js} +22 -42
- package/dist/module/integration/integration.module.js.map +1 -0
- package/dist/module/integration/service/calendar-event.service.js.map +1 -0
- package/dist/module/{communication/service/communication-queue.service.d.ts → integration/service/integration-queue.service.d.ts} +1 -1
- package/dist/module/{communication/service/communication-queue.service.js → integration/service/integration-queue.service.js} +8 -8
- package/dist/module/integration/service/integration-queue.service.js.map +1 -0
- package/dist/module/integration/service/integration.service.d.ts +155 -0
- package/dist/module/{communication/service/communication.service.js → integration/service/integration.service.js} +391 -307
- package/dist/module/integration/service/integration.service.js.map +1 -0
- package/dist/module/{communication → integration}/service/oauth.service.js +1 -1
- package/dist/module/integration/service/oauth.service.js.map +1 -0
- package/dist/module/{communication → integration}/service/wrapper.service.d.ts +4 -4
- package/dist/module/{communication → integration}/service/wrapper.service.js +25 -26
- package/dist/module/integration/service/wrapper.service.js.map +1 -0
- package/dist/module/{communication → integration}/strategies/email/gmail-api.strategy.d.ts +3 -3
- package/dist/module/{communication → integration}/strategies/email/gmail-api.strategy.js +2 -6
- package/dist/module/integration/strategies/email/gmail-api.strategy.js.map +1 -0
- package/dist/module/integration/strategies/email/outlook-api.strategy.d.ts +5 -0
- package/dist/module/integration/strategies/email/outlook-api.strategy.js.map +1 -0
- package/dist/module/integration/strategies/email/outlook.strategy.d.ts +5 -0
- package/dist/module/integration/strategies/email/outlook.strategy.js.map +1 -0
- package/dist/module/{communication → integration}/strategies/email/sendgrid-api.strategy.d.ts +3 -3
- package/dist/module/integration/strategies/email/sendgrid-api.strategy.js.map +1 -0
- package/dist/module/{communication/strategies/communication.strategy.d.ts → integration/strategies/integration.strategy.d.ts} +4 -3
- package/dist/module/{communication/strategies/communication.strategy.js → integration/strategies/integration.strategy.js} +1 -1
- package/dist/module/integration/strategies/integration.strategy.js.map +1 -0
- package/dist/module/integration/strategies/telephone/ozonetel-voice.strategy.d.ts +17 -0
- package/dist/module/{communication → integration}/strategies/telephone/ozonetel-voice.strategy.js +13 -5
- package/dist/module/integration/strategies/telephone/ozonetel-voice.strategy.js.map +1 -0
- package/dist/module/{communication → integration}/strategies/telephone/tubelight-voice.strategy.d.ts +6 -4
- package/dist/module/{communication → integration}/strategies/telephone/tubelight-voice.strategy.js +3 -7
- package/dist/module/integration/strategies/telephone/tubelight-voice.strategy.js.map +1 -0
- package/dist/module/{communication → integration}/strategies/whatsapp/whatsapp-cloud.strategy.d.ts +3 -3
- package/dist/module/integration/strategies/whatsapp/whatsapp-cloud.strategy.js.map +1 -0
- package/dist/module/integration/strategies/whatsapp/whatsapp.strategy.d.ts +5 -0
- package/dist/module/integration/strategies/whatsapp/whatsapp.strategy.js.map +1 -0
- package/dist/module/meta/entity/entity-master.entity.d.ts +1 -1
- package/dist/module/meta/entity/entity-master.entity.js +2 -2
- package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +47 -27
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.d.ts +3 -3
- package/dist/module/user/controller/login.controller.js +5 -5
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/user.module.js +2 -2
- package/dist/module/user/user.module.js.map +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation-action.entity.d.ts +1 -0
- package/dist/module/workflow-automation/entity/workflow-automation-action.entity.js +4 -0
- package/dist/module/workflow-automation/entity/workflow-automation-action.entity.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.d.ts +2 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.js +8 -4
- package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/docs/modules/event-driven-integration-design.md +92 -0
- package/docs/modules/integration.md +197 -0
- package/package.json +1 -1
- package/src/app.module.ts +2 -2
- package/src/module/integration/controller/integration.controller.ts +411 -0
- package/src/module/{communication → integration}/dto/create-config.dto.ts +110 -18
- package/src/module/{communication/entity/communication-config.entity.ts → integration/entity/integration-config.entity.ts} +33 -6
- package/src/module/{communication → integration}/entity/integration-source.entity.ts +1 -1
- package/src/module/integration/entity/user-integration.entity.ts +71 -0
- package/src/module/integration/examples/usage.example.ts +338 -0
- package/src/module/{communication → integration}/factories/base.factory.ts +2 -2
- package/src/module/{communication → integration}/factories/email.factory.ts +2 -12
- package/src/module/{communication/factories/communication.factory.ts → integration/factories/integration.factory.ts} +18 -18
- package/src/module/integration/factories/sms.factory.ts +19 -0
- package/src/module/integration/factories/telephone.factory.ts +41 -0
- package/src/module/{communication → integration}/factories/whatsapp.factory.ts +2 -2
- package/src/module/integration/integration.module.ts +86 -0
- package/src/module/{communication/service/communication-queue.service.ts → integration/service/integration-queue.service.ts} +2 -2
- package/src/module/{communication/service/communication.service.ts → integration/service/integration.service.ts} +598 -448
- package/src/module/{communication → integration}/service/oauth.service.ts +1 -1
- package/src/module/{communication → integration}/service/wrapper.service.ts +24 -25
- package/src/module/{communication → integration}/strategies/email/gmail-api.strategy.ts +6 -18
- package/src/module/{communication → integration}/strategies/email/outlook-api.strategy.ts +5 -5
- package/src/module/{communication → integration}/strategies/email/outlook.strategy.ts +5 -5
- package/src/module/{communication → integration}/strategies/email/sendgrid-api.strategy.ts +5 -5
- package/src/module/{communication/strategies/communication.strategy.ts → integration/strategies/integration.strategy.ts} +7 -3
- package/src/module/{communication → integration}/strategies/telephone/ozonetel-voice.strategy.ts +40 -12
- package/src/module/{communication → integration}/strategies/telephone/tubelight-voice.strategy.ts +24 -17
- package/src/module/{communication → integration}/strategies/whatsapp/whatsapp-cloud.strategy.ts +5 -5
- package/src/module/{communication → integration}/strategies/whatsapp/whatsapp.strategy.ts +5 -5
- package/src/module/meta/entity/entity-master.entity.ts +2 -2
- package/src/module/meta/service/entity-dynamic.service.ts +55 -28
- package/src/module/user/controller/login.controller.ts +3 -3
- package/src/module/user/user.module.ts +2 -2
- package/src/module/workflow-automation/entity/workflow-automation-action.entity.ts +3 -0
- package/src/module/workflow-automation/service/workflow-automation.service.ts +8 -4
- package/src/resources/dev.properties.yaml +3 -3
- package/.vscode/extensions.json +0 -5
- package/dist/module/communication/communication.module.d.ts +0 -2
- package/dist/module/communication/communication.module.js.map +0 -1
- package/dist/module/communication/controller/calender-event.controller.js.map +0 -1
- package/dist/module/communication/controller/communication.controller.d.ts +0 -99
- package/dist/module/communication/controller/communication.controller.js.map +0 -1
- package/dist/module/communication/controller/wrapper.controller.js.map +0 -1
- package/dist/module/communication/dto/create-config.dto.js.map +0 -1
- package/dist/module/communication/entity/communication-config.entity.js +0 -45
- package/dist/module/communication/entity/communication-config.entity.js.map +0 -1
- package/dist/module/communication/entity/communication-hub.entity.d.ts +0 -20
- package/dist/module/communication/entity/communication-hub.entity.js +0 -115
- package/dist/module/communication/entity/communication-hub.entity.js.map +0 -1
- package/dist/module/communication/entity/integration-source.entity.js.map +0 -1
- package/dist/module/communication/examples/usage.example.d.ts +0 -11
- package/dist/module/communication/examples/usage.example.js +0 -89
- package/dist/module/communication/examples/usage.example.js.map +0 -1
- package/dist/module/communication/factories/base.factory.js.map +0 -1
- package/dist/module/communication/factories/communication.factory.js.map +0 -1
- package/dist/module/communication/factories/email.factory.js.map +0 -1
- package/dist/module/communication/factories/sms.factory.d.ts +0 -15
- package/dist/module/communication/factories/sms.factory.js +0 -49
- package/dist/module/communication/factories/sms.factory.js.map +0 -1
- package/dist/module/communication/factories/telephone.factory.js.map +0 -1
- package/dist/module/communication/factories/whatsapp.factory.js.map +0 -1
- package/dist/module/communication/service/calendar-event.service.js.map +0 -1
- package/dist/module/communication/service/communication-queue.service.js.map +0 -1
- package/dist/module/communication/service/communication.service.d.ts +0 -155
- package/dist/module/communication/service/communication.service.js.map +0 -1
- package/dist/module/communication/service/oauth.service.js.map +0 -1
- package/dist/module/communication/service/wrapper.service.js.map +0 -1
- package/dist/module/communication/strategies/communication.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/gmail-api.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/gmail-smtp-v2.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/email/gmail-smtp-v2.strategy.js +0 -60
- package/dist/module/communication/strategies/email/gmail-smtp-v2.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/gmail-smtp.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/email/gmail-smtp.strategy.js +0 -49
- package/dist/module/communication/strategies/email/gmail-smtp.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/outlook-api.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/email/outlook-api.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/outlook-smtp.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/email/outlook-smtp.strategy.js +0 -65
- package/dist/module/communication/strategies/email/outlook-smtp.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/outlook.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/email/outlook.strategy.js.map +0 -1
- package/dist/module/communication/strategies/email/sendgrid-api.strategy.js.map +0 -1
- package/dist/module/communication/strategies/sms/knowlarity-multi.strategy.d.ts +0 -6
- package/dist/module/communication/strategies/sms/knowlarity-multi.strategy.js +0 -121
- package/dist/module/communication/strategies/sms/knowlarity-multi.strategy.js.map +0 -1
- package/dist/module/communication/strategies/sms/knowlarity.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/sms/knowlarity.strategy.js +0 -44
- package/dist/module/communication/strategies/sms/knowlarity.strategy.js.map +0 -1
- package/dist/module/communication/strategies/sms/twilio-v2.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/sms/twilio-v2.strategy.js +0 -48
- package/dist/module/communication/strategies/sms/twilio-v2.strategy.js.map +0 -1
- package/dist/module/communication/strategies/sms/twilio.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/sms/twilio.strategy.js +0 -44
- package/dist/module/communication/strategies/sms/twilio.strategy.js.map +0 -1
- package/dist/module/communication/strategies/telephone/knowlarity-multi.strategy.d.ts +0 -6
- package/dist/module/communication/strategies/telephone/knowlarity-multi.strategy.js +0 -121
- package/dist/module/communication/strategies/telephone/knowlarity-multi.strategy.js.map +0 -1
- package/dist/module/communication/strategies/telephone/knowlarity-voice.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/telephone/knowlarity-voice.strategy.js +0 -44
- package/dist/module/communication/strategies/telephone/knowlarity-voice.strategy.js.map +0 -1
- package/dist/module/communication/strategies/telephone/ozonetel-voice.strategy.d.ts +0 -15
- package/dist/module/communication/strategies/telephone/ozonetel-voice.strategy.js.map +0 -1
- package/dist/module/communication/strategies/telephone/tubelight-voice.strategy.js.map +0 -1
- package/dist/module/communication/strategies/whatsapp/whatsapp-cloud.strategy.js.map +0 -1
- package/dist/module/communication/strategies/whatsapp/whatsapp.strategy.d.ts +0 -5
- package/dist/module/communication/strategies/whatsapp/whatsapp.strategy.js.map +0 -1
- package/docs/modules/communication.md +0 -177
- package/src/module/communication/communication.module.ts +0 -106
- package/src/module/communication/controller/communication.controller.ts +0 -293
- package/src/module/communication/entity/communication-hub.entity.ts +0 -103
- package/src/module/communication/examples/usage.example.ts +0 -170
- package/src/module/communication/factories/sms.factory.ts +0 -44
- package/src/module/communication/factories/telephone.factory.ts +0 -49
- package/src/module/communication/strategies/email/gmail-smtp-v2.strategy.ts +0 -68
- package/src/module/communication/strategies/email/gmail-smtp.strategy.ts +0 -51
- package/src/module/communication/strategies/email/outlook-smtp.strategy.ts +0 -73
- package/src/module/communication/strategies/sms/knowlarity-multi.strategy.ts +0 -158
- package/src/module/communication/strategies/sms/knowlarity.strategy.ts +0 -44
- package/src/module/communication/strategies/sms/twilio-v2.strategy.ts +0 -47
- package/src/module/communication/strategies/sms/twilio.strategy.ts +0 -44
- package/src/module/communication/strategies/telephone/knowlarity-multi.strategy.ts +0 -158
- package/src/module/communication/strategies/telephone/knowlarity-voice.strategy.ts +0 -44
- /package/dist/module/{communication → integration}/controller/calender-event.controller.d.ts +0 -0
- /package/dist/module/{communication → integration}/controller/calender-event.controller.js +0 -0
- /package/dist/module/{communication → integration}/controller/wrapper.controller.js +0 -0
- /package/dist/module/{communication → integration}/factories/base.factory.js +0 -0
- /package/dist/module/{communication → integration}/factories/whatsapp.factory.js +0 -0
- /package/dist/module/{communication → integration}/service/calendar-event.service.d.ts +0 -0
- /package/dist/module/{communication → integration}/service/calendar-event.service.js +0 -0
- /package/dist/module/{communication → integration}/service/oauth.service.d.ts +0 -0
- /package/dist/module/{communication → integration}/strategies/email/outlook-api.strategy.js +0 -0
- /package/dist/module/{communication → integration}/strategies/email/outlook.strategy.js +0 -0
- /package/dist/module/{communication → integration}/strategies/email/sendgrid-api.strategy.js +0 -0
- /package/dist/module/{communication → integration}/strategies/whatsapp/whatsapp-cloud.strategy.js +0 -0
- /package/dist/module/{communication → integration}/strategies/whatsapp/whatsapp.strategy.js +0 -0
- /package/src/module/{communication → integration}/controller/calender-event.controller.ts +0 -0
- /package/src/module/{communication → integration}/controller/wrapper.controller.ts +0 -0
- /package/src/module/{communication → integration}/service/calendar-event.service.ts +0 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommunicationUsageExamples = void 0;
|
|
4
|
+
class CommunicationUsageExamples {
|
|
5
|
+
constructor(communicationService) {
|
|
6
|
+
this.communicationService = communicationService;
|
|
7
|
+
}
|
|
8
|
+
async sendEmailViaGmailApi() {
|
|
9
|
+
const emailConfig = {
|
|
10
|
+
clientId: 'your-gmail-client-id',
|
|
11
|
+
clientSecret: 'your-gmail-client-secret',
|
|
12
|
+
refreshToken: 'your-refresh-token',
|
|
13
|
+
};
|
|
14
|
+
const hub = await this.communicationService.createIntegrationConfig(1, 'organization', 'MY_APP_001', 'EMAIL', 'gmail', 1, emailConfig);
|
|
15
|
+
console.log('Created email config:', hub);
|
|
16
|
+
const result = await this.communicationService.sendMessage({
|
|
17
|
+
levelId: 1,
|
|
18
|
+
levelType: 'organization',
|
|
19
|
+
app_code: 'MY_APP_001',
|
|
20
|
+
to: 'recipient@example.com',
|
|
21
|
+
message: 'Hello from Gmail API!',
|
|
22
|
+
mode: 'EMAIL',
|
|
23
|
+
});
|
|
24
|
+
console.log('Email sent:', result);
|
|
25
|
+
}
|
|
26
|
+
async sendEmailViaOutlookApi() {
|
|
27
|
+
const outlookConfig = {
|
|
28
|
+
clientId: 'your-outlook-client-id',
|
|
29
|
+
clientSecret: 'your-outlook-client-secret',
|
|
30
|
+
tenantId: 'your-tenant-id',
|
|
31
|
+
email: 'user@outlook.com',
|
|
32
|
+
};
|
|
33
|
+
await this.communicationService.createIntegrationConfig(1, 'organization', 'MY_APP_001', 'EMAIL', 'outlook', 2, outlookConfig);
|
|
34
|
+
const result = await this.communicationService.sendMessage({
|
|
35
|
+
levelId: 1,
|
|
36
|
+
levelType: 'organization',
|
|
37
|
+
app_code: 'MY_APP_001',
|
|
38
|
+
to: 'recipient@example.com',
|
|
39
|
+
message: 'Hello from Outlook API!',
|
|
40
|
+
mode: 'EMAIL',
|
|
41
|
+
});
|
|
42
|
+
console.log('Email sent:', result);
|
|
43
|
+
}
|
|
44
|
+
async sendWhatsAppMessage() {
|
|
45
|
+
const whatsappConfig = {
|
|
46
|
+
accessToken: 'your-whatsapp-access-token',
|
|
47
|
+
phoneNumberId: 'your-phone-number-id',
|
|
48
|
+
businessAccountId: 'your-business-account-id',
|
|
49
|
+
};
|
|
50
|
+
await this.communicationService.createIntegrationConfig(1, 'organization', 'MY_APP_001', 'WA', 'whatsapp', 3, whatsappConfig);
|
|
51
|
+
const result = await this.communicationService.sendMessage({
|
|
52
|
+
levelId: 1,
|
|
53
|
+
levelType: 'organization',
|
|
54
|
+
app_code: 'MY_APP_001',
|
|
55
|
+
to: '+9876543210',
|
|
56
|
+
message: 'Hello from WhatsApp!',
|
|
57
|
+
mode: 'WA',
|
|
58
|
+
});
|
|
59
|
+
console.log('WhatsApp sent:', result);
|
|
60
|
+
}
|
|
61
|
+
async makeVoiceCall() {
|
|
62
|
+
const voiceConfig = {
|
|
63
|
+
apiKey: 'your-ozonetel-api-key',
|
|
64
|
+
callerId: '+1234567890',
|
|
65
|
+
voiceUrl: 'https://your-voice-script-url.com',
|
|
66
|
+
};
|
|
67
|
+
await this.communicationService.createIntegrationConfig(1, 'organization', 'MY_APP_001', 'TELEPHONE', 'ozonetel', 4, voiceConfig);
|
|
68
|
+
const result = await this.communicationService.sendMessage({
|
|
69
|
+
levelId: 1,
|
|
70
|
+
levelType: 'organization',
|
|
71
|
+
app_code: 'MY_APP_001',
|
|
72
|
+
to: '+9876543210',
|
|
73
|
+
message: 'Voice message content',
|
|
74
|
+
mode: 'TELEPHONE',
|
|
75
|
+
});
|
|
76
|
+
console.log('Voice call initiated:', result);
|
|
77
|
+
}
|
|
78
|
+
getSupportedCombinations() {
|
|
79
|
+
const combinations = this.communicationService.getSupportedCombinations();
|
|
80
|
+
console.log('Supported combinations:', combinations);
|
|
81
|
+
}
|
|
82
|
+
async sendGmailWithAttachments() {
|
|
83
|
+
const result = await this.communicationService.sendGenericMessage({
|
|
84
|
+
levelId: 1,
|
|
85
|
+
levelType: 'organization',
|
|
86
|
+
app_code: 'MY_APP_001',
|
|
87
|
+
to: 'recipient@example.com',
|
|
88
|
+
subject: 'Email with Attachments',
|
|
89
|
+
message: 'Please find the attached documents.',
|
|
90
|
+
type: 'EMAIL',
|
|
91
|
+
attachments: [
|
|
92
|
+
{
|
|
93
|
+
filename: 'document.pdf',
|
|
94
|
+
content: 'base64-encoded-content-here',
|
|
95
|
+
contentType: 'application/pdf',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
filename: 'image.jpg',
|
|
99
|
+
path: '/path/to/local/image.jpg',
|
|
100
|
+
contentType: 'image/jpeg',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
console.log('Gmail with attachments sent:', result);
|
|
105
|
+
}
|
|
106
|
+
async sendGmailWithTemplate() {
|
|
107
|
+
const htmlTemplate = `
|
|
108
|
+
<html>
|
|
109
|
+
<body>
|
|
110
|
+
<h2>Welcome {{userName}}!</h2>
|
|
111
|
+
<p>Thank you for joining our platform.</p>
|
|
112
|
+
<p>Your account ID is: {{accountId}}</p>
|
|
113
|
+
<a href="{{verificationLink}}">Verify your email</a>
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
116
|
+
`;
|
|
117
|
+
const result = await this.communicationService.sendGenericMessage({
|
|
118
|
+
levelId: 1,
|
|
119
|
+
levelType: 'organization',
|
|
120
|
+
app_code: 'MY_APP_001',
|
|
121
|
+
to: 'recipient@example.com',
|
|
122
|
+
subject: 'Welcome to Our Platform',
|
|
123
|
+
message: 'Welcome to Our Platform',
|
|
124
|
+
html: htmlTemplate,
|
|
125
|
+
type: 'EMAIL',
|
|
126
|
+
variables: {
|
|
127
|
+
userName: 'John Doe',
|
|
128
|
+
accountId: 'ACC_12345',
|
|
129
|
+
verificationLink: 'https://example.com/verify/token123',
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
console.log('Gmail template email sent:', result);
|
|
133
|
+
}
|
|
134
|
+
async sendSendGridWithAttachments() {
|
|
135
|
+
const sendGridConfig = {
|
|
136
|
+
apiKey: 'your-sendgrid-api-key',
|
|
137
|
+
fromEmail: 'noreply@yourdomain.com',
|
|
138
|
+
fromName: 'Your Company',
|
|
139
|
+
};
|
|
140
|
+
await this.communicationService.createIntegrationConfig(1, 'organization', 'MY_APP_001', 'EMAIL', 'sendgrid', 5, sendGridConfig);
|
|
141
|
+
const result = await this.communicationService.sendGenericMessage({
|
|
142
|
+
levelId: 1,
|
|
143
|
+
levelType: 'organization',
|
|
144
|
+
app_code: 'MY_APP_001',
|
|
145
|
+
to: 'recipient@example.com',
|
|
146
|
+
subject: 'Invoice and Receipt',
|
|
147
|
+
message: 'Please find your invoice and receipt attached.',
|
|
148
|
+
type: 'EMAIL',
|
|
149
|
+
attachments: [
|
|
150
|
+
{
|
|
151
|
+
filename: 'invoice.pdf',
|
|
152
|
+
content: 'base64-encoded-invoice-content',
|
|
153
|
+
contentType: 'application/pdf',
|
|
154
|
+
disposition: 'attachment',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
filename: 'receipt.pdf',
|
|
158
|
+
content: 'base64-encoded-receipt-content',
|
|
159
|
+
contentType: 'application/pdf',
|
|
160
|
+
disposition: 'attachment',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
console.log('SendGrid with attachments sent:', result);
|
|
165
|
+
}
|
|
166
|
+
async sendSendGridWithDynamicTemplate() {
|
|
167
|
+
const result = await this.communicationService.sendGenericMessage({
|
|
168
|
+
levelId: 1,
|
|
169
|
+
levelType: 'organization',
|
|
170
|
+
app_code: 'MY_APP_001',
|
|
171
|
+
to: 'recipient@example.com',
|
|
172
|
+
message: '',
|
|
173
|
+
type: 'EMAIL',
|
|
174
|
+
templateId: 'd-1234567890abcdef1234567890abcdef',
|
|
175
|
+
variables: {
|
|
176
|
+
firstName: 'John',
|
|
177
|
+
lastName: 'Doe',
|
|
178
|
+
companyName: 'Acme Corp',
|
|
179
|
+
orderNumber: 'ORD-2024-001',
|
|
180
|
+
orderDate: '2024-01-15',
|
|
181
|
+
items: [
|
|
182
|
+
{ name: 'Product A', quantity: 2, price: '$29.99' },
|
|
183
|
+
{ name: 'Product B', quantity: 1, price: '$49.99' },
|
|
184
|
+
],
|
|
185
|
+
totalAmount: '$109.97',
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
console.log('SendGrid dynamic template email sent:', result);
|
|
189
|
+
}
|
|
190
|
+
async sendSendGridWithCustomOptions() {
|
|
191
|
+
const result = await this.communicationService.sendGenericMessage({
|
|
192
|
+
levelId: 1,
|
|
193
|
+
levelType: 'organization',
|
|
194
|
+
app_code: 'MY_APP_001',
|
|
195
|
+
to: ['recipient1@example.com', 'recipient2@example.com'],
|
|
196
|
+
cc: ['manager@example.com'],
|
|
197
|
+
bcc: ['archive@example.com'],
|
|
198
|
+
subject: 'Monthly Newsletter',
|
|
199
|
+
message: 'Our Monthly Newsletter',
|
|
200
|
+
html: '<h1>Our Monthly Newsletter</h1><p>Latest updates from our team...</p>',
|
|
201
|
+
type: 'EMAIL',
|
|
202
|
+
});
|
|
203
|
+
console.log('SendGrid custom email sent:', result);
|
|
204
|
+
}
|
|
205
|
+
async sendMessageAutoMode() {
|
|
206
|
+
const result = await this.communicationService.sendMessage({
|
|
207
|
+
levelId: 1,
|
|
208
|
+
levelType: 'organization',
|
|
209
|
+
app_code: 'MY_APP_001',
|
|
210
|
+
to: 'recipient@example.com',
|
|
211
|
+
message: 'Hello! This will use the first available communication method.',
|
|
212
|
+
});
|
|
213
|
+
console.log('Message sent via auto-selected provider:', result);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
exports.CommunicationUsageExamples = CommunicationUsageExamples;
|
|
217
|
+
//# sourceMappingURL=usage.example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.example.js","sourceRoot":"","sources":["../../../../src/module/integration/examples/usage.example.ts"],"names":[],"mappings":";;;AAQA,MAAa,0BAA0B;IACrC,YAA6B,oBAAwC;QAAxC,yBAAoB,GAApB,oBAAoB,CAAoB;IAAG,CAAC;IAKzE,KAAK,CAAC,oBAAoB;QAExB,MAAM,WAAW,GAAG;YAClB,QAAQ,EAAE,sBAAsB;Y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
|
-
import {
|
|
1
|
+
import { IntegrationStrategy } from '../strategies/integration.strategy';
|
|
2
2
|
export interface BaseFactory {
|
|
3
|
-
createProvider(service: string, provider: string):
|
|
3
|
+
createProvider(service: string, provider: string): IntegrationStrategy;
|
|
4
4
|
getSupportedCombinations(): Array<{
|
|
5
5
|
service: string;
|
|
6
6
|
provider: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.factory.js","sourceRoot":"","sources":["../../../../src/module/integration/factories/base.factory.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { BaseFactory } from './base.factory';
|
|
2
|
-
import {
|
|
2
|
+
import { IntegrationStrategy } from '../strategies/integration.strategy';
|
|
3
3
|
import { GmailApiStrategy } from '../strategies/email/gmail-api.strategy';
|
|
4
4
|
import { OutlookStrategy } from '../strategies/email/outlook.strategy';
|
|
5
|
-
import { GmailSMTPStrategy } from '../strategies/email/gmail-smtp-v2.strategy';
|
|
6
|
-
import { OutlookSMTPStrategy } from '../strategies/email/outlook-smtp.strategy';
|
|
7
5
|
import { SendGridApiStrategy } from '../strategies/email/sendgrid-api.strategy';
|
|
8
6
|
export declare class EmailFactory implements BaseFactory {
|
|
9
7
|
private gmailApiStrategy;
|
|
10
8
|
private outlookStrategy;
|
|
11
|
-
private gmailSMTPStrategy;
|
|
12
|
-
private outlookSMTPStrategy;
|
|
13
9
|
private sendGridApiStrategy;
|
|
14
|
-
constructor(gmailApiStrategy: GmailApiStrategy, outlookStrategy: OutlookStrategy,
|
|
15
|
-
createProvider(service: string, provider: string):
|
|
10
|
+
constructor(gmailApiStrategy: GmailApiStrategy, outlookStrategy: OutlookStrategy, sendGridApiStrategy: SendGridApiStrategy);
|
|
11
|
+
createProvider(service: string, provider: string): IntegrationStrategy;
|
|
16
12
|
getSupportedCombinations(): Array<{
|
|
17
13
|
service: string;
|
|
18
14
|
provider: string;
|
|
@@ -13,15 +13,11 @@ exports.EmailFactory = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const gmail_api_strategy_1 = require("../strategies/email/gmail-api.strategy");
|
|
15
15
|
const outlook_strategy_1 = require("../strategies/email/outlook.strategy");
|
|
16
|
-
const gmail_smtp_v2_strategy_1 = require("../strategies/email/gmail-smtp-v2.strategy");
|
|
17
|
-
const outlook_smtp_strategy_1 = require("../strategies/email/outlook-smtp.strategy");
|
|
18
16
|
const sendgrid_api_strategy_1 = require("../strategies/email/sendgrid-api.strategy");
|
|
19
17
|
let EmailFactory = class EmailFactory {
|
|
20
|
-
constructor(gmailApiStrategy, outlookStrategy,
|
|
18
|
+
constructor(gmailApiStrategy, outlookStrategy, sendGridApiStrategy) {
|
|
21
19
|
this.gmailApiStrategy = gmailApiStrategy;
|
|
22
20
|
this.outlookStrategy = outlookStrategy;
|
|
23
|
-
this.gmailSMTPStrategy = gmailSMTPStrategy;
|
|
24
|
-
this.outlookSMTPStrategy = outlookSMTPStrategy;
|
|
25
21
|
this.sendGridApiStrategy = sendGridApiStrategy;
|
|
26
22
|
}
|
|
27
23
|
createProvider(service, provider) {
|
|
@@ -33,10 +29,6 @@ let EmailFactory = class EmailFactory {
|
|
|
33
29
|
return this.outlookStrategy;
|
|
34
30
|
case 'api_sendgrid':
|
|
35
31
|
return this.sendGridApiStrategy;
|
|
36
|
-
case 'smtp_gmail':
|
|
37
|
-
return this.gmailSMTPStrategy;
|
|
38
|
-
case 'smtp_outlook':
|
|
39
|
-
return this.outlookSMTPStrategy;
|
|
40
32
|
default:
|
|
41
33
|
throw new Error(`Unsupported EMAIL service/provider: ${service}/${provider}`);
|
|
42
34
|
}
|
|
@@ -46,8 +38,6 @@ let EmailFactory = class EmailFactory {
|
|
|
46
38
|
{ service: 'API', provider: 'gmail' },
|
|
47
39
|
{ service: 'API', provider: 'outlook' },
|
|
48
40
|
{ service: 'API', provider: 'sendgrid' },
|
|
49
|
-
{ service: 'SMTP', provider: 'gmail' },
|
|
50
|
-
{ service: 'SMTP', provider: 'outlook' },
|
|
51
41
|
];
|
|
52
42
|
}
|
|
53
43
|
validateCombination(service, provider) {
|
|
@@ -60,8 +50,6 @@ exports.EmailFactory = EmailFactory = __decorate([
|
|
|
60
50
|
(0, common_1.Injectable)(),
|
|
61
51
|
__metadata("design:paramtypes", [gmail_api_strategy_1.GmailApiStrategy,
|
|
62
52
|
outlook_strategy_1.OutlookStrategy,
|
|
63
|
-
gmail_smtp_v2_strategy_1.GmailSMTPStrategy,
|
|
64
|
-
outlook_smtp_strategy_1.OutlookSMTPStrategy,
|
|
65
53
|
sendgrid_api_strategy_1.SendGridApiStrategy])
|
|
66
54
|
], EmailFactory);
|
|
67
55
|
//# sourceMappingURL=email.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.factory.js","sourceRoot":"","sources":["../../../../src/module/integration/factories/email.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,+EAA0E;AAC1E,2EAAuE;AACvE,qFAAgF;AAGzE,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YACU,gBAAkC,EAClC,eAAgC,EAChC,mBAAwC;QAFxC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,oBAAe,GAAf,eAAe,CAAiB;QAChC,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,gBAAgB,CAAC;YAC/B,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,eAAe,CAAC;YAC9B,KAAK,cAAc;gBACjB,OAAO,IAAI,CAAC,mBAAmB,CAAC;YAElC;gBACE,MAAM,IAAI,KAAK,CACb,uCAAuC,OAAO,IAAI,QAAQ,EAAE,CAC7D,CAAC;QACN,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,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,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE;YACrD,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CAC1D,CAAC;IACJ,CAAC;CACF,CAAA;AAxCY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAGiB,qCAAgB;QACjB,kCAAe;QACX,2CAAmB;GAJvC,YAAY,CAwCxB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegrationStrategy } from '../strategies/integration.strategy';
|
|
2
2
|
import { EmailFactory } from './email.factory';
|
|
3
3
|
import { SmsFactory } from './sms.factory';
|
|
4
4
|
import { WhatsAppFactory } from './whatsapp.factory';
|
|
5
5
|
import { TelephoneFactory } from './telephone.factory';
|
|
6
|
-
export declare enum
|
|
6
|
+
export declare enum IntegrationMode {
|
|
7
7
|
EMAIL = "EMAIL",
|
|
8
8
|
SMS = "SMS",
|
|
9
9
|
WA = "WA",
|
|
10
10
|
TELEPHONE = "TELEPHONE"
|
|
11
11
|
}
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class IntegrationFactory {
|
|
13
13
|
private emailFactory;
|
|
14
14
|
private smsFactory;
|
|
15
15
|
private whatsappFactory;
|
|
@@ -17,7 +17,7 @@ export declare class CommunicationFactory {
|
|
|
17
17
|
private readonly modeFactoryMap;
|
|
18
18
|
constructor(emailFactory: EmailFactory, smsFactory: SmsFactory, whatsappFactory: WhatsAppFactory, telephoneFactory: TelephoneFactory);
|
|
19
19
|
private initializeFactoryMap;
|
|
20
|
-
create(mode: string, service: string, provider: string):
|
|
20
|
+
create(mode: string, service: string, provider: string): IntegrationStrategy;
|
|
21
21
|
getAllSupportedCombinations(): Array<{
|
|
22
22
|
mode: string;
|
|
23
23
|
service: string;
|
|
@@ -9,20 +9,20 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.IntegrationFactory = exports.IntegrationMode = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const email_factory_1 = require("./email.factory");
|
|
15
15
|
const sms_factory_1 = require("./sms.factory");
|
|
16
16
|
const whatsapp_factory_1 = require("./whatsapp.factory");
|
|
17
17
|
const telephone_factory_1 = require("./telephone.factory");
|
|
18
|
-
var
|
|
19
|
-
(function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})(
|
|
25
|
-
let
|
|
18
|
+
var IntegrationMode;
|
|
19
|
+
(function (IntegrationMode) {
|
|
20
|
+
IntegrationMode["EMAIL"] = "EMAIL";
|
|
21
|
+
IntegrationMode["SMS"] = "SMS";
|
|
22
|
+
IntegrationMode["WA"] = "WA";
|
|
23
|
+
IntegrationMode["TELEPHONE"] = "TELEPHONE";
|
|
24
|
+
})(IntegrationMode || (exports.IntegrationMode = IntegrationMode = {}));
|
|
25
|
+
let IntegrationFactory = class IntegrationFactory {
|
|
26
26
|
constructor(emailFactory, smsFactory, whatsappFactory, telephoneFactory) {
|
|
27
27
|
this.emailFactory = emailFactory;
|
|
28
28
|
this.smsFactory = smsFactory;
|
|
@@ -32,17 +32,17 @@ let CommunicationFactory = class CommunicationFactory {
|
|
|
32
32
|
this.initializeFactoryMap();
|
|
33
33
|
}
|
|
34
34
|
initializeFactoryMap() {
|
|
35
|
-
this.modeFactoryMap.set(
|
|
36
|
-
this.modeFactoryMap.set(
|
|
37
|
-
this.modeFactoryMap.set(
|
|
38
|
-
this.modeFactoryMap.set(
|
|
35
|
+
this.modeFactoryMap.set(IntegrationMode.EMAIL, this.emailFactory);
|
|
36
|
+
this.modeFactoryMap.set(IntegrationMode.SMS, this.smsFactory);
|
|
37
|
+
this.modeFactoryMap.set(IntegrationMode.WA, this.whatsappFactory);
|
|
38
|
+
this.modeFactoryMap.set(IntegrationMode.TELEPHONE, this.telephoneFactory);
|
|
39
39
|
}
|
|
40
40
|
create(mode, service, provider) {
|
|
41
|
-
const
|
|
42
|
-
if (!Object.values(
|
|
43
|
-
throw new Error(`Unsupported
|
|
41
|
+
const integrationMode = mode.toUpperCase();
|
|
42
|
+
if (!Object.values(IntegrationMode).includes(integrationMode)) {
|
|
43
|
+
throw new Error(`Unsupported integration mode: ${mode}`);
|
|
44
44
|
}
|
|
45
|
-
const factory = this.modeFactoryMap.get(
|
|
45
|
+
const factory = this.modeFactoryMap.get(integrationMode);
|
|
46
46
|
if (!factory) {
|
|
47
47
|
throw new Error(`Factory not found for mode: ${mode}`);
|
|
48
48
|
}
|
|
@@ -63,8 +63,8 @@ let CommunicationFactory = class CommunicationFactory {
|
|
|
63
63
|
return combinations;
|
|
64
64
|
}
|
|
65
65
|
getSupportedCombinationsForMode(mode) {
|
|
66
|
-
const
|
|
67
|
-
const factory = this.modeFactoryMap.get(
|
|
66
|
+
const integrationMode = mode.toUpperCase();
|
|
67
|
+
const factory = this.modeFactoryMap.get(integrationMode);
|
|
68
68
|
if (!factory) {
|
|
69
69
|
throw new Error(`Factory not found for mode: ${mode}`);
|
|
70
70
|
}
|
|
@@ -72,8 +72,8 @@ let CommunicationFactory = class CommunicationFactory {
|
|
|
72
72
|
}
|
|
73
73
|
validateCombination(mode, service, provider) {
|
|
74
74
|
try {
|
|
75
|
-
const
|
|
76
|
-
const factory = this.modeFactoryMap.get(
|
|
75
|
+
const integrationMode = mode.toUpperCase();
|
|
76
|
+
const factory = this.modeFactoryMap.get(integrationMode);
|
|
77
77
|
if (!factory) {
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
@@ -84,7 +84,7 @@ let CommunicationFactory = class CommunicationFactory {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
getAvailableModes() {
|
|
87
|
-
return Object.values(
|
|
87
|
+
return Object.values(IntegrationMode);
|
|
88
88
|
}
|
|
89
89
|
getProvidersByModeAndService(mode, service) {
|
|
90
90
|
const combinations = this.getSupportedCombinationsForMode(mode);
|
|
@@ -93,12 +93,12 @@ let CommunicationFactory = class CommunicationFactory {
|
|
|
93
93
|
.map((combo) => combo.provider);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
exports.
|
|
97
|
-
exports.
|
|
96
|
+
exports.IntegrationFactory = IntegrationFactory;
|
|
97
|
+
exports.IntegrationFactory = IntegrationFactory = __decorate([
|
|
98
98
|
(0, common_1.Injectable)(),
|
|
99
99
|
__metadata("design:paramtypes", [email_factory_1.EmailFactory,
|
|
100
100
|
sms_factory_1.SmsFactory,
|
|
101
101
|
whatsapp_factory_1.WhatsAppFactory,
|
|
102
102
|
telephone_factory_1.TelephoneFactory])
|
|
103
|
-
],
|
|
104
|
-
//# sourceMappingURL=
|
|
103
|
+
], IntegrationFactory);
|
|
104
|
+
//# sourceMappingURL=integration.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.factory.js","sourceRoot":"","sources":["../../../../src/module/integration/factories/integration.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,+CAA2C;AAC3C,yDAAqD;AACrD,2DAAuD;AA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zD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC;YACf,CAAC;YAED,OAAO,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,iBAAiB;QACf,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,4BAA4B,CAAC,IAAY,EAAE,OAAe;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;QAChE,OAAO,YAAY;aAChB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;aACxE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAzGY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;qCAKa,4BAAY;QACd,wBAAU;QACL,kCAAe;QACd,oCAAgB;GAPjC,kBAAkB,CAyG9B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IntegrationStrategy } from '../strategies/integration.strategy';
|
|
2
|
+
export declare class SmsFactory {
|
|
3
|
+
createProvider(service: string, provider: string): IntegrationStrategy;
|
|
4
|
+
getSupportedCombinations(): Array<{
|
|
5
|
+
service: string;
|
|
6
|
+
provider: string;
|
|
7
|
+
}>;
|
|
8
|
+
validateCombination(service: string, provider: string): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SmsFactory = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
let SmsFactory = class SmsFactory {
|
|
12
|
+
createProvider(service, provider) {
|
|
13
|
+
throw new Error(`SMS integration is not supported. Provider: ${provider}, Service: ${service}`);
|
|
14
|
+
}
|
|
15
|
+
getSupportedCombinations() {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
validateCombination(service, provider) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.SmsFactory = SmsFactory;
|
|
23
|
+
exports.SmsFactory = SmsFactory = __decorate([
|
|
24
|
+
(0, common_1.Injectable)()
|
|
25
|
+
], SmsFactory);
|
|
26
|
+
//# sourceMappingURL=sms.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms.factory.js","sourceRoot":"","sources":["../../../../src/module/integration/factories/sms.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAIrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,cAAc,CAAC,OAAe,EAAE,QAAgB;QAC9C,MAAM,IAAI,KAAK,CAAC,+CAA+C,QAAQ,cAAc,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,wBAAwB;QAEtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,mBAAmB,CAAC,OAAe,EAAE,QAAgB;QAEnD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAdY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CActB"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { BaseFactory } from './base.factory';
|
|
2
|
-
import {
|
|
3
|
-
import { KnowlarityStrategy as TelephoneKnowlarityStrategy } from '../strategies/telephone/knowlarity-multi.strategy';
|
|
2
|
+
import { IntegrationStrategy } from '../strategies/integration.strategy';
|
|
4
3
|
import { OzonetelVoiceStrategy } from '../strategies/telephone/ozonetel-voice.strategy';
|
|
5
4
|
import { TubelightVoiceStrategy } from '../strategies/telephone/tubelight-voice.strategy';
|
|
6
5
|
export declare class TelephoneFactory implements BaseFactory {
|
|
7
|
-
private knowlarityStrategy;
|
|
8
6
|
private ozonetelVoiceStrategy;
|
|
9
7
|
private tubelightVoiceStrategy;
|
|
10
|
-
constructor(
|
|
11
|
-
createProvider(service: string, provider: string):
|
|
8
|
+
constructor(ozonetelVoiceStrategy: OzonetelVoiceStrategy, tubelightVoiceStrategy: TubelightVoiceStrategy);
|
|
9
|
+
createProvider(service: string, provider: string): IntegrationStrategy;
|
|
12
10
|
getSupportedCombinations(): Array<{
|
|
13
11
|
service: string;
|
|
14
12
|
provider: string;
|
|
@@ -11,45 +11,39 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TelephoneFactory = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const knowlarity_multi_strategy_1 = require("../strategies/telephone/knowlarity-multi.strategy");
|
|
15
14
|
const ozonetel_voice_strategy_1 = require("../strategies/telephone/ozonetel-voice.strategy");
|
|
16
15
|
const tubelight_voice_strategy_1 = require("../strategies/telephone/tubelight-voice.strategy");
|
|
17
16
|
let TelephoneFactory = class TelephoneFactory {
|
|
18
|
-
constructor(
|
|
19
|
-
this.knowlarityStrategy = knowlarityStrategy;
|
|
17
|
+
constructor(ozonetelVoiceStrategy, tubelightVoiceStrategy) {
|
|
20
18
|
this.ozonetelVoiceStrategy = ozonetelVoiceStrategy;
|
|
21
19
|
this.tubelightVoiceStrategy = tubelightVoiceStrategy;
|
|
22
20
|
}
|
|
23
21
|
createProvider(service, provider) {
|
|
24
|
-
const
|
|
25
|
-
switch (
|
|
26
|
-
case '
|
|
27
|
-
return this.knowlarityStrategy;
|
|
28
|
-
case 'third_party_ozonetel':
|
|
22
|
+
const providerKey = provider.toLowerCase();
|
|
23
|
+
switch (providerKey) {
|
|
24
|
+
case 'ozonetel':
|
|
29
25
|
return this.ozonetelVoiceStrategy;
|
|
30
|
-
case '
|
|
26
|
+
case 'tubelight':
|
|
31
27
|
return this.tubelightVoiceStrategy;
|
|
32
28
|
default:
|
|
33
|
-
throw new Error(`Unsupported Telephone
|
|
29
|
+
throw new Error(`Unsupported Telephone provider: ${provider}`);
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
32
|
getSupportedCombinations() {
|
|
37
33
|
return [
|
|
38
|
-
{ service: '
|
|
39
|
-
{ service: '
|
|
40
|
-
{ service: 'THIRD_PARTY', provider: 'tubelight' }
|
|
34
|
+
{ service: 'API', provider: 'ozonetel' },
|
|
35
|
+
{ service: 'API', provider: 'tubelight' }
|
|
41
36
|
];
|
|
42
37
|
}
|
|
43
38
|
validateCombination(service, provider) {
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
const supportedProviders = ['ozonetel', 'tubelight'];
|
|
40
|
+
return supportedProviders.includes(provider.toLowerCase());
|
|
46
41
|
}
|
|
47
42
|
};
|
|
48
43
|
exports.TelephoneFactory = TelephoneFactory;
|
|
49
44
|
exports.TelephoneFactory = TelephoneFactory = __decorate([
|
|
50
45
|
(0, common_1.Injectable)(),
|
|
51
|
-
__metadata("design:paramtypes", [
|
|
52
|
-
ozonetel_voice_strategy_1.OzonetelVoiceStrategy,
|
|
46
|
+
__metadata("design:paramtypes", [ozonetel_voice_strategy_1.OzonetelVoiceStrategy,
|
|
53
47
|
tubelight_voice_strategy_1.TubelightVoiceStrategy])
|
|
54
48
|
], TelephoneFactory);
|
|
55
49
|
//# sourceMappingURL=telephone.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telephone.factory.js","sourceRoot":"","sources":["../../../../src/module/integration/factories/telephone.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,6FAAwF;AACxF,+FAA0F;AAGnF,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACU,qBAA4C,EAC5C,sBAA8C;QAD9C,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,2BAAsB,GAAtB,sBAAsB,CAAwB;IACrD,CAAC;IAEJ,cAAc,CAAC,OAAe,EAAE,QAAgB;QAC9C,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAE3C,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,qBAAqB,CAAC;YACpC,KAAK,WAAW;gBACd,OAAO,IAAI,CAAC,sBAAsB,CAAC;YAErC;gBACE,MAAM,IAAI,KAAK,CACb,mCAAmC,QAAQ,EAAE,CAC9C,CAAC;QACN,CAAC;IACH,CAAC;IAED,wBAAwB;QACtB,OAAO;YACL,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE;YACxC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE;SAC1C,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,OAAe,EAAE,QAAgB;QACnD,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF,CAAA;AAjCY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAGsB,+CAAqB;QACpB,iDAAsB;GAH7C,gBAAgB,CAiC5B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseFactory } from './base.factory';
|
|
2
|
-
import {
|
|
2
|
+
import { IntegrationStrategy } from '../strategies/integration.strategy';
|
|
3
3
|
import { WhatsAppStrategy } from '../strategies/whatsapp/whatsapp.strategy';
|
|
4
4
|
import { WhatsAppCloudStrategy } from '../strategies/whatsapp/whatsapp-cloud.strategy';
|
|
5
5
|
export declare class WhatsAppFactory implements BaseFactory {
|
|
6
6
|
private whatsappStrategy;
|
|
7
7
|
private whatsappCloudStrategy;
|
|
8
8
|
constructor(whatsappStrategy: WhatsAppStrategy, whatsappCloudStrategy: WhatsAppCloudStrategy);
|
|
9
|
-
createProvider(service: string, provider: string):
|
|
9
|
+
createProvider(service: string, provider: string): IntegrationStrategy;
|
|
10
10
|
getSupportedCombinations(): Array<{
|
|
11
11
|
service: string;
|
|
12
12
|
provider: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsapp.factory.js","sourceRoot":"","sources":["../../../../src/module/integration/factories/whatsapp.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,gFAA4E;AAC5E,4FAAuF;AAGhF,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YACU,gBAAkC,EAClC,qBAA4C;QAD5C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;IACnD,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,cAAc;gBACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;YAC/B,KAAK,oBAAoB,CAAC;YAC1B,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,qBAAqB,CAAC;YAEpC;gBACE,MAAM,IAAI,KAAK,CACb,0CA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