@amohamud23/notihub 1.1.8 → 1.1.10
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 +31 -3
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +32 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -940,13 +940,21 @@ var Subscription = class _Subscription {
|
|
|
940
940
|
* @returns A promise that resolves to the subscription object or null if not found.
|
|
941
941
|
*/
|
|
942
942
|
static async getSubscriptionBySubscriptionId(subscriptionId) {
|
|
943
|
-
const command = new import_lib_dynamodb7.
|
|
943
|
+
const command = new import_lib_dynamodb7.QueryCommand({
|
|
944
944
|
TableName: _Subscription.TABLE_NAME,
|
|
945
|
-
|
|
945
|
+
IndexName: "SubscriptionIdIndex",
|
|
946
|
+
// Assuming you have a GSI for userId
|
|
947
|
+
KeyConditionExpression: "subscriptionId = :subscriptionId",
|
|
948
|
+
ExpressionAttributeValues: {
|
|
949
|
+
":subscriptionId": subscriptionId
|
|
950
|
+
}
|
|
946
951
|
});
|
|
947
952
|
try {
|
|
948
953
|
const result = await ddbDocClient.send(command);
|
|
949
|
-
|
|
954
|
+
if (!result.Items || result.Items.length === 0) {
|
|
955
|
+
return null;
|
|
956
|
+
}
|
|
957
|
+
return result.Items[0] || null;
|
|
950
958
|
} catch (error) {
|
|
951
959
|
console.error("Error fetching subscription by SubscriptionId:", error);
|
|
952
960
|
throw new Error("Could not fetch subscription by SubscriptionId");
|
|
@@ -1190,6 +1198,26 @@ var SubscriptionType = class _SubscriptionType {
|
|
|
1190
1198
|
throw new Error("Could not fetch subscription types by notifierId");
|
|
1191
1199
|
}
|
|
1192
1200
|
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Creates a subscription type.
|
|
1203
|
+
* @param subscriptionType - The subscription type object to create.
|
|
1204
|
+
* @returns A promise that resolves to the created subscription type object.
|
|
1205
|
+
*/
|
|
1206
|
+
static async createSubscriptionType(subscriptionType) {
|
|
1207
|
+
const command = new import_lib_dynamodb10.PutCommand({
|
|
1208
|
+
TableName: _SubscriptionType.TABLE_NAME,
|
|
1209
|
+
Item: {
|
|
1210
|
+
subscriptionType
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
try {
|
|
1214
|
+
await ddbDocClient.send(command);
|
|
1215
|
+
return subscriptionType;
|
|
1216
|
+
} catch (error) {
|
|
1217
|
+
console.error("Error creating subscription type:", error);
|
|
1218
|
+
throw new Error("Could not create subscription type");
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1193
1221
|
};
|
|
1194
1222
|
var SubscriptionType_default = SubscriptionType;
|
|
1195
1223
|
|
package/dist/index.d.cts
CHANGED
|
@@ -544,6 +544,12 @@ declare class SubscriptionType {
|
|
|
544
544
|
* @returns A promise that resolves to an array of subscription type objects or null if not found.
|
|
545
545
|
*/
|
|
546
546
|
static getSubscriptionTypesByNotifierId(notiTypeId: string): Promise<IUserSubscribeNotifier[] | []>;
|
|
547
|
+
/**
|
|
548
|
+
* Creates a subscription type.
|
|
549
|
+
* @param subscriptionType - The subscription type object to create.
|
|
550
|
+
* @returns A promise that resolves to the created subscription type object.
|
|
551
|
+
*/
|
|
552
|
+
static createSubscriptionType(subscriptionType: IUserSubscribeNotifier): Promise<IUserSubscribeNotifier>;
|
|
547
553
|
}
|
|
548
554
|
|
|
549
555
|
declare class CustomerMetaData {
|
package/dist/index.d.ts
CHANGED
|
@@ -544,6 +544,12 @@ declare class SubscriptionType {
|
|
|
544
544
|
* @returns A promise that resolves to an array of subscription type objects or null if not found.
|
|
545
545
|
*/
|
|
546
546
|
static getSubscriptionTypesByNotifierId(notiTypeId: string): Promise<IUserSubscribeNotifier[] | []>;
|
|
547
|
+
/**
|
|
548
|
+
* Creates a subscription type.
|
|
549
|
+
* @param subscriptionType - The subscription type object to create.
|
|
550
|
+
* @returns A promise that resolves to the created subscription type object.
|
|
551
|
+
*/
|
|
552
|
+
static createSubscriptionType(subscriptionType: IUserSubscribeNotifier): Promise<IUserSubscribeNotifier>;
|
|
547
553
|
}
|
|
548
554
|
|
|
549
555
|
declare class CustomerMetaData {
|
package/dist/index.js
CHANGED
|
@@ -933,13 +933,21 @@ var Subscription = class _Subscription {
|
|
|
933
933
|
* @returns A promise that resolves to the subscription object or null if not found.
|
|
934
934
|
*/
|
|
935
935
|
static async getSubscriptionBySubscriptionId(subscriptionId) {
|
|
936
|
-
const command = new
|
|
936
|
+
const command = new QueryCommand6({
|
|
937
937
|
TableName: _Subscription.TABLE_NAME,
|
|
938
|
-
|
|
938
|
+
IndexName: "SubscriptionIdIndex",
|
|
939
|
+
// Assuming you have a GSI for userId
|
|
940
|
+
KeyConditionExpression: "subscriptionId = :subscriptionId",
|
|
941
|
+
ExpressionAttributeValues: {
|
|
942
|
+
":subscriptionId": subscriptionId
|
|
943
|
+
}
|
|
939
944
|
});
|
|
940
945
|
try {
|
|
941
946
|
const result = await ddbDocClient.send(command);
|
|
942
|
-
|
|
947
|
+
if (!result.Items || result.Items.length === 0) {
|
|
948
|
+
return null;
|
|
949
|
+
}
|
|
950
|
+
return result.Items[0] || null;
|
|
943
951
|
} catch (error) {
|
|
944
952
|
console.error("Error fetching subscription by SubscriptionId:", error);
|
|
945
953
|
throw new Error("Could not fetch subscription by SubscriptionId");
|
|
@@ -1108,6 +1116,7 @@ var Views_default = Views;
|
|
|
1108
1116
|
import {
|
|
1109
1117
|
DeleteCommand as DeleteCommand9,
|
|
1110
1118
|
GetCommand as GetCommand9,
|
|
1119
|
+
PutCommand as PutCommand9,
|
|
1111
1120
|
QueryCommand as QueryCommand9
|
|
1112
1121
|
} from "@aws-sdk/lib-dynamodb";
|
|
1113
1122
|
var SubscriptionType = class _SubscriptionType {
|
|
@@ -1195,6 +1204,26 @@ var SubscriptionType = class _SubscriptionType {
|
|
|
1195
1204
|
throw new Error("Could not fetch subscription types by notifierId");
|
|
1196
1205
|
}
|
|
1197
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Creates a subscription type.
|
|
1209
|
+
* @param subscriptionType - The subscription type object to create.
|
|
1210
|
+
* @returns A promise that resolves to the created subscription type object.
|
|
1211
|
+
*/
|
|
1212
|
+
static async createSubscriptionType(subscriptionType) {
|
|
1213
|
+
const command = new PutCommand9({
|
|
1214
|
+
TableName: _SubscriptionType.TABLE_NAME,
|
|
1215
|
+
Item: {
|
|
1216
|
+
subscriptionType
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
try {
|
|
1220
|
+
await ddbDocClient.send(command);
|
|
1221
|
+
return subscriptionType;
|
|
1222
|
+
} catch (error) {
|
|
1223
|
+
console.error("Error creating subscription type:", error);
|
|
1224
|
+
throw new Error("Could not create subscription type");
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1198
1227
|
};
|
|
1199
1228
|
var SubscriptionType_default = SubscriptionType;
|
|
1200
1229
|
|