@tc-libs/sms 3.6.0 → 3.6.1

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.
Files changed (2) hide show
  1. package/README.md +63 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,63 @@
1
- # sms
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build sms` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test sms` to execute the unit tests via [Jest](https://jestjs.io).
1
+ # @tc-libs/sms
2
+
3
+ Gateway SMS basato su AWS SNS.
4
+
5
+ Il package espone `SmsModule`, enum `SMS_TYPE`, interfaccia `ISmSService` e l'implementazione `SmSAwsSnsService`.
6
+
7
+ ## Registrazione
8
+
9
+ ```ts
10
+ SmsModule.register(
11
+ {
12
+ aws: {
13
+ credential: {
14
+ key: process.env.AWS_ACCESS_KEY_ID!,
15
+ secret: process.env.AWS_SECRET_ACCESS_KEY!,
16
+ },
17
+ s3: {
18
+ region: process.env.AWS_REGION!,
19
+ bucket: '',
20
+ baseUrl: '',
21
+ },
22
+ },
23
+ },
24
+ true,
25
+ );
26
+ ```
27
+
28
+ Nota: l'opzione si chiama `s3`, ma il servizio usa solo `region` per configurare SNS.
29
+
30
+ ## Invio SMS
31
+
32
+ ```ts
33
+ const sent = await this.smsService.sendSmS(
34
+ '+391234567890',
35
+ 'Codice OTP: 123456',
36
+ 'MyApp',
37
+ SMS_TYPE.TRANSACTIONAL,
38
+ );
39
+ ```
40
+
41
+ Il metodo:
42
+
43
+ - verifica prima se il numero e opt-out su SNS
44
+ - invia il messaggio con `SenderID`
45
+ - restituisce `true` o `false`
46
+
47
+ ## Export pubblici
48
+
49
+ ```ts
50
+ import {
51
+ ISmSService,
52
+ SMS_TYPE,
53
+ SmSAwsSnsService,
54
+ SmsModule,
55
+ } from '@tc-libs/sms';
56
+ ```
57
+
58
+ ## Sviluppo
59
+
60
+ ```bash
61
+ nx build sms
62
+ nx test sms
63
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tc-libs/sms",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "dependencies": {
5
5
  "@aws-sdk/client-sns": "^3.777.0",
6
6
  "@nestjs/common": "^11.0.12",