@venturialstd/workflow 0.1.1 → 0.1.3
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/constants/workflow.constant.d.ts +2 -1
- package/dist/constants/workflow.constant.d.ts.map +1 -1
- package/dist/constants/workflow.constant.js +1 -0
- package/dist/constants/workflow.constant.js.map +1 -1
- package/dist/dtos/create-workflow-webhook.dto.d.ts +9 -0
- package/dist/dtos/create-workflow-webhook.dto.d.ts.map +1 -0
- package/dist/dtos/create-workflow-webhook.dto.js +48 -0
- package/dist/dtos/create-workflow-webhook.dto.js.map +1 -0
- package/dist/dtos/index.d.ts +1 -0
- package/dist/dtos/index.d.ts.map +1 -1
- package/dist/dtos/index.js +1 -0
- package/dist/dtos/index.js.map +1 -1
- package/dist/entities/workflow-webhook.entity.d.ts +22 -0
- package/dist/entities/workflow-webhook.entity.d.ts.map +1 -0
- package/dist/entities/workflow-webhook.entity.js +103 -0
- package/dist/entities/workflow-webhook.entity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/conditional/services/evaluate-condition.service.d.ts.map +1 -1
- package/dist/modules/conditional/services/evaluate-condition.service.js +39 -23
- package/dist/modules/conditional/services/evaluate-condition.service.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +5 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/twilio/actions/cancel-verification.action.d.ts +3 -0
- package/dist/modules/twilio/actions/cancel-verification.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/cancel-verification.action.js +56 -0
- package/dist/modules/twilio/actions/cancel-verification.action.js.map +1 -0
- package/dist/modules/twilio/actions/create-conversation.action.d.ts +3 -0
- package/dist/modules/twilio/actions/create-conversation.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/create-conversation.action.js +79 -0
- package/dist/modules/twilio/actions/create-conversation.action.js.map +1 -0
- package/dist/modules/twilio/actions/create-video-room.action.d.ts +3 -0
- package/dist/modules/twilio/actions/create-video-room.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/create-video-room.action.js +89 -0
- package/dist/modules/twilio/actions/create-video-room.action.js.map +1 -0
- package/dist/modules/twilio/actions/delete-call.action.d.ts +3 -0
- package/dist/modules/twilio/actions/delete-call.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/delete-call.action.js +40 -0
- package/dist/modules/twilio/actions/delete-call.action.js.map +1 -0
- package/dist/modules/twilio/actions/delete-message.action.d.ts +3 -0
- package/dist/modules/twilio/actions/delete-message.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/delete-message.action.js +40 -0
- package/dist/modules/twilio/actions/delete-message.action.js.map +1 -0
- package/dist/modules/twilio/actions/fetch-call-recordings.action.d.ts +3 -0
- package/dist/modules/twilio/actions/fetch-call-recordings.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/fetch-call-recordings.action.js +46 -0
- package/dist/modules/twilio/actions/fetch-call-recordings.action.js.map +1 -0
- package/dist/modules/twilio/actions/fetch-call.action.d.ts +3 -0
- package/dist/modules/twilio/actions/fetch-call.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/fetch-call.action.js +52 -0
- package/dist/modules/twilio/actions/fetch-call.action.js.map +1 -0
- package/dist/modules/twilio/actions/fetch-message.action.d.ts +3 -0
- package/dist/modules/twilio/actions/fetch-message.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/fetch-message.action.js +58 -0
- package/dist/modules/twilio/actions/fetch-message.action.js.map +1 -0
- package/dist/modules/twilio/actions/fetch-verification.action.d.ts +3 -0
- package/dist/modules/twilio/actions/fetch-verification.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/fetch-verification.action.js +62 -0
- package/dist/modules/twilio/actions/fetch-verification.action.js.map +1 -0
- package/dist/modules/twilio/actions/generate-twiml-dial.action.d.ts +3 -0
- package/dist/modules/twilio/actions/generate-twiml-dial.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/generate-twiml-dial.action.js +72 -0
- package/dist/modules/twilio/actions/generate-twiml-dial.action.js.map +1 -0
- package/dist/modules/twilio/actions/generate-twiml-say.action.d.ts +3 -0
- package/dist/modules/twilio/actions/generate-twiml-say.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/generate-twiml-say.action.js +68 -0
- package/dist/modules/twilio/actions/generate-twiml-say.action.js.map +1 -0
- package/dist/modules/twilio/actions/index.d.ts +20 -0
- package/dist/modules/twilio/actions/index.d.ts.map +1 -1
- package/dist/modules/twilio/actions/index.js +20 -0
- package/dist/modules/twilio/actions/index.js.map +1 -1
- package/dist/modules/twilio/actions/list-calls.action.d.ts +3 -0
- package/dist/modules/twilio/actions/list-calls.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/list-calls.action.js +80 -0
- package/dist/modules/twilio/actions/list-calls.action.js.map +1 -0
- package/dist/modules/twilio/actions/list-messages.action.d.ts +3 -0
- package/dist/modules/twilio/actions/list-messages.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/list-messages.action.js +89 -0
- package/dist/modules/twilio/actions/list-messages.action.js.map +1 -0
- package/dist/modules/twilio/actions/lookup-phone-number.action.d.ts +3 -0
- package/dist/modules/twilio/actions/lookup-phone-number.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/lookup-phone-number.action.js +79 -0
- package/dist/modules/twilio/actions/lookup-phone-number.action.js.map +1 -0
- package/dist/modules/twilio/actions/make-call.action.d.ts +3 -0
- package/dist/modules/twilio/actions/make-call.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/make-call.action.js +109 -0
- package/dist/modules/twilio/actions/make-call.action.js.map +1 -0
- package/dist/modules/twilio/actions/send-conversation-message.action.d.ts +3 -0
- package/dist/modules/twilio/actions/send-conversation-message.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/send-conversation-message.action.js +72 -0
- package/dist/modules/twilio/actions/send-conversation-message.action.js.map +1 -0
- package/dist/modules/twilio/actions/send-sms.action.d.ts.map +1 -1
- package/dist/modules/twilio/actions/send-sms.action.js.map +1 -1
- package/dist/modules/twilio/actions/send-verification.action.d.ts +3 -0
- package/dist/modules/twilio/actions/send-verification.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/send-verification.action.js +99 -0
- package/dist/modules/twilio/actions/send-verification.action.js.map +1 -0
- package/dist/modules/twilio/actions/update-call.action.d.ts +3 -0
- package/dist/modules/twilio/actions/update-call.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/update-call.action.js +72 -0
- package/dist/modules/twilio/actions/update-call.action.js.map +1 -0
- package/dist/modules/twilio/actions/update-message.action.d.ts +3 -0
- package/dist/modules/twilio/actions/update-message.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/update-message.action.js +57 -0
- package/dist/modules/twilio/actions/update-message.action.js.map +1 -0
- package/dist/modules/twilio/actions/verify-code.action.d.ts +3 -0
- package/dist/modules/twilio/actions/verify-code.action.d.ts.map +1 -0
- package/dist/modules/twilio/actions/verify-code.action.js +72 -0
- package/dist/modules/twilio/actions/verify-code.action.js.map +1 -0
- package/dist/modules/twilio/services/cancel-verification.service.d.ts +8 -0
- package/dist/modules/twilio/services/cancel-verification.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/cancel-verification.service.js +53 -0
- package/dist/modules/twilio/services/cancel-verification.service.js.map +1 -0
- package/dist/modules/twilio/services/create-conversation.service.d.ts +8 -0
- package/dist/modules/twilio/services/create-conversation.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/create-conversation.service.js +56 -0
- package/dist/modules/twilio/services/create-conversation.service.js.map +1 -0
- package/dist/modules/twilio/services/create-video-room.service.d.ts +8 -0
- package/dist/modules/twilio/services/create-video-room.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/create-video-room.service.js +57 -0
- package/dist/modules/twilio/services/create-video-room.service.js.map +1 -0
- package/dist/modules/twilio/services/delete-call.service.d.ts +8 -0
- package/dist/modules/twilio/services/delete-call.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/delete-call.service.js +48 -0
- package/dist/modules/twilio/services/delete-call.service.js.map +1 -0
- package/dist/modules/twilio/services/delete-message.service.d.ts +8 -0
- package/dist/modules/twilio/services/delete-message.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/delete-message.service.js +43 -0
- package/dist/modules/twilio/services/delete-message.service.js.map +1 -0
- package/dist/modules/twilio/services/fetch-call-recordings.service.d.ts +8 -0
- package/dist/modules/twilio/services/fetch-call-recordings.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/fetch-call-recordings.service.js +56 -0
- package/dist/modules/twilio/services/fetch-call-recordings.service.js.map +1 -0
- package/dist/modules/twilio/services/fetch-call.service.d.ts +8 -0
- package/dist/modules/twilio/services/fetch-call.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/fetch-call.service.js +52 -0
- package/dist/modules/twilio/services/fetch-call.service.js.map +1 -0
- package/dist/modules/twilio/services/fetch-message.service.d.ts +8 -0
- package/dist/modules/twilio/services/fetch-message.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/fetch-message.service.js +60 -0
- package/dist/modules/twilio/services/fetch-message.service.js.map +1 -0
- package/dist/modules/twilio/services/fetch-verification.service.d.ts +8 -0
- package/dist/modules/twilio/services/fetch-verification.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/fetch-verification.service.js +58 -0
- package/dist/modules/twilio/services/fetch-verification.service.js.map +1 -0
- package/dist/modules/twilio/services/generate-twiml-dial.service.d.ts +8 -0
- package/dist/modules/twilio/services/generate-twiml-dial.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/generate-twiml-dial.service.js +43 -0
- package/dist/modules/twilio/services/generate-twiml-dial.service.js.map +1 -0
- package/dist/modules/twilio/services/generate-twiml-say.service.d.ts +8 -0
- package/dist/modules/twilio/services/generate-twiml-say.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/generate-twiml-say.service.js +41 -0
- package/dist/modules/twilio/services/generate-twiml-say.service.js.map +1 -0
- package/dist/modules/twilio/services/index.d.ts +20 -0
- package/dist/modules/twilio/services/index.d.ts.map +1 -1
- package/dist/modules/twilio/services/index.js +20 -0
- package/dist/modules/twilio/services/index.js.map +1 -1
- package/dist/modules/twilio/services/list-calls.service.d.ts +8 -0
- package/dist/modules/twilio/services/list-calls.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/list-calls.service.js +62 -0
- package/dist/modules/twilio/services/list-calls.service.js.map +1 -0
- package/dist/modules/twilio/services/list-messages.service.d.ts +8 -0
- package/dist/modules/twilio/services/list-messages.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/list-messages.service.js +65 -0
- package/dist/modules/twilio/services/list-messages.service.js.map +1 -0
- package/dist/modules/twilio/services/lookup-phone-number.service.d.ts +8 -0
- package/dist/modules/twilio/services/lookup-phone-number.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/lookup-phone-number.service.js +61 -0
- package/dist/modules/twilio/services/lookup-phone-number.service.js.map +1 -0
- package/dist/modules/twilio/services/make-call.service.d.ts +8 -0
- package/dist/modules/twilio/services/make-call.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/make-call.service.js +80 -0
- package/dist/modules/twilio/services/make-call.service.js.map +1 -0
- package/dist/modules/twilio/services/send-conversation-message.service.d.ts +8 -0
- package/dist/modules/twilio/services/send-conversation-message.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/send-conversation-message.service.js +61 -0
- package/dist/modules/twilio/services/send-conversation-message.service.js.map +1 -0
- package/dist/modules/twilio/services/send-sms.service.d.ts.map +1 -1
- package/dist/modules/twilio/services/send-verification.service.d.ts +8 -0
- package/dist/modules/twilio/services/send-verification.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/send-verification.service.js +64 -0
- package/dist/modules/twilio/services/send-verification.service.js.map +1 -0
- package/dist/modules/twilio/services/update-call.service.d.ts +8 -0
- package/dist/modules/twilio/services/update-call.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/update-call.service.js +62 -0
- package/dist/modules/twilio/services/update-call.service.js.map +1 -0
- package/dist/modules/twilio/services/update-message.service.d.ts +8 -0
- package/dist/modules/twilio/services/update-message.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/update-message.service.js +54 -0
- package/dist/modules/twilio/services/update-message.service.js.map +1 -0
- package/dist/modules/twilio/services/verify-code.service.d.ts +8 -0
- package/dist/modules/twilio/services/verify-code.service.d.ts.map +1 -0
- package/dist/modules/twilio/services/verify-code.service.js +62 -0
- package/dist/modules/twilio/services/verify-code.service.js.map +1 -0
- package/dist/modules/twilio/twilio-nest.module.d.ts.map +1 -1
- package/dist/modules/twilio/twilio-nest.module.js +51 -3
- package/dist/modules/twilio/twilio-nest.module.js.map +1 -1
- package/dist/modules/twilio/twilio.module.d.ts.map +1 -1
- package/dist/modules/twilio/twilio.module.js +24 -2
- package/dist/modules/twilio/twilio.module.js.map +1 -1
- package/dist/modules/types.d.ts +3 -1
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/types.js.map +1 -1
- package/dist/modules/webhook/controllers/index.d.ts +2 -0
- package/dist/modules/webhook/controllers/index.d.ts.map +1 -0
- package/dist/modules/webhook/controllers/index.js +18 -0
- package/dist/modules/webhook/controllers/index.js.map +1 -0
- package/dist/modules/webhook/controllers/webhook-receiver.controller.d.ts +12 -0
- package/dist/modules/webhook/controllers/webhook-receiver.controller.d.ts.map +1 -0
- package/dist/modules/webhook/controllers/webhook-receiver.controller.js +122 -0
- package/dist/modules/webhook/controllers/webhook-receiver.controller.js.map +1 -0
- package/dist/modules/webhook/credentials.d.ts +3 -0
- package/dist/modules/webhook/credentials.d.ts.map +1 -0
- package/dist/modules/webhook/credentials.js +5 -0
- package/dist/modules/webhook/credentials.js.map +1 -0
- package/dist/modules/webhook/services/index.d.ts +2 -0
- package/dist/modules/webhook/services/index.d.ts.map +1 -0
- package/dist/modules/webhook/services/index.js +18 -0
- package/dist/modules/webhook/services/index.js.map +1 -0
- package/dist/modules/webhook/services/webhook-received.service.d.ts +10 -0
- package/dist/modules/webhook/services/webhook-received.service.d.ts.map +1 -0
- package/dist/modules/webhook/services/webhook-received.service.js +94 -0
- package/dist/modules/webhook/services/webhook-received.service.js.map +1 -0
- package/dist/modules/webhook/triggers/index.d.ts +2 -0
- package/dist/modules/webhook/triggers/index.d.ts.map +1 -0
- package/dist/modules/webhook/triggers/index.js +18 -0
- package/dist/modules/webhook/triggers/index.js.map +1 -0
- package/dist/modules/webhook/triggers/webhook-received.trigger.d.ts +3 -0
- package/dist/modules/webhook/triggers/webhook-received.trigger.d.ts.map +1 -0
- package/dist/modules/webhook/triggers/webhook-received.trigger.js +78 -0
- package/dist/modules/webhook/triggers/webhook-received.trigger.js.map +1 -0
- package/dist/modules/webhook/webhook-nest.module.d.ts +3 -0
- package/dist/modules/webhook/webhook-nest.module.d.ts.map +1 -0
- package/dist/modules/webhook/webhook-nest.module.js +32 -0
- package/dist/modules/webhook/webhook-nest.module.js.map +1 -0
- package/dist/modules/webhook/webhook.module.d.ts +3 -0
- package/dist/modules/webhook/webhook.module.d.ts.map +1 -0
- package/dist/modules/webhook/webhook.module.js +16 -0
- package/dist/modules/webhook/webhook.module.js.map +1 -0
- package/dist/services/workflow-execution.service.d.ts +14 -1
- package/dist/services/workflow-execution.service.d.ts.map +1 -1
- package/dist/services/workflow-execution.service.js +319 -2
- package/dist/services/workflow-execution.service.js.map +1 -1
- package/dist/services/workflow-webhook.service.d.ts +13 -0
- package/dist/services/workflow-webhook.service.d.ts.map +1 -0
- package/dist/services/workflow-webhook.service.js +72 -0
- package/dist/services/workflow-webhook.service.js.map +1 -0
- package/dist/workflow-core.module.d.ts.map +1 -1
- package/dist/workflow-core.module.js +5 -0
- package/dist/workflow-core.module.js.map +1 -1
- package/dist/workflow.module.d.ts.map +1 -1
- package/dist/workflow.module.js +3 -0
- package/dist/workflow.module.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,62 @@
|
|
|
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.ListCallsService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let ListCallsService = class ListCallsService {
|
|
16
|
+
twilioVoiceService;
|
|
17
|
+
constructor(twilioVoiceService) {
|
|
18
|
+
this.twilioVoiceService = twilioVoiceService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const accountSid = context.credentials?.accountSid;
|
|
22
|
+
const authToken = context.credentials?.authToken;
|
|
23
|
+
if (!accountSid || !authToken) {
|
|
24
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
25
|
+
}
|
|
26
|
+
const config = {
|
|
27
|
+
auth: {
|
|
28
|
+
accountSid,
|
|
29
|
+
authToken,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const options = {};
|
|
33
|
+
if (inputs.to)
|
|
34
|
+
options.to = inputs.to;
|
|
35
|
+
if (inputs.from)
|
|
36
|
+
options.from = inputs.from;
|
|
37
|
+
if (inputs.status) {
|
|
38
|
+
options.status = inputs.status;
|
|
39
|
+
}
|
|
40
|
+
if (inputs.limit)
|
|
41
|
+
options.limit = Number(inputs.limit);
|
|
42
|
+
const calls = await this.twilioVoiceService.listCalls(config, options);
|
|
43
|
+
return {
|
|
44
|
+
calls: calls.map((call) => ({
|
|
45
|
+
callSid: call.sid,
|
|
46
|
+
status: call.status,
|
|
47
|
+
to: call.to,
|
|
48
|
+
from: call.from,
|
|
49
|
+
direction: call.direction,
|
|
50
|
+
duration: call.duration,
|
|
51
|
+
dateCreated: call.dateCreated?.toISOString(),
|
|
52
|
+
})),
|
|
53
|
+
count: calls.length,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.ListCallsService = ListCallsService;
|
|
58
|
+
exports.ListCallsService = ListCallsService = __decorate([
|
|
59
|
+
(0, common_1.Injectable)(),
|
|
60
|
+
__metadata("design:paramtypes", [twilio_1.TwilioVoiceService])
|
|
61
|
+
], ListCallsService);
|
|
62
|
+
//# sourceMappingURL=list-calls.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-calls.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/list-calls.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAwE;AAKjE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACE;IAA7B,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAEvE,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAG9B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAE3D,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE;gBACJ,UAAU;gBACV,SAAS;aACV;SACF,CAAC;QAEF,MAAM,OAAO,GAKT,EAAE,CAAC;QAEP,IAAI,MAAM,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,EAAY,CAAC;QAChD,IAAI,MAAM,CAAC,IAAI;YAAE,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAc,CAAC;QACtD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAA2G,CAAC;QACtI,CAAC;QACD,IAAI,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEvE,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC1B,OAAO,EAAE,IAAI,CAAC,GAAG;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE;aAC7C,CAAC,CAAC;YACH,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF,CAAA;AAnDY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAEsC,2BAAkB;GADxD,gBAAgB,CAmD5B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioMessageService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class ListMessagesService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioMessageService;
|
|
5
|
+
constructor(twilioMessageService: TwilioMessageService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=list-messages.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-messages.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/list-messages.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,mBAAoB,YAAW,sBAAsB;IACpD,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB;IAEjE,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CA+CpC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.ListMessagesService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let ListMessagesService = class ListMessagesService {
|
|
16
|
+
twilioMessageService;
|
|
17
|
+
constructor(twilioMessageService) {
|
|
18
|
+
this.twilioMessageService = twilioMessageService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const accountSid = context.credentials?.accountSid;
|
|
22
|
+
const authToken = context.credentials?.authToken;
|
|
23
|
+
if (!accountSid || !authToken) {
|
|
24
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
25
|
+
}
|
|
26
|
+
const config = {
|
|
27
|
+
auth: {
|
|
28
|
+
accountSid,
|
|
29
|
+
authToken,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const options = {};
|
|
33
|
+
if (inputs.to)
|
|
34
|
+
options.to = inputs.to;
|
|
35
|
+
if (inputs.from)
|
|
36
|
+
options.from = inputs.from;
|
|
37
|
+
if (inputs.dateSent)
|
|
38
|
+
options.dateSent = new Date(inputs.dateSent);
|
|
39
|
+
if (inputs.dateSentBefore)
|
|
40
|
+
options.dateSentBefore = new Date(inputs.dateSentBefore);
|
|
41
|
+
if (inputs.dateSentAfter)
|
|
42
|
+
options.dateSentAfter = new Date(inputs.dateSentAfter);
|
|
43
|
+
if (inputs.limit)
|
|
44
|
+
options.limit = Number(inputs.limit);
|
|
45
|
+
const messages = await this.twilioMessageService.listMessages(config, options);
|
|
46
|
+
return {
|
|
47
|
+
messages: messages.map((msg) => ({
|
|
48
|
+
messageSid: msg.sid,
|
|
49
|
+
status: msg.status,
|
|
50
|
+
to: msg.to,
|
|
51
|
+
from: msg.from,
|
|
52
|
+
body: msg.body,
|
|
53
|
+
dateCreated: msg.dateCreated?.toISOString(),
|
|
54
|
+
dateSent: msg.dateSent?.toISOString(),
|
|
55
|
+
})),
|
|
56
|
+
count: messages.length,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.ListMessagesService = ListMessagesService;
|
|
61
|
+
exports.ListMessagesService = ListMessagesService = __decorate([
|
|
62
|
+
(0, common_1.Injectable)(),
|
|
63
|
+
__metadata("design:paramtypes", [twilio_1.TwilioMessageService])
|
|
64
|
+
], ListMessagesService);
|
|
65
|
+
//# sourceMappingURL=list-messages.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-messages.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/list-messages.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAA0E;AAKnE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACD;IAA7B,YAA6B,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAE3E,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAG9B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAE3D,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE;gBACJ,UAAU;gBACV,SAAS;aACV;SACF,CAAC;QAEF,MAAM,OAAO,GAOT,EAAE,CAAC;QAEP,IAAI,MAAM,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,EAAY,CAAC;QAChD,IAAI,MAAM,CAAC,IAAI;YAAE,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAc,CAAC;QACtD,IAAI,MAAM,CAAC,QAAQ;YAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,QAAkB,CAAC,CAAC;QAC5E,IAAI,MAAM,CAAC,cAAc;YAAE,OAAO,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,cAAwB,CAAC,CAAC;QAC9F,IAAI,MAAM,CAAC,aAAa;YAAE,OAAO,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,aAAuB,CAAC,CAAC;QAC3F,IAAI,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE/E,OAAO;YACL,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC/B,UAAU,EAAE,GAAG,CAAC,GAAG;gBACnB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE;gBAC3C,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE;aACtC,CAAC,CAAC;YACH,KAAK,EAAE,QAAQ,CAAC,MAAM;SACvB,CAAC;IACJ,CAAC;CACF,CAAA;AArDY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAEwC,6BAAoB;GAD5D,mBAAmB,CAqD/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioLookupService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class LookupPhoneNumberService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioLookupService;
|
|
5
|
+
constructor(twilioLookupService: TwilioLookupService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=lookup-phone-number.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup-phone-number.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/lookup-phone-number.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,wBAAyB,YAAW,sBAAsB;IACzD,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,mBAAmB;IAE/D,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CA+CpC"}
|
|
@@ -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.LookupPhoneNumberService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let LookupPhoneNumberService = class LookupPhoneNumberService {
|
|
16
|
+
twilioLookupService;
|
|
17
|
+
constructor(twilioLookupService) {
|
|
18
|
+
this.twilioLookupService = twilioLookupService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const phoneNumber = inputs.phoneNumber;
|
|
22
|
+
if (!phoneNumber) {
|
|
23
|
+
throw new Error('Phone number is required');
|
|
24
|
+
}
|
|
25
|
+
const accountSid = context.credentials?.accountSid;
|
|
26
|
+
const authToken = context.credentials?.authToken;
|
|
27
|
+
if (!accountSid || !authToken) {
|
|
28
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
29
|
+
}
|
|
30
|
+
const config = {
|
|
31
|
+
auth: {
|
|
32
|
+
accountSid,
|
|
33
|
+
authToken,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const options = {
|
|
37
|
+
phoneNumber,
|
|
38
|
+
};
|
|
39
|
+
if (inputs.countryCode)
|
|
40
|
+
options.countryCode = inputs.countryCode;
|
|
41
|
+
if (inputs.type) {
|
|
42
|
+
const typeArray = Array.isArray(inputs.type) ? inputs.type : [inputs.type];
|
|
43
|
+
options.type = typeArray.map((t) => t);
|
|
44
|
+
}
|
|
45
|
+
const lookup = await this.twilioLookupService.lookupPhoneNumber(config, options);
|
|
46
|
+
return {
|
|
47
|
+
phoneNumber: lookup.phoneNumber,
|
|
48
|
+
countryCode: lookup.countryCode,
|
|
49
|
+
nationalFormat: lookup.nationalFormat,
|
|
50
|
+
carrier: lookup.carrier,
|
|
51
|
+
callerName: lookup.callerName,
|
|
52
|
+
addOns: lookup.addOns,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.LookupPhoneNumberService = LookupPhoneNumberService;
|
|
57
|
+
exports.LookupPhoneNumberService = LookupPhoneNumberService = __decorate([
|
|
58
|
+
(0, common_1.Injectable)(),
|
|
59
|
+
__metadata("design:paramtypes", [twilio_1.TwilioLookupService])
|
|
60
|
+
], LookupPhoneNumberService);
|
|
61
|
+
//# sourceMappingURL=lookup-phone-number.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup-phone-number.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/lookup-phone-number.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAyE;AAKlE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACN;IAA7B,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAAG,CAAC;IAEzE,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAE9B,MAAM,WAAW,GAAG,MAAM,CAAC,WAAqB,CAAC;QAEjD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAGD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAE3D,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE;gBACJ,UAAU;gBACV,SAAS;aACV;SACF,CAAC;QAEF,MAAM,OAAO,GAIT;YACF,WAAW;SACZ,CAAC;QAEF,IAAI,MAAM,CAAC,WAAW;YAAE,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,WAAqB,CAAC;QAC3E,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3E,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAA8B,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEjF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;CACF,CAAA;AArDY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAEuC,4BAAmB;GAD1D,wBAAwB,CAqDpC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioVoiceService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class MakeCallService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioVoiceService;
|
|
5
|
+
constructor(twilioVoiceService: TwilioVoiceService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=make-call.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-call.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/make-call.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,eAAgB,YAAW,sBAAsB;IAChD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,kBAAkB;IAE7D,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAmEpC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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.MakeCallService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let MakeCallService = class MakeCallService {
|
|
16
|
+
twilioVoiceService;
|
|
17
|
+
constructor(twilioVoiceService) {
|
|
18
|
+
this.twilioVoiceService = twilioVoiceService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const to = inputs.to;
|
|
22
|
+
const url = inputs.url;
|
|
23
|
+
const twiml = inputs.twiml;
|
|
24
|
+
if (!to) {
|
|
25
|
+
throw new Error('Phone number (to) is required');
|
|
26
|
+
}
|
|
27
|
+
if (!url && !twiml) {
|
|
28
|
+
throw new Error('Either URL or TwiML is required');
|
|
29
|
+
}
|
|
30
|
+
const accountSid = context.credentials?.accountSid;
|
|
31
|
+
const authToken = context.credentials?.authToken;
|
|
32
|
+
const phoneNumberFrom = context.credentials?.fromNumber || undefined;
|
|
33
|
+
if (!accountSid || !authToken) {
|
|
34
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
35
|
+
}
|
|
36
|
+
const config = phoneNumberFrom
|
|
37
|
+
? {
|
|
38
|
+
auth: {
|
|
39
|
+
accountSid,
|
|
40
|
+
authToken,
|
|
41
|
+
},
|
|
42
|
+
phoneNumber: phoneNumberFrom,
|
|
43
|
+
}
|
|
44
|
+
: {
|
|
45
|
+
auth: {
|
|
46
|
+
accountSid,
|
|
47
|
+
authToken,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
const callOptions = {
|
|
51
|
+
to,
|
|
52
|
+
};
|
|
53
|
+
if (url)
|
|
54
|
+
callOptions.url = url;
|
|
55
|
+
if (twiml)
|
|
56
|
+
callOptions.twiml = twiml;
|
|
57
|
+
if (inputs.method)
|
|
58
|
+
callOptions.method = inputs.method;
|
|
59
|
+
if (inputs.record !== undefined)
|
|
60
|
+
callOptions.record = inputs.record;
|
|
61
|
+
if (inputs.timeout)
|
|
62
|
+
callOptions.timeout = Number(inputs.timeout);
|
|
63
|
+
const call = await this.twilioVoiceService.makeCall(config, callOptions);
|
|
64
|
+
return {
|
|
65
|
+
callSid: call.sid,
|
|
66
|
+
status: call.status,
|
|
67
|
+
to: call.to,
|
|
68
|
+
from: call.from,
|
|
69
|
+
direction: call.direction,
|
|
70
|
+
dateCreated: call.dateCreated?.toISOString(),
|
|
71
|
+
startTime: call.startTime?.toISOString(),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.MakeCallService = MakeCallService;
|
|
76
|
+
exports.MakeCallService = MakeCallService = __decorate([
|
|
77
|
+
(0, common_1.Injectable)(),
|
|
78
|
+
__metadata("design:paramtypes", [twilio_1.TwilioVoiceService])
|
|
79
|
+
], MakeCallService);
|
|
80
|
+
//# sourceMappingURL=make-call.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-call.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/make-call.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAwE;AAKjE,IAAM,eAAe,GAArB,MAAM,eAAe;IACG;IAA7B,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAEvE,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAE9B,MAAM,EAAE,GAAG,MAAM,CAAC,EAAY,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAyB,CAAC;QAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,KAA2B,CAAC;QAEjD,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QAGD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAC3D,MAAM,eAAe,GAAI,OAAO,CAAC,WAAW,EAAE,UAAqB,IAAI,SAAS,CAAC;QAEjF,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB,eAAe;YACjD,CAAC,CAAC;gBACE,IAAI,EAAE;oBACJ,UAAU;oBACV,SAAS;iBACV;gBACD,WAAW,EAAE,eAAe;aAC7B;YACH,CAAC,CAAC;gBACE,IAAI,EAAE;oBACJ,UAAU;oBACV,SAAS;iBACV;aACF,CAAC;QAEN,MAAM,WAAW,GAQb;YACF,EAAE;SACH,CAAC;QAEF,IAAI,GAAG;YAAE,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC;QAC/B,IAAI,KAAK;YAAE,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;QACrC,IAAI,MAAM,CAAC,MAAM;YAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,MAAwB,CAAC;QACxE,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,MAAiB,CAAC;QAC/E,IAAI,MAAM,CAAC,OAAO;YAAE,WAAW,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEjE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEzE,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,GAAG;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE;YAC5C,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE;SACzC,CAAC;IACJ,CAAC;CACF,CAAA;AAzEY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAEsC,2BAAkB;GADxD,eAAe,CAyE3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioConversationService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class SendConversationMessageService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioConversationService;
|
|
5
|
+
constructor(twilioConversationService: TwilioConversationService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=send-conversation-message.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-conversation-message.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/send-conversation-message.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,8BAA+B,YAAW,sBAAsB;IAC/D,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAE3E,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CA2CpC"}
|
|
@@ -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.SendConversationMessageService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let SendConversationMessageService = class SendConversationMessageService {
|
|
16
|
+
twilioConversationService;
|
|
17
|
+
constructor(twilioConversationService) {
|
|
18
|
+
this.twilioConversationService = twilioConversationService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const conversationSid = inputs.conversationSid;
|
|
22
|
+
const body = inputs.body;
|
|
23
|
+
const author = inputs.author;
|
|
24
|
+
if (!conversationSid) {
|
|
25
|
+
throw new Error('Conversation SID is required');
|
|
26
|
+
}
|
|
27
|
+
if (!body) {
|
|
28
|
+
throw new Error('Message body is required');
|
|
29
|
+
}
|
|
30
|
+
const accountSid = context.credentials?.accountSid;
|
|
31
|
+
const authToken = context.credentials?.authToken;
|
|
32
|
+
if (!accountSid || !authToken) {
|
|
33
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
34
|
+
}
|
|
35
|
+
const config = {
|
|
36
|
+
auth: {
|
|
37
|
+
accountSid,
|
|
38
|
+
authToken,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const message = await this.twilioConversationService.createMessage(config, {
|
|
42
|
+
conversationSid,
|
|
43
|
+
body,
|
|
44
|
+
author,
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
messageSid: message.sid,
|
|
48
|
+
conversationSid: message.conversationSid,
|
|
49
|
+
author: message.author,
|
|
50
|
+
body: message.body,
|
|
51
|
+
dateCreated: message.dateCreated?.toISOString(),
|
|
52
|
+
index: message.index,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.SendConversationMessageService = SendConversationMessageService;
|
|
57
|
+
exports.SendConversationMessageService = SendConversationMessageService = __decorate([
|
|
58
|
+
(0, common_1.Injectable)(),
|
|
59
|
+
__metadata("design:paramtypes", [twilio_1.TwilioConversationService])
|
|
60
|
+
], SendConversationMessageService);
|
|
61
|
+
//# sourceMappingURL=send-conversation-message.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-conversation-message.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/send-conversation-message.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAA+E;AAKxE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACZ;IAA7B,YAA6B,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA2B;IAAG,CAAC;IAErF,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAE9B,MAAM,eAAe,GAAG,MAAM,CAAC,eAAyB,CAAC;QACzD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAc,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAA4B,CAAC;QAEnD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAGD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAE3D,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE;gBACJ,UAAU;gBACV,SAAS;aACV;SACF,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,aAAa,CAAC,MAAM,EAAE;YACzE,eAAe;YACf,IAAI;YACJ,MAAM;SACP,CAAC,CAAC;QAEH,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,GAAG;YACvB,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE;YAC/C,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC;IACJ,CAAC;CACF,CAAA;AAjDY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;qCAE6C,kCAAyB;GADtE,8BAA8B,CAiD1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-sms.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/send-sms.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"send-sms.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/send-sms.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,cAAe,YAAW,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB;IAEjE,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAgDpC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioVerifyService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class SendVerificationService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioVerifyService;
|
|
5
|
+
constructor(twilioVerifyService: TwilioVerifyService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=send-verification.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-verification.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/send-verification.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,uBAAwB,YAAW,sBAAsB;IACxD,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,mBAAmB;IAE/D,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAuDpC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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.SendVerificationService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let SendVerificationService = class SendVerificationService {
|
|
16
|
+
twilioVerifyService;
|
|
17
|
+
constructor(twilioVerifyService) {
|
|
18
|
+
this.twilioVerifyService = twilioVerifyService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const to = inputs.to;
|
|
22
|
+
const serviceSid = inputs.serviceSid;
|
|
23
|
+
const channel = inputs.channel || 'sms';
|
|
24
|
+
if (!to) {
|
|
25
|
+
throw new Error('Phone number (to) is required');
|
|
26
|
+
}
|
|
27
|
+
if (!serviceSid) {
|
|
28
|
+
throw new Error('Verify Service SID is required');
|
|
29
|
+
}
|
|
30
|
+
const accountSid = context.credentials?.accountSid;
|
|
31
|
+
const authToken = context.credentials?.authToken;
|
|
32
|
+
if (!accountSid || !authToken) {
|
|
33
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
34
|
+
}
|
|
35
|
+
const config = {
|
|
36
|
+
auth: {
|
|
37
|
+
accountSid,
|
|
38
|
+
authToken,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const verificationOptions = {
|
|
42
|
+
to,
|
|
43
|
+
channel: channel,
|
|
44
|
+
};
|
|
45
|
+
if (inputs.customMessage)
|
|
46
|
+
verificationOptions.customMessage = inputs.customMessage;
|
|
47
|
+
if (inputs.customCode)
|
|
48
|
+
verificationOptions.customCode = inputs.customCode;
|
|
49
|
+
const verification = await this.twilioVerifyService.sendVerification(config, serviceSid, verificationOptions);
|
|
50
|
+
return {
|
|
51
|
+
verificationSid: verification.sid,
|
|
52
|
+
status: verification.status,
|
|
53
|
+
to: verification.to,
|
|
54
|
+
channel: verification.channel,
|
|
55
|
+
dateCreated: verification.dateCreated?.toISOString(),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.SendVerificationService = SendVerificationService;
|
|
60
|
+
exports.SendVerificationService = SendVerificationService = __decorate([
|
|
61
|
+
(0, common_1.Injectable)(),
|
|
62
|
+
__metadata("design:paramtypes", [twilio_1.TwilioVerifyService])
|
|
63
|
+
], SendVerificationService);
|
|
64
|
+
//# sourceMappingURL=send-verification.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-verification.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/send-verification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAyE;AAKlE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACL;IAA7B,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAAG,CAAC;IAEzE,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAE9B,MAAM,EAAE,GAAG,MAAM,CAAC,EAAY,CAAC;QAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAoB,CAAC;QAC/C,MAAM,OAAO,GAAI,MAAM,CAAC,OAAkB,IAAI,KAAK,CAAC;QAEpD,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QAGD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAE3D,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE;gBACJ,UAAU;gBACV,SAAS;aACV;SACF,CAAC;QAEF,MAAM,mBAAmB,GAKrB;YACF,EAAE;YACF,OAAO,EAAE,OAAiE;SAC3E,CAAC;QAEF,IAAI,MAAM,CAAC,aAAa;YAAE,mBAAmB,CAAC,aAAa,GAAG,MAAM,CAAC,aAAuB,CAAC;QAC7F,IAAI,MAAM,CAAC,UAAU;YAAE,mBAAmB,CAAC,UAAU,GAAG,MAAM,CAAC,UAAoB,CAAC;QAEpF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAClE,MAAM,EACN,UAAU,EACV,mBAAmB,CACpB,CAAC;QAEF,OAAO;YACL,eAAe,EAAE,YAAY,CAAC,GAAG;YACjC,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,EAAE,EAAE,YAAY,CAAC,EAAE;YACnB,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,WAAW,EAAE,YAAY,CAAC,WAAW,EAAE,WAAW,EAAE;SACrD,CAAC;IACJ,CAAC;CACF,CAAA;AA7DY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAEuC,4BAAmB;GAD1D,uBAAuB,CA6DnC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioVoiceService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class UpdateCallService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioVoiceService;
|
|
5
|
+
constructor(twilioVoiceService: TwilioVoiceService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=update-call.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-call.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/update-call.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,iBAAkB,YAAW,sBAAsB;IAClD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,kBAAkB;IAE7D,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAgDpC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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.UpdateCallService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const twilio_1 = require("@venturialstd/twilio");
|
|
15
|
+
let UpdateCallService = class UpdateCallService {
|
|
16
|
+
twilioVoiceService;
|
|
17
|
+
constructor(twilioVoiceService) {
|
|
18
|
+
this.twilioVoiceService = twilioVoiceService;
|
|
19
|
+
}
|
|
20
|
+
async perform(inputs, context) {
|
|
21
|
+
const callSid = inputs.callSid;
|
|
22
|
+
const status = inputs.status;
|
|
23
|
+
const url = inputs.url;
|
|
24
|
+
const twiml = inputs.twiml;
|
|
25
|
+
if (!callSid) {
|
|
26
|
+
throw new Error('Call SID is required');
|
|
27
|
+
}
|
|
28
|
+
if (!status && !url && !twiml) {
|
|
29
|
+
throw new Error('At least one of status, URL, or TwiML is required');
|
|
30
|
+
}
|
|
31
|
+
const accountSid = context.credentials?.accountSid;
|
|
32
|
+
const authToken = context.credentials?.authToken;
|
|
33
|
+
if (!accountSid || !authToken) {
|
|
34
|
+
throw new Error('Twilio credentials (accountSid and authToken) are required');
|
|
35
|
+
}
|
|
36
|
+
const config = {
|
|
37
|
+
auth: {
|
|
38
|
+
accountSid,
|
|
39
|
+
authToken,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const updateOptions = { callSid };
|
|
43
|
+
if (status)
|
|
44
|
+
updateOptions.status = status;
|
|
45
|
+
if (url)
|
|
46
|
+
updateOptions.url = url;
|
|
47
|
+
if (twiml)
|
|
48
|
+
updateOptions.twiml = twiml;
|
|
49
|
+
const call = await this.twilioVoiceService.updateCall(config, updateOptions);
|
|
50
|
+
return {
|
|
51
|
+
callSid: call.sid,
|
|
52
|
+
status: call.status,
|
|
53
|
+
dateUpdated: call.dateUpdated?.toISOString(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.UpdateCallService = UpdateCallService;
|
|
58
|
+
exports.UpdateCallService = UpdateCallService = __decorate([
|
|
59
|
+
(0, common_1.Injectable)(),
|
|
60
|
+
__metadata("design:paramtypes", [twilio_1.TwilioVoiceService])
|
|
61
|
+
], UpdateCallService);
|
|
62
|
+
//# sourceMappingURL=update-call.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-call.service.js","sourceRoot":"","sources":["../../../../src/modules/twilio/services/update-call.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAwE;AAKjE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACC;IAA7B,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAEvE,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,OAA8B;QAE9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAiB,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,MAA4B,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAyB,CAAC;QAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,KAA2B,CAAC;QAEjD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAGD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,UAAoB,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,SAAmB,CAAC;QAE3D,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE;gBACJ,UAAU;gBACV,SAAS;aACV;SACF,CAAC;QAEF,MAAM,aAAa,GAKf,EAAE,OAAO,EAAE,CAAC;QAEhB,IAAI,MAAM;YAAE,aAAa,CAAC,MAAM,GAAG,MAAkC,CAAC;QACtE,IAAI,GAAG;YAAE,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;QACjC,IAAI,KAAK;YAAE,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAEvC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAE7E,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,GAAG;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE;SAC7C,CAAC;IACJ,CAAC;CACF,CAAA;AAtDY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAEsC,2BAAkB;GADxD,iBAAiB,CAsD7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TwilioMessageService } from '@venturialstd/twilio';
|
|
2
|
+
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
|
+
export declare class UpdateMessageService implements IWorkflowActionService {
|
|
4
|
+
private readonly twilioMessageService;
|
|
5
|
+
constructor(twilioMessageService: TwilioMessageService);
|
|
6
|
+
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=update-message.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-message.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/twilio/services/update-message.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,oBAAqB,YAAW,sBAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB;IAEjE,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAoCpC"}
|