@amohamud23/notihub 1.1.64 → 1.1.65

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
@@ -461,21 +461,13 @@ var Notifications = class _Notifications {
461
461
  * @returns A promise that resolves to the notification object or null if not found.
462
462
  */
463
463
  static async getNotificationById(id) {
464
- const params = {
464
+ const command = new import_lib_dynamodb4.GetCommand({
465
465
  TableName: _Notifications.TABLE_NAME,
466
- IndexName: "NotificationIdIndex",
467
- KeyConditionExpression: "id = :id",
468
- ExpressionAttributeValues: {
469
- ":id": id
470
- }
471
- };
472
- const command = new import_lib_dynamodb4.QueryCommand(params);
466
+ Key: { id }
467
+ });
473
468
  try {
474
469
  const response = await ddbDocClient.send(command);
475
- if (!response.Items || response.Items.length === 0) {
476
- return null;
477
- }
478
- return response.Items[0] ?? null;
470
+ return response.Item || null;
479
471
  } catch (error) {
480
472
  console.error("Error fetching notification:", error);
481
473
  throw new Error("Could not fetch notification");
package/dist/index.js CHANGED
@@ -437,6 +437,7 @@ var Customer_default = Customer;
437
437
  // src/DynamoModels/Notifications.ts
438
438
  import {
439
439
  DeleteCommand as DeleteCommand3,
440
+ GetCommand as GetCommand3,
440
441
  PutCommand as PutCommand3,
441
442
  QueryCommand as QueryCommand3
442
443
  } from "@aws-sdk/lib-dynamodb";
@@ -449,21 +450,13 @@ var Notifications = class _Notifications {
449
450
  * @returns A promise that resolves to the notification object or null if not found.
450
451
  */
451
452
  static async getNotificationById(id) {
452
- const params = {
453
+ const command = new GetCommand3({
453
454
  TableName: _Notifications.TABLE_NAME,
454
- IndexName: "NotificationIdIndex",
455
- KeyConditionExpression: "id = :id",
456
- ExpressionAttributeValues: {
457
- ":id": id
458
- }
459
- };
460
- const command = new QueryCommand3(params);
455
+ Key: { id }
456
+ });
461
457
  try {
462
458
  const response = await ddbDocClient.send(command);
463
- if (!response.Items || response.Items.length === 0) {
464
- return null;
465
- }
466
- return response.Items[0] ?? null;
459
+ return response.Item || null;
467
460
  } catch (error) {
468
461
  console.error("Error fetching notification:", error);
469
462
  throw new Error("Could not fetch notification");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.1.64",
3
+ "version": "1.1.65",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",