@amohamud23/notihub 1.1.17 → 1.1.19
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 +14 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -25
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -525,7 +525,7 @@ var Notifications = class _Notifications {
|
|
|
525
525
|
notiTypeIds.map(async (ntid) => {
|
|
526
526
|
const params = {
|
|
527
527
|
TableName: this.TABLE_NAME,
|
|
528
|
-
IndexName: "
|
|
528
|
+
IndexName: "NotiTypeIdCreatedAtIndex",
|
|
529
529
|
// Assuming you have a GSI for notiTypeId
|
|
530
530
|
KeyConditionExpression: "notiTypeId = :ntid",
|
|
531
531
|
ExpressionAttributeValues: { ":ntid": ntid },
|
|
@@ -1071,20 +1071,28 @@ var NotiTypeStats_default = NotiTypeStats;
|
|
|
1071
1071
|
var import_lib_dynamodb9 = require("@aws-sdk/lib-dynamodb");
|
|
1072
1072
|
var Views = class _Views {
|
|
1073
1073
|
static ENV = process.env.ENV || "dev";
|
|
1074
|
-
static TABLE_NAME = `NotiHub-Views-
|
|
1074
|
+
static TABLE_NAME = `NotiHub-Views-v2-${_Views.ENV}`;
|
|
1075
1075
|
/**
|
|
1076
1076
|
* Retrieves a view by its ID.
|
|
1077
1077
|
* @param id - The ID of the view to retrieve.
|
|
1078
1078
|
* @returns A promise that resolves to the view object or null if not found.
|
|
1079
1079
|
*/
|
|
1080
|
-
static async
|
|
1081
|
-
const command = new import_lib_dynamodb9.
|
|
1080
|
+
static async getViewByViewId(viewId) {
|
|
1081
|
+
const command = new import_lib_dynamodb9.QueryCommand({
|
|
1082
1082
|
TableName: _Views.TABLE_NAME,
|
|
1083
|
-
|
|
1083
|
+
IndexName: "ViewIdIndex",
|
|
1084
|
+
// Assuming you have a GSI for viewId
|
|
1085
|
+
KeyConditionExpression: "viewId = :viewId",
|
|
1086
|
+
ExpressionAttributeValues: {
|
|
1087
|
+
":viewId": viewId
|
|
1088
|
+
}
|
|
1084
1089
|
});
|
|
1085
1090
|
try {
|
|
1086
1091
|
const result = await ddbDocClient.send(command);
|
|
1087
|
-
|
|
1092
|
+
if (!result.Items || result.Items.length === 0) {
|
|
1093
|
+
return null;
|
|
1094
|
+
}
|
|
1095
|
+
return result.Items[0] || null;
|
|
1088
1096
|
} catch (error) {
|
|
1089
1097
|
console.error("Error fetching view:", error);
|
|
1090
1098
|
throw new Error("Could not fetch view");
|
package/dist/index.d.cts
CHANGED
|
@@ -510,7 +510,7 @@ declare class Views {
|
|
|
510
510
|
* @param id - The ID of the view to retrieve.
|
|
511
511
|
* @returns A promise that resolves to the view object or null if not found.
|
|
512
512
|
*/
|
|
513
|
-
static
|
|
513
|
+
static getViewByViewId(viewId: string): Promise<INotiHubUserView | null>;
|
|
514
514
|
/**
|
|
515
515
|
* Creates or updates a view.
|
|
516
516
|
* @param view - The view object to create or update.
|
package/dist/index.d.ts
CHANGED
|
@@ -510,7 +510,7 @@ declare class Views {
|
|
|
510
510
|
* @param id - The ID of the view to retrieve.
|
|
511
511
|
* @returns A promise that resolves to the view object or null if not found.
|
|
512
512
|
*/
|
|
513
|
-
static
|
|
513
|
+
static getViewByViewId(viewId: string): Promise<INotiHubUserView | null>;
|
|
514
514
|
/**
|
|
515
515
|
* Creates or updates a view.
|
|
516
516
|
* @param view - The view object to create or update.
|
package/dist/index.js
CHANGED
|
@@ -501,7 +501,7 @@ var Notifications = class _Notifications {
|
|
|
501
501
|
notiTypeIds.map(async (ntid) => {
|
|
502
502
|
const params = {
|
|
503
503
|
TableName: this.TABLE_NAME,
|
|
504
|
-
IndexName: "
|
|
504
|
+
IndexName: "NotiTypeIdCreatedAtIndex",
|
|
505
505
|
// Assuming you have a GSI for notiTypeId
|
|
506
506
|
KeyConditionExpression: "notiTypeId = :ntid",
|
|
507
507
|
ExpressionAttributeValues: { ":ntid": ntid },
|
|
@@ -1066,26 +1066,31 @@ var NotiTypeStats = class _NotiTypeStats {
|
|
|
1066
1066
|
var NotiTypeStats_default = NotiTypeStats;
|
|
1067
1067
|
|
|
1068
1068
|
// src/DynamoModels/Views.ts
|
|
1069
|
-
import {
|
|
1070
|
-
GetCommand as GetCommand8,
|
|
1071
|
-
PutCommand as PutCommand8
|
|
1072
|
-
} from "@aws-sdk/lib-dynamodb";
|
|
1069
|
+
import { QueryCommand as QueryCommand8, PutCommand as PutCommand8 } from "@aws-sdk/lib-dynamodb";
|
|
1073
1070
|
var Views = class _Views {
|
|
1074
1071
|
static ENV = process.env.ENV || "dev";
|
|
1075
|
-
static TABLE_NAME = `NotiHub-Views-
|
|
1072
|
+
static TABLE_NAME = `NotiHub-Views-v2-${_Views.ENV}`;
|
|
1076
1073
|
/**
|
|
1077
1074
|
* Retrieves a view by its ID.
|
|
1078
1075
|
* @param id - The ID of the view to retrieve.
|
|
1079
1076
|
* @returns A promise that resolves to the view object or null if not found.
|
|
1080
1077
|
*/
|
|
1081
|
-
static async
|
|
1082
|
-
const command = new
|
|
1078
|
+
static async getViewByViewId(viewId) {
|
|
1079
|
+
const command = new QueryCommand8({
|
|
1083
1080
|
TableName: _Views.TABLE_NAME,
|
|
1084
|
-
|
|
1081
|
+
IndexName: "ViewIdIndex",
|
|
1082
|
+
// Assuming you have a GSI for viewId
|
|
1083
|
+
KeyConditionExpression: "viewId = :viewId",
|
|
1084
|
+
ExpressionAttributeValues: {
|
|
1085
|
+
":viewId": viewId
|
|
1086
|
+
}
|
|
1085
1087
|
});
|
|
1086
1088
|
try {
|
|
1087
1089
|
const result = await ddbDocClient.send(command);
|
|
1088
|
-
|
|
1090
|
+
if (!result.Items || result.Items.length === 0) {
|
|
1091
|
+
return null;
|
|
1092
|
+
}
|
|
1093
|
+
return result.Items[0] || null;
|
|
1089
1094
|
} catch (error) {
|
|
1090
1095
|
console.error("Error fetching view:", error);
|
|
1091
1096
|
throw new Error("Could not fetch view");
|
|
@@ -1114,8 +1119,8 @@ var Views_default = Views;
|
|
|
1114
1119
|
|
|
1115
1120
|
// src/DynamoModels/SubscriptionType.ts
|
|
1116
1121
|
import {
|
|
1117
|
-
DeleteCommand as
|
|
1118
|
-
GetCommand as
|
|
1122
|
+
DeleteCommand as DeleteCommand8,
|
|
1123
|
+
GetCommand as GetCommand8,
|
|
1119
1124
|
PutCommand as PutCommand9,
|
|
1120
1125
|
QueryCommand as QueryCommand9
|
|
1121
1126
|
} from "@aws-sdk/lib-dynamodb";
|
|
@@ -1128,7 +1133,7 @@ var SubscriptionType = class _SubscriptionType {
|
|
|
1128
1133
|
* @returns A promise that resolves to the subscription type object or null if not found.
|
|
1129
1134
|
*/
|
|
1130
1135
|
static async getSubscriptionTypeById(id) {
|
|
1131
|
-
const command = new
|
|
1136
|
+
const command = new GetCommand8({
|
|
1132
1137
|
TableName: _SubscriptionType.TABLE_NAME,
|
|
1133
1138
|
Key: { id }
|
|
1134
1139
|
});
|
|
@@ -1167,7 +1172,7 @@ var SubscriptionType = class _SubscriptionType {
|
|
|
1167
1172
|
* @returns A promise that resolves when the subscription type is deleted.
|
|
1168
1173
|
*/
|
|
1169
1174
|
static async deleteSubscriptionTypeById(id) {
|
|
1170
|
-
const command = new
|
|
1175
|
+
const command = new DeleteCommand8({
|
|
1171
1176
|
TableName: _SubscriptionType.TABLE_NAME,
|
|
1172
1177
|
Key: { id }
|
|
1173
1178
|
});
|
|
@@ -1227,8 +1232,8 @@ var SubscriptionType_default = SubscriptionType;
|
|
|
1227
1232
|
|
|
1228
1233
|
// src/DynamoModels/CustomerMetaData.ts
|
|
1229
1234
|
import {
|
|
1230
|
-
DeleteCommand as
|
|
1231
|
-
GetCommand as
|
|
1235
|
+
DeleteCommand as DeleteCommand9,
|
|
1236
|
+
GetCommand as GetCommand9,
|
|
1232
1237
|
PutCommand as PutCommand10,
|
|
1233
1238
|
QueryCommand as QueryCommand10
|
|
1234
1239
|
} from "@aws-sdk/lib-dynamodb";
|
|
@@ -1241,7 +1246,7 @@ var CustomerMetaData = class _CustomerMetaData {
|
|
|
1241
1246
|
* @returns A promise that resolves to the customer metadata object or null if not found.
|
|
1242
1247
|
*/
|
|
1243
1248
|
static async getCustomerMetaDataById(id) {
|
|
1244
|
-
const command = new
|
|
1249
|
+
const command = new GetCommand9({
|
|
1245
1250
|
TableName: _CustomerMetaData.TABLE_NAME,
|
|
1246
1251
|
Key: { id }
|
|
1247
1252
|
});
|
|
@@ -1259,7 +1264,7 @@ var CustomerMetaData = class _CustomerMetaData {
|
|
|
1259
1264
|
* @returns A promise that resolves when the customer metadata is deleted.
|
|
1260
1265
|
*/
|
|
1261
1266
|
static async deleteCustomerMetaDataById(id) {
|
|
1262
|
-
const command = new
|
|
1267
|
+
const command = new DeleteCommand9({
|
|
1263
1268
|
TableName: _CustomerMetaData.TABLE_NAME,
|
|
1264
1269
|
Key: { id }
|
|
1265
1270
|
});
|
|
@@ -1318,8 +1323,8 @@ var CustomerMetaData_default = CustomerMetaData;
|
|
|
1318
1323
|
|
|
1319
1324
|
// src/DynamoModels/CustomerMinified.ts
|
|
1320
1325
|
import {
|
|
1321
|
-
DeleteCommand as
|
|
1322
|
-
GetCommand as
|
|
1326
|
+
DeleteCommand as DeleteCommand10,
|
|
1327
|
+
GetCommand as GetCommand10,
|
|
1323
1328
|
PutCommand as PutCommand11,
|
|
1324
1329
|
QueryCommand as QueryCommand11,
|
|
1325
1330
|
ScanCommand as ScanCommand2
|
|
@@ -1333,7 +1338,7 @@ var CustomerMinified = class _CustomerMinified {
|
|
|
1333
1338
|
* @returns A promise that resolves to the customer object or null if not found.
|
|
1334
1339
|
*/
|
|
1335
1340
|
static async getCustomerMinifiedById(id) {
|
|
1336
|
-
const command = new
|
|
1341
|
+
const command = new GetCommand10({
|
|
1337
1342
|
TableName: _CustomerMinified.TABLE_NAME,
|
|
1338
1343
|
Key: { id }
|
|
1339
1344
|
});
|
|
@@ -1390,7 +1395,7 @@ var CustomerMinified = class _CustomerMinified {
|
|
|
1390
1395
|
* @returns A promise that resolves when the customer is deleted.
|
|
1391
1396
|
*/
|
|
1392
1397
|
static async deleteCustomerMinifiedById(id) {
|
|
1393
|
-
const command = new
|
|
1398
|
+
const command = new DeleteCommand10({
|
|
1394
1399
|
TableName: _CustomerMinified.TABLE_NAME,
|
|
1395
1400
|
Key: { id }
|
|
1396
1401
|
});
|
|
@@ -1431,7 +1436,7 @@ var CustomerMinified = class _CustomerMinified {
|
|
|
1431
1436
|
var CustomerMinified_default = CustomerMinified;
|
|
1432
1437
|
|
|
1433
1438
|
// src/DynamoModels/NotificationStats.ts
|
|
1434
|
-
import { DeleteCommand as
|
|
1439
|
+
import { DeleteCommand as DeleteCommand11, GetCommand as GetCommand11, PutCommand as PutCommand12 } from "@aws-sdk/lib-dynamodb";
|
|
1435
1440
|
var NotificationStats = class _NotificationStats {
|
|
1436
1441
|
static ENV = process.env.ENV || "dev";
|
|
1437
1442
|
static TABLE_NAME = `NotiHub-NotificationStats-v1-${_NotificationStats.ENV}`;
|
|
@@ -1441,7 +1446,7 @@ var NotificationStats = class _NotificationStats {
|
|
|
1441
1446
|
* @returns A promise that resolves to the notification stats object or null if not found.
|
|
1442
1447
|
*/
|
|
1443
1448
|
static async getNotificationStatsById(id, customerId) {
|
|
1444
|
-
const command = new
|
|
1449
|
+
const command = new GetCommand11({
|
|
1445
1450
|
TableName: _NotificationStats.TABLE_NAME,
|
|
1446
1451
|
Key: { id, customerId }
|
|
1447
1452
|
});
|
|
@@ -1477,7 +1482,7 @@ var NotificationStats = class _NotificationStats {
|
|
|
1477
1482
|
* @returns A promise that resolves when the deletion is complete.
|
|
1478
1483
|
*/
|
|
1479
1484
|
static async deleteNotificationStatsById(id) {
|
|
1480
|
-
const command = new
|
|
1485
|
+
const command = new DeleteCommand11({
|
|
1481
1486
|
TableName: _NotificationStats.TABLE_NAME,
|
|
1482
1487
|
Key: { id }
|
|
1483
1488
|
});
|