@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 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, customerId) {
604
- const command = new import_lib_dynamodb6.GetCommand({
603
+ static async getNotiTypeById(id) {
604
+ const command = new import_lib_dynamodb6.QueryCommand({
605
605
  TableName: _NotiType.TABLE_NAME,
606
- Key: {
607
- customerId,
608
- id
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
- return result.Item || null;
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, customerId: string): Promise<INotiType | null>;
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, customerId: string): Promise<INotiType | null>;
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, customerId) {
592
- const command = new GetCommand5({
590
+ static async getNotiTypeById(id) {
591
+ const command = new QueryCommand5({
593
592
  TableName: _NotiType.TABLE_NAME,
594
- Key: {
595
- customerId,
596
- id
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
- return result.Item || null;
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.0.196",
3
+ "version": "1.0.197",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",