@ariary/notification 3.0.4 → 3.0.5

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 CHANGED
@@ -56,7 +56,15 @@ const details = await task.status(100)
56
56
  const page2 = await task.status(20, 2)
57
57
  ```
58
58
 
59
- SMS statuses: `SCHEDULED` | `PENDING` | `SENT` | `DELIVERED` | `FAILED`
59
+ SMS statuses: `SmsStatus.SCHEDULED` | `SmsStatus.PENDING` | `SmsStatus.SENT` | `SmsStatus.DELIVERED` | `SmsStatus.FAILED`
60
+
61
+ A `SmsStatus` enum is also exported:
62
+
63
+ ```ts
64
+ import { SmsStatus } from '@ariary/notification'
65
+
66
+ if (sms.status === SmsStatus.DELIVERED) { ... }
67
+ ```
60
68
 
61
69
  ## Retrieve an existing Task
62
70
 
package/dist/index.d.mts CHANGED
@@ -24,7 +24,13 @@ type Message = {
24
24
  type SendOptions = {
25
25
  scheduledAt?: string;
26
26
  };
27
- type SmsStatus = 'SCHEDULED' | 'PENDING' | 'SENT' | 'DELIVERED' | 'FAILED';
27
+ declare enum SmsStatus {
28
+ SCHEDULED = "SCHEDULED",
29
+ PENDING = "PENDING",
30
+ SENT = "SENT",
31
+ DELIVERED = "DELIVERED",
32
+ FAILED = "FAILED"
33
+ }
28
34
  type TaskStatus = {
29
35
  total: number;
30
36
  sent: number;
@@ -76,4 +82,4 @@ declare class Ariari {
76
82
  static getTask: (taskId: string) => Promise<Task>;
77
83
  }
78
84
 
79
- export { Ariari as default };
85
+ export { SmsStatus, Ariari as default };
package/dist/index.d.ts CHANGED
@@ -24,7 +24,13 @@ type Message = {
24
24
  type SendOptions = {
25
25
  scheduledAt?: string;
26
26
  };
27
- type SmsStatus = 'SCHEDULED' | 'PENDING' | 'SENT' | 'DELIVERED' | 'FAILED';
27
+ declare enum SmsStatus {
28
+ SCHEDULED = "SCHEDULED",
29
+ PENDING = "PENDING",
30
+ SENT = "SENT",
31
+ DELIVERED = "DELIVERED",
32
+ FAILED = "FAILED"
33
+ }
28
34
  type TaskStatus = {
29
35
  total: number;
30
36
  sent: number;
@@ -76,4 +82,4 @@ declare class Ariari {
76
82
  static getTask: (taskId: string) => Promise<Task>;
77
83
  }
78
84
 
79
- export { Ariari as default };
85
+ export { SmsStatus, Ariari as default };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ SmsStatus: () => SmsStatus,
23
24
  default: () => src_default
24
25
  });
25
26
  module.exports = __toCommonJS(src_exports);
@@ -27,7 +28,7 @@ module.exports = __toCommonJS(src_exports);
27
28
  // ../common/http.ts
28
29
  async function request(verb, endpoint, options, config) {
29
30
  if (!config) throw new Error("Ariari package not configured.");
30
- const url = `${config.baseUrl || "https://back.ariari.mg"}${endpoint}`;
31
+ const url = `${config.baseUrl || "https://api.ariari.mg"}${endpoint}`;
31
32
  const headers = { "Content-Type": "application/json" };
32
33
  if (!options.public) {
33
34
  headers["x-project-id"] = config.projectId;
@@ -67,6 +68,16 @@ var normalizePhoneNumber = (phone) => {
67
68
  return normalized;
68
69
  };
69
70
 
71
+ // src/types/index.ts
72
+ var SmsStatus = /* @__PURE__ */ ((SmsStatus2) => {
73
+ SmsStatus2["SCHEDULED"] = "SCHEDULED";
74
+ SmsStatus2["PENDING"] = "PENDING";
75
+ SmsStatus2["SENT"] = "SENT";
76
+ SmsStatus2["DELIVERED"] = "DELIVERED";
77
+ SmsStatus2["FAILED"] = "FAILED";
78
+ return SmsStatus2;
79
+ })(SmsStatus || {});
80
+
70
81
  // src/index.ts
71
82
  var instances = {};
72
83
  var Task = class {
@@ -115,3 +126,7 @@ _Ariari.send = async (...args) => await _Ariari.get("main")?.send(...args);
115
126
  _Ariari.getTask = async (taskId) => _Ariari.get("main")?.getTask(taskId);
116
127
  var Ariari = _Ariari;
117
128
  var src_default = Ariari;
129
+ // Annotate the CommonJS export names for ESM import in node:
130
+ 0 && (module.exports = {
131
+ SmsStatus
132
+ });
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // ../common/http.ts
2
2
  async function request(verb, endpoint, options, config) {
3
3
  if (!config) throw new Error("Ariari package not configured.");
4
- const url = `${config.baseUrl || "https://back.ariari.mg"}${endpoint}`;
4
+ const url = `${config.baseUrl || "https://api.ariari.mg"}${endpoint}`;
5
5
  const headers = { "Content-Type": "application/json" };
6
6
  if (!options.public) {
7
7
  headers["x-project-id"] = config.projectId;
@@ -41,6 +41,16 @@ var normalizePhoneNumber = (phone) => {
41
41
  return normalized;
42
42
  };
43
43
 
44
+ // src/types/index.ts
45
+ var SmsStatus = /* @__PURE__ */ ((SmsStatus2) => {
46
+ SmsStatus2["SCHEDULED"] = "SCHEDULED";
47
+ SmsStatus2["PENDING"] = "PENDING";
48
+ SmsStatus2["SENT"] = "SENT";
49
+ SmsStatus2["DELIVERED"] = "DELIVERED";
50
+ SmsStatus2["FAILED"] = "FAILED";
51
+ return SmsStatus2;
52
+ })(SmsStatus || {});
53
+
44
54
  // src/index.ts
45
55
  var instances = {};
46
56
  var Task = class {
@@ -90,5 +100,6 @@ _Ariari.getTask = async (taskId) => _Ariari.get("main")?.getTask(taskId);
90
100
  var Ariari = _Ariari;
91
101
  var src_default = Ariari;
92
102
  export {
103
+ SmsStatus,
93
104
  src_default as default
94
105
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariary/notification",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "SMS et Notification Task SDK pour l'API Ariary",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",