@amohamud23/notihub 1.1.21 → 1.1.23

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.d.ts CHANGED
@@ -1,707 +1,2 @@
1
- import { Response as Response$1 } from 'express';
2
- import mongoose from 'mongoose';
3
1
 
4
- type CreateNotiRequestBody = {
5
- customerId: string;
6
- subscriptionId: string;
7
- notiTypeId: string;
8
- userId: string;
9
- title: string;
10
- message: string;
11
- body: string;
12
- type: string;
13
- deliveryType: "IMMEDIATE" | "SCHEDULED";
14
- scheduledAt?: string;
15
- };
16
- type CreateSubscriptionRequestBody = {
17
- subscriptionId: string;
18
- type: string;
19
- };
20
- type CreateUserRequestBody = {
21
- name: string;
22
- email: string;
23
- token: string;
24
- };
25
- type ICreateCustomerRequestBody = {
26
- email: string;
27
- username: string;
28
- name: string;
29
- };
30
- type ICreateNotiRequestBody = {};
31
- type Response = {
32
- data?: any;
33
- message?: string;
34
- error?: {
35
- errorCode: string;
36
- error: string;
37
- };
38
- statusCode?: number;
39
- timestamp?: string;
40
- };
41
- type DBMetaData = {
42
- createdAt: string;
43
- updatedAt: string;
44
- id: string;
45
- };
46
- type INotiHubCustomerMinified = {
47
- id: string;
48
- name: string;
49
- username: string;
50
- customerId: string;
51
- createdAt: string;
52
- updatedAt: string;
53
- };
54
- type INotiHubCustomer = {
55
- id: string;
56
- name: string;
57
- email: string;
58
- minified: INotiHubCustomerMinified;
59
- verified: boolean;
60
- paid: boolean;
61
- phone?: string;
62
- website?: string;
63
- location?: string;
64
- metadata?: INotiHubCustomerMetadata;
65
- bio: string;
66
- confirmed: boolean;
67
- createdAt: string;
68
- updatedAt: string;
69
- };
70
- type INotiHubCustomerMetadata = {
71
- id: string;
72
- customerId: string;
73
- paymentState: "ACTIVE" | "INACTIVE";
74
- emailState: "VERIFIED" | "UNVERIFIED";
75
- isOnboarded: boolean;
76
- notiLimit: number;
77
- companyName: string;
78
- phone: string;
79
- subcriptionType: "MONTHLY" | "ANNUAL";
80
- website: string;
81
- createdAt: string;
82
- updatedAt: string;
83
- };
84
- type INotiHubNotification = {
85
- id: string;
86
- title: string;
87
- message: string;
88
- type: string;
89
- notiTypeId: string;
90
- customerId: string;
91
- notificationStatsId: string;
92
- customerMinified: INotiHubCustomerMinified;
93
- body: string;
94
- deliveryType: "IMMEDIATE" | "SCHEDULED";
95
- scheduledAt: string;
96
- createdAt: string;
97
- updatedAt: string;
98
- };
99
- type INotiHubNotificationStats = {
100
- id: string;
101
- notificationId: string;
102
- customerId: string;
103
- views: number;
104
- createdAt: string;
105
- updatedAt: string;
106
- };
107
- type INotiHubUser = {
108
- id: string;
109
- pushToken: string;
110
- name: string;
111
- email: string;
112
- dob: string;
113
- subscriptions: string[];
114
- events: number;
115
- isSignedIn: boolean;
116
- createdAt: string;
117
- updatedAt: string;
118
- };
119
- type INotiHubImage = {
120
- bucket: string;
121
- key: string;
122
- };
123
- type INotiHubStats = {
124
- id: string;
125
- customerId: string;
126
- subscriptions: number;
127
- notifications: number;
128
- views: number;
129
- createdAt: string;
130
- updatedAt: string;
131
- };
132
- type INotiHubStatsHistory = {
133
- id: string;
134
- customerId: string;
135
- type: "DAY" | "MONTH" | "YEAR";
136
- stat: INotiHubStats;
137
- createdAt: string;
138
- updatedAt: string;
139
- };
140
- type INotiType = {
141
- id: string;
142
- type: string;
143
- customerId: string;
144
- createdAt: string;
145
- updatedAt: string;
146
- };
147
- type INotiTypeStats = {
148
- id: string;
149
- notiTypeId: string;
150
- subscribed: number;
151
- views: number;
152
- createdAt: string;
153
- updatedAt: string;
154
- };
155
- type IUserSubscription = {
156
- id: string;
157
- userId: string;
158
- customerId: string;
159
- subscriptionId: string;
160
- type: "SUBSCRIBED" | "UNSUBSCRIBED";
161
- createdAt: string;
162
- updatedAt: string;
163
- };
164
- type IUserSubscribeNotifier = {
165
- id: string;
166
- userId: string;
167
- customerId: string;
168
- notiTypeId: string;
169
- subscriptionId: string;
170
- createdAt: string;
171
- updatedAt: string;
172
- };
173
- type INotiHubUserView = {
174
- id: string;
175
- userId: string;
176
- customerId: string;
177
- notificationId: string;
178
- viewId: string;
179
- createdAt: string;
180
- };
181
- type INotiHubSubscription = {
182
- id: string;
183
- subscriptionId: string;
184
- customerId: string;
185
- userId: string;
186
- type: "SUBSCRIBED" | "UNSUBSCRIBED";
187
- createdAt: string;
188
- updatedAt: string;
189
- };
190
- type INotiHubSubscriptionActivity = {
191
- id: string;
192
- customerId: string;
193
- userId: string;
194
- activity: "SUBSCRIBED" | "UNSUBSCRIBED";
195
- createdAt: string;
196
- updatedAt: string;
197
- };
198
- type INotiHubStripeSubscription = {
199
- id: string;
200
- customer: string;
201
- customerRef: INotiHubCustomer;
202
- stripe_subscription: string;
203
- };
204
- type INotiHubPaymentSession = {
205
- id: string;
206
- session: string;
207
- customerId: string;
208
- };
209
- type NotiHubTypes = {
210
- INotiHubUserView: INotiHubUserView;
211
- IUserSubscribeNotifier: IUserSubscribeNotifier;
212
- IUserSubscription: IUserSubscription;
213
- INotiHubUser: INotiHubUser;
214
- INotiTypeStats: INotiTypeStats;
215
- INotiHubImage: INotiHubImage;
216
- INotiHubSubscription: INotiHubSubscription;
217
- INotiHubNotificationStats: INotiHubNotificationStats;
218
- INotiHubNotification: INotiHubNotification;
219
- INotiHubCustomer: INotiHubCustomer;
220
- INotiHubCustomerMinified: INotiHubCustomerMinified;
221
- INotiHubStatsHistory: INotiHubStatsHistory;
222
- INotiHubCustomerMetadata: INotiHubCustomerMetadata;
223
- };
224
-
225
- type AddMonths = {
226
- date: Date;
227
- months: number;
228
- };
229
-
230
- declare function getDate(dateStr: string): string;
231
- declare function getDateFormat(dateStr: string): string;
232
- declare function addMonths({ date, months }: AddMonths): Date;
233
- /**
234
- * Handles errors by logging them and sending a standardized error response.
235
- * @param error - The error object to handle.
236
- * @param res - The Express response object to send the error response.
237
- * @param req - Optional Express request object for additional context.
238
- * @return void
239
- */
240
- declare const handleError: (error: any, res: Response$1, req?: any) => void;
241
- /**
242
- * Handles successful responses by sending a standardized success response.
243
- * @param data - The data to include in the success response.
244
- * @param res - The Express response object to send the success response.
245
- * @param statusCode - Optional HTTP status code (default is 200).
246
- * @return void
247
- */
248
- declare const handleSuccess: <T>(data: T, res: Response$1, statusCode?: number) => void;
249
-
250
- declare const formatResponse: (data: any, message?: string, error?: {
251
- errorCode: string;
252
- error: string;
253
- }, statusCode?: number) => Response;
254
-
255
- declare const client: () => Promise<mongoose.Connection>;
256
-
257
- declare class DocumentNotFoundException extends Error {
258
- constructor(msg: string);
259
- }
260
-
261
- declare class User {
262
- static ENV: string;
263
- /**
264
- * The name of the DynamoDB table for users.
265
- */
266
- static TABLE_NAME: string;
267
- /**
268
- * Retrieves a user by their ID.
269
- * @param id - The ID of the user to retrieve.
270
- * @returns A promise that resolves to the user object or null if not found.
271
- */
272
- static getUserById(id: string): Promise<INotiHubUser | null>;
273
- /**
274
- * Retrieves a user by their email.
275
- * @param email - The email of the user to retrieve.
276
- * @returns A promise that resolves to the user object or null if not found.
277
- */
278
- static getUserByEmail(email: string): Promise<INotiHubUser[] | null>;
279
- /**
280
- * Creates a new user.
281
- * @param user - The user object to create.
282
- * @returns A promise that resolves to the created user object.
283
- */
284
- static createUser(user: INotiHubUser): Promise<INotiHubUser>;
285
- /**
286
- * Updates an existing user.
287
- * @param user - The user object to update.
288
- * @returns A promise that resolves to the updated user object.
289
- */
290
- static updateUser(id: string, user: Partial<INotiHubUser>): Promise<INotiHubUser>;
291
- /**
292
- * Deletes a user by their ID.
293
- * @param id - The ID of the user to delete.
294
- * @returns A promise that resolves when the user is deleted.
295
- */
296
- static deleteUser(id: string): Promise<void>;
297
- /**
298
- * Searches for users by email and customerId
299
- * @param email - The email to search for.
300
- * @param customerId - The customer ID to filter by.
301
- * @returns A promise that resolves to an array of user objects.
302
- */
303
- static searchUsersByEmailAndCustomerId(email: string, customerId: string): Promise<INotiHubUser[]>;
304
- }
305
-
306
- declare class Customer {
307
- static ENV: string;
308
- static TABLE_NAME: string;
309
- /**
310
- * Retrieves a customer by their ID.
311
- * @param id - The ID of the customer to retrieve.
312
- * @returns A promise that resolves to the customer object or null if not found.
313
- */
314
- static getCustomerById(id: string): Promise<INotiHubCustomer | null>;
315
- /**
316
- * Retrieves a customer by their email.
317
- * @param email - The email of the customer to retrieve.
318
- * @returns A promise that resolves to the customer object or null if not found.
319
- */
320
- static getCustomerByEmail(email: string): Promise<INotiHubCustomer | null>;
321
- /**
322
- * Creates a new customer.
323
- * @param customer - The customer object to create.
324
- * @returns A promise that resolves to the created customer object.
325
- */
326
- static createCustomer(customer: INotiHubCustomer): Promise<INotiHubCustomer>;
327
- /**
328
- * Deletes a customer by their ID.
329
- * @param id - The ID of the customer to delete.
330
- * @returns A promise that resolves when the customer is deleted.
331
- */
332
- static deleteCustomer(id: string): Promise<void>;
333
- /**
334
- * Updates an existing customer.
335
- * @param id - The ID of the customer to update.
336
- * @param customer - The updated customer object.
337
- * @returns A promise that resolves to the updated customer object.
338
- */
339
- static updateCustomer(id: string, updates: Partial<INotiHubCustomer>): Promise<INotiHubCustomer>;
340
- }
341
-
342
- declare class Notifications {
343
- static ENV: string;
344
- static TABLE_NAME: string;
345
- /**
346
- * Retrieves a notification by its ID.
347
- * @param id - The ID of the notification to retrieve.
348
- * @returns A promise that resolves to the notification object or null if not found.
349
- */
350
- static getNotificationById(id: string): Promise<INotiHubNotification | null>;
351
- static getAllNotificationsByEntityId(customerId: string): Promise<INotiHubNotification[] | null>;
352
- /**
353
- * Creates a new notification.
354
- * @param notification - The notification object to create.
355
- * @returns A promise that resolves to the created notification object.
356
- */
357
- static createNotification(notification: INotiHubNotification): Promise<INotiHubNotification>;
358
- /**
359
- * Fetches and merges paginated notifications for multiple notiTypeIds, sorted by createdAt descending.
360
- * @param notiTypeIds - Array of notiTypeIds to fetch.
361
- * @param limitPerType - Max items to fetch per notiTypeId.
362
- * @param exclusiveStartKeys - Optional map of pagination keys per notiTypeId.
363
- * @returns An object with merged, sorted notifications and nextPageKeys map.
364
- */
365
- static getUnifiedFeedByNotiTypeIds(notiTypeIds: string[], limitPerType?: number, exclusiveStartKeys?: Record<string, Record<string, any>>): Promise<{
366
- notifications: INotiHubNotification[];
367
- nextPageKeys: Record<string, Record<string, any> | undefined>;
368
- }>;
369
- }
370
-
371
- declare class NotiHubStats {
372
- static ENV: string;
373
- static TABLE_NAME: string;
374
- static createStats(stats: INotiHubStats): Promise<INotiHubStats>;
375
- static getStatsByCustomerId(customerId: string): Promise<INotiHubStats | null>;
376
- static incrementViews(id: string, customerId: string): Promise<INotiHubStats>;
377
- /**
378
- * Increment the count of notifications sent for a specific customer.
379
- * @param id - The ID of the stats entry.
380
- * @param customerId - The ID of the customer.
381
- * @returns A promise that resolves to the updated stats object.
382
- */
383
- static incrementNotificationsSent(id: string, customerId: string): Promise<INotiHubStats>;
384
- /**
385
- * Increment the count of subscriptions for a specific customer.
386
- * @param id - The ID of the stats entry.
387
- * @param customerId - The ID of the customer.
388
- * @returns A promise that resolves to the updated stats object.
389
- */
390
- static incrementSubscriptions(id: string, customerId: string): Promise<INotiHubStats>;
391
- static getStatsInDateRange(customerId: string, startDate: string, endDate: string): Promise<INotiHubStats[]>;
392
- static deleteStatsById(id: string): Promise<void>;
393
- }
394
-
395
- declare class NotiType {
396
- static ENV: string;
397
- static TABLE_NAME: string;
398
- /**
399
- * Retrieves a notification type by its ID.
400
- * @param id - The ID of the notification type to retrieve.
401
- * @param customerId - The customer ID associated with the notification type.
402
- * @returns A promise that resolves to the notification type object or null if not found.
403
- */
404
- static getNotiTypeById(id: string): Promise<INotiType | null>;
405
- /**
406
- * Retrieves all notification types.
407
- * @returns A promise that resolves to an array of notification type objects.
408
- */
409
- static getAllNotiTypesByEntityId(entityId: string): Promise<INotiType[] | null>;
410
- /**
411
- * Creates a new notification type.
412
- * @param notiType - The notification type object to create.
413
- * @returns A promise that resolves to the created notification type object.
414
- */
415
- static createNotiType(notiType: INotiType): Promise<INotiType>;
416
- /**
417
- * Updates an existing notification type.
418
- * @param id - The ID of the notification type to update.
419
- * @param updates - An object containing the fields to update.
420
- * @returns A promise that resolves to the updated notification type object.
421
- */
422
- static updateNotiType(id: string, updates: Partial<INotiType>): Promise<INotiType>;
423
- /**
424
- * Deletes a notification type by its ID.
425
- * @param id - The ID of the notification type to delete.
426
- * @returns A promise that resolves when the notification type is deleted.
427
- */ static deleteNotiType(id: string): Promise<void>;
428
- /**
429
- * Delete all notification types for a given customerId
430
- * Uses Query + BatchWrite with chunking
431
- */
432
- static deleteAllNotiTypesByCustomerId(customerId: string): Promise<void>;
433
- }
434
-
435
- declare class Subscription {
436
- static ENV: string;
437
- static TABLE_NAME: string;
438
- /**
439
- * Retrieves a subscription by its ID.
440
- * @param id - The ID of the subscription to retrieve.
441
- * @returns A promise that resolves to the subscription object or null if not found.
442
- */
443
- static getSubscriptionById(id: string): Promise<INotiHubSubscription | null>;
444
- /**
445
- * Retrieves subscriptions by user ID.
446
- * @param userId - The ID of the user whose subscriptions to retrieve.
447
- * @returns A promise that resolves to an array of subscription objects or null if not found.
448
- */
449
- static getSubscriptionsByUserId(userId: string): Promise<INotiHubSubscription[] | null>;
450
- /**
451
- * Creates or updates a subscription.
452
- * @param subscription - The subscription object to create or update.
453
- * @returns A promise that resolves to the created or updated subscription object.
454
- */
455
- static createOrUpdateSubscription(subscription: INotiHubSubscription): Promise<INotiHubSubscription>;
456
- /**
457
- * Deletes a subscription by its ID.
458
- * @param id - The ID of the subscription to delete.
459
- * @returns A promise that resolves when the deletion is complete.
460
- */
461
- static deleteSubscriptionById(id: string): Promise<void>;
462
- /**
463
- * Fetch subscription by SubscriptionId.
464
- * @param subscriptionId - The ID of the subscription to retrieve.
465
- * @returns A promise that resolves to the subscription object or null if not found.
466
- */
467
- static getSubscriptionBySubscriptionId(subscriptionId: string): Promise<INotiHubSubscription | null>;
468
- /**
469
- * Delete all subscriptions by user ID.
470
- * @param userId - The ID of the user whose subscriptions to delete.
471
- * @returns A promise that resolves when all subscriptions are deleted.
472
- */
473
- static deleteAllSubscriptionsByUserId(userId: string): Promise<void>;
474
- }
475
-
476
- declare class NotiTypeStats {
477
- static ENV: string;
478
- static TABLE_NAME: string;
479
- /**
480
- * Retrieves notification type stats by their ID.
481
- * @param id - The ID of the notification type stats to retrieve.
482
- * @returns A promise that resolves to the notification type stats object or null if not found.
483
- */
484
- static getNotiTypeStatsById(id: string): Promise<INotiTypeStats | null>;
485
- /**
486
- * Retrieves all notification type stats by entity ID.
487
- * @param notiTypeId - The ID of the notification type to retrieve stats for.
488
- * @returns A promise that resolves to an array of notification type stats objects or null if not found.
489
- */
490
- static getNotiTypeStatsByNotiTypeId(notiTypeId: string): Promise<INotiTypeStats[] | null>;
491
- /**
492
- * Creates or updates notification type stats.
493
- * @param notiTypeStats - The notification type stats object to create or update.
494
- * @returns A promise that resolves to the created or updated notification type stats object.
495
- */
496
- static createOrUpdateNotiTypeStats(notiTypeStats: INotiTypeStats): Promise<INotiTypeStats>;
497
- /**
498
- * Deletes notification type stats by their ID.
499
- * @param id - The ID of the notification type stats to delete.
500
- * @returns A promise that resolves when the deletion is complete.
501
- */
502
- static deleteNotiTypeStatsById(id: string): Promise<void>;
503
- }
504
-
505
- declare class Views {
506
- static ENV: string;
507
- static TABLE_NAME: string;
508
- /**
509
- * Retrieves a view by its ID.
510
- * @param id - The ID of the view to retrieve.
511
- * @returns A promise that resolves to the view object or null if not found.
512
- */
513
- static getViewByViewId(viewId: string): Promise<INotiHubUserView | null>;
514
- /**
515
- * Creates or updates a view.
516
- * @param view - The view object to create or update.
517
- * @returns A promise that resolves to the created or updated view object.
518
- */
519
- static createView(view: INotiHubUserView): Promise<INotiHubUserView>;
520
- }
521
-
522
- declare class SubscriptionType {
523
- static ENV: string;
524
- static TABLE_NAME: string;
525
- /**
526
- * Retrieves a subscription type by its ID.
527
- * @param id - The ID of the subscription type to retrieve.
528
- * @returns A promise that resolves to the subscription type object or null if not found.
529
- */
530
- static getSubscriptionTypeById(id: string): Promise<IUserSubscribeNotifier | null>;
531
- static getSubscriptionTypesByUserId(userId: string): Promise<IUserSubscribeNotifier[] | null>;
532
- /**
533
- * Deletes a subscription type by its ID.
534
- * @param id - The ID of the subscription type to delete.
535
- * @returns A promise that resolves when the subscription type is deleted.
536
- */
537
- static deleteSubscriptionTypeById(id: string): Promise<void>;
538
- /**
539
- * Get all subscription types by notifier ID.
540
- * @param notiTypeId - The ID of the notifier to retrieve subscription types for.
541
- * @returns A promise that resolves to an array of subscription type objects or null if not found.
542
- */
543
- static getSubscriptionTypesByNotifierId(notiTypeId: string): Promise<IUserSubscribeNotifier[] | []>;
544
- /**
545
- * Creates a subscription type.
546
- * @param subscriptionType - The subscription type object to create.
547
- * @returns A promise that resolves to the created subscription type object.
548
- */
549
- static createSubscriptionType(subscriptionType: IUserSubscribeNotifier): Promise<IUserSubscribeNotifier>;
550
- }
551
-
552
- declare class CustomerMetaData {
553
- static ENV: string;
554
- static TABLE_NAME: string;
555
- /**
556
- * Retrieves customer metadata by its ID.
557
- * @param id - The ID of the customer metadata to retrieve.
558
- * @returns A promise that resolves to the customer metadata object or null if not found.
559
- */
560
- static getCustomerMetaDataById(id: string): Promise<INotiHubCustomerMetadata | null>;
561
- /**
562
- * Deletes customer metadata by its ID.
563
- * @param id - The ID of the customer metadata to delete.
564
- * @returns A promise that resolves when the customer metadata is deleted.
565
- */
566
- static deleteCustomerMetaDataById(id: string): Promise<void>;
567
- /**
568
- * Retrieve customer metadata by customerId.
569
- * @param ids - An array of customer IDs to fetch metadata for.
570
- * @returns A promise that resolves to an array of customer metadata objects or null if not found.
571
- */
572
- static getCustomerMetaDataByCustomerId(customerId: string): Promise<INotiHubCustomerMetadata | null>;
573
- /**
574
- * Creates or updates customer metadata.
575
- * @param customerMetaData - The customer metadata object to create or update.
576
- * @returns A promise that resolves to the created or updated customer metadata object.
577
- */
578
- static createOrUpdateCustomerMetaData(customerMetaData: INotiHubCustomerMetadata): Promise<INotiHubCustomerMetadata>;
579
- }
580
-
581
- declare class CustomerMinified {
582
- static ENV: string;
583
- static TABLE_NAME: string;
584
- /**
585
- * Retrieves a customer by their ID.
586
- * @param id - The ID of the customer to retrieve.
587
- * @returns A promise that resolves to the customer object or null if not found.
588
- */
589
- static getCustomerMinifiedById(id: string): Promise<INotiHubCustomerMinified | null>;
590
- /**
591
- * Searches for customers by their username.
592
- * @param username - The username of the customer to search for.
593
- * @returns A promise that resolves to an array of customer objects or an empty array if not found.
594
- */
595
- static searchCustomersByUsername(username: string): Promise<INotiHubCustomerMinified[]>;
596
- /**
597
- * Creates or updates a customer minified.
598
- * @param customer - The customer object to create or update.
599
- * @returns A promise that resolves to the created or updated customer object.
600
- */
601
- static createOrUpdateCustomerMinified(customer: INotiHubCustomerMinified): Promise<INotiHubCustomerMinified>;
602
- /**
603
- * Delete customer minified by ID.
604
- * @param id - The ID of the customer to delete.
605
- * @returns A promise that resolves when the customer is deleted.
606
- */
607
- static deleteCustomerMinifiedById(id: string): Promise<void>;
608
- /**
609
- * Get Customer Minified by username
610
- * @param username - The username of the customer to retrieve.
611
- * @returns A promise that resolves to the customer object or null if not found.
612
- */
613
- static getCustomerMinifiedByUsername(username: string): Promise<INotiHubCustomerMinified | null>;
614
- }
615
-
616
- declare class NotificationStats {
617
- static ENV: string;
618
- static TABLE_NAME: string;
619
- /**
620
- * Retrieves notification stats by their ID.
621
- * @param id - The ID of the notification stats to retrieve.
622
- * @returns A promise that resolves to the notification stats object or null if not found.
623
- */
624
- static getNotificationStatsById(id: string, customerId: string): Promise<INotiHubNotificationStats | null>;
625
- /**
626
- * Creates a new notification stats entry.
627
- * @param stats - The notification stats object to create.
628
- * @returns A promise that resolves to the created notification stats object.
629
- */
630
- static createNotificationStats(stats: INotiHubNotificationStats): Promise<INotiHubNotificationStats>;
631
- /**
632
- * Deletes a notification stats entry by its ID.
633
- * @param id - The ID of the notification stats to delete.
634
- * @returns A promise that resolves when the deletion is complete.
635
- */
636
- static deleteNotificationStatsById(id: string): Promise<void>;
637
- }
638
-
639
- declare class NotiHubStatsHistory {
640
- static ENV: string;
641
- static TABLE_NAME: string;
642
- /**
643
- * Creates a new NotiHub stats history entry.
644
- * @param statsHistory - The statistics history object to create.
645
- * @returns A promise that resolves to the created statistics history object.
646
- */
647
- static createStatsHistory(statsHistory: INotiHubStatsHistory): Promise<INotiHubStatsHistory>;
648
- /**
649
- * Gets stats history by customerId in the last year
650
- * @param customerId - The ID of the customer to retrieve stats history for.
651
- * @returns A promise that resolves to an array of statistics history objects or null if not found.
652
- */
653
- static getStatsHistoryPastYearByCustomerId(customerId: string): Promise<INotiHubStatsHistory[] | null>;
654
- /**
655
- * Gets stats history by customerId from last 6 months
656
- * @param customerId - The ID of the customer to retrieve stats history for.
657
- * @returns A promise that resolves to an array of statistics history objects or null if not found.
658
- */
659
- static getStatsHistoryPastSixMonthsByCustomerId(customerId: string): Promise<INotiHubStatsHistory[] | null>;
660
- /**
661
- * Get last stats history by customerId
662
- * @param customerId - The ID of the customer to retrieve stats history for.
663
- * @returns A promise that resolves to the last statistics history object or null if not found.
664
- */
665
- static getLastStatsHistoryByCustomerId(customerId: string): Promise<INotiHubStatsHistory | null>;
666
- }
667
-
668
- declare const TABLES: {
669
- User: typeof User;
670
- Customer: typeof Customer;
671
- Notifications: typeof Notifications;
672
- NotiHubStats: typeof NotiHubStats;
673
- NotiType: typeof NotiType;
674
- Subscription: typeof Subscription;
675
- NotiTypeStats: typeof NotiTypeStats;
676
- Views: typeof Views;
677
- SubscriptionType: typeof SubscriptionType;
678
- CustomerMetaData: typeof CustomerMetaData;
679
- CustomerMinified: typeof CustomerMinified;
680
- NotificationStats: typeof NotificationStats;
681
- NotiHubStatsHistory: typeof NotiHubStatsHistory;
682
- };
683
-
684
- declare const DocumentNotFound = "4001";
685
- declare const UserNotFound = "4002";
686
- declare const CustomerNotFound = "4003";
687
- declare const InvalidEmail = "4006";
688
- declare const InvalidPassword = "4007";
689
- declare const InvalidName = "4008";
690
- declare const InvalidPushToken = "4009";
691
- declare const InvalidPhoneNumber = "4010";
692
- declare const InvalidDate = "4011";
693
-
694
- declare const errorcodes_CustomerNotFound: typeof CustomerNotFound;
695
- declare const errorcodes_DocumentNotFound: typeof DocumentNotFound;
696
- declare const errorcodes_InvalidDate: typeof InvalidDate;
697
- declare const errorcodes_InvalidEmail: typeof InvalidEmail;
698
- declare const errorcodes_InvalidName: typeof InvalidName;
699
- declare const errorcodes_InvalidPassword: typeof InvalidPassword;
700
- declare const errorcodes_InvalidPhoneNumber: typeof InvalidPhoneNumber;
701
- declare const errorcodes_InvalidPushToken: typeof InvalidPushToken;
702
- declare const errorcodes_UserNotFound: typeof UserNotFound;
703
- declare namespace errorcodes {
704
- export { errorcodes_CustomerNotFound as CustomerNotFound, errorcodes_DocumentNotFound as DocumentNotFound, errorcodes_InvalidDate as InvalidDate, errorcodes_InvalidEmail as InvalidEmail, errorcodes_InvalidName as InvalidName, errorcodes_InvalidPassword as InvalidPassword, errorcodes_InvalidPhoneNumber as InvalidPhoneNumber, errorcodes_InvalidPushToken as InvalidPushToken, errorcodes_UserNotFound as UserNotFound };
705
- }
706
-
707
- export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, type DBMetaData, 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, type NotiHubTypes, type Response, TABLES, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
2
+ export { }