@ariary/notification 3.0.10 → 3.0.11
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 +31 -23
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,32 +103,40 @@ const estimate = await Ariari.estimate(
|
|
|
103
103
|
|
|
104
104
|
`send()` returns a `Task` object. Call `.status()` to check delivery progress.
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
All methods return the same response shape:
|
|
107
107
|
|
|
108
108
|
| Field | Type | Description |
|
|
109
109
|
|---|---|---|
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `delivered` | number | Confirmed delivered |
|
|
110
|
+
| `task` | TaskData | Task metadata (see below) |
|
|
111
|
+
| `sms` | SmsDetail[] | List of SMS details (`[]` when no details requested) |
|
|
112
|
+
| `total` | number | Total SMS count for pagination (`0` when no details requested) |
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
| Field | Type | Description |
|
|
114
|
+
| Method | Details query | Description |
|
|
118
115
|
|---|---|---|
|
|
119
|
-
| `task` |
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
116
|
+
| `task.status()` | *(none)* | Task only, `sms: []` |
|
|
117
|
+
| `task.status(count)` | `?details=count,1` | Task + first `count` SMS |
|
|
118
|
+
| `task.status(count, page)` | `?details=count,page` | Task + paginated SMS |
|
|
119
|
+
| `task.fullStatus()` | `?details=-1` | Task + all SMS |
|
|
122
120
|
|
|
123
|
-
###
|
|
121
|
+
### TaskData
|
|
124
122
|
|
|
125
123
|
| Field | Type | Description |
|
|
126
124
|
|---|---|---|
|
|
127
125
|
| `_id` | string | Task ID |
|
|
128
|
-
| `status` |
|
|
129
|
-
| `statusPage` |
|
|
126
|
+
| `status` | TaskCounters | Delivery counters per SMS |
|
|
127
|
+
| `statusPage` | TaskCounters | Delivery counters per SMS page |
|
|
128
|
+
| `projectId` | string | Project ID |
|
|
130
129
|
| `createdAt` | string | Creation date |
|
|
131
|
-
| `scheduledAt` | string? | Scheduled date |
|
|
130
|
+
| `scheduledAt` | string? | Scheduled date (only if scheduled) |
|
|
131
|
+
|
|
132
|
+
### TaskCounters
|
|
133
|
+
|
|
134
|
+
| Field | Type | Description |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `total` | number | Total SMS count |
|
|
137
|
+
| `sent` | number | Successfully sent |
|
|
138
|
+
| `failed` | number | Failed to send |
|
|
139
|
+
| `delivered` | number | Confirmed delivered |
|
|
132
140
|
|
|
133
141
|
### SmsDetail
|
|
134
142
|
|
|
@@ -143,20 +151,20 @@ const estimate = await Ariari.estimate(
|
|
|
143
151
|
```ts
|
|
144
152
|
const task = await Ariari.send({ phone: '0340000000', message: 'Hello!' })
|
|
145
153
|
|
|
146
|
-
//
|
|
147
|
-
const
|
|
148
|
-
// { total: 1, sent: 1, failed: 0, delivered:
|
|
154
|
+
// task only (sms: [], total: 0)
|
|
155
|
+
const res = await task.status()
|
|
156
|
+
// res.task.status => { total: 1, sent: 1, failed: 0, delivered: 0 }
|
|
149
157
|
|
|
150
|
-
//
|
|
151
|
-
const details = await task.status(
|
|
152
|
-
//
|
|
158
|
+
// task + first 10 SMS
|
|
159
|
+
const details = await task.status(10)
|
|
160
|
+
// details.sms => [{ smsId, phone, message, status, retryCount }]
|
|
153
161
|
|
|
154
162
|
// paginated: 20 per page, page 2
|
|
155
163
|
const page2 = await task.status(20, 2)
|
|
156
164
|
|
|
157
|
-
// all SMS
|
|
165
|
+
// all SMS at once
|
|
158
166
|
const full = await task.fullStatus()
|
|
159
|
-
//
|
|
167
|
+
// full.sms => [...all SMS], full.total => 50
|
|
160
168
|
```
|
|
161
169
|
|
|
162
170
|
SMS statuses: `SmsStatus.SCHEDULED` | `SmsStatus.PENDING` | `SmsStatus.SENT` | `SmsStatus.DELIVERED` | `SmsStatus.FAILED`
|
package/dist/index.d.mts
CHANGED
|
@@ -28,17 +28,17 @@ declare enum SmsStatus {
|
|
|
28
28
|
DELIVERED = "DELIVERED",
|
|
29
29
|
FAILED = "FAILED"
|
|
30
30
|
}
|
|
31
|
-
type
|
|
31
|
+
type TaskCounters = {
|
|
32
32
|
total: number;
|
|
33
33
|
sent: number;
|
|
34
34
|
failed: number;
|
|
35
35
|
delivered: number;
|
|
36
36
|
};
|
|
37
|
-
type
|
|
37
|
+
type TaskData = {
|
|
38
38
|
_id: string;
|
|
39
39
|
projectId: string;
|
|
40
|
-
status:
|
|
41
|
-
statusPage:
|
|
40
|
+
status: TaskCounters;
|
|
41
|
+
statusPage: TaskCounters;
|
|
42
42
|
createdAt: string;
|
|
43
43
|
scheduledAt?: string;
|
|
44
44
|
};
|
|
@@ -49,8 +49,8 @@ type SmsDetail = {
|
|
|
49
49
|
status: SmsStatus;
|
|
50
50
|
retryCount: number;
|
|
51
51
|
};
|
|
52
|
-
type
|
|
53
|
-
task:
|
|
52
|
+
type TaskResponse = {
|
|
53
|
+
task: TaskData;
|
|
54
54
|
sms: SmsDetail[];
|
|
55
55
|
total: number;
|
|
56
56
|
};
|
|
@@ -67,9 +67,9 @@ declare class Task {
|
|
|
67
67
|
id: string;
|
|
68
68
|
private _requester;
|
|
69
69
|
constructor(id: string, requester: ReturnType<typeof createRequester>);
|
|
70
|
-
status(): Promise<
|
|
71
|
-
status(count: number, page?: number): Promise<
|
|
72
|
-
fullStatus(): Promise<
|
|
70
|
+
status(): Promise<TaskResponse>;
|
|
71
|
+
status(count: number, page?: number): Promise<TaskResponse>;
|
|
72
|
+
fullStatus(): Promise<TaskResponse>;
|
|
73
73
|
}
|
|
74
74
|
declare class Ariari {
|
|
75
75
|
private _config;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,17 +28,17 @@ declare enum SmsStatus {
|
|
|
28
28
|
DELIVERED = "DELIVERED",
|
|
29
29
|
FAILED = "FAILED"
|
|
30
30
|
}
|
|
31
|
-
type
|
|
31
|
+
type TaskCounters = {
|
|
32
32
|
total: number;
|
|
33
33
|
sent: number;
|
|
34
34
|
failed: number;
|
|
35
35
|
delivered: number;
|
|
36
36
|
};
|
|
37
|
-
type
|
|
37
|
+
type TaskData = {
|
|
38
38
|
_id: string;
|
|
39
39
|
projectId: string;
|
|
40
|
-
status:
|
|
41
|
-
statusPage:
|
|
40
|
+
status: TaskCounters;
|
|
41
|
+
statusPage: TaskCounters;
|
|
42
42
|
createdAt: string;
|
|
43
43
|
scheduledAt?: string;
|
|
44
44
|
};
|
|
@@ -49,8 +49,8 @@ type SmsDetail = {
|
|
|
49
49
|
status: SmsStatus;
|
|
50
50
|
retryCount: number;
|
|
51
51
|
};
|
|
52
|
-
type
|
|
53
|
-
task:
|
|
52
|
+
type TaskResponse = {
|
|
53
|
+
task: TaskData;
|
|
54
54
|
sms: SmsDetail[];
|
|
55
55
|
total: number;
|
|
56
56
|
};
|
|
@@ -67,9 +67,9 @@ declare class Task {
|
|
|
67
67
|
id: string;
|
|
68
68
|
private _requester;
|
|
69
69
|
constructor(id: string, requester: ReturnType<typeof createRequester>);
|
|
70
|
-
status(): Promise<
|
|
71
|
-
status(count: number, page?: number): Promise<
|
|
72
|
-
fullStatus(): Promise<
|
|
70
|
+
status(): Promise<TaskResponse>;
|
|
71
|
+
status(count: number, page?: number): Promise<TaskResponse>;
|
|
72
|
+
fullStatus(): Promise<TaskResponse>;
|
|
73
73
|
}
|
|
74
74
|
declare class Ariari {
|
|
75
75
|
private _config;
|
package/dist/index.js
CHANGED
|
@@ -98,12 +98,12 @@ var Task = class {
|
|
|
98
98
|
}
|
|
99
99
|
async status(count, page) {
|
|
100
100
|
if (count === void 0) {
|
|
101
|
-
|
|
102
|
-
return response.status;
|
|
101
|
+
return this._requester.get(`/api/notif-task/${this.id}`);
|
|
103
102
|
}
|
|
104
103
|
const details = `${count},${page || 1}`;
|
|
105
104
|
return this._requester.get(`/api/notif-task/${this.id}?details=${details}`);
|
|
106
105
|
}
|
|
106
|
+
// All SMS at once
|
|
107
107
|
async fullStatus() {
|
|
108
108
|
return this._requester.get(`/api/notif-task/${this.id}?details=-1`);
|
|
109
109
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -71,12 +71,12 @@ var Task = class {
|
|
|
71
71
|
}
|
|
72
72
|
async status(count, page) {
|
|
73
73
|
if (count === void 0) {
|
|
74
|
-
|
|
75
|
-
return response.status;
|
|
74
|
+
return this._requester.get(`/api/notif-task/${this.id}`);
|
|
76
75
|
}
|
|
77
76
|
const details = `${count},${page || 1}`;
|
|
78
77
|
return this._requester.get(`/api/notif-task/${this.id}?details=${details}`);
|
|
79
78
|
}
|
|
79
|
+
// All SMS at once
|
|
80
80
|
async fullStatus() {
|
|
81
81
|
return this._requester.get(`/api/notif-task/${this.id}?details=-1`);
|
|
82
82
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariary/notification",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
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",
|