@tstdl/base 0.93.119 → 0.93.120
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.
|
@@ -2,7 +2,7 @@ import { afterResolve } from '../../../injector/index.js';
|
|
|
2
2
|
import { type NewEntity } from '../../../orm/index.js';
|
|
3
3
|
import { Transactional, type Transaction } from '../../../orm/server/index.js';
|
|
4
4
|
import type { TypedOmit } from '../../../types/types.js';
|
|
5
|
-
import { NotificationPreference, type InAppNotificationView, type
|
|
5
|
+
import { NotificationChannel, NotificationPreference, type InAppNotificationView, type NotificationDefinitionMap, type NotificationLog } from '../../models/index.js';
|
|
6
6
|
export type NewNotificationData<Definitions extends NotificationDefinitionMap = NotificationDefinitionMap> = TypedOmit<NewEntity<NotificationLog<Definitions>>, 'tenantId' | 'id' | 'userId' | 'timestamp' | 'status' | 'currentStep' | 'priority'> & Partial<Pick<NotificationLog<Definitions>, 'priority'>>;
|
|
7
7
|
export declare class NotificationService<Definitions extends NotificationDefinitionMap = NotificationDefinitionMap> extends Transactional {
|
|
8
8
|
#private;
|
|
@@ -16,7 +16,8 @@ import { injectRepository, Transactional } from '../../../orm/server/index.js';
|
|
|
16
16
|
import { TaskQueue } from '../../../task-queue/task-queue.js';
|
|
17
17
|
import { tryIgnoreLogAsync } from '../../../utils/try-ignore.js';
|
|
18
18
|
import { isDefined } from '../../../utils/type-guards.js';
|
|
19
|
-
import { InAppNotification, NotificationLogEntity, NotificationPreference, NotificationPriority, NotificationStatus, toInAppNotificationView, WebPushSubscription } from '../../models/index.js';
|
|
19
|
+
import { InAppNotification, NotificationChannel, NotificationLogEntity, NotificationPreference, NotificationPriority, NotificationStatus, toInAppNotificationView, WebPushSubscription } from '../../models/index.js';
|
|
20
|
+
import { InAppChannelProvider } from '../providers/index.js';
|
|
20
21
|
import { inAppNotification, notificationLog } from '../schemas.js';
|
|
21
22
|
import { NotificationAncillaryService } from './notification-ancillary.service.js';
|
|
22
23
|
import { NotificationDeliveryWorker } from './notification-delivery.worker.js';
|
|
@@ -28,11 +29,13 @@ let NotificationService = NotificationService_1 = class NotificationService exte
|
|
|
28
29
|
#webPushSubscriptionRepository = injectRepository(WebPushSubscription);
|
|
29
30
|
#notificationAncillaryService = inject(NotificationAncillaryService);
|
|
30
31
|
#deliveryWorker = inject(NotificationDeliveryWorker);
|
|
32
|
+
#inAppChannelProvider = inject(InAppChannelProvider);
|
|
31
33
|
#taskQueue = inject((TaskQueue), 'notification');
|
|
32
34
|
#sseService = inject(NotificationSseService);
|
|
33
35
|
#logger = inject(Logger, NotificationService_1.name);
|
|
34
36
|
#cancellationSignal = inject(CancellationSignal);
|
|
35
37
|
[afterResolve]() {
|
|
38
|
+
this.#deliveryWorker.registerProvider(NotificationChannel.InApp, this.#inAppChannelProvider);
|
|
36
39
|
this.#deliveryWorker.run(this.#cancellationSignal);
|
|
37
40
|
}
|
|
38
41
|
async send(tenantId, userId, notification, options) {
|