@ariary/notification 3.0.3 → 3.0.4
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 +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +7 -6
- package/dist/index.mjs +7 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type Data = {
|
|
2
|
-
body?: Record<string,
|
|
3
|
-
params?: Record<string,
|
|
2
|
+
body?: Record<string, unknown>;
|
|
3
|
+
params?: Record<string, string>;
|
|
4
4
|
public?: boolean;
|
|
5
5
|
};
|
|
6
6
|
type PData = Omit<Data, 'body'>;
|
|
@@ -10,11 +10,11 @@ type Config = {
|
|
|
10
10
|
baseUrl?: string;
|
|
11
11
|
};
|
|
12
12
|
declare const createRequester: (config: Config) => {
|
|
13
|
-
get: <T
|
|
14
|
-
post: <T
|
|
15
|
-
patch: <T
|
|
16
|
-
put: <T
|
|
17
|
-
delete: <T =
|
|
13
|
+
get: <T>(url: string, data?: PData) => Promise<T>;
|
|
14
|
+
post: <T>(url: string, data?: Data) => Promise<T>;
|
|
15
|
+
patch: <T>(url: string, data?: Data) => Promise<T>;
|
|
16
|
+
put: <T>(url: string, data?: Data) => Promise<T>;
|
|
17
|
+
delete: <T = void>(url: string, data?: PData) => Promise<T>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
type Message = {
|
|
@@ -35,6 +35,7 @@ type TaskResponse = {
|
|
|
35
35
|
_id: string;
|
|
36
36
|
projectId: string;
|
|
37
37
|
status: TaskStatus;
|
|
38
|
+
statusPage: TaskStatus;
|
|
38
39
|
createdAt: string;
|
|
39
40
|
scheduledAt?: string;
|
|
40
41
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type Data = {
|
|
2
|
-
body?: Record<string,
|
|
3
|
-
params?: Record<string,
|
|
2
|
+
body?: Record<string, unknown>;
|
|
3
|
+
params?: Record<string, string>;
|
|
4
4
|
public?: boolean;
|
|
5
5
|
};
|
|
6
6
|
type PData = Omit<Data, 'body'>;
|
|
@@ -10,11 +10,11 @@ type Config = {
|
|
|
10
10
|
baseUrl?: string;
|
|
11
11
|
};
|
|
12
12
|
declare const createRequester: (config: Config) => {
|
|
13
|
-
get: <T
|
|
14
|
-
post: <T
|
|
15
|
-
patch: <T
|
|
16
|
-
put: <T
|
|
17
|
-
delete: <T =
|
|
13
|
+
get: <T>(url: string, data?: PData) => Promise<T>;
|
|
14
|
+
post: <T>(url: string, data?: Data) => Promise<T>;
|
|
15
|
+
patch: <T>(url: string, data?: Data) => Promise<T>;
|
|
16
|
+
put: <T>(url: string, data?: Data) => Promise<T>;
|
|
17
|
+
delete: <T = void>(url: string, data?: PData) => Promise<T>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
type Message = {
|
|
@@ -35,6 +35,7 @@ type TaskResponse = {
|
|
|
35
35
|
_id: string;
|
|
36
36
|
projectId: string;
|
|
37
37
|
status: TaskStatus;
|
|
38
|
+
statusPage: TaskStatus;
|
|
38
39
|
createdAt: string;
|
|
39
40
|
scheduledAt?: string;
|
|
40
41
|
};
|
package/dist/index.js
CHANGED
|
@@ -89,12 +89,13 @@ var _Ariari = class _Ariari {
|
|
|
89
89
|
const hasOptions = args[0] && "scheduledAt" in args[0];
|
|
90
90
|
const options = hasOptions ? args[0] : {};
|
|
91
91
|
const data = hasOptions ? args.slice(1) : args;
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
const body = {
|
|
93
|
+
messages: data.map((item) => ({
|
|
94
|
+
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
|
95
|
+
message: item.message
|
|
96
|
+
})),
|
|
97
|
+
...options.scheduledAt && { scheduledAt: options.scheduledAt }
|
|
98
|
+
};
|
|
98
99
|
const response = await this._requester.post("/api/sms/bulk", { body });
|
|
99
100
|
return new Task(response._id, this._requester);
|
|
100
101
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -63,12 +63,13 @@ var _Ariari = class _Ariari {
|
|
|
63
63
|
const hasOptions = args[0] && "scheduledAt" in args[0];
|
|
64
64
|
const options = hasOptions ? args[0] : {};
|
|
65
65
|
const data = hasOptions ? args.slice(1) : args;
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
const body = {
|
|
67
|
+
messages: data.map((item) => ({
|
|
68
|
+
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
|
69
|
+
message: item.message
|
|
70
|
+
})),
|
|
71
|
+
...options.scheduledAt && { scheduledAt: options.scheduledAt }
|
|
72
|
+
};
|
|
72
73
|
const response = await this._requester.post("/api/sms/bulk", { body });
|
|
73
74
|
return new Task(response._id, this._requester);
|
|
74
75
|
};
|