@amohamud23/notihub 1.0.194 → 1.0.196

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
@@ -597,12 +597,16 @@ var NotiType = class _NotiType {
597
597
  /**
598
598
  * Retrieves a notification type by its ID.
599
599
  * @param id - The ID of the notification type to retrieve.
600
+ * @param customerId - The customer ID associated with the notification type.
600
601
  * @returns A promise that resolves to the notification type object or null if not found.
601
602
  */
602
- static async getNotiTypeById(id) {
603
+ static async getNotiTypeById(id, customerId) {
603
604
  const command = new import_lib_dynamodb6.GetCommand({
604
605
  TableName: _NotiType.TABLE_NAME,
605
- Key: { id }
606
+ Key: {
607
+ customerId,
608
+ id
609
+ }
606
610
  });
607
611
  try {
608
612
  const result = await ddbDocClient.send(command);
@@ -1079,17 +1083,17 @@ var SubscriptionType = class _SubscriptionType {
1079
1083
  }
1080
1084
  /**
1081
1085
  * Get all subscription types by notifier ID.
1082
- * @param notifierId - The ID of the notifier to retrieve subscription types for.
1086
+ * @param notiTypeId - The ID of the notifier to retrieve subscription types for.
1083
1087
  * @returns A promise that resolves to an array of subscription type objects or null if not found.
1084
1088
  */
1085
- static async getSubscriptionTypesByNotifierId(notifierId) {
1089
+ static async getSubscriptionTypesByNotifierId(notiTypeId) {
1086
1090
  const command = new import_lib_dynamodb10.QueryCommand({
1087
1091
  TableName: _SubscriptionType.TABLE_NAME,
1088
- IndexName: "NotifierIdIndex",
1092
+ IndexName: "NotiTypeIdIndex",
1089
1093
  // Assuming you have a GSI for notifierId
1090
- KeyConditionExpression: "notifierId = :notifierId",
1094
+ KeyConditionExpression: "notiTypeId = :notiTypeId",
1091
1095
  ExpressionAttributeValues: {
1092
- ":notifierId": notifierId
1096
+ ":notiTypeId": notiTypeId
1093
1097
  }
1094
1098
  });
1095
1099
  try {
@@ -1097,7 +1101,7 @@ var SubscriptionType = class _SubscriptionType {
1097
1101
  return result.Items || null;
1098
1102
  } catch (error) {
1099
1103
  console.error(
1100
- `Error fetching subscription types by notifierId: ${notifierId}`,
1104
+ `Error fetching subscription types by notifierId: ${notiTypeId}`,
1101
1105
  error
1102
1106
  );
1103
1107
  throw new Error("Could not fetch subscription types by notifierId");
package/dist/index.d.cts CHANGED
@@ -379,9 +379,10 @@ declare class NotiType {
379
379
  /**
380
380
  * Retrieves a notification type by its ID.
381
381
  * @param id - The ID of the notification type to retrieve.
382
+ * @param customerId - The customer ID associated with the notification type.
382
383
  * @returns A promise that resolves to the notification type object or null if not found.
383
384
  */
384
- static getNotiTypeById(id: string): Promise<INotiType | null>;
385
+ static getNotiTypeById(id: string, customerId: string): Promise<INotiType | null>;
385
386
  /**
386
387
  * Retrieves all notification types.
387
388
  * @returns A promise that resolves to an array of notification type objects.
@@ -517,10 +518,10 @@ declare class SubscriptionType {
517
518
  static deleteSubscriptionTypeById(id: string): Promise<void>;
518
519
  /**
519
520
  * Get all subscription types by notifier ID.
520
- * @param notifierId - The ID of the notifier to retrieve subscription types for.
521
+ * @param notiTypeId - The ID of the notifier to retrieve subscription types for.
521
522
  * @returns A promise that resolves to an array of subscription type objects or null if not found.
522
523
  */
523
- static getSubscriptionTypesByNotifierId(notifierId: string): Promise<IUserSubscribeNotifier[] | []>;
524
+ static getSubscriptionTypesByNotifierId(notiTypeId: string): Promise<IUserSubscribeNotifier[] | []>;
524
525
  }
525
526
 
526
527
  declare class CustomerMetaData {
package/dist/index.d.ts CHANGED
@@ -379,9 +379,10 @@ declare class NotiType {
379
379
  /**
380
380
  * Retrieves a notification type by its ID.
381
381
  * @param id - The ID of the notification type to retrieve.
382
+ * @param customerId - The customer ID associated with the notification type.
382
383
  * @returns A promise that resolves to the notification type object or null if not found.
383
384
  */
384
- static getNotiTypeById(id: string): Promise<INotiType | null>;
385
+ static getNotiTypeById(id: string, customerId: string): Promise<INotiType | null>;
385
386
  /**
386
387
  * Retrieves all notification types.
387
388
  * @returns A promise that resolves to an array of notification type objects.
@@ -517,10 +518,10 @@ declare class SubscriptionType {
517
518
  static deleteSubscriptionTypeById(id: string): Promise<void>;
518
519
  /**
519
520
  * Get all subscription types by notifier ID.
520
- * @param notifierId - The ID of the notifier to retrieve subscription types for.
521
+ * @param notiTypeId - The ID of the notifier to retrieve subscription types for.
521
522
  * @returns A promise that resolves to an array of subscription type objects or null if not found.
522
523
  */
523
- static getSubscriptionTypesByNotifierId(notifierId: string): Promise<IUserSubscribeNotifier[] | []>;
524
+ static getSubscriptionTypesByNotifierId(notiTypeId: string): Promise<IUserSubscribeNotifier[] | []>;
524
525
  }
525
526
 
526
527
  declare class CustomerMetaData {
package/dist/index.js CHANGED
@@ -585,12 +585,16 @@ var NotiType = class _NotiType {
585
585
  /**
586
586
  * Retrieves a notification type by its ID.
587
587
  * @param id - The ID of the notification type to retrieve.
588
+ * @param customerId - The customer ID associated with the notification type.
588
589
  * @returns A promise that resolves to the notification type object or null if not found.
589
590
  */
590
- static async getNotiTypeById(id) {
591
+ static async getNotiTypeById(id, customerId) {
591
592
  const command = new GetCommand5({
592
593
  TableName: _NotiType.TABLE_NAME,
593
- Key: { id }
594
+ Key: {
595
+ customerId,
596
+ id
597
+ }
594
598
  });
595
599
  try {
596
600
  const result = await ddbDocClient.send(command);
@@ -1084,17 +1088,17 @@ var SubscriptionType = class _SubscriptionType {
1084
1088
  }
1085
1089
  /**
1086
1090
  * Get all subscription types by notifier ID.
1087
- * @param notifierId - The ID of the notifier to retrieve subscription types for.
1091
+ * @param notiTypeId - The ID of the notifier to retrieve subscription types for.
1088
1092
  * @returns A promise that resolves to an array of subscription type objects or null if not found.
1089
1093
  */
1090
- static async getSubscriptionTypesByNotifierId(notifierId) {
1094
+ static async getSubscriptionTypesByNotifierId(notiTypeId) {
1091
1095
  const command = new QueryCommand9({
1092
1096
  TableName: _SubscriptionType.TABLE_NAME,
1093
- IndexName: "NotifierIdIndex",
1097
+ IndexName: "NotiTypeIdIndex",
1094
1098
  // Assuming you have a GSI for notifierId
1095
- KeyConditionExpression: "notifierId = :notifierId",
1099
+ KeyConditionExpression: "notiTypeId = :notiTypeId",
1096
1100
  ExpressionAttributeValues: {
1097
- ":notifierId": notifierId
1101
+ ":notiTypeId": notiTypeId
1098
1102
  }
1099
1103
  });
1100
1104
  try {
@@ -1102,7 +1106,7 @@ var SubscriptionType = class _SubscriptionType {
1102
1106
  return result.Items || null;
1103
1107
  } catch (error) {
1104
1108
  console.error(
1105
- `Error fetching subscription types by notifierId: ${notifierId}`,
1109
+ `Error fetching subscription types by notifierId: ${notiTypeId}`,
1106
1110
  error
1107
1111
  );
1108
1112
  throw new Error("Could not fetch subscription types by notifierId");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.0.194",
3
+ "version": "1.0.196",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",