@amohamud23/notihub 1.1.52 → 1.1.53
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.cjs +17 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +18 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -545,6 +545,23 @@ var Notifications = class _Notifications {
|
|
|
545
545
|
throw new Error("Could not create notification");
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* Deletes a notification by its ID.
|
|
550
|
+
* @param id - The ID of the notification to delete.
|
|
551
|
+
* @returns A promise that resolves when the notification is deleted.
|
|
552
|
+
*/
|
|
553
|
+
static async deleteNotificationById(id) {
|
|
554
|
+
const command = new import_lib_dynamodb4.DeleteCommand({
|
|
555
|
+
TableName: _Notifications.TABLE_NAME,
|
|
556
|
+
Key: { id }
|
|
557
|
+
});
|
|
558
|
+
try {
|
|
559
|
+
await ddbDocClient.send(command);
|
|
560
|
+
} catch (error) {
|
|
561
|
+
console.error("Error deleting notification:", error);
|
|
562
|
+
throw new Error("Could not delete notification");
|
|
563
|
+
}
|
|
564
|
+
}
|
|
548
565
|
/**
|
|
549
566
|
* Fetches and merges paginated notifications for multiple notiTypeIds, sorted by createdAt descending.
|
|
550
567
|
* @param notiTypeIds - Array of notiTypeIds to fetch.
|
package/dist/index.d.cts
CHANGED
|
@@ -370,6 +370,12 @@ declare class Notifications {
|
|
|
370
370
|
* @returns A promise that resolves to the created notification object.
|
|
371
371
|
*/
|
|
372
372
|
static createNotification(notification: INotiHubNotification): Promise<INotiHubNotification>;
|
|
373
|
+
/**
|
|
374
|
+
* Deletes a notification by its ID.
|
|
375
|
+
* @param id - The ID of the notification to delete.
|
|
376
|
+
* @returns A promise that resolves when the notification is deleted.
|
|
377
|
+
*/
|
|
378
|
+
static deleteNotificationById(id: string): Promise<void>;
|
|
373
379
|
/**
|
|
374
380
|
* Fetches and merges paginated notifications for multiple notiTypeIds, sorted by createdAt descending.
|
|
375
381
|
* @param notiTypeIds - Array of notiTypeIds to fetch.
|
package/dist/index.d.ts
CHANGED
|
@@ -370,6 +370,12 @@ declare class Notifications {
|
|
|
370
370
|
* @returns A promise that resolves to the created notification object.
|
|
371
371
|
*/
|
|
372
372
|
static createNotification(notification: INotiHubNotification): Promise<INotiHubNotification>;
|
|
373
|
+
/**
|
|
374
|
+
* Deletes a notification by its ID.
|
|
375
|
+
* @param id - The ID of the notification to delete.
|
|
376
|
+
* @returns A promise that resolves when the notification is deleted.
|
|
377
|
+
*/
|
|
378
|
+
static deleteNotificationById(id: string): Promise<void>;
|
|
373
379
|
/**
|
|
374
380
|
* Fetches and merges paginated notifications for multiple notiTypeIds, sorted by createdAt descending.
|
|
375
381
|
* @param notiTypeIds - Array of notiTypeIds to fetch.
|
package/dist/index.js
CHANGED
|
@@ -453,6 +453,7 @@ var Customer_default = Customer;
|
|
|
453
453
|
|
|
454
454
|
// src/DynamoModels/Notifications.ts
|
|
455
455
|
import {
|
|
456
|
+
DeleteCommand as DeleteCommand3,
|
|
456
457
|
PutCommand as PutCommand3,
|
|
457
458
|
QueryCommand as QueryCommand3
|
|
458
459
|
} from "@aws-sdk/lib-dynamodb";
|
|
@@ -522,6 +523,23 @@ var Notifications = class _Notifications {
|
|
|
522
523
|
throw new Error("Could not create notification");
|
|
523
524
|
}
|
|
524
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Deletes a notification by its ID.
|
|
528
|
+
* @param id - The ID of the notification to delete.
|
|
529
|
+
* @returns A promise that resolves when the notification is deleted.
|
|
530
|
+
*/
|
|
531
|
+
static async deleteNotificationById(id) {
|
|
532
|
+
const command = new DeleteCommand3({
|
|
533
|
+
TableName: _Notifications.TABLE_NAME,
|
|
534
|
+
Key: { id }
|
|
535
|
+
});
|
|
536
|
+
try {
|
|
537
|
+
await ddbDocClient.send(command);
|
|
538
|
+
} catch (error) {
|
|
539
|
+
console.error("Error deleting notification:", error);
|
|
540
|
+
throw new Error("Could not delete notification");
|
|
541
|
+
}
|
|
542
|
+
}
|
|
525
543
|
/**
|
|
526
544
|
* Fetches and merges paginated notifications for multiple notiTypeIds, sorted by createdAt descending.
|
|
527
545
|
* @param notiTypeIds - Array of notiTypeIds to fetch.
|