@amohamud23/notihub 1.0.196 → 1.0.197
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 +11 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -600,17 +600,22 @@ var NotiType = class _NotiType {
|
|
|
600
600
|
* @param customerId - The customer ID associated with the notification type.
|
|
601
601
|
* @returns A promise that resolves to the notification type object or null if not found.
|
|
602
602
|
*/
|
|
603
|
-
static async getNotiTypeById(id
|
|
604
|
-
const command = new import_lib_dynamodb6.
|
|
603
|
+
static async getNotiTypeById(id) {
|
|
604
|
+
const command = new import_lib_dynamodb6.QueryCommand({
|
|
605
605
|
TableName: _NotiType.TABLE_NAME,
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
606
|
+
// Replace with your resolved table name
|
|
607
|
+
IndexName: "NotiTypeIdIndex",
|
|
608
|
+
KeyConditionExpression: "id = :id",
|
|
609
|
+
ExpressionAttributeValues: {
|
|
610
|
+
":id": id
|
|
609
611
|
}
|
|
610
612
|
});
|
|
611
613
|
try {
|
|
612
614
|
const result = await ddbDocClient.send(command);
|
|
613
|
-
|
|
615
|
+
if (!result.Items || result.Items.length === 0) {
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
return result.Items[0];
|
|
614
619
|
} catch (error) {
|
|
615
620
|
console.error("Error fetching notification type:", error);
|
|
616
621
|
throw new Error("Could not fetch notification type");
|
package/dist/index.d.cts
CHANGED
|
@@ -382,7 +382,7 @@ declare class NotiType {
|
|
|
382
382
|
* @param customerId - The customer ID associated with the notification type.
|
|
383
383
|
* @returns A promise that resolves to the notification type object or null if not found.
|
|
384
384
|
*/
|
|
385
|
-
static getNotiTypeById(id: string
|
|
385
|
+
static getNotiTypeById(id: string): Promise<INotiType | null>;
|
|
386
386
|
/**
|
|
387
387
|
* Retrieves all notification types.
|
|
388
388
|
* @returns A promise that resolves to an array of notification type objects.
|
package/dist/index.d.ts
CHANGED
|
@@ -382,7 +382,7 @@ declare class NotiType {
|
|
|
382
382
|
* @param customerId - The customer ID associated with the notification type.
|
|
383
383
|
* @returns A promise that resolves to the notification type object or null if not found.
|
|
384
384
|
*/
|
|
385
|
-
static getNotiTypeById(id: string
|
|
385
|
+
static getNotiTypeById(id: string): Promise<INotiType | null>;
|
|
386
386
|
/**
|
|
387
387
|
* Retrieves all notification types.
|
|
388
388
|
* @returns A promise that resolves to an array of notification type objects.
|
package/dist/index.js
CHANGED
|
@@ -573,7 +573,6 @@ var NotiHubStats_default = NotiHubStats;
|
|
|
573
573
|
import {
|
|
574
574
|
BatchWriteCommand,
|
|
575
575
|
DeleteCommand as DeleteCommand4,
|
|
576
|
-
GetCommand as GetCommand5,
|
|
577
576
|
PutCommand as PutCommand5,
|
|
578
577
|
QueryCommand as QueryCommand5,
|
|
579
578
|
ScanCommand,
|
|
@@ -588,17 +587,22 @@ var NotiType = class _NotiType {
|
|
|
588
587
|
* @param customerId - The customer ID associated with the notification type.
|
|
589
588
|
* @returns A promise that resolves to the notification type object or null if not found.
|
|
590
589
|
*/
|
|
591
|
-
static async getNotiTypeById(id
|
|
592
|
-
const command = new
|
|
590
|
+
static async getNotiTypeById(id) {
|
|
591
|
+
const command = new QueryCommand5({
|
|
593
592
|
TableName: _NotiType.TABLE_NAME,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
593
|
+
// Replace with your resolved table name
|
|
594
|
+
IndexName: "NotiTypeIdIndex",
|
|
595
|
+
KeyConditionExpression: "id = :id",
|
|
596
|
+
ExpressionAttributeValues: {
|
|
597
|
+
":id": id
|
|
597
598
|
}
|
|
598
599
|
});
|
|
599
600
|
try {
|
|
600
601
|
const result = await ddbDocClient.send(command);
|
|
601
|
-
|
|
602
|
+
if (!result.Items || result.Items.length === 0) {
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
return result.Items[0];
|
|
602
606
|
} catch (error) {
|
|
603
607
|
console.error("Error fetching notification type:", error);
|
|
604
608
|
throw new Error("Could not fetch notification type");
|