@nauth-toolkit/sms-aws-sns 0.1.129 → 0.1.131
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 +102 -13
- package/dist/aws-sms.provider.d.ts.map +1 -1
- package/dist/aws-sms.provider.js +205 -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
|
-
import { SMSProvider, SMSTemplateEngine, SMSTemplateVariables } from '@nauth-toolkit/core';
|
|
1
|
+
import { SMSProvider, NAuthLogger, 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
|
-
private
|
|
23
|
-
private snsClient;
|
|
32
|
+
private logger;
|
|
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,35 @@ export declare class AWSSMSProvider implements SMSProvider {
|
|
|
34
48
|
private globalVariables;
|
|
35
49
|
constructor(config: AWSSMSConfig);
|
|
36
50
|
/**
|
|
37
|
-
*
|
|
51
|
+
* Inject a logger instance from the consuming application.
|
|
52
|
+
*
|
|
53
|
+
* Called by nauth-toolkit core during initialization to replace the default silent logger
|
|
54
|
+
* with the application's logger (NestJS Logger, etc.), enabling provider log output.
|
|
55
|
+
*
|
|
56
|
+
* @param logger - NAuthLogger instance from the consuming application
|
|
57
|
+
*/
|
|
58
|
+
setLogger(logger: NAuthLogger): void;
|
|
59
|
+
/**
|
|
60
|
+
* Lazy-initialize AWS SNS SDK and client (legacy mode).
|
|
61
|
+
*
|
|
62
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
63
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
64
|
+
*
|
|
65
|
+
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
66
|
+
*/
|
|
67
|
+
private ensureSNSInitialized;
|
|
68
|
+
/**
|
|
69
|
+
* Lazy-initialize AWS End User Messaging SMS SDK and client.
|
|
70
|
+
*
|
|
71
|
+
* Note: The SDK package is still named @aws-sdk/client-pinpoint-sms-voice-v2
|
|
72
|
+
* but represents the AWS End User Messaging SMS service.
|
|
73
|
+
*
|
|
74
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
75
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
38
76
|
*
|
|
39
77
|
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
40
78
|
*/
|
|
41
|
-
private
|
|
79
|
+
private ensureEndUserMessagingSMSInitialized;
|
|
42
80
|
/**
|
|
43
81
|
* Set template engine for SMS message customization
|
|
44
82
|
*
|
|
@@ -99,9 +137,31 @@ export declare class AWSSMSProvider implements SMSProvider {
|
|
|
99
137
|
*/
|
|
100
138
|
sendVerificationCode(phone: string, code: string): Promise<void>;
|
|
101
139
|
/**
|
|
102
|
-
* Send SMS message via AWS
|
|
140
|
+
* Send SMS message via AWS (Internal)
|
|
103
141
|
*
|
|
104
|
-
*
|
|
142
|
+
* Routes to either SNS Publish or End User Messaging SMS based on apiMode configuration.
|
|
143
|
+
*
|
|
144
|
+
* **SNS Mode (legacy):**
|
|
145
|
+
* - Uses SNS Publish API
|
|
146
|
+
* - Configuration sets NOT supported
|
|
147
|
+
* - Message attributes: AWS.SNS.SMS.SenderID, AWS.SNS.SMS.SMSType, AWS.MM.SMS.OriginationNumber
|
|
148
|
+
*
|
|
149
|
+
* **End User Messaging SMS Mode (modern):**
|
|
150
|
+
* - Uses End User Messaging SMS SendTextMessage API
|
|
151
|
+
* - Configuration sets fully supported
|
|
152
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
153
|
+
* - Modern API for SMS/MMS messaging
|
|
154
|
+
*
|
|
155
|
+
* @param phone - Recipient phone number in E.164 format
|
|
156
|
+
* @param message - SMS message content
|
|
157
|
+
*
|
|
158
|
+
* @throws {Error} If AWS API call fails
|
|
159
|
+
*
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
private sendSMS;
|
|
163
|
+
/**
|
|
164
|
+
* Send SMS via AWS SNS Publish API (legacy mode)
|
|
105
165
|
*
|
|
106
166
|
* **AWS SNS Attributes:**
|
|
107
167
|
* - `AWS.SNS.SMS.SenderID`: Sender name or origination number
|
|
@@ -109,13 +169,42 @@ export declare class AWSSMSProvider implements SMSProvider {
|
|
|
109
169
|
* - `AWS.MM.SMS.OriginationNumber`: Phone number for US/Canada
|
|
110
170
|
* - `AWS.SNS.SMS.MaxPrice`: Maximum price per SMS
|
|
111
171
|
*
|
|
172
|
+
* **Note:** Configuration sets are NOT supported with SNS Publish.
|
|
173
|
+
* AWS rejects message attributes starting with 'AWS.' or 'Amazon.'
|
|
174
|
+
*
|
|
112
175
|
* @param phone - Recipient phone number in E.164 format
|
|
113
176
|
* @param message - SMS message content
|
|
114
177
|
*
|
|
115
|
-
* @throws {
|
|
178
|
+
* @throws {NAuthException} If AWS SNS API call fails
|
|
116
179
|
*
|
|
117
180
|
* @private
|
|
118
181
|
*/
|
|
119
|
-
private
|
|
182
|
+
private sendViaSNS;
|
|
183
|
+
/**
|
|
184
|
+
* Send SMS via AWS End User Messaging SMS API (modern mode)
|
|
185
|
+
*
|
|
186
|
+
* **Features:**
|
|
187
|
+
* - Full configuration set support
|
|
188
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
189
|
+
* - Modern API for SMS/MMS messaging
|
|
190
|
+
* - Supports phone numbers, sender IDs, and pools
|
|
191
|
+
*
|
|
192
|
+
* @param phone - Recipient phone number in E.164 format
|
|
193
|
+
* @param message - SMS message content
|
|
194
|
+
*
|
|
195
|
+
* @throws {NAuthException} If AWS End User Messaging SMS API call fails
|
|
196
|
+
*
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
private sendViaEndUserMessagingSMS;
|
|
200
|
+
/**
|
|
201
|
+
* Map AWS End User Messaging SMS errors to user-facing messages.
|
|
202
|
+
* Protect configuration blocks are an AWS account/config issue, not an app bug.
|
|
203
|
+
*
|
|
204
|
+
* @param awsMessage - Raw error message from AWS SDK
|
|
205
|
+
* @returns User-facing message
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
private getEndUserMessagingSMSUserMessage;
|
|
120
209
|
}
|
|
121
210
|
//# 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,
|
|
1
|
+
{"version":3,"file":"aws-sms.provider.d.ts","sourceRoot":"","sources":["../src/aws-sms.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,WAAW,EAGX,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAkBzE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,MAAM,CAAc;IAC5B,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;IAgChC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAKpC;;;;;;;OAOG;YACW,oBAAoB;IA2ClC;;;;;;;;;;OAUG;YACW,oCAAoC;IA6ClD;;;;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;IAoCxC;;;;;;;OAOG;IACH,OAAO,CAAC,iCAAiC;CAqB1C"}
|
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,54 @@ 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
|
-
*
|
|
106
|
+
* Inject a logger instance from the consuming application.
|
|
107
|
+
*
|
|
108
|
+
* Called by nauth-toolkit core during initialization to replace the default silent logger
|
|
109
|
+
* with the application's logger (NestJS Logger, etc.), enabling provider log output.
|
|
110
|
+
*
|
|
111
|
+
* @param logger - NAuthLogger instance from the consuming application
|
|
112
|
+
*/
|
|
113
|
+
setLogger(logger) {
|
|
114
|
+
this.logger = logger;
|
|
115
|
+
this.logger.log(`AWS SMS Provider logger attached (mode: ${this.apiMode})`);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Lazy-initialize AWS SNS SDK and client (legacy mode).
|
|
119
|
+
*
|
|
120
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
121
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
86
122
|
*
|
|
87
123
|
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
88
124
|
*/
|
|
89
|
-
async
|
|
125
|
+
async ensureSNSInitialized() {
|
|
90
126
|
if (this.snsClient) {
|
|
91
127
|
return;
|
|
92
128
|
}
|
|
93
129
|
if (!this.snsClientClass || !this.publishCommandClass) {
|
|
94
130
|
try {
|
|
95
|
-
|
|
131
|
+
// Try standard import first
|
|
132
|
+
let awsSdk;
|
|
133
|
+
try {
|
|
134
|
+
awsSdk = await Promise.resolve().then(() => __importStar(require('@aws-sdk/client-sns')));
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Native dynamic import fallback (avoids TypeScript rewriting to require())
|
|
138
|
+
const nativeImport = new Function('modulePath', 'return import(modulePath)');
|
|
139
|
+
awsSdk = (await nativeImport('@aws-sdk/client-sns'));
|
|
140
|
+
}
|
|
96
141
|
this.snsClientClass = awsSdk.SNSClient;
|
|
97
142
|
this.publishCommandClass = awsSdk.PublishCommand;
|
|
98
143
|
}
|
|
99
144
|
catch {
|
|
100
|
-
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, 'AWS SMS Provider: Failed to load @aws-sdk/client-sns. Ensure
|
|
145
|
+
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
146
|
}
|
|
102
147
|
}
|
|
103
148
|
// Initialize SNS client - credentials are optional (SDK auto-discovers)
|
|
@@ -111,6 +156,51 @@ class AWSSMSProvider {
|
|
|
111
156
|
}
|
|
112
157
|
this.snsClient = new this.snsClientClass(clientConfig);
|
|
113
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Lazy-initialize AWS End User Messaging SMS SDK and client.
|
|
161
|
+
*
|
|
162
|
+
* Note: The SDK package is still named @aws-sdk/client-pinpoint-sms-voice-v2
|
|
163
|
+
* but represents the AWS End User Messaging SMS service.
|
|
164
|
+
*
|
|
165
|
+
* Uses native dynamic import fallback to prevent TypeScript from converting
|
|
166
|
+
* import() to require() in CommonJS builds, which would fail in packaged npm.
|
|
167
|
+
*
|
|
168
|
+
* @throws {NAuthException} When AWS SDK cannot be loaded
|
|
169
|
+
*/
|
|
170
|
+
async ensureEndUserMessagingSMSInitialized() {
|
|
171
|
+
if (this.endUserMessagingClient) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (!this.endUserMessagingClientClass || !this.sendTextMessageCommandClass) {
|
|
175
|
+
try {
|
|
176
|
+
// Note: Package name still references pinpoint-sms-voice-v2, but this is AWS End User Messaging SMS
|
|
177
|
+
let awsSdk;
|
|
178
|
+
try {
|
|
179
|
+
awsSdk = await Promise.resolve().then(() => __importStar(require('@aws-sdk/client-pinpoint-sms-voice-v2')));
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
// Native dynamic import fallback (avoids TypeScript rewriting to require())
|
|
183
|
+
const nativeImport = new Function('modulePath', 'return import(modulePath)');
|
|
184
|
+
awsSdk = (await nativeImport('@aws-sdk/client-pinpoint-sms-voice-v2'));
|
|
185
|
+
}
|
|
186
|
+
this.endUserMessagingClientClass = awsSdk.PinpointSMSVoiceV2Client;
|
|
187
|
+
this.sendTextMessageCommandClass = awsSdk.SendTextMessageCommand;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
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.');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// Initialize End User Messaging SMS client - credentials are optional (SDK auto-discovers)
|
|
194
|
+
const clientConfig = { region: this.config.region };
|
|
195
|
+
// Only add credentials if explicitly provided
|
|
196
|
+
if (this.config.accessKeyId && this.config.secretAccessKey) {
|
|
197
|
+
clientConfig.credentials = {
|
|
198
|
+
accessKeyId: this.config.accessKeyId,
|
|
199
|
+
secretAccessKey: this.config.secretAccessKey,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
this.endUserMessagingClient = new this.endUserMessagingClientClass(clientConfig);
|
|
203
|
+
}
|
|
114
204
|
/**
|
|
115
205
|
* Set template engine for SMS message customization
|
|
116
206
|
*
|
|
@@ -208,9 +298,38 @@ class AWSSMSProvider {
|
|
|
208
298
|
await this.sendOTP(phone, code);
|
|
209
299
|
}
|
|
210
300
|
/**
|
|
211
|
-
* Send SMS message via AWS
|
|
301
|
+
* Send SMS message via AWS (Internal)
|
|
302
|
+
*
|
|
303
|
+
* Routes to either SNS Publish or End User Messaging SMS based on apiMode configuration.
|
|
304
|
+
*
|
|
305
|
+
* **SNS Mode (legacy):**
|
|
306
|
+
* - Uses SNS Publish API
|
|
307
|
+
* - Configuration sets NOT supported
|
|
308
|
+
* - Message attributes: AWS.SNS.SMS.SenderID, AWS.SNS.SMS.SMSType, AWS.MM.SMS.OriginationNumber
|
|
309
|
+
*
|
|
310
|
+
* **End User Messaging SMS Mode (modern):**
|
|
311
|
+
* - Uses End User Messaging SMS SendTextMessage API
|
|
312
|
+
* - Configuration sets fully supported
|
|
313
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
314
|
+
* - Modern API for SMS/MMS messaging
|
|
315
|
+
*
|
|
316
|
+
* @param phone - Recipient phone number in E.164 format
|
|
317
|
+
* @param message - SMS message content
|
|
318
|
+
*
|
|
319
|
+
* @throws {Error} If AWS API call fails
|
|
212
320
|
*
|
|
213
|
-
*
|
|
321
|
+
* @private
|
|
322
|
+
*/
|
|
323
|
+
async sendSMS(phone, message) {
|
|
324
|
+
if (this.apiMode === 'sns') {
|
|
325
|
+
await this.sendViaSNS(phone, message);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
await this.sendViaEndUserMessagingSMS(phone, message);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Send SMS via AWS SNS Publish API (legacy mode)
|
|
214
333
|
*
|
|
215
334
|
* **AWS SNS Attributes:**
|
|
216
335
|
* - `AWS.SNS.SMS.SenderID`: Sender name or origination number
|
|
@@ -218,16 +337,19 @@ class AWSSMSProvider {
|
|
|
218
337
|
* - `AWS.MM.SMS.OriginationNumber`: Phone number for US/Canada
|
|
219
338
|
* - `AWS.SNS.SMS.MaxPrice`: Maximum price per SMS
|
|
220
339
|
*
|
|
340
|
+
* **Note:** Configuration sets are NOT supported with SNS Publish.
|
|
341
|
+
* AWS rejects message attributes starting with 'AWS.' or 'Amazon.'
|
|
342
|
+
*
|
|
221
343
|
* @param phone - Recipient phone number in E.164 format
|
|
222
344
|
* @param message - SMS message content
|
|
223
345
|
*
|
|
224
|
-
* @throws {
|
|
346
|
+
* @throws {NAuthException} If AWS SNS API call fails
|
|
225
347
|
*
|
|
226
348
|
* @private
|
|
227
349
|
*/
|
|
228
|
-
async
|
|
350
|
+
async sendViaSNS(phone, message) {
|
|
229
351
|
try {
|
|
230
|
-
await this.
|
|
352
|
+
await this.ensureSNSInitialized();
|
|
231
353
|
const messageAttributes = {
|
|
232
354
|
'AWS.SNS.SMS.SMSType': {
|
|
233
355
|
DataType: 'String',
|
|
@@ -254,15 +376,8 @@ class AWSSMSProvider {
|
|
|
254
376
|
Message: message,
|
|
255
377
|
MessageAttributes: messageAttributes,
|
|
256
378
|
};
|
|
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
|
-
}
|
|
379
|
+
// Note: Configuration sets are NOT supported with SNS Publish API
|
|
380
|
+
// Use apiMode: 'end-user-messaging-sms' for configuration set support
|
|
266
381
|
const command = new this.publishCommandClass(input);
|
|
267
382
|
const response = await this.snsClient.send(command);
|
|
268
383
|
this.logger.log(`SMS sent to ${phone} (MessageId: ${response.MessageId})`);
|
|
@@ -273,6 +388,72 @@ class AWSSMSProvider {
|
|
|
273
388
|
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, `AWS SMS delivery failed: ${errorMessage}`);
|
|
274
389
|
}
|
|
275
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Send SMS via AWS End User Messaging SMS API (modern mode)
|
|
393
|
+
*
|
|
394
|
+
* **Features:**
|
|
395
|
+
* - Full configuration set support
|
|
396
|
+
* - Delivery events to SNS topics, CloudWatch, Kinesis
|
|
397
|
+
* - Modern API for SMS/MMS messaging
|
|
398
|
+
* - Supports phone numbers, sender IDs, and pools
|
|
399
|
+
*
|
|
400
|
+
* @param phone - Recipient phone number in E.164 format
|
|
401
|
+
* @param message - SMS message content
|
|
402
|
+
*
|
|
403
|
+
* @throws {NAuthException} If AWS End User Messaging SMS API call fails
|
|
404
|
+
*
|
|
405
|
+
* @private
|
|
406
|
+
*/
|
|
407
|
+
async sendViaEndUserMessagingSMS(phone, message) {
|
|
408
|
+
try {
|
|
409
|
+
await this.ensureEndUserMessagingSMSInitialized();
|
|
410
|
+
// Build SendTextMessage input to match API shape (ensures ConfigurationSetName is sent when set)
|
|
411
|
+
const input = {
|
|
412
|
+
DestinationPhoneNumber: phone,
|
|
413
|
+
MessageBody: message,
|
|
414
|
+
MessageType: 'TRANSACTIONAL',
|
|
415
|
+
OriginationIdentity: this.config.originationNumber,
|
|
416
|
+
...(this.config.configurationSetName ? { ConfigurationSetName: this.config.configurationSetName } : {}),
|
|
417
|
+
};
|
|
418
|
+
if (this.config.configurationSetName) {
|
|
419
|
+
this.logger.log(`Sending SMS with configuration set: ${this.config.configurationSetName} (ensure this set has event destinations in AWS End User Messaging SMS)`);
|
|
420
|
+
this.logger.debug(`End User Messaging SMS request: ConfigurationSetName=${this.config.configurationSetName}, OriginationIdentity=${this.config.originationNumber}, MessageType=TRANSACTIONAL`);
|
|
421
|
+
}
|
|
422
|
+
const command = new this.sendTextMessageCommandClass(input);
|
|
423
|
+
const response = await this.endUserMessagingClient.send(command);
|
|
424
|
+
this.logger.log(`SMS sent to ${phone} (MessageId: ${response.MessageId})`);
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
428
|
+
this.logger.error(`AWS End User Messaging SMS failed: ${errorMessage}`);
|
|
429
|
+
// Provide clearer message for protect-configuration blocks (destination country / number)
|
|
430
|
+
const userMessage = this.getEndUserMessagingSMSUserMessage(errorMessage);
|
|
431
|
+
throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, userMessage);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Map AWS End User Messaging SMS errors to user-facing messages.
|
|
436
|
+
* Protect configuration blocks are an AWS account/config issue, not an app bug.
|
|
437
|
+
*
|
|
438
|
+
* @param awsMessage - Raw error message from AWS SDK
|
|
439
|
+
* @returns User-facing message
|
|
440
|
+
* @private
|
|
441
|
+
*/
|
|
442
|
+
getEndUserMessagingSMSUserMessage(awsMessage) {
|
|
443
|
+
if (awsMessage.includes('DESTINATION_COUNTRY_BLOCKED_BY_PROTECT_CONFIGURATION')) {
|
|
444
|
+
return ('AWS End User Messaging SMS delivery failed: destination country is blocked by your AWS protect configuration. ' +
|
|
445
|
+
'Allow the country in AWS End User Messaging SMS (protect configuration) or use a configuration set without that protect association.');
|
|
446
|
+
}
|
|
447
|
+
if (awsMessage.includes('DESTINATION_PHONE_NUMBER_BLOCKED_BY_PROTECT_NUMBER_OVERRIDE')) {
|
|
448
|
+
return ('AWS End User Messaging SMS delivery failed: destination number is blocked by your AWS protect number override. ' +
|
|
449
|
+
'Update or remove the override in AWS End User Messaging SMS.');
|
|
450
|
+
}
|
|
451
|
+
if (awsMessage.includes('TEXT_PROTECT_BLOCKED')) {
|
|
452
|
+
return ('AWS End User Messaging SMS delivery failed: message blocked by AWS Text Protect. ' +
|
|
453
|
+
'Check your protect configuration in AWS End User Messaging SMS.');
|
|
454
|
+
}
|
|
455
|
+
return `AWS End User Messaging SMS delivery failed: ${awsMessage}`;
|
|
456
|
+
}
|
|
276
457
|
}
|
|
277
458
|
exports.AWSSMSProvider = AWSSMSProvider;
|
|
278
459
|
//# 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":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BAAa,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACK,iCAAiC,CAAC,UAAkB;QAC1D,IAAI,UAAU,CAAC,QAAQ,CAAC,sDAAsD,CAAC,EAAE,CAAC;YAChF,OAAO,CACL,gHAAgH;gBAChH,sIAAsI,CACvI,CAAC;QACJ,CAAC;QACD,IAAI,UAAU,CAAC,QAAQ,CAAC,6DAA6D,CAAC,EAAE,CAAC;YACvF,OAAO,CACL,iHAAiH;gBACjH,8DAA8D,CAC/D,CAAC;QACJ,CAAC;QACD,IAAI,UAAU,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAChD,OAAO,CACL,mFAAmF;gBACnF,iEAAiE,CAClE,CAAC;QACJ,CAAC;QACD,OAAO,+CAA+C,UAAU,EAAE,CAAC;IACrE,CAAC;CACF;AAndD,wCAmdC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nauth-toolkit/sms-aws-sns",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.131",
|
|
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.131"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/jest": "^29.5.0",
|