dt-common-device 13.3.11 → 13.3.13
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/Integrations/twilio/index.d.ts +1 -1
- package/dist/Integrations/twilio/index.js +1 -1
- package/dist/Integrations/twilio/interface/twilioInterface.d.ts +5 -0
- package/dist/Integrations/twilio/interface/twilioInterface.js +2 -0
- package/dist/Integrations/twilio/twilio.service.d.ts +1 -1
- package/dist/Integrations/twilio/twilio.service.js +9 -7
- package/dist/utils/redis.utils.d.ts +5 -0
- package/dist/utils/redis.utils.js +7 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./twilio.service";
|
|
2
|
-
export * from "./interface/
|
|
2
|
+
export * from "./interface/twilioInterface";
|
|
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./twilio.service"), exports);
|
|
18
|
-
__exportStar(require("./interface/
|
|
18
|
+
__exportStar(require("./interface/twilioInterface"), exports);
|
|
@@ -94,9 +94,15 @@ let TwilioService = (() => {
|
|
|
94
94
|
// Send SMS
|
|
95
95
|
// -----------------------------
|
|
96
96
|
async sendSMS(data) {
|
|
97
|
-
const { propertyId, message } = data;
|
|
97
|
+
const { propertyId, message, toNumber } = data;
|
|
98
|
+
if (!toNumber) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
98
101
|
//find fromNumber from the dt_connections table based on the propertyId
|
|
99
|
-
const response = await this.connectionRepository.queryConnections({
|
|
102
|
+
const response = await this.connectionRepository.queryConnections({
|
|
103
|
+
propertyId,
|
|
104
|
+
connectionProvider: IConnection_1.ConnectionProvider.Twilio,
|
|
105
|
+
});
|
|
100
106
|
//need connectionId, clientSecret, metaData
|
|
101
107
|
const { clientId, clientSecret, metaData } = response[0];
|
|
102
108
|
const fromNumber = metaData?.fromNumber;
|
|
@@ -109,14 +115,10 @@ let TwilioService = (() => {
|
|
|
109
115
|
throw new Error("Property settings not found");
|
|
110
116
|
}
|
|
111
117
|
const smsEnabled = _settingsRes?.settings?.notificationPreferences?.smsNotification?.enabled;
|
|
112
|
-
const toNumber = _settingsRes?.settings?.notificationPreferences?.smsNotification?.toNumber;
|
|
113
|
-
if (!toNumber) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
118
|
if (!smsEnabled) {
|
|
117
119
|
return;
|
|
118
120
|
}
|
|
119
|
-
//TODO: Need to do
|
|
121
|
+
//TODO: Need to do single tone pattern for the client
|
|
120
122
|
const client = (0, twilio_1.default)(clientId, clientSecret);
|
|
121
123
|
try {
|
|
122
124
|
const smsResponse = await client.messages.create({
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare class RedisUtils {
|
|
2
2
|
private readonly client;
|
|
3
|
+
/**
|
|
4
|
+
* Get the Redis client instance
|
|
5
|
+
* @returns The Redis client instance
|
|
6
|
+
*/
|
|
7
|
+
getClient(): Promise<import("ioredis").default>;
|
|
3
8
|
/**
|
|
4
9
|
* Get a value from Redis
|
|
5
10
|
* @param key - The key to get
|
|
@@ -50,6 +50,13 @@ let RedisUtils = (() => {
|
|
|
50
50
|
constructor() {
|
|
51
51
|
this.client = (0, redis_1.getRedisClient)(); // singleton Redis client instance
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the Redis client instance
|
|
55
|
+
* @returns The Redis client instance
|
|
56
|
+
*/
|
|
57
|
+
async getClient() {
|
|
58
|
+
return this.client;
|
|
59
|
+
}
|
|
53
60
|
/**
|
|
54
61
|
* Get a value from Redis
|
|
55
62
|
* @param key - The key to get
|