@amohamud23/notihub 1.0.190 → 1.0.192

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
@@ -496,7 +496,7 @@ var Notifications_default = Notifications;
496
496
  var import_lib_dynamodb5 = require("@aws-sdk/lib-dynamodb");
497
497
  var NotiHubStats = class _NotiHubStats {
498
498
  static ENV = process.env.ENV || "dev";
499
- static TABLE_NAME = `NotiHub-NotiHubStats-v1-${_NotiHubStats.ENV}`;
499
+ static TABLE_NAME = `NotiHub-Stats-v1-${_NotiHubStats.ENV}`;
500
500
  static async createStats(stats) {
501
501
  const command = new import_lib_dynamodb5.PutCommand({
502
502
  TableName: _NotiHubStats.TABLE_NAME,
@@ -533,6 +533,44 @@ var NotiHubStats = class _NotiHubStats {
533
533
  const result = await ddbDocClient.send(command);
534
534
  return result.Attributes;
535
535
  }
536
+ /**
537
+ * Increment the count of notifications sent for a specific customer.
538
+ * @param id - The ID of the stats entry.
539
+ * @param customerId - The ID of the customer.
540
+ * @returns A promise that resolves to the updated stats object.
541
+ */
542
+ static async incrementNotificationsSent(id, customerId) {
543
+ const command = new import_lib_dynamodb5.UpdateCommand({
544
+ TableName: _NotiHubStats.TABLE_NAME,
545
+ Key: { id, customerId },
546
+ UpdateExpression: "ADD notifications :inc",
547
+ ExpressionAttributeValues: {
548
+ ":inc": 1
549
+ },
550
+ ReturnValues: "ALL_NEW"
551
+ });
552
+ const result = await ddbDocClient.send(command);
553
+ return result.Attributes;
554
+ }
555
+ /**
556
+ * Increment the count of subscriptions for a specific customer.
557
+ * @param id - The ID of the stats entry.
558
+ * @param customerId - The ID of the customer.
559
+ * @returns A promise that resolves to the updated stats object.
560
+ */
561
+ static async incrementSubscriptions(id, customerId) {
562
+ const command = new import_lib_dynamodb5.UpdateCommand({
563
+ TableName: _NotiHubStats.TABLE_NAME,
564
+ Key: { id, customerId },
565
+ UpdateExpression: "ADD subscriptions :inc",
566
+ ExpressionAttributeValues: {
567
+ ":inc": 1
568
+ },
569
+ ReturnValues: "ALL_NEW"
570
+ });
571
+ const result = await ddbDocClient.send(command);
572
+ return result.Attributes;
573
+ }
536
574
  static async getStatsInDateRange(customerId, startDate, endDate) {
537
575
  const command = new import_lib_dynamodb5.QueryCommand({
538
576
  TableName: _NotiHubStats.TABLE_NAME,
package/dist/index.d.cts CHANGED
@@ -356,6 +356,20 @@ declare class NotiHubStats {
356
356
  static createStats(stats: INotiHubStats): Promise<INotiHubStats>;
357
357
  static getStatsByCustomerId(customerId: string): Promise<INotiHubStats | null>;
358
358
  static incrementViews(id: string, customerId: string): Promise<INotiHubStats>;
359
+ /**
360
+ * Increment the count of notifications sent for a specific customer.
361
+ * @param id - The ID of the stats entry.
362
+ * @param customerId - The ID of the customer.
363
+ * @returns A promise that resolves to the updated stats object.
364
+ */
365
+ static incrementNotificationsSent(id: string, customerId: string): Promise<INotiHubStats>;
366
+ /**
367
+ * Increment the count of subscriptions for a specific customer.
368
+ * @param id - The ID of the stats entry.
369
+ * @param customerId - The ID of the customer.
370
+ * @returns A promise that resolves to the updated stats object.
371
+ */
372
+ static incrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
359
373
  static getStatsInDateRange(customerId: string, startDate: string, endDate: string): Promise<INotiHubStats[]>;
360
374
  }
361
375
 
package/dist/index.d.ts CHANGED
@@ -356,6 +356,20 @@ declare class NotiHubStats {
356
356
  static createStats(stats: INotiHubStats): Promise<INotiHubStats>;
357
357
  static getStatsByCustomerId(customerId: string): Promise<INotiHubStats | null>;
358
358
  static incrementViews(id: string, customerId: string): Promise<INotiHubStats>;
359
+ /**
360
+ * Increment the count of notifications sent for a specific customer.
361
+ * @param id - The ID of the stats entry.
362
+ * @param customerId - The ID of the customer.
363
+ * @returns A promise that resolves to the updated stats object.
364
+ */
365
+ static incrementNotificationsSent(id: string, customerId: string): Promise<INotiHubStats>;
366
+ /**
367
+ * Increment the count of subscriptions for a specific customer.
368
+ * @param id - The ID of the stats entry.
369
+ * @param customerId - The ID of the customer.
370
+ * @returns A promise that resolves to the updated stats object.
371
+ */
372
+ static incrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
359
373
  static getStatsInDateRange(customerId: string, startDate: string, endDate: string): Promise<INotiHubStats[]>;
360
374
  }
361
375
 
package/dist/index.js CHANGED
@@ -476,7 +476,7 @@ import {
476
476
  } from "@aws-sdk/lib-dynamodb";
477
477
  var NotiHubStats = class _NotiHubStats {
478
478
  static ENV = process.env.ENV || "dev";
479
- static TABLE_NAME = `NotiHub-NotiHubStats-v1-${_NotiHubStats.ENV}`;
479
+ static TABLE_NAME = `NotiHub-Stats-v1-${_NotiHubStats.ENV}`;
480
480
  static async createStats(stats) {
481
481
  const command = new PutCommand4({
482
482
  TableName: _NotiHubStats.TABLE_NAME,
@@ -513,6 +513,44 @@ var NotiHubStats = class _NotiHubStats {
513
513
  const result = await ddbDocClient.send(command);
514
514
  return result.Attributes;
515
515
  }
516
+ /**
517
+ * Increment the count of notifications sent for a specific customer.
518
+ * @param id - The ID of the stats entry.
519
+ * @param customerId - The ID of the customer.
520
+ * @returns A promise that resolves to the updated stats object.
521
+ */
522
+ static async incrementNotificationsSent(id, customerId) {
523
+ const command = new UpdateCommand4({
524
+ TableName: _NotiHubStats.TABLE_NAME,
525
+ Key: { id, customerId },
526
+ UpdateExpression: "ADD notifications :inc",
527
+ ExpressionAttributeValues: {
528
+ ":inc": 1
529
+ },
530
+ ReturnValues: "ALL_NEW"
531
+ });
532
+ const result = await ddbDocClient.send(command);
533
+ return result.Attributes;
534
+ }
535
+ /**
536
+ * Increment the count of subscriptions for a specific customer.
537
+ * @param id - The ID of the stats entry.
538
+ * @param customerId - The ID of the customer.
539
+ * @returns A promise that resolves to the updated stats object.
540
+ */
541
+ static async incrementSubscriptions(id, customerId) {
542
+ const command = new UpdateCommand4({
543
+ TableName: _NotiHubStats.TABLE_NAME,
544
+ Key: { id, customerId },
545
+ UpdateExpression: "ADD subscriptions :inc",
546
+ ExpressionAttributeValues: {
547
+ ":inc": 1
548
+ },
549
+ ReturnValues: "ALL_NEW"
550
+ });
551
+ const result = await ddbDocClient.send(command);
552
+ return result.Attributes;
553
+ }
516
554
  static async getStatsInDateRange(customerId, startDate, endDate) {
517
555
  const command = new QueryCommand4({
518
556
  TableName: _NotiHubStats.TABLE_NAME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.0.190",
3
+ "version": "1.0.192",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",