@amohamud23/notihub 1.1.4 → 1.1.6
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 +24 -0
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +24 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -298,6 +298,30 @@ var User = class _User {
|
|
|
298
298
|
throw new Error("Could not delete user");
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Searches for users by email and customerId
|
|
303
|
+
* @param email - The email to search for.
|
|
304
|
+
* @param customerId - The customer ID to filter by.
|
|
305
|
+
* @returns A promise that resolves to an array of user objects.
|
|
306
|
+
*/
|
|
307
|
+
static async searchUsersByEmailAndCustomerId(email, customerId) {
|
|
308
|
+
const command = new import_lib_dynamodb2.QueryCommand({
|
|
309
|
+
TableName: _User.TABLE_NAME,
|
|
310
|
+
IndexName: "EmailCustomerIndex",
|
|
311
|
+
KeyConditionExpression: "begins_with(email, :email) and customerId = :customerId",
|
|
312
|
+
ExpressionAttributeValues: {
|
|
313
|
+
":email": email,
|
|
314
|
+
":customerId": customerId
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
try {
|
|
318
|
+
const result = await ddbDocClient.send(command);
|
|
319
|
+
return result.Items || [];
|
|
320
|
+
} catch (error) {
|
|
321
|
+
console.error("Error searching users by email and customerId:", error);
|
|
322
|
+
throw new Error("Could not search users by email and customerId");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
301
325
|
};
|
|
302
326
|
var User_default = User;
|
|
303
327
|
|
package/dist/index.d.cts
CHANGED
|
@@ -109,7 +109,7 @@ type INotiHubUser = {
|
|
|
109
109
|
name: string;
|
|
110
110
|
email: string;
|
|
111
111
|
dob: string;
|
|
112
|
-
subscriptions:
|
|
112
|
+
subscriptions: string[];
|
|
113
113
|
events: number;
|
|
114
114
|
isSignedIn: boolean;
|
|
115
115
|
createdAt: string;
|
|
@@ -296,6 +296,13 @@ declare class User {
|
|
|
296
296
|
* @returns A promise that resolves when the user is deleted.
|
|
297
297
|
*/
|
|
298
298
|
static deleteUser(id: string): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Searches for users by email and customerId
|
|
301
|
+
* @param email - The email to search for.
|
|
302
|
+
* @param customerId - The customer ID to filter by.
|
|
303
|
+
* @returns A promise that resolves to an array of user objects.
|
|
304
|
+
*/
|
|
305
|
+
static searchUsersByEmailAndCustomerId(email: string, customerId: string): Promise<INotiHubUser[]>;
|
|
299
306
|
}
|
|
300
307
|
|
|
301
308
|
declare class Customer {
|
package/dist/index.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ type INotiHubUser = {
|
|
|
109
109
|
name: string;
|
|
110
110
|
email: string;
|
|
111
111
|
dob: string;
|
|
112
|
-
subscriptions:
|
|
112
|
+
subscriptions: string[];
|
|
113
113
|
events: number;
|
|
114
114
|
isSignedIn: boolean;
|
|
115
115
|
createdAt: string;
|
|
@@ -296,6 +296,13 @@ declare class User {
|
|
|
296
296
|
* @returns A promise that resolves when the user is deleted.
|
|
297
297
|
*/
|
|
298
298
|
static deleteUser(id: string): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Searches for users by email and customerId
|
|
301
|
+
* @param email - The email to search for.
|
|
302
|
+
* @param customerId - The customer ID to filter by.
|
|
303
|
+
* @returns A promise that resolves to an array of user objects.
|
|
304
|
+
*/
|
|
305
|
+
static searchUsersByEmailAndCustomerId(email: string, customerId: string): Promise<INotiHubUser[]>;
|
|
299
306
|
}
|
|
300
307
|
|
|
301
308
|
declare class Customer {
|
package/dist/index.js
CHANGED
|
@@ -265,6 +265,30 @@ var User = class _User {
|
|
|
265
265
|
throw new Error("Could not delete user");
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Searches for users by email and customerId
|
|
270
|
+
* @param email - The email to search for.
|
|
271
|
+
* @param customerId - The customer ID to filter by.
|
|
272
|
+
* @returns A promise that resolves to an array of user objects.
|
|
273
|
+
*/
|
|
274
|
+
static async searchUsersByEmailAndCustomerId(email, customerId) {
|
|
275
|
+
const command = new QueryCommand({
|
|
276
|
+
TableName: _User.TABLE_NAME,
|
|
277
|
+
IndexName: "EmailCustomerIndex",
|
|
278
|
+
KeyConditionExpression: "begins_with(email, :email) and customerId = :customerId",
|
|
279
|
+
ExpressionAttributeValues: {
|
|
280
|
+
":email": email,
|
|
281
|
+
":customerId": customerId
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
try {
|
|
285
|
+
const result = await ddbDocClient.send(command);
|
|
286
|
+
return result.Items || [];
|
|
287
|
+
} catch (error) {
|
|
288
|
+
console.error("Error searching users by email and customerId:", error);
|
|
289
|
+
throw new Error("Could not search users by email and customerId");
|
|
290
|
+
}
|
|
291
|
+
}
|
|
268
292
|
};
|
|
269
293
|
var User_default = User;
|
|
270
294
|
|