NotificationService
constructor
Parameters
containerInjectedDependenciesRequiredProperties
__configModule__Record<string, unknown>__container__anyRequired__moduleDeclaration__Record<string, unknown>attachmentGenerator_unknownRequiredDefault: null
container_InjectedDependencies & objectRequiredmanager_EntityManagerRequiredsubscribers_objectRequiredDefault: {}
transactionManager_undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManagerEntityManagerRequiredMethods
atomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Returns
PromisePromise<TResult>RequiredhandleEvent
Handles an event by relaying the event data to the subscribing providers. The result of the notification send will be persisted in the database in order to allow for resends. Will log any errors that are encountered.
Parameters
eventNamestringRequireddataRecord<string, unknown>RequiredReturns
list
Retrieves a list of notifications.
Parameters
Returns
listAndCount
Retrieves a list of notifications and total count.
Parameters
Returns
registerAttachmentGenerator
Registers an attachment generator to the service. The generator can be used to generate on demand invoices or other documents.
Parameters
serviceunknownRequiredReturns
voidvoidregisterInstalledProviders
Takes a list of notification provider ids and persists them in the database.
Parameters
providerIdsstring[]RequiredReturns
PromisePromise<void>Requiredresend
Resends a notification by retrieving a prior notification and calling the underlying provider's resendNotification method.
Parameters
idstringRequiredDefault: {}
Returns
retrieve
Retrieves a notification with a given id
Parameters
idstringRequiredDefault: {}
Returns
retrieveProvider_
Finds a provider with a given id. Will throw a NOT_FOUND error if the resolution fails.
Parameters
idstringRequiredReturns
AbstractNotificationServiceobjectRequiredsend
Sends a notification, by calling the given provider's sendNotification method. Persists the Notification in the database.
Parameters
eventstringRequiredeventDataRecord<string, unknown>RequiredproviderIdstringRequiredReturns
shouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleansubscribe
Subscribes a given provider to an event.
Parameters
eventNamestringRequiredproviderIdstringRequiredReturns
voidvoidwithTransaction
Parameters
transactionManagerEntityManagerReturns
NotificationServiceobjectRequired