@amohamud23/notihub 1.0.156 → 1.0.157

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
@@ -1282,6 +1282,50 @@ var SubscriptionType2 = class _SubscriptionType {
1282
1282
  };
1283
1283
  var SubscriptionType_default = SubscriptionType2;
1284
1284
 
1285
+ // src/DynamoModels/CustomerMetaData.ts
1286
+ var import_lib_dynamodb11 = require("@aws-sdk/lib-dynamodb");
1287
+ var CustomerMetaData = class _CustomerMetaData {
1288
+ static ENV = process.env.ENV || "dev";
1289
+ static TABLE_NAME = `NotiHub-CustomerMetaData-${_CustomerMetaData.ENV}`;
1290
+ /**
1291
+ * Retrieves customer metadata by its ID.
1292
+ * @param id - The ID of the customer metadata to retrieve.
1293
+ * @returns A promise that resolves to the customer metadata object or null if not found.
1294
+ */
1295
+ static async getCustomerMetaDataById(id) {
1296
+ const command = new import_lib_dynamodb11.GetCommand({
1297
+ TableName: _CustomerMetaData.TABLE_NAME,
1298
+ Key: { id }
1299
+ });
1300
+ try {
1301
+ const result = await ddbDocClient.send(command);
1302
+ return result.Item || null;
1303
+ } catch (error) {
1304
+ console.error("Error fetching customer metadata:", error);
1305
+ throw new Error("Could not fetch customer metadata");
1306
+ }
1307
+ }
1308
+ /**
1309
+ * Creates or updates customer metadata.
1310
+ * @param customerMetaData - The customer metadata object to create or update.
1311
+ * @returns A promise that resolves to the created or updated customer metadata object.
1312
+ */
1313
+ static async createOrUpdateCustomerMetaData(customerMetaData) {
1314
+ const command = new import_lib_dynamodb11.PutCommand({
1315
+ TableName: _CustomerMetaData.TABLE_NAME,
1316
+ Item: customerMetaData
1317
+ });
1318
+ try {
1319
+ await ddbDocClient.send(command);
1320
+ return customerMetaData;
1321
+ } catch (error) {
1322
+ console.error("Error creating or updating customer metadata:", error);
1323
+ throw new Error("Could not create or update customer metadata");
1324
+ }
1325
+ }
1326
+ };
1327
+ var CustomerMetaData_default = CustomerMetaData;
1328
+
1285
1329
  // src/DynamoModels/index.ts
1286
1330
  var TABLES = {
1287
1331
  User: User_default,
@@ -1292,7 +1336,8 @@ var TABLES = {
1292
1336
  Subscription: Subscription_default,
1293
1337
  NotiTypeStats: NotiTypeStats_default,
1294
1338
  Views: Views_default,
1295
- SubscriptionType: SubscriptionType_default
1339
+ SubscriptionType: SubscriptionType_default,
1340
+ CustomerMetaData: CustomerMetaData_default
1296
1341
  };
1297
1342
 
1298
1343
  // src/errorcodes.ts
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Response as Response$1 } from 'express';
2
2
  import * as mongoose from 'mongoose';
3
- import mongoose__default from 'mongoose';
3
+ import mongoose__default, { Types } from 'mongoose';
4
4
 
