@amohamud23/notihub 1.0.157 → 1.0.158

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
@@ -1326,6 +1326,68 @@ var CustomerMetaData = class _CustomerMetaData {
1326
1326
  };
1327
1327
  var CustomerMetaData_default = CustomerMetaData;
1328
1328
 
1329
+ // src/DynamoModels/CustomerMinified.ts
1330
+ var import_lib_dynamodb12 = require("@aws-sdk/lib-dynamodb");
1331
+ var CustomerMinified2 = class _CustomerMinified {
1332
+ static ENV = process.env.ENV || "dev";
1333
+ static TABLE_NAME = `NotiHub-CustomersMinified-${_CustomerMinified.ENV}`;
1334
+ /**
1335
+ * Retrieves a customer by their ID.
1336
+ * @param id - The ID of the customer to retrieve.
1337
+ * @returns A promise that resolves to the customer object or null if not found.
1338
+ */
1339
+ static async getCustomerMinifiedById(id) {
1340
+ const command = new import_lib_dynamodb12.GetCommand({
1341
+ TableName: _CustomerMinified.TABLE_NAME,
1342
+ Key: { id }
1343
+ });
1344
+ try {
1345
+ const result = await ddbDocClient.send(command);
1346
+ return result.Item || null;
1347
+ } catch (error) {
1348
+ console.error("Error fetching customer:", error);
1349
+ throw new Error("Could not fetch customer");
1350
+ }
1351
+ }
1352
+ /**
1353
+ * Creates or updates a customer minified.
1354
+ * @param customer - The customer object to create or update.
1355
+ * @returns A promise that resolves to the created or updated customer object.
1356
+ */
1357
+ static async createOrUpdateCustomerMinified(customer) {
1358
+ const command = new import_lib_dynamodb12.PutCommand({
1359
+ TableName: _CustomerMinified.TABLE_NAME,
1360
+ Item: customer
1361
+ });
1362
+ try {
1363
+ await ddbDocClient.send(command);
1364
+ return customer;
1365
+ } catch (error) {
1366
+ console.error("Error creating or updating customer:", error);
1367
+ throw new Error("Could not create or update customer");
1368
+ }
1369
+ }
1370
+ /**
1371
+ * Delete customer minified by ID.
1372
+ * @param id - The ID of the customer to delete.
1373
+ * @returns A promise that resolves when the customer is deleted.
1374
+ */
1375
+ static async deleteCustomerMinifiedById(id) {
1376
+ const command = new import_lib_dynamodb12.DeleteCommand({
1377
+ TableName: _CustomerMinified.TABLE_NAME,
1378
+ Key: { id }
1379
+ });
1380
+ try {
1381
+ await ddbDocClient.send(command);
1382
+ console.log(`Customer with ID ${id} deleted successfully.`);
1383
+ } catch (error) {
1384
+ console.error(`Error deleting customer with ID ${id}:`, error);
1385
+ throw new Error("Could not delete customer");
1386
+ }
1387
+ }
1388
+ };
1389
+ var CustomerMinified_default = CustomerMinified2;
1390
+
1329
1391
  // src/DynamoModels/index.ts
1330
1392
  var TABLES = {
1331
1393
  User: User_default,
@@ -1337,7 +1399,8 @@ var TABLES = {
1337
1399
  NotiTypeStats: NotiTypeStats_default,
1338
1400
  Views: Views_default,
1339
1401
  SubscriptionType: SubscriptionType_default,
1340
- CustomerMetaData: CustomerMetaData_default
1402
+ CustomerMetaData: CustomerMetaData_default,
1403
+ CustomerMinified: CustomerMinified_default
1341
1404
  };
1342
1405
 
1343
1406
  // src/errorcodes.ts
package/dist/index.d.cts CHANGED
@@ -280,7 +280,7 @@ declare const Customer$1: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.
280
280
  __v?: number;
281
281
  }, any>;
282
282
 
