@nauth-toolkit/sms-aws-sns 0.1.128 → 0.1.130
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/aws-sms-config.interface.d.ts +51 -6
- package/dist/aws-sms-config.interface.d.ts.map +1 -1
- package/dist/aws-sms.provider.d.ts +82 -11
- package/dist/aws-sms.provider.d.ts.map +1 -1
- package/dist/aws-sms.provider.js +169 -24
- package/dist/aws-sms.provider.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS SMS API Mode
|
|
3
|
+
*
|
|
4
|
+
* Determines which AWS service to use for sending SMS messages:
|
|
5
|
+
* - `sns`: Legacy SNS Publish API (default, no configuration set support)
|
|
6
|
+
* - `end-user-messaging-sms`: AWS End User Messaging SMS API (supports configuration sets, delivery events)
|
|
7
|
+
*/
|
|
8
|
+
export type AWSSMSApiMode = 'sns' | 'end-user-messaging-sms';
|
|
1
9
|
/**
|
|
2
10
|
* AWS SNS SMS Configuration
|
|
3
11
|
*
|
|
4
|
-
* Minimal configuration for sending authentication SMS via AWS SNS.
|
|
12
|
+
* Minimal configuration for sending authentication SMS via AWS SNS or AWS End User Messaging.
|
|
5
13
|
* All messages are sent as transactional (highest priority).
|
|
6
14
|
*
|
|
7
15
|
* AWS credentials are optional - SDK will auto-discover from:
|
|
@@ -13,12 +21,20 @@
|
|
|
13
21
|
*
|
|
14
22
|
* @example
|
|
15
23
|
* ```typescript
|
|
16
|
-
* //
|
|
24
|
+
* // Legacy SNS API (default, backward compatible)
|
|
17
25
|
* const config: AWSSMSConfig = {
|
|
18
26
|
* region: 'us-east-1',
|
|
19
27
|
* originationNumber: '+12345678901',
|
|
20
28
|
* };
|
|
21
29
|
*
|
|
30
|
+
* // New End User Messaging SMS API with configuration set
|
|
31
|
+
* const config: AWSSMSConfig = {
|
|
32
|
+
* region: 'ap-southeast-2',
|
|
33
|
+
* originationNumber: 'anyspaces',
|
|
34
|
+
* apiMode: 'end-user-messaging-sms',
|
|
35
|
+
* configurationSetName: 'default',
|
|
36
|
+
* };
|
|
37
|
+
*
|
|
22
38
|
* // With explicit credentials (if needed)
|
|
23
39
|
* const config: AWSSMSConfig = {
|
|
24
40
|
* region: 'us-east-1',
|
|
@@ -55,21 +71,50 @@ export interface AWSSMSConfig {
|
|
|
55
71
|
* - **US/Canada:** Phone number required (e.g., '+12345678901')
|
|
56
72
|
* - **Other regions:** Alphanumeric sender ID supported (e.g., 'MyApp')
|
|
57
73
|
*
|
|
74
|
+
* For `end-user-messaging-sms` mode:
|
|
75
|
+
* - Can be PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn
|
|
76
|
+
* - Alphanumeric sender IDs supported in regions that allow them
|
|
77
|
+
*
|
|
58
78
|
* @example '+12345678901'
|
|
59
79
|
* @example 'MyApp'
|
|
60
80
|
*/
|
|
61
81
|
originationNumber: string;
|
|
62
82
|
/**
|
|
63
|
-
* AWS
|
|
83
|
+
* AWS SMS API Mode (Optional)
|
|
64
84
|
*
|
|
65
|
-
*
|
|
85
|
+
* Choose which AWS service to use for sending SMS:
|
|
86
|
+
* - `sns` (default): Legacy SNS Publish API
|
|
87
|
+
* - Simple, backward compatible
|
|
88
|
+
* - Configuration sets NOT supported (AWS rejects AWS.* attributes)
|
|
89
|
+
* - Use for basic SMS sending without delivery tracking
|
|
90
|
+
*
|
|
91
|
+
* - `end-user-messaging-sms`: AWS End User Messaging SMS API
|
|
92
|
+
* - Modern SMS/MMS messaging service
|
|
93
|
+
* - Configuration sets fully supported
|
|
94
|
+
* - Delivery events to SNS, CloudWatch, Kinesis
|
|
95
|
+
* - Required for delivery tracking and event destinations
|
|
96
|
+
*
|
|
97
|
+
* @default 'sns'
|
|
98
|
+
* @example 'end-user-messaging-sms'
|
|
99
|
+
*/
|
|
100
|
+
apiMode?: AWSSMSApiMode;
|
|
101
|
+
/**
|
|
102
|
+
* AWS Configuration Set Name (Optional)
|
|
103
|
+
*
|
|
104
|
+
* **IMPORTANT:** Only works with `apiMode: 'end-user-messaging-sms'`
|
|
105
|
+
*
|
|
106
|
+
* Configuration sets control:
|
|
66
107
|
* - CloudWatch metrics and logging
|
|
67
|
-
* - Event destinations (
|
|
108
|
+
* - Event destinations (SNS topics for delivery/failure events)
|
|
68
109
|
* - Delivery status tracking
|
|
69
110
|
* - Spend limits and price controls
|
|
70
111
|
*
|
|
71
|
-
* Configure
|
|
112
|
+
* Configure event destinations in AWS Console:
|
|
113
|
+
* End User Messaging SMS → Configuration sets → [your-set] → Event destinations
|
|
114
|
+
*
|
|
115
|
+
* With `apiMode: 'sns'` (default), this setting is ignored (SNS does not support it).
|
|
72
116
|
*
|
|
117
|
+
* @example 'default'
|
|
73
118
|
* @example 'my-sms-config-set'
|
|
74
119
|
*/
|
|
75
120
|
configurationSetName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-sms-config.interface.d.ts","sourceRoot":"","sources":["../src/aws-sms-config.interface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"aws-sms-config.interface.d.ts","sourceRoot":"","sources":["../src/aws-sms-config.interface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;OAYG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
import { SMSProvider, SMSTemplateEngine, SMSTemplateVariables } from '@nauth-toolkit/core';
|
|
2
2
|
import { AWSSMSConfig } from './aws-sms-config.interface';
|
|
3
3
|
/**
|
|
4
|
-
* AWS SNS SMS Provider (Platform-Agnostic)
|
|
4
|
+
* AWS SNS & End User Messaging SMS Provider (Platform-Agnostic)
|
|
5
|
+
*
|
|
6
|
+
* Sends authentication SMS via:
|
|
7
|
+
* - AWS SNS Publish API (legacy, default)
|
|
8
|
+
* - AWS End User Messaging SMS API - modern, supports configuration sets
|
|
5
9
|
*
|
|
6
|
-
* Sends authentication SMS via AWS Simple Notification Service.
|
|
7
10
|
* All messages sent as transactional (highest priority).
|
|
8
11
|
*
|
|
9
12
|
* @example
|
|
10
13
|
* ```typescript
|
|
14
|
+
* // Legacy SNS API (backward compatible)
|
|
11
15
|
* const provider = new AWSSMSProvider({
|
|
12
16
|
* region: 'us-east-1',
|
|
13
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
14
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
15
17
|
* originationNumber: '+12345678901',
|
|
16
18
|
* });
|
|
17
19
|
*
|
|
20
|
+
* // New End User Messaging SMS API with configuration set
|
|
21
|
+
* const provider = new AWSSMSProvider({
|
|
22
|
+
* region: 'ap-southeast-2',
|
|
23
|
+
* originationNumber: 'anyspaces',
|
|
24
|
+
* apiMode: 'end-user-messaging-sms',
|
|
25
|
+
* configurationSetName: 'default',
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
18
28
|
* await provider.sendOTP('+1234567890', '123456');
|
|
19
29
|
* ```
|
|
20
30
|
*/
|
|
21
31
|
export declare class AWSSMSProvider implements SMSProvider {
|
|
22
32
|
private readonly logger;
|
|
23
|
-
private snsClient;
|
|
24
33
|
private readonly config;
|
|
34
|
+
private readonly apiMode;
|
|
35
|
+
private snsClient;
|
|
25
36
|
private snsClientClass;
|
|
26
37
|
private publishCommandClass;
|
|
38
|
+
private endUserMessagingClient;
|
|
39
|
+
private endUserMessagingClientClass;
|
|
40
|
+
private sendTextMessageCommandClass;
|
|
27
41
|
/**
|
|
28
42
|
* Optional SMS template engine for customizing message content
|
|
29
43
|
*/
|
|
@@ -34,11 +48,26 @@ export declare class AWSSMSProvider implements SMSProvider {
|
|
|
34
48
|
private globalVariables;
|
|
35
49
|
constructor(config: AWSSMSConfig);
|
|
36
50
|
/**
|
|
37
|
-
* Lazy-initialize AWS SNS SDK and client.
|
|
51
|
+
* Lazy-initialize AWS SNS SDK and client (legacy mode).
|
|
52
|
+
*
|
|
53
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
54
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
55
|
+
*
|
|
56
|
+
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
57
|
+
*/
|
|
58
|
+
private ensureSNSInitialized;
|
|
59
|
+
/**
|
|
60
|
+
* Lazy-initialize AWS End User Messaging SMS SDK and client.
|
|
61
|
+
*
|
|
62
|
+
* Note: The SDK package is still named @aws-sdk/client-pinpoint-sms-voice-v2
|
|
63
|
+
* but represents the AWS End User Messaging SMS service.
|
|
64
|
+
*
|
|
65
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
66
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
38
67
|
*
|
|
39
68
|
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
40
69
|
*/
|
|
41
|
-
private
|
|
70
|
+
private ensureEndUserMessagingSMSInitialized;
|
|
42
71
|
/**
|
|
43
72
|
* Set template engine for SMS message customization
|
|
44
73
|
*
|
|
@@ -99,9 +128,31 @@ export declare class AWSSMSProvider implements SMSProvider {
|
|
|
99
128
|
*/
|
|
100
129
|
sendVerificationCode(phone: string, code: string): Promise<void>;
|
|
101
130
|
/**
|
|
102
|
-
* Send SMS message via AWS
|
|
131
|
+
* Send SMS message via AWS (Internal)
|
|
132
|
+
*
|
|
133
|
+
* Routes to either SNS Publish or End User Messaging SMS based on apiMode configuration.
|
|
103
134
|
*
|
|
104
|
-
*
|
|
135
|
+
* **SNS Mode (legacy):**
|
|
136
|
+
* - Uses SNS Publish API
|
|
137
|
+
* - Configuration sets NOT supported
|
|
138
|
+
* - Message attributes: AWS.SNS.SMS.SenderID, AWS.SNS.SMS.SMSType, AWS.MM.SMS.OriginationNumber
|
|
139
|
+
*
|
|
140
|
+
* **End User Messaging SMS Mode (modern):**
|
|
141
|
+
* - Uses End User Messaging SMS SendTextMessage API
|
|
142
|
+
* - Configuration sets fully supported
|
|
143
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
144
|
+
* - Modern API for SMS/MMS messaging
|
|
145
|
+
*
|
|
146
|
+
* @param phone - Recipient phone number in E.164 format
|
|
147
|
+
* @param message - SMS message content
|
|
148
|
+
*
|
|
149
|
+
* @throws {Error} If AWS API call fails
|
|
150
|
+
*
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
private sendSMS;
|
|
154
|
+
/**
|
|
155
|
+
* Send SMS via AWS SNS Publish API (legacy mode)
|
|
105
156
|
*
|
|
106
157
|
* **AWS SNS Attributes:**
|
|
107
158
|
* - `AWS.SNS.SMS.SenderID`: Sender name or origination number
|
|
@@ -109,13 +160,33 @@ export declare class AWSSMSProvider implements SMSProvider {
|
|
|
109
160
|
* - `AWS.MM.SMS.OriginationNumber`: Phone number for US/Canada
|
|
110
161
|
* - `AWS.SNS.SMS.MaxPrice`: Maximum price per SMS
|
|
111
162
|
*
|
|
163
|
+
* **Note:** Configuration sets are NOT supported with SNS Publish.
|
|
164
|
+
* AWS rejects message attributes starting with 'AWS.' or 'Amazon.'
|
|
165
|
+
*
|
|
112
166
|
* @param phone - Recipient phone number in E.164 format
|
|
113
167
|
* @param message - SMS message content
|
|
114
168
|
*
|
|
115
|
-
* @throws {
|
|
169
|
+
* @throws {NAuthException} If AWS SNS API call fails
|
|
116
170
|
*
|
|
117
171
|
* @private
|
|
118
172
|
*/
|
|
119
|
-
private
|
|
173
|
+
private sendViaSNS;
|
|
174
|
+
/**
|
|
175
|
+
* Send SMS via AWS End User Messaging SMS API (modern mode)
|
|
176
|
+
*
|
|
177
|
+
* **Features:**
|
|
178
|
+
* - Full configuration set support
|
|
179
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
180
|
+
* - Modern API for SMS/MMS messaging
|
|
181
|
+
* - Supports phone numbers, sender IDs, and pools
|
|
182
|
+
*
|
|
183
|
+
* @param phone - Recipient phone number in E.164 format
|
|
184
|
+
* @param message - SMS message content
|
|
185
|
+
*
|
|
186
|
+
* @throws {NAuthException} If AWS End User Messaging SMS API call fails
|
|
187
|
+
*
|
|
188
|
+
* @private
|
|
189
|
+
*/
|
|
190
|
+
private sendViaEndUserMessagingSMS;
|
|
120
191
|
}
|
|
121
192
|
//# sourceMappingURL=aws-sms.provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-sms.provider.d.ts","sourceRoot":"","sources":["../src/aws-sms.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAIX,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"aws-sms.provider.d.ts","sourceRoot":"","sources":["../src/aws-sms.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAIX,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAkBzE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IAGxC,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,mBAAmB,CAAmC;IAG9D,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,2BAA2B,CAA8C;IACjF,OAAO,CAAC,2BAA2B,CAA2C;IAE9E;;OAEG;IACH,OAAO,CAAC,cAAc,CAAC,CAAoB;IAE3C;;OAEG;IACH,OAAO,CAAC,eAAe,CAA4B;gBAEvC,MAAM,EAAE,YAAY;IAkChC;;;;;;;OAOG;YACW,oBAAoB;IA2ClC;;;;;;;;;;OAUG;YACW,oCAAoC;IA+ClD;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAIlD;;;;OAIG;IACH,kBAAkB,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI;IAIzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACG,OAAO,CACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC;IAkChB;;;;;;;;;OASG;IACG,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItE;;;;;;;;;;;;;;;;;;;;;;OAsBG;YACW,OAAO;IAQrB;;;;;;;;;;;;;;;;;;OAkBG;YACW,UAAU;IAqDxB;;;;;;;;;;;;;;;OAeG;YACW,0BAA0B;CA8BzC"}
|
package/dist/aws-sms.provider.js
CHANGED
|
@@ -36,29 +36,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.AWSSMSProvider = void 0;
|
|
37
37
|
const core_1 = require("@nauth-toolkit/core");
|
|
38
38
|
/**
|
|
39
|
-
* AWS SNS SMS Provider (Platform-Agnostic)
|
|
39
|
+
* AWS SNS & End User Messaging SMS Provider (Platform-Agnostic)
|
|
40
|
+
*
|
|
41
|
+
* Sends authentication SMS via:
|
|
42
|
+
* - AWS SNS Publish API (legacy, default)
|
|
43
|
+
* - AWS End User Messaging SMS API - modern, supports configuration sets
|
|
40
44
|
*
|
|
41
|
-
* Sends authentication SMS via AWS Simple Notification Service.
|
|
42
45
|
* All messages sent as transactional (highest priority).
|
|
43
46
|
*
|
|
44
47
|
* @example
|
|
45
48
|
* ```typescript
|
|
49
|
+
* // Legacy SNS API (backward compatible)
|
|
46
50
|
* const provider = new AWSSMSProvider({
|
|
47
51
|
* region: 'us-east-1',
|
|
48
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
49
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
50
52
|
* originationNumber: '+12345678901',
|
|
51
53
|
* });
|
|
52
54
|
*
|
|
55
|
+
* // New End User Messaging SMS API with configuration set
|
|
56
|
+
* const provider = new AWSSMSProvider({
|
|
57
|
+
* region: 'ap-southeast-2',
|
|
58
|
+
* originationNumber: 'anyspaces',
|
|
59
|
+
* apiMode: 'end-user-messaging-sms',
|
|
60
|
+
* configurationSetName: 'default',
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
53
63
|
* await provider.sendOTP('+1234567890', '123456');
|
|
54
64
|
* ```
|
|
55
65
|
*/
|
|
56
66
|
class AWSSMSProvider {
|
|
57
67
|
logger;
|
|
58
|
-
snsClient = null;
|
|
59
68
|
config;
|
|
69
|
+
apiMode;
|
|
70
|
+
// SNS (legacy)
|
|
71
|
+
snsClient = null;
|
|
60
72
|
snsClientClass = null;
|
|
61
73
|
publishCommandClass = null;
|
|
74
|
+
// End User Messaging SMS (modern)
|
|
75
|
+
endUserMessagingClient = null;
|
|
76
|
+
endUserMessagingClientClass = null;
|
|
77
|
+
sendTextMessageCommandClass = null;
|
|
62
78
|
/**
|
|
63
79
|
* Optional SMS template engine for customizing message content
|
|
64
80
|
*/
|
|
@@ -70,6 +86,7 @@ class AWSSMSProvider {
|
|
|
70
86
|
constructor(config) {
|
|
71
87
|
this.logger = new core_1.NAuthLogger();
|
|
72
88
|
this.config = config;
|
|
89
|
+
this.apiMode = config.apiMode || 'sns';
|
|
73
90
|
// Validate required configuration
|
|
74
91
|
if (!config.region || !config.originationNumber) {
|
|
75
92
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'AWS SMS Provider: region and originationNumber are required');
|
|
@@ -78,26 +95,42 @@ class AWSSMSProvider {
|
|
|
78
95
|
if (config.accessKeyId && !config.secretAccessKey) {
|
|
79
96
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'AWS SMS Provider: secretAccessKey is required when accessKeyId is provided');
|
|
80
97
|
}
|
|
98
|
+
// Warn if configuration set used with SNS mode (not supported)
|
|
99
|
+
if (this.apiMode === 'sns' && config.configurationSetName) {
|
|
100
|
+
this.logger.warn(`AWS SMS Provider: configurationSetName is ignored with apiMode='sns'. Use apiMode='end-user-messaging-sms' for configuration set support.`);
|
|
101
|
+
}
|
|
81
102
|
// AWS SDK + client are initialized lazily in sendSMS() (async) to avoid require().
|
|
82
|
-
this.logger.log(`AWS SMS Provider initialized (region: ${config.region})`);
|
|
103
|
+
this.logger.log(`AWS SMS Provider initialized (region: ${config.region}, mode: ${this.apiMode})`);
|
|
83
104
|
}
|
|
84
105
|
/**
|
|
85
|
-
* Lazy-initialize AWS SNS SDK and client.
|
|
106
|
+
* Lazy-initialize AWS SNS SDK and client (legacy mode).
|
|
107
|
+
*
|
|
108
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
109
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
86
110
|
*
|
|
87
111
|
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
88
112
|
*/
|
|
89
|
-
async
|
|
113
|
+
async ensureSNSInitialized() {
|
|
90
114
|
if (this.snsClient) {
|
|
91
115
|
return;
|
|
92
116
|
}
|
|
93
117
|
if (!this.snsClientClass || !this.publishCommandClass) {
|
|
94
118
|
try {
|
|
95
|
-
|
|
119
|
+
// Try standard import first
|
|
120
|
+
let awsSdk;
|
|
121
|
+
try {
|
|
122
|
+
awsSdk = await Promise.resolve().then(() => __importStar(require('@aws-sdk/client-sns')));
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Native dynamic import fallback (avoids TypeScript rewriting to require())
|
|
126
|
+
const nativeImport = new Function('modulePath', 'return import(modulePath)');
|
|
127
|
+
awsSdk = (await nativeImport('@aws-sdk/client-sns'));
|
|
128
|
+
}
|
|
96
129
|
this.snsClientClass = awsSdk.SNSClient;
|
|
97
130
|
this.publishCommandClass = awsSdk.PublishCommand;
|
|
98
131
|
}
|
|
99
132
|
catch {
|
|
100
|
-
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, 'AWS SMS Provider: Failed to load @aws-sdk/client-sns. Ensure
|
|
133
|
+
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, 'AWS SMS Provider: Failed to load @aws-sdk/client-sns. Ensure it is installed.');
|
|
101
134
|
}
|
|
102
135
|
}
|
|
103
136
|
// Initialize SNS client - credentials are optional (SDK auto-discovers)
|
|
@@ -111,6 +144,53 @@ class AWSSMSProvider {
|
|
|
111
144
|
}
|
|
112
145
|
this.snsClient = new this.snsClientClass(clientConfig);
|
|
113
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Lazy-initialize AWS End User Messaging SMS SDK and client.
|
|
149
|
+
*
|
|
150
|
+
* Note: The SDK package is still named @aws-sdk/client-pinpoint-sms-voice-v2
|
|
151
|
+
* but represents the AWS End User Messaging SMS service.
|
|
152
|
+
*
|
|
153
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
154
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
155
|
+
*
|
|
156
|
+
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
157
|
+
*/
|
|
158
|
+
async ensureEndUserMessagingSMSInitialized() {
|
|
159
|
+
if (this.endUserMessagingClient) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!this.endUserMessagingClientClass || !this.sendTextMessageCommandClass) {
|
|
163
|
+
try {
|
|
164
|
+
// Note: Package name still references pinpoint-sms-voice-v2, but this is AWS End User Messaging SMS
|
|
165
|
+
let awsSdk;
|
|
166
|
+
try {
|
|
167
|
+
awsSdk = await Promise.resolve().then(() => __importStar(require('@aws-sdk/client-pinpoint-sms-voice-v2')));
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
// Native dynamic import fallback (avoids TypeScript rewriting to require())
|
|
171
|
+
const nativeImport = new Function('modulePath', 'return import(modulePath)');
|
|
172
|
+
awsSdk = (await nativeImport('@aws-sdk/client-pinpoint-sms-voice-v2'));
|
|
173
|
+
}
|
|
174
|
+
this.endUserMessagingClientClass =
|
|
175
|
+
awsSdk.PinpointSMSVoiceV2Client;
|
|
176
|
+
this.sendTextMessageCommandClass =
|
|
177
|
+
awsSdk.SendTextMessageCommand;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, 'AWS SMS Provider: Failed to load @aws-sdk/client-pinpoint-sms-voice-v2. Ensure it is installed.');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Initialize End User Messaging SMS client - credentials are optional (SDK auto-discovers)
|
|
184
|
+
const clientConfig = { region: this.config.region };
|
|
185
|
+
// Only add credentials if explicitly provided
|
|
186
|
+
if (this.config.accessKeyId && this.config.secretAccessKey) {
|
|
187
|
+
clientConfig.credentials = {
|
|
188
|
+
accessKeyId: this.config.accessKeyId,
|
|
189
|
+
secretAccessKey: this.config.secretAccessKey,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
this.endUserMessagingClient = new this.endUserMessagingClientClass(clientConfig);
|
|
193
|
+
}
|
|
114
194
|
/**
|
|
115
195
|
* Set template engine for SMS message customization
|
|
116
196
|
*
|
|
@@ -208,9 +288,38 @@ class AWSSMSProvider {
|
|
|
208
288
|
await this.sendOTP(phone, code);
|
|
209
289
|
}
|
|
210
290
|
/**
|
|
211
|
-
* Send SMS message via AWS
|
|
291
|
+
* Send SMS message via AWS (Internal)
|
|
292
|
+
*
|
|
293
|
+
* Routes to either SNS Publish or End User Messaging SMS based on apiMode configuration.
|
|
212
294
|
*
|
|
213
|
-
*
|
|
295
|
+
* **SNS Mode (legacy):**
|
|
296
|
+
* - Uses SNS Publish API
|
|
297
|
+
* - Configuration sets NOT supported
|
|
298
|
+
* - Message attributes: AWS.SNS.SMS.SenderID, AWS.SNS.SMS.SMSType, AWS.MM.SMS.OriginationNumber
|
|
299
|
+
*
|
|
300
|
+
* **End User Messaging SMS Mode (modern):**
|
|
301
|
+
* - Uses End User Messaging SMS SendTextMessage API
|
|
302
|
+
* - Configuration sets fully supported
|
|
303
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
304
|
+
* - Modern API for SMS/MMS messaging
|
|
305
|
+
*
|
|
306
|
+
* @param phone - Recipient phone number in E.164 format
|
|
307
|
+
* @param message - SMS message content
|
|
308
|
+
*
|
|
309
|
+
* @throws {Error} If AWS API call fails
|
|
310
|
+
*
|
|
311
|
+
* @private
|
|
312
|
+
*/
|
|
313
|
+
async sendSMS(phone, message) {
|
|
314
|
+
if (this.apiMode === 'sns') {
|
|
315
|
+
await this.sendViaSNS(phone, message);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
await this.sendViaEndUserMessagingSMS(phone, message);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Send SMS via AWS SNS Publish API (legacy mode)
|
|
214
323
|
*
|
|
215
324
|
* **AWS SNS Attributes:**
|
|
216
325
|
* - `AWS.SNS.SMS.SenderID`: Sender name or origination number
|
|
@@ -218,16 +327,19 @@ class AWSSMSProvider {
|
|
|
218
327
|
* - `AWS.MM.SMS.OriginationNumber`: Phone number for US/Canada
|
|
219
328
|
* - `AWS.SNS.SMS.MaxPrice`: Maximum price per SMS
|
|
220
329
|
*
|
|
330
|
+
* **Note:** Configuration sets are NOT supported with SNS Publish.
|
|
331
|
+
* AWS rejects message attributes starting with 'AWS.' or 'Amazon.'
|
|
332
|
+
*
|
|
221
333
|
* @param phone - Recipient phone number in E.164 format
|
|
222
334
|
* @param message - SMS message content
|
|
223
335
|
*
|
|
224
|
-
* @throws {
|
|
336
|
+
* @throws {NAuthException} If AWS SNS API call fails
|
|
225
337
|
*
|
|
226
338
|
* @private
|
|
227
339
|
*/
|
|
228
|
-
async
|
|
340
|
+
async sendViaSNS(phone, message) {
|
|
229
341
|
try {
|
|
230
|
-
await this.
|
|
342
|
+
await this.ensureSNSInitialized();
|
|
231
343
|
const messageAttributes = {
|
|
232
344
|
'AWS.SNS.SMS.SMSType': {
|
|
233
345
|
DataType: 'String',
|
|
@@ -254,15 +366,8 @@ class AWSSMSProvider {
|
|
|
254
366
|
Message: message,
|
|
255
367
|
MessageAttributes: messageAttributes,
|
|
256
368
|
};
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
// Note: Configuration sets control delivery tracking, logging, etc.
|
|
260
|
-
// Configure these in AWS Console, not here
|
|
261
|
-
input.MessageAttributes['AWS.SNS.SMS.ConfigurationSetName'] = {
|
|
262
|
-
DataType: 'String',
|
|
263
|
-
StringValue: this.config.configurationSetName,
|
|
264
|
-
};
|
|
265
|
-
}
|
|
369
|
+
// Note: Configuration sets are NOT supported with SNS Publish API
|
|
370
|
+
// Use apiMode: 'end-user-messaging-sms' for configuration set support
|
|
266
371
|
const command = new this.publishCommandClass(input);
|
|
267
372
|
const response = await this.snsClient.send(command);
|
|
268
373
|
this.logger.log(`SMS sent to ${phone} (MessageId: ${response.MessageId})`);
|
|
@@ -273,6 +378,46 @@ class AWSSMSProvider {
|
|
|
273
378
|
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, `AWS SMS delivery failed: ${errorMessage}`);
|
|
274
379
|
}
|
|
275
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Send SMS via AWS End User Messaging SMS API (modern mode)
|
|
383
|
+
*
|
|
384
|
+
* **Features:**
|
|
385
|
+
* - Full configuration set support
|
|
386
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
387
|
+
* - Modern API for SMS/MMS messaging
|
|
388
|
+
* - Supports phone numbers, sender IDs, and pools
|
|
389
|
+
*
|
|
390
|
+
* @param phone - Recipient phone number in E.164 format
|
|
391
|
+
* @param message - SMS message content
|
|
392
|
+
*
|
|
393
|
+
* @throws {NAuthException} If AWS End User Messaging SMS API call fails
|
|
394
|
+
*
|
|
395
|
+
* @private
|
|
396
|
+
*/
|
|
397
|
+
async sendViaEndUserMessagingSMS(phone, message) {
|
|
398
|
+
try {
|
|
399
|
+
await this.ensureEndUserMessagingSMSInitialized();
|
|
400
|
+
// Build SendTextMessage input
|
|
401
|
+
const input = {
|
|
402
|
+
DestinationPhoneNumber: phone,
|
|
403
|
+
MessageBody: message,
|
|
404
|
+
MessageType: 'TRANSACTIONAL',
|
|
405
|
+
OriginationIdentity: this.config.originationNumber,
|
|
406
|
+
};
|
|
407
|
+
// Add configuration set if provided
|
|
408
|
+
if (this.config.configurationSetName) {
|
|
409
|
+
input.ConfigurationSetName = this.config.configurationSetName;
|
|
410
|
+
}
|
|
411
|
+
const command = new this.sendTextMessageCommandClass(input);
|
|
412
|
+
const response = await this.endUserMessagingClient.send(command);
|
|
413
|
+
this.logger.log(`SMS sent to ${phone} (MessageId: ${response.MessageId})`);
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
417
|
+
this.logger.error(`AWS End User Messaging SMS failed: ${errorMessage}`);
|
|
418
|
+
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, `AWS End User Messaging SMS delivery failed: ${errorMessage}`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
276
421
|
}
|
|
277
422
|
exports.AWSSMSProvider = AWSSMSProvider;
|
|
278
423
|
//# sourceMappingURL=aws-sms.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-sms.provider.js","sourceRoot":"","sources":["../src/aws-sms.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAO6B;
|
|
1
|
+
{"version":3,"file":"aws-sms.provider.js","sourceRoot":"","sources":["../src/aws-sms.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAO6B;AAmB7B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,cAAc;IACR,MAAM,CAAc;IACpB,MAAM,CAAe;IACrB,OAAO,CAAgB;IAExC,eAAe;IACP,SAAS,GAAyB,IAAI,CAAC;IACvC,cAAc,GAAyB,IAAI,CAAC;IAC5C,mBAAmB,GAA8B,IAAI,CAAC;IAE9D,kCAAkC;IAC1B,sBAAsB,GAAyC,IAAI,CAAC;IACpE,2BAA2B,GAAyC,IAAI,CAAC;IACzE,2BAA2B,GAAsC,IAAI,CAAC;IAE9E;;OAEG;IACK,cAAc,CAAqB;IAE3C;;OAEG;IACK,eAAe,GAAyB,EAAE,CAAC;IAEnD,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAW,EAAE,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;QAEvC,kCAAkC;QAClC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAChD,MAAM,IAAI,qBAAc,CACtB,oBAAa,CAAC,iBAAiB,EAC/B,6D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
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.130",
|
|
4
4
|
"description": "AWS SNS SMS provider for nauth-toolkit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"format:check": "prettier --check \"src/**/*.ts\""
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@aws-sdk/client-pinpoint-sms-voice-v2": "^3.989.0",
|
|
17
18
|
"@aws-sdk/client-sns": "^3.0.0"
|
|
18
19
|
},
|
|
19
20
|
"peerDependencies": {
|
|
20
|
-
"@nauth-toolkit/core": "^0.1.
|
|
21
|
+
"@nauth-toolkit/core": "^0.1.130"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/jest": "^29.5.0",
|