@notifykit/sdk 1.0.1 → 1.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/README.md CHANGED
@@ -182,8 +182,8 @@ result.data.forEach((job) => {
182
182
  const status = await client.getJob(job.jobId);
183
183
 
184
184
  if (status.status === "failed") {
185
- const message = await client.retryJob(job.jobId);
186
- console.log(message); // "Job has been re-queued for processing"
185
+ const result = await client.retryJob(job.jobId);
186
+ console.log(result.message); // "Job has been re-queued for processing"
187
187
  }
188
188
  ```
189
189
 
@@ -229,9 +229,9 @@ try {
229
229
  | ---------------------- | ----------------------------------- | ------------------------------ |
230
230
  | `sendEmail(options)` | Send an email notification | `Promise<JobResponse>` |
231
231
  | `sendWebhook(options)` | Send a webhook notification | `Promise<JobResponse>` |
232
- | `getJob(jobId)` | Get job status and details | `Promise<JobDetails>` |
232
+ | `getJob(jobId)` | Get job status and details | `Promise<JobStatus>` |
233
233
  | `listJobs(options?)` | List jobs with optional filters | `Promise<{ data, pagination }>` |
234
- | `retryJob(jobId)` | Retry a failed job | `Promise<string>` |
234
+ | `retryJob(jobId)` | Retry a failed job | `Promise<RetryJobResponse>` |
235
235
  | `ping()` | Test API connection | `Promise<string>` |
236
236
  | `getApiInfo()` | Get API version info | `Promise<ApiInfo>` |
237
237
 
package/dist/types.d.ts CHANGED
@@ -13,20 +13,15 @@ export interface SendEmailOptions {
13
13
  subject: string;
14
14
  body: string;
15
15
  from?: string;
16
- priority?: number;
16
+ priority?: 1 | 5 | 10;
17
17
  idempotencyKey?: string;
18
18
  }
19
- export interface ApiInfo {
20
- name: string;
21
- version: string;
22
- description: string;
23
- documentation: string;
24
- }
25
19
  export interface SendWebhookOptions {
26
20
  url: string;
27
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
28
- payload?: any;
21
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
22
+ payload: any;
29
23
  headers?: Record<string, string>;
24
+ priority?: 1 | 5 | 10;
30
25
  idempotencyKey?: string;
31
26
  }
32
27
  export interface JobResponse {
@@ -38,10 +33,14 @@ export interface JobResponse {
38
33
  export interface JobStatus {
39
34
  id: string;
40
35
  type: string;
41
- status: 'pending' | 'processing' | 'completed' | 'failed';
36
+ status: "pending" | "processing" | "completed" | "failed";
37
+ priority: number;
38
+ payload: object;
42
39
  attempts: number;
40
+ maxAttempts: number;
43
41
  errorMessage?: string;
44
42
  createdAt: string;
43
+ startedAt?: string;
45
44
  completedAt?: string;
46
45
  }
47
46
  export interface RetryJobResponse {
@@ -49,3 +48,9 @@ export interface RetryJobResponse {
49
48
  status: string;
50
49
  message: string;
51
50
  }
51
+ export interface ApiInfo {
52
+ name: string;
53
+ version: string;
54
+ description: string;
55
+ documentation: string;
56
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notifykit/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "Official NotifyKit SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",