@ariary/notification 3.0.9 → 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 +33 -21
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +6 -3
- package/dist/index.mjs +6 -3
- package/package.json +2 -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 |
|
|
114
|
-
|
|
115
|
-
### `task.status(count, page?)` — TaskWithDetails
|
|
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) |
|
|
116
113
|
|
|
117
|
-
|
|
|
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,16 +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)
|
|
164
|
+
|
|
165
|
+
// all SMS at once
|
|
166
|
+
const full = await task.fullStatus()
|
|
167
|
+
// full.sms => [...all SMS], full.total => 50
|
|
156
168
|
```
|
|
157
169
|
|
|
158
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,8 +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<
|
|
70
|
+
status(): Promise<TaskResponse>;
|
|
71
|
+
status(count: number, page?: number): Promise<TaskResponse>;
|
|
72
|
+
fullStatus(): Promise<TaskResponse>;
|
|
72
73
|
}
|
|
73
74
|
declare class Ariari {
|
|
74
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,8 +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<
|
|
70
|
+
status(): Promise<TaskResponse>;
|
|
71
|
+
status(count: number, page?: number): Promise<TaskResponse>;
|
|
72
|
+
fullStatus(): Promise<TaskResponse>;
|
|
72
73
|
}
|
|
73
74
|
declare class Ariari {
|
|
74
75
|
private _config;
|
package/dist/index.js
CHANGED
|
@@ -98,12 +98,15 @@ 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
|
-
const details =
|
|
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
|
+
async fullStatus() {
|
|
108
|
+
return this._requester.get(`/api/notif-task/${this.id}?details=-1`);
|
|
109
|
+
}
|
|
107
110
|
};
|
|
108
111
|
var _Ariari = class _Ariari {
|
|
109
112
|
constructor({ name = "main", ...config }) {
|
package/dist/index.mjs
CHANGED
|
@@ -71,12 +71,15 @@ 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
|
-
const details =
|
|
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
|
+
async fullStatus() {
|
|
81
|
+
return this._requester.get(`/api/notif-task/${this.id}?details=-1`);
|
|
82
|
+
}
|
|
80
83
|
};
|
|
81
84
|
var _Ariari = class _Ariari {
|
|
82
85
|
constructor({ name = "main", ...config }) {
|
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",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"orange",
|
|
35
35
|
"airtel",
|
|
36
36
|
"telma",
|
|
37
|
+
"yas",
|
|
37
38
|
"scheduled-sms",
|
|
38
39
|
"deferred-sms",
|
|
39
40
|
"delivery-tracking",
|