@strav/signal 0.1.0
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/package.json +48 -0
- package/src/broadcast/broadcast_manager.ts +424 -0
- package/src/broadcast/client.ts +308 -0
- package/src/broadcast/index.ts +58 -0
- package/src/index.ts +4 -0
- package/src/mail/css_inliner.ts +79 -0
- package/src/mail/helpers.ts +212 -0
- package/src/mail/index.ts +23 -0
- package/src/mail/mail_manager.ts +111 -0
- package/src/mail/transports/alibaba_transport.ts +88 -0
- package/src/mail/transports/log_transport.ts +69 -0
- package/src/mail/transports/mailgun_transport.ts +74 -0
- package/src/mail/transports/resend_transport.ts +58 -0
- package/src/mail/transports/sendgrid_transport.ts +80 -0
- package/src/mail/transports/smtp_transport.ts +48 -0
- package/src/mail/types.ts +98 -0
- package/src/notification/base_notification.ts +67 -0
- package/src/notification/channels/database_channel.ts +30 -0
- package/src/notification/channels/discord_channel.ts +48 -0
- package/src/notification/channels/email_channel.ts +37 -0
- package/src/notification/channels/webhook_channel.ts +50 -0
- package/src/notification/helpers.ts +214 -0
- package/src/notification/index.ts +20 -0
- package/src/notification/notification_manager.ts +127 -0
- package/src/notification/types.ts +122 -0
- package/src/providers/broadcast_provider.ts +22 -0
- package/src/providers/index.ts +5 -0
- package/src/providers/mail_provider.ts +16 -0
- package/src/providers/notification_provider.ts +29 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ServiceProvider from '@stravigor/kernel/core/service_provider'
|
|
2
|
+
import type Application from '@stravigor/kernel/core/application'
|
|
3
|
+
import MailManager from '../mail/mail_manager.ts'
|
|
4
|
+
|
|
5
|
+
export default class MailProvider extends ServiceProvider {
|
|
6
|
+
readonly name = 'mail'
|
|
7
|
+
override readonly dependencies = ['config']
|
|
8
|
+
|
|
9
|
+
override register(app: Application): void {
|
|
10
|
+
app.singleton(MailManager)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override boot(app: Application): void {
|
|
14
|
+
app.resolve(MailManager)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import ServiceProvider from '@stravigor/kernel/core/service_provider'
|
|
2
|
+
import type Application from '@stravigor/kernel/core/application'
|
|
3
|
+
import NotificationManager from '../notification/notification_manager.ts'
|
|
4
|
+
|
|
5
|
+
export interface NotificationProviderOptions {
|
|
6
|
+
/** Whether to auto-create the notifications table. Default: `true` */
|
|
7
|
+
ensureTable?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default class NotificationProvider extends ServiceProvider {
|
|
11
|
+
readonly name = 'notification'
|
|
12
|
+
override readonly dependencies = ['database']
|
|
13
|
+
|
|
14
|
+
constructor(private options?: NotificationProviderOptions) {
|
|
15
|
+
super()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override register(app: Application): void {
|
|
19
|
+
app.singleton(NotificationManager)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override async boot(app: Application): Promise<void> {
|
|
23
|
+
app.resolve(NotificationManager)
|
|
24
|
+
|
|
25
|
+
if (this.options?.ensureTable !== false) {
|
|
26
|
+
await NotificationManager.ensureTable()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|