@amohamud23/notihub 1.0.196 → 1.0.198

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
@@ -96,6 +96,7 @@ type INotiHubNotification = {
96
96
  type INotiHubNotificationStats = {
97
97
  id: string;
98
98
  notificationId: string;
99
+ customerId: string;
99
100
  views: number;
100
101
  createdAt: string;
101
102
  updatedAt: string;
@@ -129,9 +130,7 @@ type INotiHubStatsHistory = {
129
130
  id: string;
130
131
  customerId: string;
131
132
  type: "DAY" | "MONTH" | "YEAR";
132
- subscription: number;
133
- notifications: number;
134
- views: number;
133
+ stat: INotiHubStats;
135
134
  createdAt: string;
136
135
  updatedAt: string;
137
136
  };
@@ -382,7 +381,7 @@ declare class NotiType {
382
381
  * @param customerId - The customer ID associated with the notification type.
383
382
  * @returns A promise that resolves to the notification type object or null if not found.
384
383
  */
385
- static getNotiTypeById(id: string, customerId: string): Promise<INotiType | null>;
384
+ static getNotiTypeById(id: string): Promise<INotiType | null>;
386
385
  /**
387
386
  * Retrieves all notification types.
388
387
  * @returns A promise that resolves to an array of notification type objects.
package/dist/index.d.ts CHANGED
@@ -96,6 +96,7 @@ type INotiHubNotification = {
96
96
  type INotiHubNotificationStats = {
97
97
  id: string;
98
98
  notificationId: string;
99
+ customerId: string;
99
100
  views: number;
100
101
  createdAt: string;
101
102
  updatedAt: string;
@@ -129,9 +130,7 @@ type INotiHubStatsHistory = {
129
130
  id: string;
130
131
  customerId: string;
131
132
  type: "DAY" | "MONTH" | "YEAR";
132
- subscription: number;
133
- notifications: number;
134
- views: number;
133
+ stat: INotiHubStats;
135
134
  createdAt: string;
136
135
  updatedAt: string;
137
136
  };
@@ -382,7 +381,7 @@ declare class NotiType {
382
381
  * @param customerId - The customer ID associated with the notification type.
383
382
  * @returns A promise that resolves to the notification type object or null if not found.
384
383
  */
385
- static getNotiTypeById(id: string, customerId: string): Promise<INotiType | null>;
384
+ static getNotiTypeById(id: string): Promise<INotiType | null>;
386
385
  /**
387
386
  * Retrieves all notification types.
388
387
  * @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.198",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",