@amohamud23/notihub 1.1.24 → 1.1.25
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 +107 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +109 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -653,6 +653,25 @@ var NotiHubStats = class _NotiHubStats {
|
|
|
653
653
|
const result = await ddbDocClient.send(command);
|
|
654
654
|
return result.Attributes;
|
|
655
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Decrement the count of subscriptions for a specific customer.
|
|
658
|
+
* @param id - The ID of the stats entry.
|
|
659
|
+
* @param customerId - The ID of the customer.
|
|
660
|
+
* @returns A promise that resolves to the updated stats object.
|
|
661
|
+
*/
|
|
662
|
+
static async decrementSubscriptions(id, customerId) {
|
|
663
|
+
const command = new import_lib_dynamodb5.UpdateCommand({
|
|
664
|
+
TableName: _NotiHubStats.TABLE_NAME,
|
|
665
|
+
Key: { id, customerId },
|
|
666
|
+
UpdateExpression: "ADD subscriptions :dec",
|
|
667
|
+
ExpressionAttributeValues: {
|
|
668
|
+
":dec": -1
|
|
669
|
+
},
|
|
670
|
+
ReturnValues: "ALL_NEW"
|
|
671
|
+
});
|
|
672
|
+
const result = await ddbDocClient.send(command);
|
|
673
|
+
return result.Attributes;
|
|
674
|
+
}
|
|
656
675
|
static async getStatsInDateRange(customerId, startDate, endDate) {
|
|
657
676
|
const command = new import_lib_dynamodb5.QueryCommand({
|
|
658
677
|
TableName: _NotiHubStats.TABLE_NAME,
|
|
@@ -1081,6 +1100,94 @@ var NotiTypeStats = class _NotiTypeStats {
|
|
|
1081
1100
|
throw new Error("Could not delete notification type stats");
|
|
1082
1101
|
}
|
|
1083
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Increment the count of subscriptions for a specific notification type.
|
|
1105
|
+
* @param id - The ID of the notification type stats entry.
|
|
1106
|
+
*/
|
|
1107
|
+
static async incrementSubscriptions(id) {
|
|
1108
|
+
const command = new import_lib_dynamodb8.UpdateCommand({
|
|
1109
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1110
|
+
Key: { id },
|
|
1111
|
+
UpdateExpression: "ADD subscribed :inc",
|
|
1112
|
+
ExpressionAttributeValues: {
|
|
1113
|
+
":inc": 1
|
|
1114
|
+
},
|
|
1115
|
+
ReturnValues: "ALL_NEW"
|
|
1116
|
+
});
|
|
1117
|
+
try {
|
|
1118
|
+
const result = await ddbDocClient.send(command);
|
|
1119
|
+
return result.Attributes;
|
|
1120
|
+
} catch (error) {
|
|
1121
|
+
console.error("Error incrementing subscriptions:", error);
|
|
1122
|
+
throw new Error("Could not increment subscriptions");
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Decrement the count of subscriptions for a specific notification type.
|
|
1127
|
+
* @param id - The ID of the notification type stats entry.
|
|
1128
|
+
*/
|
|
1129
|
+
static async decrementSubscriptions(id) {
|
|
1130
|
+
const command = new import_lib_dynamodb8.UpdateCommand({
|
|
1131
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1132
|
+
Key: { id },
|
|
1133
|
+
UpdateExpression: "ADD subscribed :dec",
|
|
1134
|
+
ExpressionAttributeValues: {
|
|
1135
|
+
":dec": -1
|
|
1136
|
+
},
|
|
1137
|
+
ReturnValues: "ALL_NEW"
|
|
1138
|
+
});
|
|
1139
|
+
try {
|
|
1140
|
+
const result = await ddbDocClient.send(command);
|
|
1141
|
+
return result.Attributes;
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
console.error("Error decrementing subscriptions:", error);
|
|
1144
|
+
throw new Error("Could not decrement subscriptions");
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Increment the count of views for a specific notification type.
|
|
1149
|
+
* @param id - The ID of the notification type stats entry.
|
|
1150
|
+
*/
|
|
1151
|
+
static async incrementViews(id) {
|
|
1152
|
+
const command = new import_lib_dynamodb8.UpdateCommand({
|
|
1153
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1154
|
+
Key: { id },
|
|
1155
|
+
UpdateExpression: "ADD views :inc",
|
|
1156
|
+
ExpressionAttributeValues: {
|
|
1157
|
+
":inc": 1
|
|
1158
|
+
},
|
|
1159
|
+
ReturnValues: "ALL_NEW"
|
|
1160
|
+
});
|
|
1161
|
+
try {
|
|
1162
|
+
const result = await ddbDocClient.send(command);
|
|
1163
|
+
return result.Attributes;
|
|
1164
|
+
} catch (error) {
|
|
1165
|
+
console.error("Error incrementing views:", error);
|
|
1166
|
+
throw new Error("Could not increment views");
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Decrement the count of views for a specific notification type.
|
|
1171
|
+
* @param id - The ID of the notification type stats entry.
|
|
1172
|
+
*/
|
|
1173
|
+
static async decrementViews(id) {
|
|
1174
|
+
const command = new import_lib_dynamodb8.UpdateCommand({
|
|
1175
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1176
|
+
Key: { id },
|
|
1177
|
+
UpdateExpression: "ADD views :dec",
|
|
1178
|
+
ExpressionAttributeValues: {
|
|
1179
|
+
":dec": -1
|
|
1180
|
+
},
|
|
1181
|
+
ReturnValues: "ALL_NEW"
|
|
1182
|
+
});
|
|
1183
|
+
try {
|
|
1184
|
+
const result = await ddbDocClient.send(command);
|
|
1185
|
+
return result.Attributes;
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
console.error("Error decrementing views:", error);
|
|
1188
|
+
throw new Error("Could not decrement views");
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1084
1191
|
};
|
|
1085
1192
|
var NotiTypeStats_default = NotiTypeStats;
|
|
1086
1193
|
|
package/dist/index.d.cts
CHANGED
|
@@ -389,6 +389,13 @@ declare class NotiHubStats {
|
|
|
389
389
|
* @returns A promise that resolves to the updated stats object.
|
|
390
390
|
*/
|
|
391
391
|
static incrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
|
|
392
|
+
/**
|
|
393
|
+
* Decrement the count of subscriptions for a specific customer.
|
|
394
|
+
* @param id - The ID of the stats entry.
|
|
395
|
+
* @param customerId - The ID of the customer.
|
|
396
|
+
* @returns A promise that resolves to the updated stats object.
|
|
397
|
+
*/
|
|
398
|
+
static decrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
|
|
392
399
|
static getStatsInDateRange(customerId: string, startDate: string, endDate: string): Promise<INotiHubStats[]>;
|
|
393
400
|
static deleteStatsById(id: string): Promise<void>;
|
|
394
401
|
}
|
|
@@ -501,6 +508,26 @@ declare class NotiTypeStats {
|
|
|
501
508
|
* @returns A promise that resolves when the deletion is complete.
|
|
502
509
|
*/
|
|
503
510
|
static deleteNotiTypeStatsById(id: string): Promise<void>;
|
|
511
|
+
/**
|
|
512
|
+
* Increment the count of subscriptions for a specific notification type.
|
|
513
|
+
* @param id - The ID of the notification type stats entry.
|
|
514
|
+
*/
|
|
515
|
+
static incrementSubscriptions(id: string): Promise<INotiTypeStats>;
|
|
516
|
+
/**
|
|
517
|
+
* Decrement the count of subscriptions for a specific notification type.
|
|
518
|
+
* @param id - The ID of the notification type stats entry.
|
|
519
|
+
*/
|
|
520
|
+
static decrementSubscriptions(id: string): Promise<INotiTypeStats>;
|
|
521
|
+
/**
|
|
522
|
+
* Increment the count of views for a specific notification type.
|
|
523
|
+
* @param id - The ID of the notification type stats entry.
|
|
524
|
+
*/
|
|
525
|
+
static incrementViews(id: string): Promise<INotiTypeStats>;
|
|
526
|
+
/**
|
|
527
|
+
* Decrement the count of views for a specific notification type.
|
|
528
|
+
* @param id - The ID of the notification type stats entry.
|
|
529
|
+
*/
|
|
530
|
+
static decrementViews(id: string): Promise<INotiTypeStats>;
|
|
504
531
|
}
|
|
505
532
|
|
|
506
533
|
declare class Views {
|
package/dist/index.d.ts
CHANGED
|
@@ -389,6 +389,13 @@ declare class NotiHubStats {
|
|
|
389
389
|
* @returns A promise that resolves to the updated stats object.
|
|
390
390
|
*/
|
|
391
391
|
static incrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
|
|
392
|
+
/**
|
|
393
|
+
* Decrement the count of subscriptions for a specific customer.
|
|
394
|
+
* @param id - The ID of the stats entry.
|
|
395
|
+
* @param customerId - The ID of the customer.
|
|
396
|
+
* @returns A promise that resolves to the updated stats object.
|
|
397
|
+
*/
|
|
398
|
+
static decrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
|
|
392
399
|
static getStatsInDateRange(customerId: string, startDate: string, endDate: string): Promise<INotiHubStats[]>;
|
|
393
400
|
static deleteStatsById(id: string): Promise<void>;
|
|
394
401
|
}
|
|
@@ -501,6 +508,26 @@ declare class NotiTypeStats {
|
|
|
501
508
|
* @returns A promise that resolves when the deletion is complete.
|
|
502
509
|
*/
|
|
503
510
|
static deleteNotiTypeStatsById(id: string): Promise<void>;
|
|
511
|
+
/**
|
|
512
|
+
* Increment the count of subscriptions for a specific notification type.
|
|
513
|
+
* @param id - The ID of the notification type stats entry.
|
|
514
|
+
*/
|
|
515
|
+
static incrementSubscriptions(id: string): Promise<INotiTypeStats>;
|
|
516
|
+
/**
|
|
517
|
+
* Decrement the count of subscriptions for a specific notification type.
|
|
518
|
+
* @param id - The ID of the notification type stats entry.
|
|
519
|
+
*/
|
|
520
|
+
static decrementSubscriptions(id: string): Promise<INotiTypeStats>;
|
|
521
|
+
/**
|
|
522
|
+
* Increment the count of views for a specific notification type.
|
|
523
|
+
* @param id - The ID of the notification type stats entry.
|
|
524
|
+
*/
|
|
525
|
+
static incrementViews(id: string): Promise<INotiTypeStats>;
|
|
526
|
+
/**
|
|
527
|
+
* Decrement the count of views for a specific notification type.
|
|
528
|
+
* @param id - The ID of the notification type stats entry.
|
|
529
|
+
*/
|
|
530
|
+
static decrementViews(id: string): Promise<INotiTypeStats>;
|
|
504
531
|
}
|
|
505
532
|
|
|
506
533
|
declare class Views {
|
package/dist/index.js
CHANGED
|
@@ -634,6 +634,25 @@ var NotiHubStats = class _NotiHubStats {
|
|
|
634
634
|
const result = await ddbDocClient.send(command);
|
|
635
635
|
return result.Attributes;
|
|
636
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Decrement the count of subscriptions for a specific customer.
|
|
639
|
+
* @param id - The ID of the stats entry.
|
|
640
|
+
* @param customerId - The ID of the customer.
|
|
641
|
+
* @returns A promise that resolves to the updated stats object.
|
|
642
|
+
*/
|
|
643
|
+
static async decrementSubscriptions(id, customerId) {
|
|
644
|
+
const command = new UpdateCommand4({
|
|
645
|
+
TableName: _NotiHubStats.TABLE_NAME,
|
|
646
|
+
Key: { id, customerId },
|
|
647
|
+
UpdateExpression: "ADD subscriptions :dec",
|
|
648
|
+
ExpressionAttributeValues: {
|
|
649
|
+
":dec": -1
|
|
650
|
+
},
|
|
651
|
+
ReturnValues: "ALL_NEW"
|
|
652
|
+
});
|
|
653
|
+
const result = await ddbDocClient.send(command);
|
|
654
|
+
return result.Attributes;
|
|
655
|
+
}
|
|
637
656
|
static async getStatsInDateRange(customerId, startDate, endDate) {
|
|
638
657
|
const command = new QueryCommand4({
|
|
639
658
|
TableName: _NotiHubStats.TABLE_NAME,
|
|
@@ -992,7 +1011,8 @@ import {
|
|
|
992
1011
|
DeleteCommand as DeleteCommand7,
|
|
993
1012
|
GetCommand as GetCommand7,
|
|
994
1013
|
PutCommand as PutCommand7,
|
|
995
|
-
QueryCommand as QueryCommand7
|
|
1014
|
+
QueryCommand as QueryCommand7,
|
|
1015
|
+
UpdateCommand as UpdateCommand7
|
|
996
1016
|
} from "@aws-sdk/lib-dynamodb";
|
|
997
1017
|
var NotiTypeStats = class _NotiTypeStats {
|
|
998
1018
|
static ENV = process.env.ENV || "dev";
|
|
@@ -1079,6 +1099,94 @@ var NotiTypeStats = class _NotiTypeStats {
|
|
|
1079
1099
|
throw new Error("Could not delete notification type stats");
|
|
1080
1100
|
}
|
|
1081
1101
|
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Increment the count of subscriptions for a specific notification type.
|
|
1104
|
+
* @param id - The ID of the notification type stats entry.
|
|
1105
|
+
*/
|
|
1106
|
+
static async incrementSubscriptions(id) {
|
|
1107
|
+
const command = new UpdateCommand7({
|
|
1108
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1109
|
+
Key: { id },
|
|
1110
|
+
UpdateExpression: "ADD subscribed :inc",
|
|
1111
|
+
ExpressionAttributeValues: {
|
|
1112
|
+
":inc": 1
|
|
1113
|
+
},
|
|
1114
|
+
ReturnValues: "ALL_NEW"
|
|
1115
|
+
});
|
|
1116
|
+
try {
|
|
1117
|
+
const result = await ddbDocClient.send(command);
|
|
1118
|
+
return result.Attributes;
|
|
1119
|
+
} catch (error) {
|
|
1120
|
+
console.error("Error incrementing subscriptions:", error);
|
|
1121
|
+
throw new Error("Could not increment subscriptions");
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Decrement the count of subscriptions for a specific notification type.
|
|
1126
|
+
* @param id - The ID of the notification type stats entry.
|
|
1127
|
+
*/
|
|
1128
|
+
static async decrementSubscriptions(id) {
|
|
1129
|
+
const command = new UpdateCommand7({
|
|
1130
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1131
|
+
Key: { id },
|
|
1132
|
+
UpdateExpression: "ADD subscribed :dec",
|
|
1133
|
+
ExpressionAttributeValues: {
|
|
1134
|
+
":dec": -1
|
|
1135
|
+
},
|
|
1136
|
+
ReturnValues: "ALL_NEW"
|
|
1137
|
+
});
|
|
1138
|
+
try {
|
|
1139
|
+
const result = await ddbDocClient.send(command);
|
|
1140
|
+
return result.Attributes;
|
|
1141
|
+
} catch (error) {
|
|
1142
|
+
console.error("Error decrementing subscriptions:", error);
|
|
1143
|
+
throw new Error("Could not decrement subscriptions");
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Increment the count of views for a specific notification type.
|
|
1148
|
+
* @param id - The ID of the notification type stats entry.
|
|
1149
|
+
*/
|
|
1150
|
+
static async incrementViews(id) {
|
|
1151
|
+
const command = new UpdateCommand7({
|
|
1152
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1153
|
+
Key: { id },
|
|
1154
|
+
UpdateExpression: "ADD views :inc",
|
|
1155
|
+
ExpressionAttributeValues: {
|
|
1156
|
+
":inc": 1
|
|
1157
|
+
},
|
|
1158
|
+
ReturnValues: "ALL_NEW"
|
|
1159
|
+
});
|
|
1160
|
+
try {
|
|
1161
|
+
const result = await ddbDocClient.send(command);
|
|
1162
|
+
return result.Attributes;
|
|
1163
|
+
} catch (error) {
|
|
1164
|
+
console.error("Error incrementing views:", error);
|
|
1165
|
+
throw new Error("Could not increment views");
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Decrement the count of views for a specific notification type.
|
|
1170
|
+
* @param id - The ID of the notification type stats entry.
|
|
1171
|
+
*/
|
|
1172
|
+
static async decrementViews(id) {
|
|
1173
|
+
const command = new UpdateCommand7({
|
|
1174
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
1175
|
+
Key: { id },
|
|
1176
|
+
UpdateExpression: "ADD views :dec",
|
|
1177
|
+
ExpressionAttributeValues: {
|
|
1178
|
+
":dec": -1
|
|
1179
|
+
},
|
|
1180
|
+
ReturnValues: "ALL_NEW"
|
|
1181
|
+
});
|
|
1182
|
+
try {
|
|
1183
|
+
const result = await ddbDocClient.send(command);
|
|
1184
|
+
return result.Attributes;
|
|
1185
|
+
} catch (error) {
|
|
1186
|
+
console.error("Error decrementing views:", error);
|
|
1187
|
+
throw new Error("Could not decrement views");
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1082
1190
|
};
|
|
1083
1191
|
var NotiTypeStats_default = NotiTypeStats;
|
|
1084
1192
|
|