@ariary/notification 3.0.13 → 4.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/dist/index.d.mts +236 -30
- package/dist/index.d.ts +236 -30
- package/dist/index.js +78 -5
- package/dist/index.mjs +78 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Payment Service - NestJS
|
|
3
|
+
* Système de gestion des paiements - NestJS
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface EstimateMessage
|
|
16
|
+
*/
|
|
17
|
+
interface EstimateMessage$1 {
|
|
18
|
+
/**
|
|
19
|
+
* SMS text content
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof EstimateMessage
|
|
22
|
+
*/
|
|
23
|
+
text: string;
|
|
24
|
+
/**
|
|
25
|
+
* Number of recipients (default 1)
|
|
26
|
+
* @type {number}
|
|
27
|
+
* @memberof EstimateMessage
|
|
28
|
+
*/
|
|
29
|
+
repeat?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* API Payment Service - NestJS
|
|
34
|
+
* Système de gestion des paiements - NestJS
|
|
35
|
+
*
|
|
36
|
+
* The version of the OpenAPI document: 1.0
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
40
|
+
* https://openapi-generator.tech
|
|
41
|
+
* Do not edit the class manually.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @export
|
|
46
|
+
* @interface EstimateSmsResponse
|
|
47
|
+
*/
|
|
48
|
+
interface EstimateSmsResponse {
|
|
49
|
+
/**
|
|
50
|
+
* Total SMS count
|
|
51
|
+
* @type {number}
|
|
52
|
+
* @memberof EstimateSmsResponse
|
|
53
|
+
*/
|
|
54
|
+
sms: number;
|
|
55
|
+
/**
|
|
56
|
+
* Total credit consumption
|
|
57
|
+
* @type {number}
|
|
58
|
+
* @memberof EstimateSmsResponse
|
|
59
|
+
*/
|
|
60
|
+
credit: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* API Payment Service - NestJS
|
|
65
|
+
* Système de gestion des paiements - NestJS
|
|
66
|
+
*
|
|
67
|
+
* The version of the OpenAPI document: 1.0
|
|
68
|
+
*
|
|
69
|
+
*
|
|
70
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
71
|
+
* https://openapi-generator.tech
|
|
72
|
+
* Do not edit the class manually.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @export
|
|
77
|
+
* @interface NotifTaskStatus
|
|
78
|
+
*/
|
|
79
|
+
interface NotifTaskStatus {
|
|
80
|
+
/**
|
|
81
|
+
* Nombre total de SMS
|
|
82
|
+
* @type {number}
|
|
83
|
+
* @memberof NotifTaskStatus
|
|
84
|
+
*/
|
|
85
|
+
total: number;
|
|
86
|
+
/**
|
|
87
|
+
* Nombre de SMS envoyés avec succès
|
|
88
|
+
* @type {number}
|
|
89
|
+
* @memberof NotifTaskStatus
|
|
90
|
+
*/
|
|
91
|
+
sent: number;
|
|
92
|
+
/**
|
|
93
|
+
* Nombre de SMS échoués
|
|
94
|
+
* @type {number}
|
|
95
|
+
* @memberof NotifTaskStatus
|
|
96
|
+
*/
|
|
97
|
+
failed: number;
|
|
98
|
+
/**
|
|
99
|
+
* Nombre de SMS reçus par le destinataire
|
|
100
|
+
* @type {number}
|
|
101
|
+
* @memberof NotifTaskStatus
|
|
102
|
+
*/
|
|
103
|
+
delivered: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* API Payment Service - NestJS
|
|
108
|
+
* Système de gestion des paiements - NestJS
|
|
109
|
+
*
|
|
110
|
+
* The version of the OpenAPI document: 1.0
|
|
111
|
+
*
|
|
112
|
+
*
|
|
113
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
114
|
+
* https://openapi-generator.tech
|
|
115
|
+
* Do not edit the class manually.
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @export
|
|
120
|
+
*/
|
|
121
|
+
declare const SmsStatus$1: {
|
|
122
|
+
readonly Scheduled: "SCHEDULED";
|
|
123
|
+
readonly Pending: "PENDING";
|
|
124
|
+
readonly Sent: "SENT";
|
|
125
|
+
readonly Delivered: "DELIVERED";
|
|
126
|
+
readonly Failed: "FAILED";
|
|
127
|
+
};
|
|
128
|
+
type SmsStatus$1 = typeof SmsStatus$1[keyof typeof SmsStatus$1];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* API Payment Service - NestJS
|
|
132
|
+
* Système de gestion des paiements - NestJS
|
|
133
|
+
*
|
|
134
|
+
* The version of the OpenAPI document: 1.0
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
138
|
+
* https://openapi-generator.tech
|
|
139
|
+
* Do not edit the class manually.
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
*
|
|
144
|
+
* @export
|
|
145
|
+
* @interface SmsDetail
|
|
146
|
+
*/
|
|
147
|
+
interface SmsDetail$1 {
|
|
148
|
+
/**
|
|
149
|
+
* ID unique du SMS
|
|
150
|
+
* @type {string}
|
|
151
|
+
* @memberof SmsDetail
|
|
152
|
+
*/
|
|
153
|
+
smsId: string;
|
|
154
|
+
/**
|
|
155
|
+
* Numéro de téléphone destinataire
|
|
156
|
+
* @type {string}
|
|
157
|
+
* @memberof SmsDetail
|
|
158
|
+
*/
|
|
159
|
+
phone: string;
|
|
160
|
+
/**
|
|
161
|
+
* Contenu du message SMS
|
|
162
|
+
* @type {string}
|
|
163
|
+
* @memberof SmsDetail
|
|
164
|
+
*/
|
|
165
|
+
message: string;
|
|
166
|
+
/**
|
|
167
|
+
* Statut du SMS
|
|
168
|
+
* @type {SmsStatus}
|
|
169
|
+
* @memberof SmsDetail
|
|
170
|
+
*/
|
|
171
|
+
status: SmsStatus$1;
|
|
172
|
+
/**
|
|
173
|
+
* Nombre de retries effectués (0-2, au-delà de 2 = FAILED)
|
|
174
|
+
* @type {number}
|
|
175
|
+
* @memberof SmsDetail
|
|
176
|
+
*/
|
|
177
|
+
retryCount: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* API Payment Service - NestJS
|
|
182
|
+
* Système de gestion des paiements - NestJS
|
|
183
|
+
*
|
|
184
|
+
* The version of the OpenAPI document: 1.0
|
|
185
|
+
*
|
|
186
|
+
*
|
|
187
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
188
|
+
* https://openapi-generator.tech
|
|
189
|
+
* Do not edit the class manually.
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
*
|
|
194
|
+
* @export
|
|
195
|
+
* @interface ResponseNotifTask
|
|
196
|
+
*/
|
|
197
|
+
interface ResponseNotifTask {
|
|
198
|
+
/**
|
|
199
|
+
* ID unique de la tâche de notification
|
|
200
|
+
* @type {string}
|
|
201
|
+
* @memberof ResponseNotifTask
|
|
202
|
+
*/
|
|
203
|
+
id: string;
|
|
204
|
+
/**
|
|
205
|
+
* Statut par SMS
|
|
206
|
+
* @type {NotifTaskStatus}
|
|
207
|
+
* @memberof ResponseNotifTask
|
|
208
|
+
*/
|
|
209
|
+
status: NotifTaskStatus;
|
|
210
|
+
/**
|
|
211
|
+
* Statut par pages SMS
|
|
212
|
+
* @type {NotifTaskStatus}
|
|
213
|
+
* @memberof ResponseNotifTask
|
|
214
|
+
*/
|
|
215
|
+
statusPage: NotifTaskStatus;
|
|
216
|
+
/**
|
|
217
|
+
* ID du projet
|
|
218
|
+
* @type {string}
|
|
219
|
+
* @memberof ResponseNotifTask
|
|
220
|
+
*/
|
|
221
|
+
projectId: string;
|
|
222
|
+
/**
|
|
223
|
+
* Date de création de la tâche
|
|
224
|
+
* @type {Date}
|
|
225
|
+
* @memberof ResponseNotifTask
|
|
226
|
+
*/
|
|
227
|
+
createdAt: Date;
|
|
228
|
+
}
|
|
229
|
+
|
|
1
230
|
type Data = {
|
|
2
|
-
body?: Record<string, unknown
|
|
231
|
+
body?: Record<string, unknown> | object;
|
|
3
232
|
params?: Record<string, string>;
|
|
4
233
|
public?: boolean;
|
|
5
234
|
};
|
|
@@ -28,40 +257,17 @@ declare enum SmsStatus {
|
|
|
28
257
|
DELIVERED = "DELIVERED",
|
|
29
258
|
FAILED = "FAILED"
|
|
30
259
|
}
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
type TaskData = {
|
|
38
|
-
_id: string;
|
|
39
|
-
projectId: string;
|
|
40
|
-
status: TaskCounters;
|
|
41
|
-
statusPage: TaskCounters;
|
|
42
|
-
createdAt: string;
|
|
43
|
-
scheduledAt?: string;
|
|
44
|
-
};
|
|
45
|
-
type SmsDetail = {
|
|
46
|
-
smsId: string;
|
|
47
|
-
phone: string;
|
|
48
|
-
message: string;
|
|
49
|
-
status: SmsStatus;
|
|
50
|
-
retryCount: number;
|
|
260
|
+
type SmsDetail = SmsDetail$1;
|
|
261
|
+
type EstimateMessage = EstimateMessage$1;
|
|
262
|
+
type EstimateResponse = EstimateSmsResponse;
|
|
263
|
+
type TaskData = ResponseNotifTask & {
|
|
264
|
+
scheduledAt?: Date;
|
|
51
265
|
};
|
|
52
266
|
type TaskResponse = {
|
|
53
267
|
task: TaskData;
|
|
54
268
|
sms: SmsDetail[];
|
|
55
269
|
total: number;
|
|
56
270
|
};
|
|
57
|
-
type EstimateMessage = {
|
|
58
|
-
text: string;
|
|
59
|
-
repeat?: number;
|
|
60
|
-
};
|
|
61
|
-
type EstimateResponse = {
|
|
62
|
-
sms: number;
|
|
63
|
-
credit: number;
|
|
64
|
-
};
|
|
65
271
|
|
|
66
272
|
declare class Task {
|
|
67
273
|
id: string;
|
|
@@ -87,7 +293,7 @@ declare class Ariari {
|
|
|
87
293
|
estimate: (...messages: EstimateMessage[]) => Promise<EstimateResponse>;
|
|
88
294
|
static send: (...args: [string, ...Message[]] | Message[]) => Promise<Task>;
|
|
89
295
|
static getTask: (taskId: string) => Task;
|
|
90
|
-
static estimate: (...messages: EstimateMessage[]) => Promise<
|
|
296
|
+
static estimate: (...messages: EstimateMessage[]) => Promise<EstimateSmsResponse>;
|
|
91
297
|
}
|
|
92
298
|
|
|
93
299
|
export { SmsStatus, Ariari as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Payment Service - NestJS
|
|
3
|
+
* Système de gestion des paiements - NestJS
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface EstimateMessage
|
|
16
|
+
*/
|
|
17
|
+
interface EstimateMessage$1 {
|
|
18
|
+
/**
|
|
19
|
+
* SMS text content
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof EstimateMessage
|
|
22
|
+
*/
|
|
23
|
+
text: string;
|
|
24
|
+
/**
|
|
25
|
+
* Number of recipients (default 1)
|
|
26
|
+
* @type {number}
|
|
27
|
+
* @memberof EstimateMessage
|
|
28
|
+
*/
|
|
29
|
+
repeat?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* API Payment Service - NestJS
|
|
34
|
+
* Système de gestion des paiements - NestJS
|
|
35
|
+
*
|
|
36
|
+
* The version of the OpenAPI document: 1.0
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
40
|
+
* https://openapi-generator.tech
|
|
41
|
+
* Do not edit the class manually.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @export
|
|
46
|
+
* @interface EstimateSmsResponse
|
|
47
|
+
*/
|
|
48
|
+
interface EstimateSmsResponse {
|
|
49
|
+
/**
|
|
50
|
+
* Total SMS count
|
|
51
|
+
* @type {number}
|
|
52
|
+
* @memberof EstimateSmsResponse
|
|
53
|
+
*/
|
|
54
|
+
sms: number;
|
|
55
|
+
/**
|
|
56
|
+
* Total credit consumption
|
|
57
|
+
* @type {number}
|
|
58
|
+
* @memberof EstimateSmsResponse
|
|
59
|
+
*/
|
|
60
|
+
credit: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* API Payment Service - NestJS
|
|
65
|
+
* Système de gestion des paiements - NestJS
|
|
66
|
+
*
|
|
67
|
+
* The version of the OpenAPI document: 1.0
|
|
68
|
+
*
|
|
69
|
+
*
|
|
70
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
71
|
+
* https://openapi-generator.tech
|
|
72
|
+
* Do not edit the class manually.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @export
|
|
77
|
+
* @interface NotifTaskStatus
|
|
78
|
+
*/
|
|
79
|
+
interface NotifTaskStatus {
|
|
80
|
+
/**
|
|
81
|
+
* Nombre total de SMS
|
|
82
|
+
* @type {number}
|
|
83
|
+
* @memberof NotifTaskStatus
|
|
84
|
+
*/
|
|
85
|
+
total: number;
|
|
86
|
+
/**
|
|
87
|
+
* Nombre de SMS envoyés avec succès
|
|
88
|
+
* @type {number}
|
|
89
|
+
* @memberof NotifTaskStatus
|
|
90
|
+
*/
|
|
91
|
+
sent: number;
|
|
92
|
+
/**
|
|
93
|
+
* Nombre de SMS échoués
|
|
94
|
+
* @type {number}
|
|
95
|
+
* @memberof NotifTaskStatus
|
|
96
|
+
*/
|
|
97
|
+
failed: number;
|
|
98
|
+
/**
|
|
99
|
+
* Nombre de SMS reçus par le destinataire
|
|
100
|
+
* @type {number}
|
|
101
|
+
* @memberof NotifTaskStatus
|
|
102
|
+
*/
|
|
103
|
+
delivered: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* API Payment Service - NestJS
|
|
108
|
+
* Système de gestion des paiements - NestJS
|
|
109
|
+
*
|
|
110
|
+
* The version of the OpenAPI document: 1.0
|
|
111
|
+
*
|
|
112
|
+
*
|
|
113
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
114
|
+
* https://openapi-generator.tech
|
|
115
|
+
* Do not edit the class manually.
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @export
|
|
120
|
+
*/
|
|
121
|
+
declare const SmsStatus$1: {
|
|
122
|
+
readonly Scheduled: "SCHEDULED";
|
|
123
|
+
readonly Pending: "PENDING";
|
|
124
|
+
readonly Sent: "SENT";
|
|
125
|
+
readonly Delivered: "DELIVERED";
|
|
126
|
+
readonly Failed: "FAILED";
|
|
127
|
+
};
|
|
128
|
+
type SmsStatus$1 = typeof SmsStatus$1[keyof typeof SmsStatus$1];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* API Payment Service - NestJS
|
|
132
|
+
* Système de gestion des paiements - NestJS
|
|
133
|
+
*
|
|
134
|
+
* The version of the OpenAPI document: 1.0
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
138
|
+
* https://openapi-generator.tech
|
|
139
|
+
* Do not edit the class manually.
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
*
|
|
144
|
+
* @export
|
|
145
|
+
* @interface SmsDetail
|
|
146
|
+
*/
|
|
147
|
+
interface SmsDetail$1 {
|
|
148
|
+
/**
|
|
149
|
+
* ID unique du SMS
|
|
150
|
+
* @type {string}
|
|
151
|
+
* @memberof SmsDetail
|
|
152
|
+
*/
|
|
153
|
+
smsId: string;
|
|
154
|
+
/**
|
|
155
|
+
* Numéro de téléphone destinataire
|
|
156
|
+
* @type {string}
|
|
157
|
+
* @memberof SmsDetail
|
|
158
|
+
*/
|
|
159
|
+
phone: string;
|
|
160
|
+
/**
|
|
161
|
+
* Contenu du message SMS
|
|
162
|
+
* @type {string}
|
|
163
|
+
* @memberof SmsDetail
|
|
164
|
+
*/
|
|
165
|
+
message: string;
|
|
166
|
+
/**
|
|
167
|
+
* Statut du SMS
|
|
168
|
+
* @type {SmsStatus}
|
|
169
|
+
* @memberof SmsDetail
|
|
170
|
+
*/
|
|
171
|
+
status: SmsStatus$1;
|
|
172
|
+
/**
|
|
173
|
+
* Nombre de retries effectués (0-2, au-delà de 2 = FAILED)
|
|
174
|
+
* @type {number}
|
|
175
|
+
* @memberof SmsDetail
|
|
176
|
+
*/
|
|
177
|
+
retryCount: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* API Payment Service - NestJS
|
|
182
|
+
* Système de gestion des paiements - NestJS
|
|
183
|
+
*
|
|
184
|
+
* The version of the OpenAPI document: 1.0
|
|
185
|
+
*
|
|
186
|
+
*
|
|
187
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
188
|
+
* https://openapi-generator.tech
|
|
189
|
+
* Do not edit the class manually.
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
*
|
|
194
|
+
* @export
|
|
195
|
+
* @interface ResponseNotifTask
|
|
196
|
+
*/
|
|
197
|
+
interface ResponseNotifTask {
|
|
198
|
+
/**
|
|
199
|
+
* ID unique de la tâche de notification
|
|
200
|
+
* @type {string}
|
|
201
|
+
* @memberof ResponseNotifTask
|
|
202
|
+
*/
|
|
203
|
+
id: string;
|
|
204
|
+
/**
|
|
205
|
+
* Statut par SMS
|
|
206
|
+
* @type {NotifTaskStatus}
|
|
207
|
+
* @memberof ResponseNotifTask
|
|
208
|
+
*/
|
|
209
|
+
status: NotifTaskStatus;
|
|
210
|
+
/**
|
|
211
|
+
* Statut par pages SMS
|
|
212
|
+
* @type {NotifTaskStatus}
|
|
213
|
+
* @memberof ResponseNotifTask
|
|
214
|
+
*/
|
|
215
|
+
statusPage: NotifTaskStatus;
|
|
216
|
+
/**
|
|
217
|
+
* ID du projet
|
|
218
|
+
* @type {string}
|
|
219
|
+
* @memberof ResponseNotifTask
|
|
220
|
+
*/
|
|
221
|
+
projectId: string;
|
|
222
|
+
/**
|
|
223
|
+
* Date de création de la tâche
|
|
224
|
+
* @type {Date}
|
|
225
|
+
* @memberof ResponseNotifTask
|
|
226
|
+
*/
|
|
227
|
+
createdAt: Date;
|
|
228
|
+
}
|
|
229
|
+
|
|
1
230
|
type Data = {
|
|
2
|
-
body?: Record<string, unknown
|
|
231
|
+
body?: Record<string, unknown> | object;
|
|
3
232
|
params?: Record<string, string>;
|
|
4
233
|
public?: boolean;
|
|
5
234
|
};
|
|
@@ -28,40 +257,17 @@ declare enum SmsStatus {
|
|
|
28
257
|
DELIVERED = "DELIVERED",
|
|
29
258
|
FAILED = "FAILED"
|
|
30
259
|
}
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
type TaskData = {
|
|
38
|
-
_id: string;
|
|
39
|
-
projectId: string;
|
|
40
|
-
status: TaskCounters;
|
|
41
|
-
statusPage: TaskCounters;
|
|
42
|
-
createdAt: string;
|
|
43
|
-
scheduledAt?: string;
|
|
44
|
-
};
|
|
45
|
-
type SmsDetail = {
|
|
46
|
-
smsId: string;
|
|
47
|
-
phone: string;
|
|
48
|
-
message: string;
|
|
49
|
-
status: SmsStatus;
|
|
50
|
-
retryCount: number;
|
|
260
|
+
type SmsDetail = SmsDetail$1;
|
|
261
|
+
type EstimateMessage = EstimateMessage$1;
|
|
262
|
+
type EstimateResponse = EstimateSmsResponse;
|
|
263
|
+
type TaskData = ResponseNotifTask & {
|
|
264
|
+
scheduledAt?: Date;
|
|
51
265
|
};
|
|
52
266
|
type TaskResponse = {
|
|
53
267
|
task: TaskData;
|
|
54
268
|
sms: SmsDetail[];
|
|
55
269
|
total: number;
|
|
56
270
|
};
|
|
57
|
-
type EstimateMessage = {
|
|
58
|
-
text: string;
|
|
59
|
-
repeat?: number;
|
|
60
|
-
};
|
|
61
|
-
type EstimateResponse = {
|
|
62
|
-
sms: number;
|
|
63
|
-
credit: number;
|
|
64
|
-
};
|
|
65
271
|
|
|
66
272
|
declare class Task {
|
|
67
273
|
id: string;
|
|
@@ -87,7 +293,7 @@ declare class Ariari {
|
|
|
87
293
|
estimate: (...messages: EstimateMessage[]) => Promise<EstimateResponse>;
|
|
88
294
|
static send: (...args: [string, ...Message[]] | Message[]) => Promise<Task>;
|
|
89
295
|
static getTask: (taskId: string) => Task;
|
|
90
|
-
static estimate: (...messages: EstimateMessage[]) => Promise<
|
|
296
|
+
static estimate: (...messages: EstimateMessage[]) => Promise<EstimateSmsResponse>;
|
|
91
297
|
}
|
|
92
298
|
|
|
93
299
|
export { SmsStatus, Ariari as default };
|
package/dist/index.js
CHANGED
|
@@ -68,6 +68,64 @@ var normalizePhoneNumber = (phone) => {
|
|
|
68
68
|
return normalized;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
// ../common/gen/models/NotifTaskStatus.ts
|
|
72
|
+
function NotifTaskStatusFromJSON(json) {
|
|
73
|
+
return NotifTaskStatusFromJSONTyped(json, false);
|
|
74
|
+
}
|
|
75
|
+
function NotifTaskStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
76
|
+
if (json == null) {
|
|
77
|
+
return json;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
"total": json["total"],
|
|
81
|
+
"sent": json["sent"],
|
|
82
|
+
"failed": json["failed"],
|
|
83
|
+
"delivered": json["delivered"]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ../common/gen/models/ResponseNotifTask.ts
|
|
88
|
+
function ResponseNotifTaskFromJSON(json) {
|
|
89
|
+
return ResponseNotifTaskFromJSONTyped(json, false);
|
|
90
|
+
}
|
|
91
|
+
function ResponseNotifTaskFromJSONTyped(json, ignoreDiscriminator) {
|
|
92
|
+
if (json == null) {
|
|
93
|
+
return json;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
"id": json["_id"],
|
|
97
|
+
"status": NotifTaskStatusFromJSON(json["status"]),
|
|
98
|
+
"statusPage": NotifTaskStatusFromJSON(json["statusPage"]),
|
|
99
|
+
"projectId": json["projectId"],
|
|
100
|
+
"createdAt": new Date(json["createdAt"])
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ../common/gen/models/SmsStatus.ts
|
|
105
|
+
function SmsStatusFromJSON(json) {
|
|
106
|
+
return SmsStatusFromJSONTyped(json, false);
|
|
107
|
+
}
|
|
108
|
+
function SmsStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
109
|
+
return json;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ../common/gen/models/SmsDetail.ts
|
|
113
|
+
function SmsDetailFromJSON(json) {
|
|
114
|
+
return SmsDetailFromJSONTyped(json, false);
|
|
115
|
+
}
|
|
116
|
+
function SmsDetailFromJSONTyped(json, ignoreDiscriminator) {
|
|
117
|
+
if (json == null) {
|
|
118
|
+
return json;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
"smsId": json["smsId"],
|
|
122
|
+
"phone": json["phone"],
|
|
123
|
+
"message": json["message"],
|
|
124
|
+
"status": SmsStatusFromJSON(json["status"]),
|
|
125
|
+
"retryCount": json["retryCount"]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
71
129
|
// src/types/index.ts
|
|
72
130
|
var SmsStatus = /* @__PURE__ */ ((SmsStatus2) => {
|
|
73
131
|
SmsStatus2["SCHEDULED"] = "SCHEDULED";
|
|
@@ -90,6 +148,17 @@ var parseSchedule = (input) => {
|
|
|
90
148
|
}
|
|
91
149
|
return input;
|
|
92
150
|
};
|
|
151
|
+
var parseTaskResponse = (raw) => {
|
|
152
|
+
const task = {
|
|
153
|
+
...ResponseNotifTaskFromJSON(raw.task),
|
|
154
|
+
...raw.task.scheduledAt != null && { scheduledAt: new Date(raw.task.scheduledAt) }
|
|
155
|
+
};
|
|
156
|
+
return {
|
|
157
|
+
task,
|
|
158
|
+
sms: Array.isArray(raw.sms) ? raw.sms.map(SmsDetailFromJSON) : [],
|
|
159
|
+
total: raw.total ?? 0
|
|
160
|
+
};
|
|
161
|
+
};
|
|
93
162
|
var instances = {};
|
|
94
163
|
var Task = class {
|
|
95
164
|
constructor(id, requester) {
|
|
@@ -98,14 +167,17 @@ var Task = class {
|
|
|
98
167
|
}
|
|
99
168
|
async status(count, page) {
|
|
100
169
|
if (count === void 0) {
|
|
101
|
-
|
|
170
|
+
const res2 = await this._requester.get(`/api/notif-task/${this.id}`);
|
|
171
|
+
return parseTaskResponse(res2);
|
|
102
172
|
}
|
|
103
173
|
const details = `${count},${page || 1}`;
|
|
104
|
-
|
|
174
|
+
const res = await this._requester.get(`/api/notif-task/${this.id}?details=${details}`);
|
|
175
|
+
return parseTaskResponse(res);
|
|
105
176
|
}
|
|
106
177
|
// All SMS at once
|
|
107
178
|
async fullStatus() {
|
|
108
|
-
|
|
179
|
+
const res = await this._requester.get(`/api/notif-task/${this.id}?details=-1`);
|
|
180
|
+
return parseTaskResponse(res);
|
|
109
181
|
}
|
|
110
182
|
};
|
|
111
183
|
var _Ariari = class _Ariari {
|
|
@@ -122,7 +194,8 @@ var _Ariari = class _Ariari {
|
|
|
122
194
|
...scheduledAt && { scheduledAt }
|
|
123
195
|
};
|
|
124
196
|
const response = await this._requester.post("/api/sms/bulk", { body });
|
|
125
|
-
|
|
197
|
+
const task = ResponseNotifTaskFromJSON(response);
|
|
198
|
+
return new Task(task.id, this._requester);
|
|
126
199
|
};
|
|
127
200
|
this.getTask = (taskId) => new Task(taskId, this._requester);
|
|
128
201
|
this.estimate = async (...messages) => {
|
|
@@ -136,7 +209,7 @@ var _Ariari = class _Ariari {
|
|
|
136
209
|
_Ariari.config = (nameAndConfig) => new _Ariari(nameAndConfig);
|
|
137
210
|
_Ariari.init = _Ariari.config;
|
|
138
211
|
_Ariari.get = (name = "main") => {
|
|
139
|
-
if (!instances[name]) throw new Error(`The instance of Ariari with the name "${name}" doesn't exist yet. Call Ariari.config(...
|
|
212
|
+
if (!instances[name]) throw new Error(`The instance of Ariari with the name "${name}" doesn't exist yet. Call Ariari.config(...)`);
|
|
140
213
|
return instances[name];
|
|
141
214
|
};
|
|
142
215
|
_Ariari.send = async (...args) => await _Ariari.get("main")?.send(...args);
|
package/dist/index.mjs
CHANGED
|
@@ -41,6 +41,64 @@ var normalizePhoneNumber = (phone) => {
|
|
|
41
41
|
return normalized;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
// ../common/gen/models/NotifTaskStatus.ts
|
|
45
|
+
function NotifTaskStatusFromJSON(json) {
|
|
46
|
+
return NotifTaskStatusFromJSONTyped(json, false);
|
|
47
|
+
}
|
|
48
|
+
function NotifTaskStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
49
|
+
if (json == null) {
|
|
50
|
+
return json;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
"total": json["total"],
|
|
54
|
+
"sent": json["sent"],
|
|
55
|
+
"failed": json["failed"],
|
|
56
|
+
"delivered": json["delivered"]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ../common/gen/models/ResponseNotifTask.ts
|
|
61
|
+
function ResponseNotifTaskFromJSON(json) {
|
|
62
|
+
return ResponseNotifTaskFromJSONTyped(json, false);
|
|
63
|
+
}
|
|
64
|
+
function ResponseNotifTaskFromJSONTyped(json, ignoreDiscriminator) {
|
|
65
|
+
if (json == null) {
|
|
66
|
+
return json;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
"id": json["_id"],
|
|
70
|
+
"status": NotifTaskStatusFromJSON(json["status"]),
|
|
71
|
+
"statusPage": NotifTaskStatusFromJSON(json["statusPage"]),
|
|
72
|
+
"projectId": json["projectId"],
|
|
73
|
+
"createdAt": new Date(json["createdAt"])
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ../common/gen/models/SmsStatus.ts
|
|
78
|
+
function SmsStatusFromJSON(json) {
|
|
79
|
+
return SmsStatusFromJSONTyped(json, false);
|
|
80
|
+
}
|
|
81
|
+
function SmsStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
82
|
+
return json;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ../common/gen/models/SmsDetail.ts
|
|
86
|
+
function SmsDetailFromJSON(json) {
|
|
87
|
+
return SmsDetailFromJSONTyped(json, false);
|
|
88
|
+
}
|
|
89
|
+
function SmsDetailFromJSONTyped(json, ignoreDiscriminator) {
|
|
90
|
+
if (json == null) {
|
|
91
|
+
return json;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
"smsId": json["smsId"],
|
|
95
|
+
"phone": json["phone"],
|
|
96
|
+
"message": json["message"],
|
|
97
|
+
"status": SmsStatusFromJSON(json["status"]),
|
|
98
|
+
"retryCount": json["retryCount"]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
44
102
|
// src/types/index.ts
|
|
45
103
|
var SmsStatus = /* @__PURE__ */ ((SmsStatus2) => {
|
|
46
104
|
SmsStatus2["SCHEDULED"] = "SCHEDULED";
|
|
@@ -63,6 +121,17 @@ var parseSchedule = (input) => {
|
|
|
63
121
|
}
|
|
64
122
|
return input;
|
|
65
123
|
};
|
|
124
|
+
var parseTaskResponse = (raw) => {
|
|
125
|
+
const task = {
|
|
126
|
+
...ResponseNotifTaskFromJSON(raw.task),
|
|
127
|
+
...raw.task.scheduledAt != null && { scheduledAt: new Date(raw.task.scheduledAt) }
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
task,
|
|
131
|
+
sms: Array.isArray(raw.sms) ? raw.sms.map(SmsDetailFromJSON) : [],
|
|
132
|
+
total: raw.total ?? 0
|
|
133
|
+
};
|
|
134
|
+
};
|
|
66
135
|
var instances = {};
|
|
67
136
|
var Task = class {
|
|
68
137
|
constructor(id, requester) {
|
|
@@ -71,14 +140,17 @@ var Task = class {
|
|
|
71
140
|
}
|
|
72
141
|
async status(count, page) {
|
|
73
142
|
if (count === void 0) {
|
|
74
|
-
|
|
143
|
+
const res2 = await this._requester.get(`/api/notif-task/${this.id}`);
|
|
144
|
+
return parseTaskResponse(res2);
|
|
75
145
|
}
|
|
76
146
|
const details = `${count},${page || 1}`;
|
|
77
|
-
|
|
147
|
+
const res = await this._requester.get(`/api/notif-task/${this.id}?details=${details}`);
|
|
148
|
+
return parseTaskResponse(res);
|
|
78
149
|
}
|
|
79
150
|
// All SMS at once
|
|
80
151
|
async fullStatus() {
|
|
81
|
-
|
|
152
|
+
const res = await this._requester.get(`/api/notif-task/${this.id}?details=-1`);
|
|
153
|
+
return parseTaskResponse(res);
|
|
82
154
|
}
|
|
83
155
|
};
|
|
84
156
|
var _Ariari = class _Ariari {
|
|
@@ -95,7 +167,8 @@ var _Ariari = class _Ariari {
|
|
|
95
167
|
...scheduledAt && { scheduledAt }
|
|
96
168
|
};
|
|
97
169
|
const response = await this._requester.post("/api/sms/bulk", { body });
|
|
98
|
-
|
|
170
|
+
const task = ResponseNotifTaskFromJSON(response);
|
|
171
|
+
return new Task(task.id, this._requester);
|
|
99
172
|
};
|
|
100
173
|
this.getTask = (taskId) => new Task(taskId, this._requester);
|
|
101
174
|
this.estimate = async (...messages) => {
|
|
@@ -109,7 +182,7 @@ var _Ariari = class _Ariari {
|
|
|
109
182
|
_Ariari.config = (nameAndConfig) => new _Ariari(nameAndConfig);
|
|
110
183
|
_Ariari.init = _Ariari.config;
|
|
111
184
|
_Ariari.get = (name = "main") => {
|
|
112
|
-
if (!instances[name]) throw new Error(`The instance of Ariari with the name "${name}" doesn't exist yet. Call Ariari.config(...
|
|
185
|
+
if (!instances[name]) throw new Error(`The instance of Ariari with the name "${name}" doesn't exist yet. Call Ariari.config(...)`);
|
|
113
186
|
return instances[name];
|
|
114
187
|
};
|
|
115
188
|
_Ariari.send = async (...args) => await _Ariari.get("main")?.send(...args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariary/notification",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Ariary SMS & Notification SDK (ariari.mg) — Send SMS in Madagascar with automatic phone normalization, bulk messaging, deferred/scheduled sending, delivery tracking, credit estimation. Supports Orange, Airtel, Telma. Multi-instance, TypeScript-first.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|