@amohamud23/notihub 1.1.5 → 1.1.7

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
@@ -299,18 +299,18 @@ var User = class _User {
299
299
  }
300
300
  }
301
301
  /**
302
- * Searches for users by username and customerId
303
- * @param username - The username to search for.
302
+ * Searches for users by email and customerId
303
+ * @param email - The email to search for.
304
304
  * @param customerId - The customer ID to filter by.
305
305
  * @returns A promise that resolves to an array of user objects.
306
306
  */
307
- static async searchUsersByUsernameAndCustomerId(username, customerId) {
307
+ static async searchUsersByEmailAndCustomerId(email, customerId) {
308
308
  const command = new import_lib_dynamodb2.QueryCommand({
309
309
  TableName: _User.TABLE_NAME,
310
- IndexName: "UsernameIndex",
311
- KeyConditionExpression: "begins_with(username, :uname) and customerId = :customerId",
310
+ IndexName: "EmailCustomerIndex",
311
+ KeyConditionExpression: "begins_with(email, :email) and customerId = :customerId",
312
312
  ExpressionAttributeValues: {
313
- ":uname": username,
313
+ ":email": email,
314
314
  ":customerId": customerId
315
315
  }
316
316
  });
@@ -318,8 +318,8 @@ var User = class _User {
318
318
  const result = await ddbDocClient.send(command);
319
319
  return result.Items || [];
320
320
  } catch (error) {
321
- console.error("Error searching users by username and customerId:", error);
322
- throw new Error("Could not search users by username and customerId");
321
+ console.error("Error searching users by email and customerId:", error);
322
+ throw new Error("Could not search users by email and customerId");
323
323
  }
324
324
  }
325
325
  };