283
- declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & {
283
+ declare const CustomerMinified$1: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & {
284
284
  _id: mongoose.Types.ObjectId;
285
285
  } & {
286
286
  __v?: number;
@@ -576,6 +576,29 @@ declare class CustomerMetaData {
576
576
  static createOrUpdateCustomerMetaData(customerMetaData: INotiHubCustomerMetadata): Promise<INotiHubCustomerMetadata>;
577
577
  }
578
578
 
579
+ declare class CustomerMinified {
580
+ static ENV: string;
581
+ static TABLE_NAME: string;
582
+ /**
583
+ * Retrieves a customer by their ID.
584
+ * @param id - The ID of the customer to retrieve.
585
+ * @returns A promise that resolves to the customer object or null if not found.
586
+ */
587
+ static getCustomerMinifiedById(id: string): Promise<INotiHubCustomerMinified | null>;
588
+ /**
589
+ * Creates or updates a customer minified.
590
+ * @param customer - The customer object to create or update.
591
+ * @returns A promise that resolves to the created or updated customer object.
592
+ */
593
+ static createOrUpdateCustomerMinified(customer: INotiHubCustomerMinified): Promise<INotiHubCustomerMinified>;
594
+ /**
595
+ * Delete customer minified by ID.
596
+ * @param id - The ID of the customer to delete.
597
+ * @returns A promise that resolves when the customer is deleted.
598
+ */
599
+ static deleteCustomerMinifiedById(id: string): Promise<void>;
600
+ }
601
+
579
602
  declare const TABLES: {
580
603
  User: typeof User;
581
604
  Customer: typeof Customer;
@@ -587,6 +610,7 @@ declare const TABLES: {
587
610
  Views: typeof Views;
588
611
  SubscriptionType: typeof SubscriptionType;
589
612
  CustomerMetaData: typeof CustomerMetaData;
613
+ CustomerMinified: typeof CustomerMinified;
590
614
  };
591
615
 
592
616
  declare const DocumentNotFound = "4001";
@@ -608,4 +632,4 @@ declare namespace errorcodes {
608
632
  export { errorcodes_CustomerNotFound as CustomerNotFound, errorcodes_DocumentNotFound as DocumentNotFound, errorcodes_InvalidEmail as InvalidEmail, errorcodes_InvalidName as InvalidName, errorcodes_InvalidPassword as InvalidPassword, errorcodes_InvalidPushToken as InvalidPushToken, errorcodes_UserNotFound as UserNotFound };
609
633
  }
610
634
 
611
- export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription$1 as Subscription, SubscriptionActivity, SubscriptionType$1 as SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
635
+ export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified$1 as CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription$1 as Subscription, SubscriptionActivity, SubscriptionType$1 as SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
package/dist/index.d.ts CHANGED
@@ -280,7 +280,7 @@ declare const Customer$1: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.
280
280
  __v?: number;
281
281
  }, any>;
282
282
 
283
- declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & {
283
+ declare const CustomerMinified$1: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & {
284
284
  _id: mongoose.Types.ObjectId;
285
285
  } & {
286
286
  __v?: number;
@@ -576,6 +576,29 @@ declare class CustomerMetaData {
576
576
  static createOrUpdateCustomerMetaData(customerMetaData: INotiHubCustomerMetadata): Promise<INotiHubCustomerMetadata>;
577
577
  }
578
578
 
579
+ declare class CustomerMinified {
580
+ static ENV: string;
581
+ static TABLE_NAME: string;
582
+ /**
583
+ * Retrieves a customer by their ID.
584
+ * @param id - The ID of the customer to retrieve.
585
+ * @returns A promise that resolves to the customer object or null if not found.
586
+ */
587
+ static getCustomerMinifiedById(id: string): Promise<INotiHubCustomerMinified | null>;
588
+ /**
589
+ * Creates or updates a customer minified.
590
+ * @param customer - The customer object to create or update.
591
+ * @returns A promise that resolves to the created or updated customer object.
592
+ */
593
+ static createOrUpdateCustomerMinified(customer: INotiHubCustomerMinified): Promise<INotiHubCustomerMinified>;
594
+ /**
595
+ * Delete customer minified by ID.
596
+ * @param id - The ID of the customer to delete.
597
+ * @returns A promise that resolves when the customer is deleted.
598
+ */
599
+ static deleteCustomerMinifiedById(id: string): Promise<void>;
600
+ }
601
+
579
602
  declare const TABLES: {
580
603
  User: typeof User;
581
604
  Customer: typeof Customer;
@@ -587,6 +610,7 @@ declare const TABLES: {
587
610
  Views: typeof Views;
588
611
  SubscriptionType: typeof SubscriptionType;
589
612
  CustomerMetaData: typeof CustomerMetaData;
613
+ CustomerMinified: typeof CustomerMinified;
590
614
  };
591
615
 
592
616
  declare const DocumentNotFound = "4001";
@@ -608,4 +632,4 @@ declare namespace errorcodes {
608
632
  export { errorcodes_CustomerNotFound as CustomerNotFound, errorcodes_DocumentNotFound as DocumentNotFound, errorcodes_InvalidEmail as InvalidEmail, errorcodes_InvalidName as InvalidName, errorcodes_InvalidPassword as InvalidPassword, errorcodes_InvalidPushToken as InvalidPushToken, errorcodes_UserNotFound as UserNotFound };
609
633
  }
610
634
 
611
- export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription$1 as Subscription, SubscriptionActivity, SubscriptionType$1 as SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
635
+ export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified$1 as CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription$1 as Subscription, SubscriptionActivity, SubscriptionType$1 as SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
package/dist/index.js CHANGED
@@ -1312,6 +1312,72 @@ var CustomerMetaData = class _CustomerMetaData {
1312
1312
  };
1313
1313
  var CustomerMetaData_default = CustomerMetaData;
1314
1314
 
1315
+ // src/DynamoModels/CustomerMinified.ts
1316
+ import {
1317
+ DeleteCommand as DeleteCommand11,
1318
+ GetCommand as GetCommand11,
1319
+ PutCommand as PutCommand11
1320
+ } from "@aws-sdk/lib-dynamodb";
1321
+ var CustomerMinified2 = class _CustomerMinified {
1322
+ static ENV = process.env.ENV || "dev";
1323
+ static TABLE_NAME = `NotiHub-CustomersMinified-${_CustomerMinified.ENV}`;
1324
+ /**
1325
+ * Retrieves a customer by their ID.
1326
+ * @param id - The ID of the customer to retrieve.
1327
+ * @returns A promise that resolves to the customer object or null if not found.
1328
+ */
1329
+ static async getCustomerMinifiedById(id) {
1330
+ const command = new GetCommand11({
1331
+ TableName: _CustomerMinified.TABLE_NAME,
1332
+ Key: { id }
1333
+ });
1334
+ try {
1335
+ const result = await ddbDocClient.send(command);
1336
+ return result.Item || null;
1337
+ } catch (error) {
1338
+ console.error("Error fetching customer:", error);
1339
+ throw new Error("Could not fetch customer");
1340
+ }
1341
+ }
1342
+ /**
1343
+ * Creates or updates a customer minified.
1344
+ * @param customer - The customer object to create or update.
1345
+ * @returns A promise that resolves to the created or updated customer object.
1346
+ */
1347
+ static async createOrUpdateCustomerMinified(customer) {
1348
+ const command = new PutCommand11({
1349
+ TableName: _CustomerMinified.TABLE_NAME,
1350
+ Item: customer
1351
+ });
1352
+ try {
1353
+ await ddbDocClient.send(command);
1354
+ return customer;
1355
+ } catch (error) {
1356
+ console.error("Error creating or updating customer:", error);
1357
+ throw new Error("Could not create or update customer");
1358
+ }
1359
+ }
1360
+ /**
1361
+ * Delete customer minified by ID.
1362
+ * @param id - The ID of the customer to delete.
1363
+ * @returns A promise that resolves when the customer is deleted.
1364
+ */
1365
+ static async deleteCustomerMinifiedById(id) {
1366
+ const command = new DeleteCommand11({
1367
+ TableName: _CustomerMinified.TABLE_NAME,
1368
+ Key: { id }
1369
+ });
1370
+ try {
1371
+ await ddbDocClient.send(command);
1372
+ console.log(`Customer with ID ${id} deleted successfully.`);
1373
+ } catch (error) {
1374
+ console.error(`Error deleting customer with ID ${id}:`, error);
1375
+ throw new Error("Could not delete customer");
1376
+ }
1377
+ }
1378
+ };
1379
+ var CustomerMinified_default = CustomerMinified2;
1380
+
1315
1381
  // src/DynamoModels/index.ts
1316
1382
  var TABLES = {
1317
1383
  User: User_default,
@@ -1323,7 +1389,8 @@ var TABLES = {
1323
1389
  NotiTypeStats: NotiTypeStats_default,
1324
1390
  Views: Views_default,
1325
1391
  SubscriptionType: SubscriptionType_default,
1326
- CustomerMetaData: CustomerMetaData_default
1392
+ CustomerMetaData: CustomerMetaData_default,
1393
+ CustomerMinified: CustomerMinified_default
1327
1394
  };
1328
1395
 
1329
1396
  // src/errorcodes.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.0.157",
3
+ "version": "1.0.158",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",