@ariary/notification 2.0.5 → 2.0.7
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 +3 -38
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,60 +21,25 @@ Ariari.config({
|
|
|
21
21
|
});
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
### Send Messages
|
|
25
|
-
|
|
26
24
|
```typescript
|
|
27
25
|
const task = await Ariari.send(
|
|
28
26
|
{ phone: '+261123456789', message: 'Message 1' },
|
|
29
27
|
{ phone: ['+261987654321', '+261555555555'], message: 'Message 2' }
|
|
30
28
|
);
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Check Task Status
|
|
34
|
-
|
|
35
|
-
#### Quick Status (Summary Only)
|
|
36
29
|
|
|
37
|
-
Get a quick overview of the task status without SMS details:
|
|
38
30
|
|
|
39
|
-
```typescript
|
|
40
|
-
const task = await Ariari.send(
|
|
41
|
-
{ phone: '+261123456789', message: 'Message 1' },
|
|
42
|
-
{ phone: ['+261987654321', '+261555555555'], message: 'Message 2' }
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const status = await task.status();
|
|
46
|
-
console.log(status);
|
|
47
|
-
// Returns: { notifTaskId, projectId, createdAt, summary: { total, sent, failed, pending } }
|
|
48
31
|
```
|
|
49
32
|
|
|
50
33
|
Or check an existing task by ID:
|
|
51
34
|
|
|
52
35
|
```typescript
|
|
53
|
-
const task = new Ariari.Task('id');
|
|
54
|
-
const status = await task.status();
|
|
55
|
-
```
|
|
36
|
+
const task = new Ariari.Task( 'id');
|
|
56
37
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Get complete SMS details including individual message status and retry information:
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
const task = await Ariari.send(
|
|
63
|
-
{ phone: '+261123456789', message: 'Message 1' },
|
|
64
|
-
{ phone: ['+261987654321', '+261555555555'], message: 'Message 2' }
|
|
65
|
-
);
|
|
38
|
+
const status = await task.status();
|
|
39
|
+
// Returns SMS details: status (PENDING, SENT, FAILED),
|
|
66
40
|
|
|
67
41
|
const details = await task.smsDetails();
|
|
68
|
-
console.log(details);
|
|
69
|
-
// Returns: { notifTaskId, projectId, createdAt, summary, smsDetails: [...] }
|
|
70
|
-
// smsDetails includes: smsId, phone, message, status, retryCount
|
|
71
|
-
```
|
|
72
42
|
|
|
73
|
-
Or get details for an existing task:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
const task = new Ariari.Task('id');
|
|
77
|
-
const details = await task.smsDetails();
|
|
78
43
|
```
|
|
79
44
|
|
|
80
45
|
### List Tasks
|
package/dist/index.d.mts
CHANGED
|
@@ -17,6 +17,7 @@ declare class Task {
|
|
|
17
17
|
detailedStatus(): Promise<unknown>;
|
|
18
18
|
}
|
|
19
19
|
declare class Notification {
|
|
20
|
+
tasks(param: GetTaskParam): Promise<unknown>;
|
|
20
21
|
send(...data: Message[]): Promise<Task>;
|
|
21
22
|
sendMessage(data: Message): Promise<Task>;
|
|
22
23
|
getMessages(param: GetTaskParam): Promise<unknown>;
|
|
@@ -26,7 +27,7 @@ declare class Ariari {
|
|
|
26
27
|
static config(config: any): void;
|
|
27
28
|
static sendMessage(data: Message): Promise<Task>;
|
|
28
29
|
static send(...data: Message[]): Promise<Task>;
|
|
29
|
-
static
|
|
30
|
+
static tasks(param: GetTaskParam): Promise<unknown>;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export { Ariari, type GetTaskParam, type Message, Notification, Task };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare class Task {
|
|
|
17
17
|
detailedStatus(): Promise<unknown>;
|
|
18
18
|
}
|
|
19
19
|
declare class Notification {
|
|
20
|
+
tasks(param: GetTaskParam): Promise<unknown>;
|
|
20
21
|
send(...data: Message[]): Promise<Task>;
|
|
21
22
|
sendMessage(data: Message): Promise<Task>;
|
|
22
23
|
getMessages(param: GetTaskParam): Promise<unknown>;
|
|
@@ -26,7 +27,7 @@ declare class Ariari {
|
|
|
26
27
|
static config(config: any): void;
|
|
27
28
|
static sendMessage(data: Message): Promise<Task>;
|
|
28
29
|
static send(...data: Message[]): Promise<Task>;
|
|
29
|
-
static
|
|
30
|
+
static tasks(param: GetTaskParam): Promise<unknown>;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export { Ariari, type GetTaskParam, type Message, Notification, Task };
|
package/dist/index.js
CHANGED
|
@@ -103,6 +103,9 @@ var Task = class {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
var Notification = class {
|
|
106
|
+
async tasks(param) {
|
|
107
|
+
return httpGet(`/api/sms?from=${param.from}&count=${param.count}&order=${param.order}`);
|
|
108
|
+
}
|
|
106
109
|
async send(...data) {
|
|
107
110
|
const messages = data.map((item) => ({
|
|
108
111
|
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
|
@@ -134,8 +137,8 @@ var Ariari = class {
|
|
|
134
137
|
static async send(...data) {
|
|
135
138
|
return this.notification.send(...data);
|
|
136
139
|
}
|
|
137
|
-
static async
|
|
138
|
-
return this.notification.
|
|
140
|
+
static async tasks(param) {
|
|
141
|
+
return this.notification.tasks(param);
|
|
139
142
|
}
|
|
140
143
|
};
|
|
141
144
|
Ariari.notification = new Notification();
|
package/dist/index.mjs
CHANGED
|
@@ -75,6 +75,9 @@ var Task = class {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
var Notification = class {
|
|
78
|
+
async tasks(param) {
|
|
79
|
+
return httpGet(`/api/sms?from=${param.from}&count=${param.count}&order=${param.order}`);
|
|
80
|
+
}
|
|
78
81
|
async send(...data) {
|
|
79
82
|
const messages = data.map((item) => ({
|
|
80
83
|
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
|
@@ -106,8 +109,8 @@ var Ariari = class {
|
|
|
106
109
|
static async send(...data) {
|
|
107
110
|
return this.notification.send(...data);
|
|
108
111
|
}
|
|
109
|
-
static async
|
|
110
|
-
return this.notification.
|
|
112
|
+
static async tasks(param) {
|
|
113
|
+
return this.notification.tasks(param);
|
|
111
114
|
}
|
|
112
115
|
};
|
|
113
116
|
Ariari.notification = new Notification();
|