@amohamud23/notihub 1.1.28 → 1.1.29
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 +22 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +28 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1623,6 +1623,28 @@ var NotificationStats = class _NotificationStats {
|
|
|
1623
1623
|
throw new Error("Could not delete notification stats");
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Increments the view count for a notification stats entry.
|
|
1628
|
+
* @param id - The ID of the notification stats entry.
|
|
1629
|
+
*/
|
|
1630
|
+
static async incrementViewCount(id) {
|
|
1631
|
+
const command = new import_lib_dynamodb13.UpdateCommand({
|
|
1632
|
+
TableName: _NotificationStats.TABLE_NAME,
|
|
1633
|
+
Key: { id },
|
|
1634
|
+
UpdateExpression: "ADD viewCount :inc",
|
|
1635
|
+
ExpressionAttributeValues: {
|
|
1636
|
+
":inc": 1
|
|
1637
|
+
},
|
|
1638
|
+
ReturnValues: "ALL_NEW"
|
|
1639
|
+
});
|
|
1640
|
+
try {
|
|
1641
|
+
const result = await ddbDocClient.send(command);
|
|
1642
|
+
return result.Attributes;
|
|
1643
|
+
} catch (error) {
|
|
1644
|
+
console.error("Error incrementing view count:", error);
|
|
1645
|
+
throw new Error("Could not increment view count");
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1626
1648
|
};
|
|
1627
1649
|
var NotificationStats_default = NotificationStats;
|
|
1628
1650
|
|
package/dist/index.d.cts
CHANGED
|
@@ -668,6 +668,11 @@ declare class NotificationStats {
|
|
|
668
668
|
* @returns A promise that resolves when the deletion is complete.
|
|
669
669
|
*/
|
|
670
670
|
static deleteNotificationStatsById(id: string): Promise<void>;
|
|
671
|
+
/**
|
|
672
|
+
* Increments the view count for a notification stats entry.
|
|
673
|
+
* @param id - The ID of the notification stats entry.
|
|
674
|
+
*/
|
|
675
|
+
static incrementViewCount(id: string): Promise<INotiHubNotificationStats>;
|
|
671
676
|
}
|
|
672
677
|
|
|
673
678
|
declare class NotiHubStatsHistory {
|
package/dist/index.d.ts
CHANGED
|
@@ -668,6 +668,11 @@ declare class NotificationStats {
|
|
|
668
668
|
* @returns A promise that resolves when the deletion is complete.
|
|
669
669
|
*/
|
|
670
670
|
static deleteNotificationStatsById(id: string): Promise<void>;
|
|
671
|
+
/**
|
|
672
|
+
* Increments the view count for a notification stats entry.
|
|
673
|
+
* @param id - The ID of the notification stats entry.
|
|
674
|
+
*/
|
|
675
|
+
static incrementViewCount(id: string): Promise<INotiHubNotificationStats>;
|
|
671
676
|
}
|
|
672
677
|
|
|
673
678
|
declare class NotiHubStatsHistory {
|
package/dist/index.js
CHANGED
|
@@ -1582,7 +1582,12 @@ var CustomerMinified = class _CustomerMinified {
|
|
|
1582
1582
|
var CustomerMinified_default = CustomerMinified;
|
|
1583
1583
|
|
|
1584
1584
|
// src/DynamoModels/NotificationStats.ts
|
|
1585
|
-
import {
|
|
1585
|
+
import {
|
|
1586
|
+
DeleteCommand as DeleteCommand11,
|
|
1587
|
+
GetCommand as GetCommand11,
|
|
1588
|
+
PutCommand as PutCommand12,
|
|
1589
|
+
UpdateCommand as UpdateCommand11
|
|
1590
|
+
} from "@aws-sdk/lib-dynamodb";
|
|
1586
1591
|
var NotificationStats = class _NotificationStats {
|
|
1587
1592
|
static ENV = process.env.ENV || "dev";
|
|
1588
1593
|
static TABLE_NAME = `NotiHub-NotificationStats-v1-${_NotificationStats.ENV}`;
|
|
@@ -1639,6 +1644,28 @@ var NotificationStats = class _NotificationStats {
|
|
|
1639
1644
|
throw new Error("Could not delete notification stats");
|
|
1640
1645
|
}
|
|
1641
1646
|
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Increments the view count for a notification stats entry.
|
|
1649
|
+
* @param id - The ID of the notification stats entry.
|
|
1650
|
+
*/
|
|
1651
|
+
static async incrementViewCount(id) {
|
|
1652
|
+
const command = new UpdateCommand11({
|
|
1653
|
+
TableName: _NotificationStats.TABLE_NAME,
|
|
1654
|
+
Key: { id },
|
|
1655
|
+
UpdateExpression: "ADD viewCount :inc",
|
|
1656
|
+
ExpressionAttributeValues: {
|
|
1657
|
+
":inc": 1
|
|
1658
|
+
},
|
|
1659
|
+
ReturnValues: "ALL_NEW"
|
|
1660
|
+
});
|
|
1661
|
+
try {
|
|
1662
|
+
const result = await ddbDocClient.send(command);
|
|
1663
|
+
return result.Attributes;
|
|
1664
|
+
} catch (error) {
|
|
1665
|
+
console.error("Error incrementing view count:", error);
|
|
1666
|
+
throw new Error("Could not increment view count");
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1642
1669
|
};
|
|
1643
1670
|
var NotificationStats_default = NotificationStats;
|
|
1644
1671
|
|