@xbg.solutions/utils-sms-connector 1.0.0
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/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +83 -0
- package/lib/index.js.map +1 -0
- package/lib/providers/messagebird-provider.d.ts +36 -0
- package/lib/providers/messagebird-provider.d.ts.map +1 -0
- package/lib/providers/messagebird-provider.js +175 -0
- package/lib/providers/messagebird-provider.js.map +1 -0
- package/lib/providers/twilio-provider.d.ts +37 -0
- package/lib/providers/twilio-provider.d.ts.map +1 -0
- package/lib/providers/twilio-provider.js +132 -0
- package/lib/providers/twilio-provider.js.map +1 -0
- package/lib/sms-connector.d.ts +36 -0
- package/lib/sms-connector.d.ts.map +1 -0
- package/lib/sms-connector.js +101 -0
- package/lib/sms-connector.js.map +1 -0
- package/lib/types.d.ts +51 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +6 -0
- package/lib/types.js.map +1 -0
- package/package.json +31 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMS Connector Barrel Export
|
|
3
|
+
*/
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './sms-connector';
|
|
6
|
+
export * from './providers/twilio-provider';
|
|
7
|
+
export * from './providers/messagebird-provider';
|
|
8
|
+
import { SMSConnector } from './sms-connector';
|
|
9
|
+
export declare function initializeSMSConnector(config: any): void;
|
|
10
|
+
/**
|
|
11
|
+
* Factory function to create SMS connector with configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare function createSMSConnector(): SMSConnector | null;
|
|
14
|
+
export declare function getSMSConnector(): SMSConnector | null;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAO/C,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAIxD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,CAyCxD;AAOD,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAKrD"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SMS Connector Barrel Export
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.initializeSMSConnector = initializeSMSConnector;
|
|
21
|
+
exports.createSMSConnector = createSMSConnector;
|
|
22
|
+
exports.getSMSConnector = getSMSConnector;
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./sms-connector"), exports);
|
|
25
|
+
__exportStar(require("./providers/twilio-provider"), exports);
|
|
26
|
+
__exportStar(require("./providers/messagebird-provider"), exports);
|
|
27
|
+
const sms_connector_1 = require("./sms-connector");
|
|
28
|
+
const twilio_provider_1 = require("./providers/twilio-provider");
|
|
29
|
+
const messagebird_provider_1 = require("./providers/messagebird-provider");
|
|
30
|
+
// Config is provided via initializeSMSConnector() at app startup
|
|
31
|
+
let connectorConfig = null;
|
|
32
|
+
function initializeSMSConnector(config) {
|
|
33
|
+
connectorConfig = config;
|
|
34
|
+
// Reset singleton so it gets re-created with new config
|
|
35
|
+
smsConnectorInstance = undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create SMS connector with configuration
|
|
39
|
+
*/
|
|
40
|
+
function createSMSConnector() {
|
|
41
|
+
if (!connectorConfig) {
|
|
42
|
+
throw new Error('SMS connector not initialized. Call initializeSMSConnector() first.');
|
|
43
|
+
}
|
|
44
|
+
if (!connectorConfig.sms.enabled) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const provider = connectorConfig.sms.provider;
|
|
48
|
+
if (provider === 'twilio') {
|
|
49
|
+
const twilioConfig = connectorConfig.sms.providers.twilio;
|
|
50
|
+
if (!twilioConfig) {
|
|
51
|
+
throw new Error('Twilio configuration not found');
|
|
52
|
+
}
|
|
53
|
+
const twilioProvider = new twilio_provider_1.TwilioProvider({
|
|
54
|
+
accountSid: twilioConfig.accountSid,
|
|
55
|
+
authToken: twilioConfig.authToken,
|
|
56
|
+
fromNumber: twilioConfig.fromNumber,
|
|
57
|
+
});
|
|
58
|
+
return new sms_connector_1.SMSConnector(twilioProvider);
|
|
59
|
+
}
|
|
60
|
+
if (provider === 'messagebird') {
|
|
61
|
+
const messagebirdConfig = connectorConfig.sms.providers.messagebird;
|
|
62
|
+
if (!messagebirdConfig) {
|
|
63
|
+
throw new Error('MessageBird configuration not found');
|
|
64
|
+
}
|
|
65
|
+
const messagebirdProvider = new messagebird_provider_1.MessageBirdProvider({
|
|
66
|
+
apiKey: messagebirdConfig.apiKey,
|
|
67
|
+
fromNumber: messagebirdConfig.fromNumber,
|
|
68
|
+
});
|
|
69
|
+
return new sms_connector_1.SMSConnector(messagebirdProvider);
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`Unsupported SMS provider: ${provider}`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Singleton instance (lazy-loaded)
|
|
75
|
+
*/
|
|
76
|
+
let smsConnectorInstance;
|
|
77
|
+
function getSMSConnector() {
|
|
78
|
+
if (smsConnectorInstance === undefined) {
|
|
79
|
+
smsConnectorInstance = createSMSConnector();
|
|
80
|
+
}
|
|
81
|
+
return smsConnectorInstance;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAcH,wDAIC;AAKD,gDAyCC;AAOD,0CAKC;AA1ED,0CAAwB;AACxB,kDAAgC;AAChC,8DAA4C;AAC5C,mEAAiD;AAEjD,mDAA+C;AAC/C,iEAA6D;AAC7D,2EAAuE;AAEvE,iEAAiE;AACjE,IAAI,eAAe,GAAQ,IAAI,CAAC;AAEhC,SAAgB,sBAAsB,CAAC,MAAW;IAChD,eAAe,GAAG,MAAM,CAAC;IACzB,wDAAwD;IACxD,oBAAoB,GAAG,SAAS,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB;IAChC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC;IAE9C,IAAI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API
|
|
4
|
+
*/
|
|
5
|
+
import { SMSProvider } from '../sms-connector';
|
|
6
|
+
import { SMSRequest, SMSResult, BulkSMSResult, MessageStatus, DeliveryReport } from '../types';
|
|
7
|
+
export interface MessageBirdConfig {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
fromNumber: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class MessageBirdProvider implements SMSProvider {
|
|
12
|
+
private client;
|
|
13
|
+
private config;
|
|
14
|
+
constructor(config: MessageBirdConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Send SMS message
|
|
17
|
+
*/
|
|
18
|
+
sendMessage(request: SMSRequest): Promise<SMSResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Send bulk SMS messages
|
|
21
|
+
*/
|
|
22
|
+
sendBulk(requests: SMSRequest[]): Promise<BulkSMSResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Get message status
|
|
25
|
+
*/
|
|
26
|
+
getMessageStatus(messageId: string): Promise<MessageStatus>;
|
|
27
|
+
/**
|
|
28
|
+
* Get delivery report
|
|
29
|
+
*/
|
|
30
|
+
getDeliveryReport(messageId: string): Promise<DeliveryReport>;
|
|
31
|
+
/**
|
|
32
|
+
* Map MessageBird status to standard status
|
|
33
|
+
*/
|
|
34
|
+
private mapMessageBirdStatus;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=messagebird-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagebird-provider.d.ts","sourceRoot":"","sources":["../../src/providers/messagebird-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,EAAE,iBAAiB;IAKrC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAgD1D;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAkC9D;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA2BjE;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6BnE;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAc7B"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MessageBird SMS Provider
|
|
4
|
+
* Implementation using MessageBird API
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MessageBirdProvider = void 0;
|
|
8
|
+
const messagebird_1 = require("messagebird");
|
|
9
|
+
class MessageBirdProvider {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.client = (0, messagebird_1.initClient)(config.apiKey);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Send SMS message
|
|
16
|
+
*/
|
|
17
|
+
async sendMessage(request) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
try {
|
|
20
|
+
const params = {
|
|
21
|
+
originator: request.from || this.config.fromNumber,
|
|
22
|
+
recipients: [request.to],
|
|
23
|
+
body: request.message,
|
|
24
|
+
};
|
|
25
|
+
// Add validity period (in seconds)
|
|
26
|
+
if (request.validityPeriod) {
|
|
27
|
+
params.validity = request.validityPeriod;
|
|
28
|
+
}
|
|
29
|
+
// Add reference if provided in metadata
|
|
30
|
+
if ((_a = request.metadata) === null || _a === void 0 ? void 0 : _a.reference) {
|
|
31
|
+
params.reference = request.metadata.reference;
|
|
32
|
+
}
|
|
33
|
+
const result = await new Promise((resolve, reject) => {
|
|
34
|
+
this.client.messages.create(params, (err, response) => {
|
|
35
|
+
if (err) {
|
|
36
|
+
reject(err);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
resolve(response);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
messageId: result.id,
|
|
46
|
+
provider: 'messagebird',
|
|
47
|
+
timestamp: new Date(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: {
|
|
54
|
+
code: ((_b = error.code) === null || _b === void 0 ? void 0 : _b.toString()) || 'MESSAGEBIRD_ERROR',
|
|
55
|
+
message: error.message || 'Unknown MessageBird error',
|
|
56
|
+
details: error.errors || error,
|
|
57
|
+
},
|
|
58
|
+
provider: 'messagebird',
|
|
59
|
+
timestamp: new Date(),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Send bulk SMS messages
|
|
65
|
+
*/
|
|
66
|
+
async sendBulk(requests) {
|
|
67
|
+
const results = [];
|
|
68
|
+
let successful = 0;
|
|
69
|
+
let failed = 0;
|
|
70
|
+
let totalCost = 0;
|
|
71
|
+
// MessageBird supports batch sending, but we'll process sequentially for consistency
|
|
72
|
+
for (const request of requests) {
|
|
73
|
+
const result = await this.sendMessage(request);
|
|
74
|
+
results.push(result);
|
|
75
|
+
if (result.success) {
|
|
76
|
+
successful++;
|
|
77
|
+
if (result.cost) {
|
|
78
|
+
totalCost += result.cost;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
failed++;
|
|
83
|
+
}
|
|
84
|
+
// Rate limiting: small delay between messages
|
|
85
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
success: failed === 0,
|
|
89
|
+
successful,
|
|
90
|
+
failed,
|
|
91
|
+
results,
|
|
92
|
+
totalCost,
|
|
93
|
+
timestamp: new Date(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get message status
|
|
98
|
+
*/
|
|
99
|
+
async getMessageStatus(messageId) {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
try {
|
|
102
|
+
const message = await new Promise((resolve, reject) => {
|
|
103
|
+
this.client.messages.read(messageId, (err, response) => {
|
|
104
|
+
if (err) {
|
|
105
|
+
reject(err);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
resolve(response);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
messageId: message.id,
|
|
114
|
+
status: this.mapMessageBirdStatus(message.status),
|
|
115
|
+
to: message.recipients.msisdn || '',
|
|
116
|
+
from: message.originator,
|
|
117
|
+
body: message.body,
|
|
118
|
+
errorCode: (_b = (_a = message.recipients) === null || _a === void 0 ? void 0 : _a.statusReason) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
119
|
+
errorMessage: undefined,
|
|
120
|
+
timestamp: new Date(message.createdDatetime),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
throw new Error(`Failed to get message status: ${error.message}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get delivery report
|
|
129
|
+
*/
|
|
130
|
+
async getDeliveryReport(messageId) {
|
|
131
|
+
var _a, _b, _c;
|
|
132
|
+
try {
|
|
133
|
+
const message = await new Promise((resolve, reject) => {
|
|
134
|
+
this.client.messages.read(messageId, (err, response) => {
|
|
135
|
+
if (err) {
|
|
136
|
+
reject(err);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
resolve(response);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
const recipient = (_b = (_a = message.recipients) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b[0];
|
|
144
|
+
const delivered = (recipient === null || recipient === void 0 ? void 0 : recipient.status) === 'delivered';
|
|
145
|
+
return {
|
|
146
|
+
messageId: message.id,
|
|
147
|
+
delivered,
|
|
148
|
+
deliveredAt: delivered && (recipient === null || recipient === void 0 ? void 0 : recipient.statusDatetime)
|
|
149
|
+
? new Date(recipient.statusDatetime)
|
|
150
|
+
: undefined,
|
|
151
|
+
errorCode: (_c = recipient === null || recipient === void 0 ? void 0 : recipient.statusReason) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
152
|
+
errorMessage: undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
throw new Error(`Failed to get delivery report: ${error.message}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Map MessageBird status to standard status
|
|
161
|
+
*/
|
|
162
|
+
mapMessageBirdStatus(messagebirdStatus) {
|
|
163
|
+
const statusMap = {
|
|
164
|
+
scheduled: 'queued',
|
|
165
|
+
buffered: 'queued',
|
|
166
|
+
sent: 'sent',
|
|
167
|
+
delivered: 'delivered',
|
|
168
|
+
expired: 'failed',
|
|
169
|
+
delivery_failed: 'undelivered',
|
|
170
|
+
};
|
|
171
|
+
return statusMap[messagebirdStatus] || 'failed';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.MessageBirdProvider = MessageBirdProvider;
|
|
175
|
+
//# sourceMappingURL=messagebird-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagebird-provider.js","sourceRoot":"","sources":["../../src/providers/messagebird-provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAAsD;AAStD,MAAa,mBAAmB;IAI9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AAI,QAAQ,CAAC;IAClD,CAAC;CACF;AAhLD,kDAgLC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Twilio SMS Provider
|
|
3
|
+
* Implementation using Twilio API
|
|
4
|
+
*/
|
|
5
|
+
import { SMSProvider } from '../sms-connector';
|
|
6
|
+
import { SMSRequest, SMSResult, BulkSMSResult, MessageStatus, DeliveryReport } from '../types';
|
|
7
|
+
export interface TwilioConfig {
|
|
8
|
+
accountSid: string;
|
|
9
|
+
authToken: string;
|
|
10
|
+
fromNumber: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class TwilioProvider implements SMSProvider {
|
|
13
|
+
private client;
|
|
14
|
+
private config;
|
|
15
|
+
constructor(config: TwilioConfig);
|
|
16
|
+
/**
|
|
17
|
+
* Send SMS message
|
|
18
|
+
*/
|
|
19
|
+
sendMessage(request: SMSRequest): Promise<SMSResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Send bulk SMS messages
|
|
22
|
+
*/
|
|
23
|
+
sendBulk(requests: SMSRequest[]): Promise<BulkSMSResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Get message status
|
|
26
|
+
*/
|
|
27
|
+
getMessageStatus(messageId: string): Promise<MessageStatus>;
|
|
28
|
+
/**
|
|
29
|
+
* Get delivery report
|
|
30
|
+
*/
|
|
31
|
+
getDeliveryReport(messageId: string): Promise<DeliveryReport>;
|
|
32
|
+
/**
|
|
33
|
+
* Map Twilio status to standard status
|
|
34
|
+
*/
|
|
35
|
+
private mapTwilioStatus;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=twilio-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twilio-provider.d.ts","sourceRoot":"","sources":["../../src/providers/twilio-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/F,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,YAAY;IAKhC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAmC1D;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAkC9D;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAejE;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAYnE;;OAEG;IACH,OAAO,CAAC,eAAe;CAcxB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Twilio SMS Provider
|
|
4
|
+
* Implementation using Twilio API
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TwilioProvider = void 0;
|
|
8
|
+
const twilio_1 = require("twilio");
|
|
9
|
+
class TwilioProvider {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.client = new twilio_1.Twilio(config.accountSid, config.authToken);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Send SMS message
|
|
16
|
+
*/
|
|
17
|
+
async sendMessage(request) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
try {
|
|
20
|
+
const message = await this.client.messages.create({
|
|
21
|
+
body: request.message,
|
|
22
|
+
from: request.from || this.config.fromNumber,
|
|
23
|
+
to: request.to,
|
|
24
|
+
mediaUrl: request.mediaUrls,
|
|
25
|
+
validityPeriod: request.validityPeriod,
|
|
26
|
+
statusCallback: (_a = request.metadata) === null || _a === void 0 ? void 0 : _a.statusCallback,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
messageId: message.sid,
|
|
31
|
+
cost: message.price ? Math.abs(parseFloat(message.price)) : undefined,
|
|
32
|
+
provider: 'twilio',
|
|
33
|
+
timestamp: new Date(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
error: {
|
|
40
|
+
code: ((_b = error.code) === null || _b === void 0 ? void 0 : _b.toString()) || 'TWILIO_ERROR',
|
|
41
|
+
message: error.message || 'Unknown Twilio error',
|
|
42
|
+
details: {
|
|
43
|
+
status: error.status,
|
|
44
|
+
moreInfo: error.moreInfo,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
provider: 'twilio',
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Send bulk SMS messages
|
|
54
|
+
*/
|
|
55
|
+
async sendBulk(requests) {
|
|
56
|
+
const results = [];
|
|
57
|
+
let successful = 0;
|
|
58
|
+
let failed = 0;
|
|
59
|
+
let totalCost = 0;
|
|
60
|
+
// Twilio doesn't have native batch send, so we send sequentially with rate limiting
|
|
61
|
+
for (const request of requests) {
|
|
62
|
+
const result = await this.sendMessage(request);
|
|
63
|
+
results.push(result);
|
|
64
|
+
if (result.success) {
|
|
65
|
+
successful++;
|
|
66
|
+
if (result.cost) {
|
|
67
|
+
totalCost += result.cost;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
failed++;
|
|
72
|
+
}
|
|
73
|
+
// Rate limiting: small delay between messages
|
|
74
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
success: failed === 0,
|
|
78
|
+
successful,
|
|
79
|
+
failed,
|
|
80
|
+
results,
|
|
81
|
+
totalCost,
|
|
82
|
+
timestamp: new Date(),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get message status
|
|
87
|
+
*/
|
|
88
|
+
async getMessageStatus(messageId) {
|
|
89
|
+
var _a;
|
|
90
|
+
const message = await this.client.messages(messageId).fetch();
|
|
91
|
+
return {
|
|
92
|
+
messageId: message.sid,
|
|
93
|
+
status: this.mapTwilioStatus(message.status),
|
|
94
|
+
to: message.to,
|
|
95
|
+
from: message.from,
|
|
96
|
+
body: message.body,
|
|
97
|
+
errorCode: (_a = message.errorCode) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
98
|
+
errorMessage: message.errorMessage || undefined,
|
|
99
|
+
timestamp: message.dateCreated,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get delivery report
|
|
104
|
+
*/
|
|
105
|
+
async getDeliveryReport(messageId) {
|
|
106
|
+
var _a;
|
|
107
|
+
const message = await this.client.messages(messageId).fetch();
|
|
108
|
+
return {
|
|
109
|
+
messageId: message.sid,
|
|
110
|
+
delivered: message.status === 'delivered',
|
|
111
|
+
deliveredAt: message.dateSent || undefined,
|
|
112
|
+
errorCode: (_a = message.errorCode) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
113
|
+
errorMessage: message.errorMessage || undefined,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Map Twilio status to standard status
|
|
118
|
+
*/
|
|
119
|
+
mapTwilioStatus(twilioStatus) {
|
|
120
|
+
const statusMap = {
|
|
121
|
+
queued: 'queued',
|
|
122
|
+
sending: 'sending',
|
|
123
|
+
sent: 'sent',
|
|
124
|
+
delivered: 'delivered',
|
|
125
|
+
failed: 'failed',
|
|
126
|
+
undelivered: 'undelivered',
|
|
127
|
+
};
|
|
128
|
+
return statusMap[twilioStatus] || 'failed';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.TwilioProvider = TwilioProvider;
|
|
132
|
+
//# sourceMappingURL=twilio-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twilio-provider.js","sourceRoot":"","sources":["../../src/providers/twilio-provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAgC;AAUhC,MAAa,cAAc;IAIzB,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,OAAmB;;QACnC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAChD,IAAI,EAAE,OAAO,CAAC,OAAO;gBACrB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU;gBAC5C,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,QAAQ,EAAE,OAAO,CAAC,SAAS;gBAC3B,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,cAAc,EAAE,MAAA,OAAO,CAAC,QAAQ,0CAAE,cAAc;aACjD,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,OAAO,CAAC,GAAG;gBACtB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;gBACrE,QAAQ,EAAE,QAAQ;gBAClB,SAAS,EAAE,IAAI,IAAI,EAA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M;YACZ,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,aAAa;SAC3B,CAAC;QAEF,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC;IAC7C,CAAC;CACF;AAtID,wCAsIC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMS Connector
|
|
3
|
+
* Sends SMS messages for notifications and verification
|
|
4
|
+
*/
|
|
5
|
+
import { SMSRequest, SMSResult, BulkSMSResult, MessageStatus, DeliveryReport } from './types';
|
|
6
|
+
export interface SMSProvider {
|
|
7
|
+
sendMessage(request: SMSRequest): Promise<SMSResult>;
|
|
8
|
+
sendBulk(requests: SMSRequest[]): Promise<BulkSMSResult>;
|
|
9
|
+
getMessageStatus(messageId: string): Promise<MessageStatus>;
|
|
10
|
+
getDeliveryReport(messageId: string): Promise<DeliveryReport>;
|
|
11
|
+
}
|
|
12
|
+
export declare class SMSConnector {
|
|
13
|
+
private provider;
|
|
14
|
+
constructor(provider: SMSProvider);
|
|
15
|
+
/**
|
|
16
|
+
* Send SMS message
|
|
17
|
+
*/
|
|
18
|
+
sendMessage(request: SMSRequest): Promise<SMSResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Send bulk SMS messages
|
|
21
|
+
*/
|
|
22
|
+
sendBulk(requests: SMSRequest[]): Promise<BulkSMSResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Get message status
|
|
25
|
+
*/
|
|
26
|
+
getMessageStatus(messageId: string): Promise<MessageStatus>;
|
|
27
|
+
/**
|
|
28
|
+
* Get delivery report
|
|
29
|
+
*/
|
|
30
|
+
getDeliveryReport(messageId: string): Promise<DeliveryReport>;
|
|
31
|
+
/**
|
|
32
|
+
* Mask phone number for logging (PII protection)
|
|
33
|
+
*/
|
|
34
|
+
private maskPhoneNumber;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=sms-connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms-connector.d.ts","sourceRoot":"","sources":["../src/sms-connector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9F,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACzD,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5D,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/D;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAc;gBAElB,QAAQ,EAAE,WAAW;IAIjC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAsC1D;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IA4B9D;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjE;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAInE;;OAEG;IACH,OAAO,CAAC,eAAe;CAIxB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SMS Connector
|
|
4
|
+
* Sends SMS messages for notifications and verification
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SMSConnector = void 0;
|
|
8
|
+
const utils_logger_1 = require("@xbg/utils-logger");
|
|
9
|
+
class SMSConnector {
|
|
10
|
+
constructor(provider) {
|
|
11
|
+
this.provider = provider;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Send SMS message
|
|
15
|
+
*/
|
|
16
|
+
async sendMessage(request) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
try {
|
|
19
|
+
utils_logger_1.logger.info('Sending SMS', {
|
|
20
|
+
to: this.maskPhoneNumber(request.to),
|
|
21
|
+
tags: request.tags,
|
|
22
|
+
});
|
|
23
|
+
const result = await this.provider.sendMessage(request);
|
|
24
|
+
if (result.success) {
|
|
25
|
+
utils_logger_1.logger.info('SMS sent successfully', {
|
|
26
|
+
messageId: result.messageId,
|
|
27
|
+
cost: result.cost,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
utils_logger_1.logger.warn('Failed to send SMS', {
|
|
32
|
+
to: this.maskPhoneNumber(request.to),
|
|
33
|
+
errorCode: (_a = result.error) === null || _a === void 0 ? void 0 : _a.code,
|
|
34
|
+
errorMessage: (_b = result.error) === null || _b === void 0 ? void 0 : _b.message,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
utils_logger_1.logger.error('SMS send error', error instanceof Error ? error : new Error('Unknown error'));
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
error: {
|
|
44
|
+
code: 'SEND_ERROR',
|
|
45
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
46
|
+
},
|
|
47
|
+
provider: 'unknown',
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Send bulk SMS messages
|
|
54
|
+
*/
|
|
55
|
+
async sendBulk(requests) {
|
|
56
|
+
try {
|
|
57
|
+
utils_logger_1.logger.info('Sending bulk SMS', {
|
|
58
|
+
count: requests.length,
|
|
59
|
+
});
|
|
60
|
+
const result = await this.provider.sendBulk(requests);
|
|
61
|
+
utils_logger_1.logger.info('Bulk SMS complete', {
|
|
62
|
+
successful: result.successful,
|
|
63
|
+
failed: result.failed,
|
|
64
|
+
totalCost: result.totalCost,
|
|
65
|
+
});
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
utils_logger_1.logger.error('Bulk SMS error', error instanceof Error ? error : new Error('Unknown error'));
|
|
70
|
+
return {
|
|
71
|
+
success: false,
|
|
72
|
+
successful: 0,
|
|
73
|
+
failed: requests.length,
|
|
74
|
+
results: [],
|
|
75
|
+
timestamp: new Date(),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get message status
|
|
81
|
+
*/
|
|
82
|
+
async getMessageStatus(messageId) {
|
|
83
|
+
return this.provider.getMessageStatus(messageId);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get delivery report
|
|
87
|
+
*/
|
|
88
|
+
async getDeliveryReport(messageId) {
|
|
89
|
+
return this.provider.getDeliveryReport(messageId);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Mask phone number for logging (PII protection)
|
|
93
|
+
*/
|
|
94
|
+
maskPhoneNumber(phone) {
|
|
95
|
+
if (phone.length <= 4)
|
|
96
|
+
return '****';
|
|
97
|
+
return phone.slice(0, -4).replace(/./g, '*') + phone.slice(-4);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.SMSConnector = SMSConnector;
|
|
101
|
+
//# sourceMappingURL=sms-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms-connector.js","sourceRoot":"","sources":["../src/sms-connector.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,oDAA2C;AAS3C,MAAa,YAAY;IAGvB,YAAY,QAAqB;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IA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AE,OAAO,MAAM,CAAC;QACrC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;CACF;AApGD,oCAoGC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMS Connector Types
|
|
3
|
+
*/
|
|
4
|
+
export interface SMSRequest {
|
|
5
|
+
to: string;
|
|
6
|
+
message: string;
|
|
7
|
+
from?: string;
|
|
8
|
+
mediaUrls?: string[];
|
|
9
|
+
validityPeriod?: number;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
metadata?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export interface SMSResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
messageId?: string;
|
|
16
|
+
cost?: number;
|
|
17
|
+
error?: SMSError;
|
|
18
|
+
provider: string;
|
|
19
|
+
timestamp: Date;
|
|
20
|
+
}
|
|
21
|
+
export interface BulkSMSResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
successful: number;
|
|
24
|
+
failed: number;
|
|
25
|
+
results: SMSResult[];
|
|
26
|
+
totalCost?: number;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
}
|
|
29
|
+
export interface SMSError {
|
|
30
|
+
code: string;
|
|
31
|
+
message: string;
|
|
32
|
+
details?: Record<string, any>;
|
|
33
|
+
}
|
|
34
|
+
export interface MessageStatus {
|
|
35
|
+
messageId: string;
|
|
36
|
+
status: 'queued' | 'sending' | 'sent' | 'delivered' | 'failed' | 'undelivered';
|
|
37
|
+
to: string;
|
|
38
|
+
from: string;
|
|
39
|
+
body: string;
|
|
40
|
+
errorCode?: string;
|
|
41
|
+
errorMessage?: string;
|
|
42
|
+
timestamp: Date;
|
|
43
|
+
}
|
|
44
|
+
export interface DeliveryReport {
|
|
45
|
+
messageId: string;
|
|
46
|
+
delivered: boolean;
|
|
47
|
+
deliveredAt?: Date;
|
|
48
|
+
errorCode?: string;
|
|
49
|
+
errorMessage?: string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC/E,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xbg.solutions/utils-sms-connector",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SMS sending with Twilio and MessageBird providers",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"build:watch": "tsc --watch",
|
|
13
|
+
"clean": "rm -rf lib",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@xbg/utils-logger": "^1.0.0",
|
|
18
|
+
"messagebird": "^4.0.0",
|
|
19
|
+
"twilio": "^4.19.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^20.11.0",
|
|
23
|
+
"typescript": "^5.3.3"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "22"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|