@ariary/notification 1.0.1 → 1.0.2
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/README.md +46 -76
- package/dist/index.d.mts +130 -15
- package/dist/index.d.ts +130 -15
- package/dist/index.js +114 -211
- package/dist/index.mjs +110 -197
- package/package.json +49 -68
- package/dist/client-BOI4a9h5.d.mts +0 -40
- package/dist/client-BOI4a9h5.d.ts +0 -40
- package/dist/notif-task/index.d.mts +0 -59
- package/dist/notif-task/index.d.ts +0 -59
- package/dist/notif-task/index.js +0 -88
- package/dist/notif-task/index.mjs +0 -61
- package/dist/sms/index.d.mts +0 -62
- package/dist/sms/index.d.ts +0 -62
- package/dist/sms/index.js +0 -64
- package/dist/sms/index.mjs +0 -37
package/README.md
CHANGED
|
@@ -1,76 +1,46 @@
|
|
|
1
|
-
# @ariary/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @ariary/
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Initialisation
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
projectId: 'your-project-id',
|
|
20
|
-
secretId: 'your-secret-id'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
await
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Créer une tâche de notification
|
|
48
|
-
const task = await sdk.notifTask.create({
|
|
49
|
-
message: 'Hello World',
|
|
50
|
-
phones: ['261234567890', '261234567891']
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Récupérer toutes les tâches
|
|
54
|
-
const tasks = await sdk.notifTask.findAll('project-id');
|
|
55
|
-
|
|
56
|
-
// Récupérer une tâche
|
|
57
|
-
const task = await sdk.notifTask.findOne('task-id');
|
|
58
|
-
|
|
59
|
-
// Mettre à jour une tâche
|
|
60
|
-
await sdk.notifTask.update('task-id', {
|
|
61
|
-
message: 'Updated message'
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Récupérer les détails SMS d'une tâche
|
|
65
|
-
const details = await sdk.notifTask.getSmsDetails('task-id');
|
|
66
|
-
|
|
67
|
-
// Réessayer les SMS échoués
|
|
68
|
-
await sdk.notifTask.retryFailedSms('task-id');
|
|
69
|
-
|
|
70
|
-
// Supprimer une tâche
|
|
71
|
-
await sdk.notifTask.remove('task-id');
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## License
|
|
75
|
-
|
|
76
|
-
ISC
|
|
1
|
+
# @ariary/notification
|
|
2
|
+
|
|
3
|
+
Un outil pour envoyer des SMS via Ariary et suivre leur état.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ariary/notification
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Initialisation
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Ariari } from '@ariary/notification';
|
|
17
|
+
|
|
18
|
+
Ariari.config({
|
|
19
|
+
projectId: 'your-project-id',
|
|
20
|
+
secretId: 'your-secret-id'
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Notifications
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
// SMS
|
|
28
|
+
const sms = await Ariari.notification.send({ phone: ['261345678901', '261345678902'], message: 'Hello' });
|
|
29
|
+
const bulkSms = await Ariari.notification.sendBulk([
|
|
30
|
+
{ phone: '261345678901', message: 'Message 1' },
|
|
31
|
+
{ phone: '261345678902', message: 'Message 2' }
|
|
32
|
+
]);
|
|
33
|
+
const allSms = await Ariari.notification.getAll();
|
|
34
|
+
|
|
35
|
+
// Notification Tasks
|
|
36
|
+
const tasks = await Ariari.notification.task.findAll('projectId');
|
|
37
|
+
const task = await Ariari.notification.task.findOne(taskId);
|
|
38
|
+
const updatedTask = await Ariari.notification.task.update(taskId, { message: 'New' });
|
|
39
|
+
const deleted = await Ariari.notification.task.delete(taskId);
|
|
40
|
+
const smsDetails = await Ariari.notification.task.getSmsDetails(taskId);
|
|
41
|
+
const retried = await Ariari.notification.task.retryFailedSms(taskId);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
ISC
|
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
interface CreateSmsDto {
|
|
2
|
+
message: string;
|
|
3
|
+
phone: string;
|
|
4
|
+
}
|
|
5
|
+
interface SendSmsDto {
|
|
6
|
+
message: string;
|
|
7
|
+
phones: string[];
|
|
8
|
+
}
|
|
9
|
+
interface BulkSmsDto {
|
|
10
|
+
messages: {
|
|
11
|
+
phones: string[];
|
|
12
|
+
message: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
interface SendSmsResponseDto {
|
|
16
|
+
id: string;
|
|
17
|
+
message: string;
|
|
18
|
+
phone: string;
|
|
19
|
+
status: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
}
|
|
22
|
+
interface ResponseSmsDto {
|
|
23
|
+
id: string;
|
|
24
|
+
message: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
status: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}
|
|
30
|
+
interface MultiSmsResponseDto {
|
|
31
|
+
status: string;
|
|
32
|
+
data: {
|
|
33
|
+
id: string;
|
|
34
|
+
message: string;
|
|
35
|
+
phone: string;
|
|
36
|
+
status: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
interface BulkSmsResponseDto {
|
|
40
|
+
status: string;
|
|
41
|
+
data: {
|
|
42
|
+
id: string;
|
|
43
|
+
message: string;
|
|
44
|
+
phone: string;
|
|
45
|
+
status: string;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
interface CreateNotifTaskDto {
|
|
49
|
+
message: string;
|
|
50
|
+
phones: string[];
|
|
51
|
+
}
|
|
52
|
+
interface UpdateNotifTaskDto {
|
|
53
|
+
message?: string;
|
|
54
|
+
phones?: string[];
|
|
55
|
+
}
|
|
56
|
+
interface ResponseNotifTaskDto {
|
|
57
|
+
id: string;
|
|
58
|
+
message: string;
|
|
59
|
+
phones: string[];
|
|
60
|
+
status: string;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
updatedAt: string;
|
|
63
|
+
}
|
|
64
|
+
interface SmsDetail {
|
|
65
|
+
id: string;
|
|
66
|
+
phone: string;
|
|
67
|
+
message: string;
|
|
68
|
+
status: string;
|
|
69
|
+
attempts: number;
|
|
70
|
+
lastAttempt?: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
updatedAt: string;
|
|
73
|
+
}
|
|
74
|
+
interface NotifTaskDetailsDto {
|
|
75
|
+
id: string;
|
|
76
|
+
message: string;
|
|
77
|
+
status: string;
|
|
78
|
+
totalSms: number;
|
|
79
|
+
successCount: number;
|
|
80
|
+
failedCount: number;
|
|
81
|
+
pendingCount: number;
|
|
82
|
+
smsDetails: SmsDetail[];
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
85
|
+
}
|
|
86
|
+
interface RetryFailedSmsResponseDto {
|
|
87
|
+
status: string;
|
|
88
|
+
message: string;
|
|
89
|
+
retried?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface SmsApi {
|
|
93
|
+
send(data: {
|
|
94
|
+
phone: string | string[];
|
|
95
|
+
message: string;
|
|
96
|
+
}): Promise<MultiSmsResponseDto>;
|
|
97
|
+
sendBulk(messages: {
|
|
98
|
+
phone: string | string[];
|
|
99
|
+
message: string;
|
|
100
|
+
}[]): Promise<BulkSmsResponseDto>;
|
|
101
|
+
getAll(): Promise<ResponseSmsDto[]>;
|
|
102
|
+
}
|
|
103
|
+
interface NotifTaskApi {
|
|
104
|
+
findAll(projectId: string): Promise<ResponseNotifTaskDto[]>;
|
|
105
|
+
findOne(id: string): Promise<ResponseNotifTaskDto>;
|
|
106
|
+
update(id: string, data: UpdateNotifTaskDto): Promise<ResponseNotifTaskDto>;
|
|
107
|
+
delete(id: string): Promise<ResponseNotifTaskDto>;
|
|
108
|
+
getSmsDetails(id: string): Promise<NotifTaskDetailsDto>;
|
|
109
|
+
retryFailedSms(id: string): Promise<RetryFailedSmsResponseDto>;
|
|
110
|
+
}
|
|
111
|
+
interface NotificationService extends SmsApi {
|
|
112
|
+
task: NotifTaskApi;
|
|
113
|
+
}
|
|
114
|
+
declare const notificationService: NotificationService;
|
|
115
|
+
|
|
116
|
+
interface ApiConfig {
|
|
117
|
+
projectId: string;
|
|
118
|
+
secretId: string;
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
}
|
|
121
|
+
declare function setConfig(cfg: ApiConfig): void;
|
|
122
|
+
declare function getConfig(): ApiConfig | null;
|
|
7
123
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
notifTask: NotifTaskService;
|
|
15
|
-
constructor(config: ApiConfig);
|
|
124
|
+
declare class AriariBridge {
|
|
125
|
+
private static instance;
|
|
126
|
+
private constructor();
|
|
127
|
+
static getInstance(): AriariBridge;
|
|
128
|
+
config(cfg: ApiConfig): void;
|
|
129
|
+
get notification(): NotificationService;
|
|
16
130
|
}
|
|
131
|
+
declare const Ariari: AriariBridge;
|
|
17
132
|
|
|
18
|
-
export { ApiConfig,
|
|
133
|
+
export { type ApiConfig, Ariari, type BulkSmsDto, type BulkSmsResponseDto, type CreateNotifTaskDto, type CreateSmsDto, type MultiSmsResponseDto, type NotifTaskApi, type NotifTaskDetailsDto, type NotificationService, type ResponseNotifTaskDto, type ResponseSmsDto, type RetryFailedSmsResponseDto, type SendSmsDto, type SendSmsResponseDto, type SmsApi, type SmsDetail, type UpdateNotifTaskDto, getConfig, notificationService, setConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
interface CreateSmsDto {
|
|
2
|
+
message: string;
|
|
3
|
+
phone: string;
|
|
4
|
+
}
|
|
5
|
+
interface SendSmsDto {
|
|
6
|
+
message: string;
|
|
7
|
+
phones: string[];
|
|
8
|
+
}
|
|
9
|
+
interface BulkSmsDto {
|
|
10
|
+
messages: {
|
|
11
|
+
phones: string[];
|
|
12
|
+
message: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
interface SendSmsResponseDto {
|
|
16
|
+
id: string;
|
|
17
|
+
message: string;
|
|
18
|
+
phone: string;
|
|
19
|
+
status: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
}
|
|
22
|
+
interface ResponseSmsDto {
|
|
23
|
+
id: string;
|
|
24
|
+
message: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
status: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}
|
|
30
|
+
interface MultiSmsResponseDto {
|
|
31
|
+
status: string;
|
|
32
|
+
data: {
|
|
33
|
+
id: string;
|
|
34
|
+
message: string;
|
|
35
|
+
phone: string;
|
|
36
|
+
status: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
interface BulkSmsResponseDto {
|
|
40
|
+
status: string;
|
|
41
|
+
data: {
|
|
42
|
+
id: string;
|
|
43
|
+
message: string;
|
|
44
|
+
phone: string;
|
|
45
|
+
status: string;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
interface CreateNotifTaskDto {
|
|
49
|
+
message: string;
|
|
50
|
+
phones: string[];
|
|
51
|
+
}
|
|
52
|
+
interface UpdateNotifTaskDto {
|
|
53
|
+
message?: string;
|
|
54
|
+
phones?: string[];
|
|
55
|
+
}
|
|
56
|
+
interface ResponseNotifTaskDto {
|
|
57
|
+
id: string;
|
|
58
|
+
message: string;
|
|
59
|
+
phones: string[];
|
|
60
|
+
status: string;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
updatedAt: string;
|
|
63
|
+
}
|
|
64
|
+
interface SmsDetail {
|
|
65
|
+
id: string;
|
|
66
|
+
phone: string;
|
|
67
|
+
message: string;
|
|
68
|
+
status: string;
|
|
69
|
+
attempts: number;
|
|
70
|
+
lastAttempt?: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
updatedAt: string;
|
|
73
|
+
}
|
|
74
|
+
interface NotifTaskDetailsDto {
|
|
75
|
+
id: string;
|
|
76
|
+
message: string;
|
|
77
|
+
status: string;
|
|
78
|
+
totalSms: number;
|
|
79
|
+
successCount: number;
|
|
80
|
+
failedCount: number;
|
|
81
|
+
pendingCount: number;
|
|
82
|
+
smsDetails: SmsDetail[];
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
85
|
+
}
|
|
86
|
+
interface RetryFailedSmsResponseDto {
|
|
87
|
+
status: string;
|
|
88
|
+
message: string;
|
|
89
|
+
retried?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface SmsApi {
|
|
93
|
+
send(data: {
|
|
94
|
+
phone: string | string[];
|
|
95
|
+
message: string;
|
|
96
|
+
}): Promise<MultiSmsResponseDto>;
|
|
97
|
+
sendBulk(messages: {
|
|
98
|
+
phone: string | string[];
|
|
99
|
+
message: string;
|
|
100
|
+
}[]): Promise<BulkSmsResponseDto>;
|
|
101
|
+
getAll(): Promise<ResponseSmsDto[]>;
|
|
102
|
+
}
|
|
103
|
+
interface NotifTaskApi {
|
|
104
|
+
findAll(projectId: string): Promise<ResponseNotifTaskDto[]>;
|
|
105
|
+
findOne(id: string): Promise<ResponseNotifTaskDto>;
|
|
106
|
+
update(id: string, data: UpdateNotifTaskDto): Promise<ResponseNotifTaskDto>;
|
|
107
|
+
delete(id: string): Promise<ResponseNotifTaskDto>;
|
|
108
|
+
getSmsDetails(id: string): Promise<NotifTaskDetailsDto>;
|
|
109
|
+
retryFailedSms(id: string): Promise<RetryFailedSmsResponseDto>;
|
|
110
|
+
}
|
|
111
|
+
interface NotificationService extends SmsApi {
|
|
112
|
+
task: NotifTaskApi;
|
|
113
|
+
}
|
|
114
|
+
declare const notificationService: NotificationService;
|
|
115
|
+
|
|
116
|
+
interface ApiConfig {
|
|
117
|
+
projectId: string;
|
|
118
|
+
secretId: string;
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
}
|
|
121
|
+
declare function setConfig(cfg: ApiConfig): void;
|
|
122
|
+
declare function getConfig(): ApiConfig | null;
|
|
7
123
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
notifTask: NotifTaskService;
|
|
15
|
-
constructor(config: ApiConfig);
|
|
124
|
+
declare class AriariBridge {
|
|
125
|
+
private static instance;
|
|
126
|
+
private constructor();
|
|
127
|
+
static getInstance(): AriariBridge;
|
|
128
|
+
config(cfg: ApiConfig): void;
|
|
129
|
+
get notification(): NotificationService;
|
|
16
130
|
}
|
|
131
|
+
declare const Ariari: AriariBridge;
|
|
17
132
|
|
|
18
|
-
export { ApiConfig,
|
|
133
|
+
export { type ApiConfig, Ariari, type BulkSmsDto, type BulkSmsResponseDto, type CreateNotifTaskDto, type CreateSmsDto, type MultiSmsResponseDto, type NotifTaskApi, type NotifTaskDetailsDto, type NotificationService, type ResponseNotifTaskDto, type ResponseSmsDto, type RetryFailedSmsResponseDto, type SendSmsDto, type SendSmsResponseDto, type SmsApi, type SmsDetail, type UpdateNotifTaskDto, getConfig, notificationService, setConfig };
|