@amohamud23/notihub 1.0.179 → 1.0.181
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 +5 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -451,14 +451,12 @@ var Notifications = class _Notifications {
|
|
|
451
451
|
throw new Error("Could not fetch notification");
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
static async
|
|
454
|
+
static async getAllNotificationsByEntityId(customerId) {
|
|
455
455
|
const command = new import_lib_dynamodb4.QueryCommand({
|
|
456
456
|
TableName: _Notifications.TABLE_NAME,
|
|
457
|
-
|
|
458
|
-
// Assuming you have a GSI for entityId
|
|
459
|
-
KeyConditionExpression: "entityId = :entityId",
|
|
457
|
+
KeyConditionExpression: "customerId = :customerId",
|
|
460
458
|
ExpressionAttributeValues: {
|
|
461
|
-
":
|
|
459
|
+
":customerId": customerId
|
|
462
460
|
}
|
|
463
461
|
});
|
|
464
462
|
try {
|
|
@@ -466,10 +464,10 @@ var Notifications = class _Notifications {
|
|
|
466
464
|
return result.Items || null;
|
|
467
465
|
} catch (error) {
|
|
468
466
|
console.error(
|
|
469
|
-
`Error fetching notifications by
|
|
467
|
+
`Error fetching notifications by customerId: ${customerId}`,
|
|
470
468
|
error
|
|
471
469
|
);
|
|
472
|
-
throw new Error("Could not fetch notifications by
|
|
470
|
+
throw new Error("Could not fetch notifications by customerId");
|
|
473
471
|
}
|
|
474
472
|
}
|
|
475
473
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -343,7 +343,7 @@ declare class Notifications {
|
|
|
343
343
|
* @returns A promise that resolves to the notification object or null if not found.
|
|
344
344
|
*/
|
|
345
345
|
static getNotificationById(id: string): Promise<INotiHubNotification | null>;
|
|
346
|
-
static
|
|
346
|
+
static getAllNotificationsByEntityId(customerId: string): Promise<INotiHubNotification[] | null>;
|
|
347
347
|
/**
|
|
348
348
|
* Creates a new notification.
|
|
349
349
|
* @param notification - The notification object to create.
|
package/dist/index.d.ts
CHANGED
|
@@ -343,7 +343,7 @@ declare class Notifications {
|
|
|
343
343
|
* @returns A promise that resolves to the notification object or null if not found.
|
|
344
344
|
*/
|
|
345
345
|
static getNotificationById(id: string): Promise<INotiHubNotification | null>;
|
|
346
|
-
static
|
|
346
|
+
static getAllNotificationsByEntityId(customerId: string): Promise<INotiHubNotification[] | null>;
|
|
347
347
|
/**
|
|
348
348
|
* Creates a new notification.
|
|
349
349
|
* @param notification - The notification object to create.
|
package/dist/index.js
CHANGED
|
@@ -427,14 +427,12 @@ var Notifications = class _Notifications {
|
|
|
427
427
|
throw new Error("Could not fetch notification");
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
static async
|
|
430
|
+
static async getAllNotificationsByEntityId(customerId) {
|
|
431
431
|
const command = new QueryCommand3({
|
|
432
432
|
TableName: _Notifications.TABLE_NAME,
|
|
433
|
-
|
|
434
|
-
// Assuming you have a GSI for entityId
|
|
435
|
-
KeyConditionExpression: "entityId = :entityId",
|
|
433
|
+
KeyConditionExpression: "customerId = :customerId",
|
|
436
434
|
ExpressionAttributeValues: {
|
|
437
|
-
":
|
|
435
|
+
":customerId": customerId
|
|
438
436
|
}
|
|
439
437
|
});
|
|
440
438
|
try {
|
|
@@ -442,10 +440,10 @@ var Notifications = class _Notifications {
|
|
|
442
440
|
return result.Items || null;
|
|
443
441
|
} catch (error) {
|
|
444
442
|
console.error(
|
|
445
|
-
`Error fetching notifications by
|
|
443
|
+
`Error fetching notifications by customerId: ${customerId}`,
|
|
446
444
|
error
|
|
447
445
|
);
|
|
448
|
-
throw new Error("Could not fetch notifications by
|
|
446
|
+
throw new Error("Could not fetch notifications by customerId");
|
|
449
447
|
}
|
|
450
448
|
}
|
|
451
449
|
/**
|