5
5
  type CreateNotiRequestBody = {
6
6
  entityId: string;
@@ -40,7 +40,7 @@ type Response = {
40
40
  timestamp?: string;
41
41
  };
42
42
  type INotiHubCustomerMinified = {
43
- _id: string;
43
+ id: string;
44
44
  name: string;
45
45
  img: INotiHubImage;
46
46
  username: string;
@@ -48,7 +48,7 @@ type INotiHubCustomerMinified = {
48
48
  updatedAt: string;
49
49
  };
50
50
  type INotiHubCustomer = {
51
- _id: string;
51
+ id: string;
52
52
  name: string;
53
53
  email: string;
54
54
  minified: INotiHubCustomerMinified;
@@ -64,7 +64,7 @@ type INotiHubCustomer = {
64
64
  updatedAt: string;
65
65
  };
66
66
  type INotiHubCustomerMetadata = {
67
- _id?: string;
67
+ id: string;
68
68
  customerId: string;
69
69
  paymentState: "ACTIVE" | "INACTIVE";
70
70
  emailState: "VERIFIED" | "UNVERIFIED";
@@ -75,7 +75,7 @@ type INotiHubCustomerMetadata = {
75
75
  website: string;
76
76
  };
77
77
  type INotiHubNotification = {
78
- _id?: string;
78
+ id: string;
79
79
  title: string;
80
80
  message: string;
81
81
  type: string;
@@ -89,7 +89,7 @@ type INotiHubNotification = {
89
89
  updatedAt: string;
90
90
  };
91
91
  type INotiHubNotificationStats = {
92
- _id?: string;
92
+ id: string;
93
93
  notification: INotiHubNotification;
94
94
  views: number;
95
95
  };
@@ -122,7 +122,7 @@ type INotiHubStatsHistory = {
122
122
  views: number;
123
123
  };
124
124
  type INotiType = {
125
- _id?: string;
125
+ id: string;
126
126
  type: string;
127
127
  entity: string;
128
128
  entityRef: INotiHubCustomer;
@@ -130,7 +130,7 @@ type INotiType = {
130
130
  updatedAt: string;
131
131
  };
132
132
  type INotiTypeStats = {
133
- _id?: string;
133
+ id: string;
134
134
  notiType: INotiType;
135
135
  subscribed: number;
136
136
  views: number;
@@ -156,13 +156,14 @@ type IUserSubscribeNotifier = {
156
156
  updatedAt: string;
157
157
  };
158
158
  type INotiHubUserView = {
159
+ id: string;
159
160
  userId: string;
160
161
  entityId: string;
161
162
  notificationId: string;
162
163
  createdAt: string;
163
164
  };
164
165
  type INotiHubSubscription = {
165
- _id?: string;
166
+ id: string;
166
167
  subscriptionId: string;
167
168
  entity: INotiHubCustomer;
168
169
  entityRef: INotiHubCustomer;
@@ -173,7 +174,7 @@ type INotiHubSubscription = {
173
174
  updatedAt: string;
174
175
  };
175
176
  type INotiHubSubscriptionActivity = {
176
- _id?: string;
177
+ id: string;
177
178
  entityId: string;
178
179
  userId: string;
179
180
  activity: "SUBSCRIBED" | "UNSUBSCRIBED";
@@ -243,15 +244,15 @@ declare const UserModel: mongoose.Model<INotiHubUser, {}, {}, {}, mongoose.Docum
243
244
  __v?: number;
244
245
  }, any>;
245
246
 
246
- declare const Subscription$1: mongoose__default.Model<INotiHubSubscription, {}, {}, {}, mongoose__default.Document<unknown, {}, INotiHubSubscription> & INotiHubSubscription & Required<{
247
- _id: string;
248
- }> & {
247
+ declare const Subscription$1: mongoose__default.Model<INotiHubSubscription, {}, {}, {}, mongoose__default.Document<unknown, {}, INotiHubSubscription> & INotiHubSubscription & {
248
+ _id: Types.ObjectId;
249
+ } & {
249
250
  __v?: number;
250
251
  }, any>;
251
252
 
252
- declare const NotiTypeModel: mongoose.Model<INotiType, {}, {}, {}, mongoose.Document<unknown, {}, INotiType> & INotiType & Required<{
253
- _id: string;
254
- }> & {
253
+ declare const NotiTypeModel: mongoose.Model<INotiType, {}, {}, {}, mongoose.Document<unknown, {}, INotiType> & INotiType & {
254
+ _id: mongoose.Types.ObjectId;
255
+ } & {
255
256
  __v?: number;
256
257
  }, any>;
257
258
 
@@ -261,27 +262,27 @@ declare const NotiHubStatsHistory: mongoose.Model<INotiHubStatsHistory, {}, {},
261
262
  __v?: number;
262
263
  }, any>;
263
264
 
264
- declare const NotificationStatsModel: mongoose.Model<INotiHubNotificationStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotificationStats> & INotiHubNotificationStats & Required<{
265
- _id: string;
266
- }> & {
265
+ declare const NotificationStatsModel: mongoose.Model<INotiHubNotificationStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotificationStats> & INotiHubNotificationStats & {
266
+ _id: mongoose.Types.ObjectId;
267
+ } & {
267
268
  __v?: number;
268
269
  }, any>;
269
270
 
270
- declare const NotificationModel: mongoose.Model<INotiHubNotification, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotification> & INotiHubNotification & Required<{
271
- _id: string;
272
- }> & {
271
+ declare const NotificationModel: mongoose.Model<INotiHubNotification, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotification> & INotiHubNotification & {
272
+ _id: mongoose.Types.ObjectId;
273
+ } & {
273
274
  __v?: number;
274
275
  }, any>;
275
276
 
276
- declare const Customer$1: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomer> & INotiHubCustomer & Required<{
277
- _id: string;
278
- }> & {
277
+ declare const Customer$1: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomer> & INotiHubCustomer & {
278
+ _id: mongoose.Types.ObjectId;
279
+ } & {
279
280
  __v?: number;
280
281
  }, any>;
281
282
 
282
- declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & Required<{
283
- _id: string;
284
- }> & {
283
+ declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & {
284
+ _id: mongoose.Types.ObjectId;
285
+ } & {
285
286
  __v?: number;
286
287
  }, any>;
287
288
 
@@ -303,9 +304,9 @@ declare const ViewsModel: mongoose.Model<INotiHubUserView, {}, {}, {}, mongoose.
303
304
  __v?: number;
304
305
  }, any>;
305
306
 
306
- declare const NotiTypeStatsModel: mongoose.Model<INotiTypeStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiTypeStats> & INotiTypeStats & Required<{
307
- _id: string;
308
- }> & {
307
+ declare const NotiTypeStatsModel: mongoose.Model<INotiTypeStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiTypeStats> & INotiTypeStats & {
308
+ _id: mongoose.Types.ObjectId;
309
+ } & {
309
310
  __v?: number;
310
311
  }, any>;
311
312
 
@@ -321,15 +322,15 @@ declare const PaymentSessionModel: mongoose.Model<INotiHubPaymentSession, {}, {}
321
322
  __v?: number;
322
323
  }, any>;
323
324
 
324
- declare const SubscriptionActivity: mongoose.Model<INotiHubSubscriptionActivity, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubSubscriptionActivity> & INotiHubSubscriptionActivity & Required<{
325
- _id: string;
326
- }> & {
325
+ declare const SubscriptionActivity: mongoose.Model<INotiHubSubscriptionActivity, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubSubscriptionActivity> & INotiHubSubscriptionActivity & {
326
+ _id: mongoose.Types.ObjectId;
327
+ } & {
327
328
  __v?: number;
328
329
  }, any>;
329
330
 
330
- declare const CustomerMetadata: mongoose.Model<INotiHubCustomerMetadata, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMetadata> & INotiHubCustomerMetadata & Required<{
331
- _id: string;
332
- }> & {
331
+ declare const CustomerMetadata: mongoose.Model<INotiHubCustomerMetadata, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMetadata> & INotiHubCustomerMetadata & {
332
+ _id: mongoose.Types.ObjectId;
333
+ } & {
333
334
  __v?: number;
334
335
  }, any>;
335
336
 
@@ -558,6 +559,23 @@ declare class SubscriptionType {
558
559
  static getSubscriptionTypesByUserId(userId: string): Promise<IUserSubscribeNotifier[] | null>;
559
560
  }
560
561
 
562
+ declare class CustomerMetaData {
563
+ static ENV: string;
564
+ static TABLE_NAME: string;
565
+ /**
566
+ * Retrieves customer metadata by its ID.
567
+ * @param id - The ID of the customer metadata to retrieve.
568
+ * @returns A promise that resolves to the customer metadata object or null if not found.
569
+ */
570
+ static getCustomerMetaDataById(id: string): Promise<INotiHubCustomerMetadata | null>;
571
+ /**
572
+ * Creates or updates customer metadata.
573
+ * @param customerMetaData - The customer metadata object to create or update.
574
+ * @returns A promise that resolves to the created or updated customer metadata object.
575
+ */
576
+ static createOrUpdateCustomerMetaData(customerMetaData: INotiHubCustomerMetadata): Promise<INotiHubCustomerMetadata>;
577
+ }
578
+
561
579
  declare const TABLES: {
562
580
  User: typeof User;
563
581
  Customer: typeof Customer;
@@ -568,6 +586,7 @@ declare const TABLES: {
568
586
  NotiTypeStats: typeof NotiTypeStats;
569
587
  Views: typeof Views;
570
588
  SubscriptionType: typeof SubscriptionType;
589
+ CustomerMetaData: typeof CustomerMetaData;
571
590
  };
572
591
 
573
592
  declare const DocumentNotFound = "4001";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Response as Response$1 } from 'express';
2
2
  import * as mongoose from 'mongoose';
3
- import mongoose__default from 'mongoose';
3
+ import mongoose__default, { Types } from 'mongoose';
4
4
 
5
5
  type CreateNotiRequestBody = {
6
6
  entityId: string;
@@ -40,7 +40,7 @@ type Response = {
40
40
  timestamp?: string;
41
41
  };
42
42
  type INotiHubCustomerMinified = {
43
- _id: string;
43
+ id: string;
44
44
  name: string;
45
45
  img: INotiHubImage;
46
46
  username: string;
@@ -48,7 +48,7 @@ type INotiHubCustomerMinified = {
48
48
  updatedAt: string;
49
49
  };
50
50
  type INotiHubCustomer = {
51
- _id: string;
51
+ id: string;
52
52
  name: string;
53
53
  email: string;
54
54
  minified: INotiHubCustomerMinified;
@@ -64,7 +64,7 @@ type INotiHubCustomer = {
64
64
  updatedAt: string;
65
65
  };
66
66
  type INotiHubCustomerMetadata = {
67
- _id?: string;
67
+ id: string;
68
68
  customerId: string;
69
69
  paymentState: "ACTIVE" | "INACTIVE";
70
70
  emailState: "VERIFIED" | "UNVERIFIED";
@@ -75,7 +75,7 @@ type INotiHubCustomerMetadata = {
75
75
  website: string;
76
76
  };
77
77
  type INotiHubNotification = {
78
- _id?: string;
78
+ id: string;
79
79
  title: string;
80
80
  message: string;
81
81
  type: string;
@@ -89,7 +89,7 @@ type INotiHubNotification = {
89
89
  updatedAt: string;
90
90
  };
91
91
  type INotiHubNotificationStats = {
92
- _id?: string;
92
+ id: string;
93
93
  notification: INotiHubNotification;
94
94
  views: number;
95
95
  };
@@ -122,7 +122,7 @@ type INotiHubStatsHistory = {
122
122
  views: number;
123
123
  };
124
124
  type INotiType = {
125
- _id?: string;
125
+ id: string;
126
126
  type: string;
127
127
  entity: string;
128
128
  entityRef: INotiHubCustomer;
@@ -130,7 +130,7 @@ type INotiType = {
130
130
  updatedAt: string;
131
131
  };
132
132
  type INotiTypeStats = {
133
- _id?: string;
133
+ id: string;
134
134
  notiType: INotiType;
135
135
  subscribed: number;
136
136
  views: number;
@@ -156,13 +156,14 @@ type IUserSubscribeNotifier = {
156
156
  updatedAt: string;
157
157
  };
158
158
  type INotiHubUserView = {
159
+ id: string;
159
160
  userId: string;
160
161
  entityId: string;
161
162
  notificationId: string;
162
163
  createdAt: string;
163
164
  };
164
165
  type INotiHubSubscription = {
165
- _id?: string;
166
+ id: string;
166
167
  subscriptionId: string;
167
168
  entity: INotiHubCustomer;
168
169
  entityRef: INotiHubCustomer;
@@ -173,7 +174,7 @@ type INotiHubSubscription = {
173
174
  updatedAt: string;
174
175
  };
175
176
  type INotiHubSubscriptionActivity = {
176
- _id?: string;
177
+ id: string;
177
178
  entityId: string;
178
179
  userId: string;
179
180
  activity: "SUBSCRIBED" | "UNSUBSCRIBED";
@@ -243,15 +244,15 @@ declare const UserModel: mongoose.Model<INotiHubUser, {}, {}, {}, mongoose.Docum
243
244
  __v?: number;
244
245
  }, any>;
245
246
 
246
- declare const Subscription$1: mongoose__default.Model<INotiHubSubscription, {}, {}, {}, mongoose__default.Document<unknown, {}, INotiHubSubscription> & INotiHubSubscription & Required<{
247
- _id: string;
248
- }> & {
247
+ declare const Subscription$1: mongoose__default.Model<INotiHubSubscription, {}, {}, {}, mongoose__default.Document<unknown, {}, INotiHubSubscription> & INotiHubSubscription & {
248
+ _id: Types.ObjectId;
249
+ } & {
249
250
  __v?: number;
250
251
  }, any>;
251
252
 
252
- declare const NotiTypeModel: mongoose.Model<INotiType, {}, {}, {}, mongoose.Document<unknown, {}, INotiType> & INotiType & Required<{
253
- _id: string;
254
- }> & {
253
+ declare const NotiTypeModel: mongoose.Model<INotiType, {}, {}, {}, mongoose.Document<unknown, {}, INotiType> & INotiType & {
254
+ _id: mongoose.Types.ObjectId;
255
+ } & {
255
256
  __v?: number;
256
257
  }, any>;
257
258
 
@@ -261,27 +262,27 @@ declare const NotiHubStatsHistory: mongoose.Model<INotiHubStatsHistory, {}, {},
261
262
  __v?: number;
262
263
  }, any>;
263
264
 
264
- declare const NotificationStatsModel: mongoose.Model<INotiHubNotificationStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotificationStats> & INotiHubNotificationStats & Required<{
265
- _id: string;
266
- }> & {
265
+ declare const NotificationStatsModel: mongoose.Model<INotiHubNotificationStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotificationStats> & INotiHubNotificationStats & {
266
+ _id: mongoose.Types.ObjectId;
267
+ } & {
267
268
  __v?: number;
268
269
  }, any>;
269
270
 
270
- declare const NotificationModel: mongoose.Model<INotiHubNotification, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotification> & INotiHubNotification & Required<{
271
- _id: string;
272
- }> & {
271
+ declare const NotificationModel: mongoose.Model<INotiHubNotification, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotification> & INotiHubNotification & {
272
+ _id: mongoose.Types.ObjectId;
273
+ } & {
273
274
  __v?: number;
274
275
  }, any>;
275
276
 
276
- declare const Customer$1: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomer> & INotiHubCustomer & Required<{
277
- _id: string;
278
- }> & {
277
+ declare const Customer$1: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomer> & INotiHubCustomer & {
278
+ _id: mongoose.Types.ObjectId;
279
+ } & {
279
280
  __v?: number;
280
281
  }, any>;
281
282
 
282
- declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & Required<{
283
- _id: string;
284
- }> & {
283
+ declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & {
284
+ _id: mongoose.Types.ObjectId;
285
+ } & {
285
286
  __v?: number;
286
287
  }, any>;
287
288
 
@@ -303,9 +304,9 @@ declare const ViewsModel: mongoose.Model<INotiHubUserView, {}, {}, {}, mongoose.
303
304
  __v?: number;
304
305
  }, any>;
305
306
 
306
- declare const NotiTypeStatsModel: mongoose.Model<INotiTypeStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiTypeStats> & INotiTypeStats & Required<{
307
- _id: string;
308
- }> & {
307
+ declare const NotiTypeStatsModel: mongoose.Model<INotiTypeStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiTypeStats> & INotiTypeStats & {
308
+ _id: mongoose.Types.ObjectId;
309
+ } & {
309
310
  __v?: number;
310
311
  }, any>;
311
312
 
@@ -321,15 +322,15 @@ declare const PaymentSessionModel: mongoose.Model<INotiHubPaymentSession, {}, {}
321
322
  __v?: number;
322
323
  }, any>;
323
324
 
324
- declare const SubscriptionActivity: mongoose.Model<INotiHubSubscriptionActivity, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubSubscriptionActivity> & INotiHubSubscriptionActivity & Required<{
325
- _id: string;
326
- }> & {
325
+ declare const SubscriptionActivity: mongoose.Model<INotiHubSubscriptionActivity, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubSubscriptionActivity> & INotiHubSubscriptionActivity & {
326
+ _id: mongoose.Types.ObjectId;
327
+ } & {
327
328
  __v?: number;
328
329
  }, any>;
329
330
 
330
- declare const CustomerMetadata: mongoose.Model<INotiHubCustomerMetadata, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMetadata> & INotiHubCustomerMetadata & Required<{
331
- _id: string;
332
- }> & {
331
+ declare const CustomerMetadata: mongoose.Model<INotiHubCustomerMetadata, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMetadata> & INotiHubCustomerMetadata & {
332
+ _id: mongoose.Types.ObjectId;
333
+ } & {
333
334
  __v?: number;
334
335
  }, any>;
335
336
 
@@ -558,6 +559,23 @@ declare class SubscriptionType {
558
559
  static getSubscriptionTypesByUserId(userId: string): Promise<IUserSubscribeNotifier[] | null>;
559
560
  }
560
561
 
562
+ declare class CustomerMetaData {
563
+ static ENV: string;
564
+ static TABLE_NAME: string;
565
+ /**
566
+ * Retrieves customer metadata by its ID.
567
+ * @param id - The ID of the customer metadata to retrieve.
568
+ * @returns A promise that resolves to the customer metadata object or null if not found.
569
+ */
570
+ static getCustomerMetaDataById(id: string): Promise<INotiHubCustomerMetadata | null>;
571
+ /**
572
+ * Creates or updates customer metadata.
573
+ * @param customerMetaData - The customer metadata object to create or update.
574
+ * @returns A promise that resolves to the created or updated customer metadata object.
575
+ */
576
+ static createOrUpdateCustomerMetaData(customerMetaData: INotiHubCustomerMetadata): Promise<INotiHubCustomerMetadata>;
577
+ }
578
+
561
579
  declare const TABLES: {
562
580
  User: typeof User;
563
581
  Customer: typeof Customer;
@@ -568,6 +586,7 @@ declare const TABLES: {
568
586
  NotiTypeStats: typeof NotiTypeStats;
569
587
  Views: typeof Views;
570
588
  SubscriptionType: typeof SubscriptionType;
589
+ CustomerMetaData: typeof CustomerMetaData;
571
590
  };
572
591
 
573
592
  declare const DocumentNotFound = "4001";
package/dist/index.js CHANGED
@@ -1265,6 +1265,53 @@ var SubscriptionType2 = class _SubscriptionType {
1265
1265
  };
1266
1266
  var SubscriptionType_default = SubscriptionType2;
1267
1267
 
1268
+ // src/DynamoModels/CustomerMetaData.ts
1269
+ import {
1270
+ GetCommand as GetCommand10,
1271
+ PutCommand as PutCommand10
1272
+ } from "@aws-sdk/lib-dynamodb";
1273
+ var CustomerMetaData = class _CustomerMetaData {
1274
+ static ENV = process.env.ENV || "dev";
1275
+ static TABLE_NAME = `NotiHub-CustomerMetaData-${_CustomerMetaData.ENV}`;
1276
+ /**
1277
+ * Retrieves customer metadata by its ID.
1278
+ * @param id - The ID of the customer metadata to retrieve.
1279
+ * @returns A promise that resolves to the customer metadata object or null if not found.
1280
+ */
1281
+ static async getCustomerMetaDataById(id) {
1282
+ const command = new GetCommand10({
1283
+ TableName: _CustomerMetaData.TABLE_NAME,
1284
+ Key: { id }
1285
+ });
1286
+ try {
1287
+ const result = await ddbDocClient.send(command);
1288
+ return result.Item || null;
1289
+ } catch (error) {
1290
+ console.error("Error fetching customer metadata:", error);
1291
+ throw new Error("Could not fetch customer metadata");
1292
+ }
1293
+ }
1294
+ /**
1295
+ * Creates or updates customer metadata.
1296
+ * @param customerMetaData - The customer metadata object to create or update.
1297
+ * @returns A promise that resolves to the created or updated customer metadata object.
1298
+ */
1299
+ static async createOrUpdateCustomerMetaData(customerMetaData) {
1300
+ const command = new PutCommand10({
1301
+ TableName: _CustomerMetaData.TABLE_NAME,
1302
+ Item: customerMetaData
1303
+ });
1304
+ try {
1305
+ await ddbDocClient.send(command);
1306
+ return customerMetaData;
1307
+ } catch (error) {
1308
+ console.error("Error creating or updating customer metadata:", error);
1309
+ throw new Error("Could not create or update customer metadata");
1310
+ }
1311
+ }
1312
+ };
1313
+ var CustomerMetaData_default = CustomerMetaData;
1314
+
1268
1315
  // src/DynamoModels/index.ts
1269
1316
  var TABLES = {
1270
1317
  User: User_default,
@@ -1275,7 +1322,8 @@ var TABLES = {
1275
1322
  Subscription: Subscription_default,
1276
1323
  NotiTypeStats: NotiTypeStats_default,
1277
1324
  Views: Views_default,
1278
- SubscriptionType: SubscriptionType_default
1325
+ SubscriptionType: SubscriptionType_default,
1326
+ CustomerMetaData: CustomerMetaData_default
1279
1327
  };
1280
1328
 
1281
1329
  // src/errorcodes.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.0.156",
3
+ "version": "1.0.157",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",