@@ -1308,10 +1308,9 @@ var CustomerMinified = class _CustomerMinified {
1308
1308
  * @returns A promise that resolves to an array of customer objects or an empty array if not found.
1309
1309
  */
1310
1310
  static async searchCustomersByUsername(username) {
1311
- const command = new import_lib_dynamodb12.QueryCommand({
1311
+ const command = new import_lib_dynamodb12.ScanCommand({
1312
1312
  TableName: _CustomerMinified.TABLE_NAME,
1313
- IndexName: "UsernameIndex",
1314
- KeyConditionExpression: "begins_with(username, :uname)",
1313
+ FilterExpression: "begins_with(username, :uname)",
1315
1314
  ExpressionAttributeValues: {
1316
1315
  ":uname": username
1317
1316
  }
@@ -1368,8 +1367,7 @@ var CustomerMinified = class _CustomerMinified {
1368
1367
  static async getCustomerMinifiedByUsername(username) {
1369
1368
  const command = new import_lib_dynamodb12.QueryCommand({
1370
1369
  TableName: _CustomerMinified.TABLE_NAME,
1371
- IndexName: "UsernameIndex",
1372
- // Assuming you have a GSI for username
1370
+ // IndexName: "UsernameIndex", // Assuming you have a GSI for username
1373
1371
  KeyConditionExpression: "username = :username",
1374
1372
  ExpressionAttributeValues: {
1375
1373
  ":username": username
package/dist/index.d.cts CHANGED
@@ -297,12 +297,12 @@ declare class User {
297
297
  */
298
298
  static deleteUser(id: string): Promise<void>;
299
299
  /**
300
- * Searches for users by username and customerId
301
- * @param username - The username to search for.
300
+ * Searches for users by email and customerId
301
+ * @param email - The email to search for.
302
302
  * @param customerId - The customer ID to filter by.
303
303
  * @returns A promise that resolves to an array of user objects.
304
304
  */
305
- static searchUsersByUsernameAndCustomerId(username: string, customerId: string): Promise<INotiHubUser[]>;
305
+ static searchUsersByEmailAndCustomerId(email: string, customerId: string): Promise<INotiHubUser[]>;
306
306
  }
307
307
 
308
308
  declare class Customer {
package/dist/index.d.ts CHANGED
@@ -297,12 +297,12 @@ declare class User {
297
297
  */
298
298
  static deleteUser(id: string): Promise<void>;
299
299
  /**
300
- * Searches for users by username and customerId
301
- * @param username - The username to search for.
300
+ * Searches for users by email and customerId
301
+ * @param email - The email to search for.
302
302
  * @param customerId - The customer ID to filter by.
303
303
  * @returns A promise that resolves to an array of user objects.
304
304
  */
305
- static searchUsersByUsernameAndCustomerId(username: string, customerId: string): Promise<INotiHubUser[]>;
305
+ static searchUsersByEmailAndCustomerId(email: string, customerId: string): Promise<INotiHubUser[]>;
306
306
  }
307
307
 
308
308
  declare class Customer {
package/dist/index.js CHANGED
@@ -266,18 +266,18 @@ var User = class _User {
266
266
  }
267
267
  }
268
268
  /**
269
- * Searches for users by username and customerId
270
- * @param username - The username to search for.
269
+ * Searches for users by email and customerId
270
+ * @param email - The email to search for.
271
271
  * @param customerId - The customer ID to filter by.
272
272
  * @returns A promise that resolves to an array of user objects.
273
273
  */
274
- static async searchUsersByUsernameAndCustomerId(username, customerId) {
274
+ static async searchUsersByEmailAndCustomerId(email, customerId) {
275
275
  const command = new QueryCommand({
276
276
  TableName: _User.TABLE_NAME,
277
- IndexName: "UsernameIndex",
278
- KeyConditionExpression: "begins_with(username, :uname) and customerId = :customerId",
277
+ IndexName: "EmailCustomerIndex",
278
+ KeyConditionExpression: "begins_with(email, :email) and customerId = :customerId",
279
279
  ExpressionAttributeValues: {
280
- ":uname": username,
280
+ ":email": email,
281
281
  ":customerId": customerId
282
282
  }
283
283
  });
@@ -285,8 +285,8 @@ var User = class _User {
285
285
  const result = await ddbDocClient.send(command);
286
286
  return result.Items || [];
287
287
  } catch (error) {
288
- console.error("Error searching users by username and customerId:", error);
289
- throw new Error("Could not search users by username and customerId");
288
+ console.error("Error searching users by email and customerId:", error);
289
+ throw new Error("Could not search users by email and customerId");
290
290
  }
291
291
  }
292
292
  };
@@ -1294,7 +1294,8 @@ import {
1294
1294
  DeleteCommand as DeleteCommand11,
1295
1295
  GetCommand as GetCommand11,
1296
1296
  PutCommand as PutCommand11,
1297
- QueryCommand as QueryCommand11
1297
+ QueryCommand as QueryCommand11,
1298
+ ScanCommand as ScanCommand2
1298
1299
  } from "@aws-sdk/lib-dynamodb";
1299
1300
  var CustomerMinified = class _CustomerMinified {
1300
1301
  static ENV = process.env.ENV || "dev";
@@ -1323,10 +1324,9 @@ var CustomerMinified = class _CustomerMinified {
1323
1324
  * @returns A promise that resolves to an array of customer objects or an empty array if not found.
1324
1325
  */
1325
1326
  static async searchCustomersByUsername(username) {
1326
- const command = new QueryCommand11({
1327
+ const command = new ScanCommand2({
1327
1328
  TableName: _CustomerMinified.TABLE_NAME,
1328
- IndexName: "UsernameIndex",
1329
- KeyConditionExpression: "begins_with(username, :uname)",
1329
+ FilterExpression: "begins_with(username, :uname)",
1330
1330
  ExpressionAttributeValues: {
1331
1331
  ":uname": username
1332
1332
  }
@@ -1383,8 +1383,7 @@ var CustomerMinified = class _CustomerMinified {
1383
1383
  static async getCustomerMinifiedByUsername(username) {
1384
1384
  const command = new QueryCommand11({
1385
1385
  TableName: _CustomerMinified.TABLE_NAME,
1386
- IndexName: "UsernameIndex",
1387
- // Assuming you have a GSI for username
1386
+ // IndexName: "UsernameIndex", // Assuming you have a GSI for username
1388
1387
  KeyConditionExpression: "username = :username",
1389
1388
  ExpressionAttributeValues: {
1390
1389
  ":username": username
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",