@boostkit/notification 0.0.1
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/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 BoostKit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @boostkit/notification
|
|
2
|
+
|
|
3
|
+
Multi-channel notification system — send notifications via mail, database, or custom channels using the Notifiable pattern.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @boostkit/notification
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// bootstrap/providers.ts
|
|
15
|
+
import { notifications } from '@boostkit/notification'
|
|
16
|
+
|
|
17
|
+
export default [
|
|
18
|
+
mail(configs.mail), // required if using the mail channel
|
|
19
|
+
notifications(), // registers built-in mail + database channels
|
|
20
|
+
]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// app/Notifications/WelcomeNotification.ts
|
|
25
|
+
import { Notification, type Notifiable } from '@boostkit/notification'
|
|
26
|
+
import { Mailable } from '@boostkit/mail'
|
|
27
|
+
|
|
28
|
+
class WelcomeMail extends Mailable {
|
|
29
|
+
build() { return this.subject('Welcome!').text('Thanks for signing up.') }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class WelcomeNotification extends Notification {
|
|
33
|
+
via(_notifiable: Notifiable): string[] {
|
|
34
|
+
return ['mail', 'database']
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
toMail(_notifiable: Notifiable): Mailable {
|
|
38
|
+
return new WelcomeMail()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
toDatabase(_notifiable: Notifiable): Record<string, unknown> {
|
|
42
|
+
return { message: 'Welcome to the app!' }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// routes/api.ts
|
|
49
|
+
import { notify } from '@boostkit/notification'
|
|
50
|
+
import { WelcomeNotification } from '../app/Notifications/WelcomeNotification.js'
|
|
51
|
+
|
|
52
|
+
const user = { id: '1', email: 'alice@example.com', name: 'Alice' }
|
|
53
|
+
|
|
54
|
+
// Single notifiable
|
|
55
|
+
await notify(user, new WelcomeNotification())
|
|
56
|
+
|
|
57
|
+
// Multiple notifiables — all channels fire concurrently
|
|
58
|
+
await notify([user1, user2], new WelcomeNotification())
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Custom Channels
|
|
62
|
+
|
|
63
|
+
Register any channel with `ChannelRegistry` — typically in a service provider:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import {
|
|
67
|
+
ChannelRegistry,
|
|
68
|
+
type NotificationChannel,
|
|
69
|
+
type Notifiable,
|
|
70
|
+
type Notification,
|
|
71
|
+
} from '@boostkit/notification'
|
|
72
|
+
|
|
73
|
+
class SmsChannel implements NotificationChannel {
|
|
74
|
+
async send(notifiable: Notifiable, notification: Notification): Promise<void> {
|
|
75
|
+
const payload = (notification as { toSms?(n: Notifiable): string }).toSms?.(notifiable)
|
|
76
|
+
if (payload) await smsClient.send({ to: (notifiable as { phone: string }).phone, body: payload })
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ChannelRegistry.register('sms', new SmsChannel())
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Then add `'sms'` to the `via()` return value and implement `toSms()` on your notification class.
|
|
84
|
+
|
|
85
|
+
## Prisma Schema
|
|
86
|
+
|
|
87
|
+
Add this model to support the built-in `database` channel:
|
|
88
|
+
|
|
89
|
+
```prisma
|
|
90
|
+
model Notification {
|
|
91
|
+
id String @id @default(cuid())
|
|
92
|
+
notifiable_id String
|
|
93
|
+
notifiable_type String
|
|
94
|
+
type String
|
|
95
|
+
data String
|
|
96
|
+
read_at String?
|
|
97
|
+
created_at String
|
|
98
|
+
updated_at String
|
|
99
|
+
|
|
100
|
+
@@index([notifiable_type, notifiable_id])
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## API Reference
|
|
105
|
+
|
|
106
|
+
- `Notifiable` — interface for entities that receive notifications (`id`, `email?`, `name?`)
|
|
107
|
+
- `Notification` — abstract base class; implement `via()`, optionally `toMail()`, `toDatabase()`
|
|
108
|
+
- `NotificationChannel` — interface for custom channels (`send(notifiable, notification)`)
|
|
109
|
+
- `ChannelRegistry` — static registry; `register(name, channel)`, `get(name)`, `has(name)`
|
|
110
|
+
- `MailChannel` — built-in; delegates to `@boostkit/mail` adapter
|
|
111
|
+
- `DatabaseChannel` — built-in; writes rows via `@boostkit/orm` adapter to the `notification` table
|
|
112
|
+
- `Notifier` — static facade; `Notifier.send(notifiables, notification)`
|
|
113
|
+
- `notify(notifiables, notification)` — shorthand helper wrapping `Notifier.send()`
|
|
114
|
+
- `notifications()` — service provider factory; registers `mail` and `database` channels
|
|
115
|
+
|
|
116
|
+
## Configuration
|
|
117
|
+
|
|
118
|
+
This package has no runtime config object.
|
|
119
|
+
|
|
120
|
+
## Notes
|
|
121
|
+
|
|
122
|
+
- `notifications()` must be listed after `mail()` in providers when using the mail channel.
|
|
123
|
+
- All channels for each notifiable are dispatched concurrently via `Promise.all`.
|
|
124
|
+
- `DatabaseChannel` writes to the `notification` Prisma accessor — map this to your table with `@@map` if needed.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ServiceProvider, type Application } from '@boostkit/core';
|
|
2
|
+
import { type Mailable } from '@boostkit/mail';
|
|
3
|
+
/**
|
|
4
|
+
* Implement this interface on any entity that can receive notifications
|
|
5
|
+
* (users, teams, subscribers, etc.)
|
|
6
|
+
*/
|
|
7
|
+
export interface Notifiable {
|
|
8
|
+
readonly id: string | number;
|
|
9
|
+
readonly email?: string;
|
|
10
|
+
readonly name?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Base class for all notifications. Extend this and implement:
|
|
14
|
+
* - `via(notifiable)` — return channel names: 'mail', 'database', etc.
|
|
15
|
+
* - `toMail(notifiable)` — required when 'mail' is in via()
|
|
16
|
+
* - `toDatabase(notifiable)` — required when 'database' is in via()
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class Notification {
|
|
19
|
+
/** Return the channel names this notification uses for the given notifiable */
|
|
20
|
+
abstract via(notifiable: Notifiable): string[];
|
|
21
|
+
/** Build the mail representation (required when 'mail' channel is used) */
|
|
22
|
+
toMail?(notifiable: Notifiable): Mailable | Promise<Mailable>;
|
|
23
|
+
/** Build the database representation (required when 'database' channel is used) */
|
|
24
|
+
toDatabase?(notifiable: Notifiable): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
25
|
+
}
|
|
26
|
+
export interface NotificationChannel {
|
|
27
|
+
send(notifiable: Notifiable, notification: Notification): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare class ChannelRegistry {
|
|
30
|
+
private static channels;
|
|
31
|
+
static register(name: string, channel: NotificationChannel): void;
|
|
32
|
+
static get(name: string): NotificationChannel | undefined;
|
|
33
|
+
static has(name: string): boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare class MailChannel implements NotificationChannel {
|
|
36
|
+
send(notifiable: Notifiable, notification: Notification): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export declare class DatabaseChannel implements NotificationChannel {
|
|
39
|
+
/** Override to use a different table name */
|
|
40
|
+
protected table: string;
|
|
41
|
+
send(notifiable: Notifiable, notification: Notification): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export declare class Notifier {
|
|
44
|
+
/**
|
|
45
|
+
* Send a notification to one or more notifiables.
|
|
46
|
+
*
|
|
47
|
+
* Example:
|
|
48
|
+
* await Notifier.send(user, new WelcomeNotification())
|
|
49
|
+
* await Notifier.send([user1, user2], new NewsletterNotification())
|
|
50
|
+
*/
|
|
51
|
+
static send(notifiables: Notifiable | Notifiable[], notification: Notification): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Convenience helper for sending notifications.
|
|
55
|
+
*
|
|
56
|
+
* Example:
|
|
57
|
+
* await notify(user, new WelcomeNotification())
|
|
58
|
+
*/
|
|
59
|
+
export declare const notify: (notifiables: Notifiable | Notifiable[], notification: Notification) => Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Returns a NotificationServiceProvider that registers built-in channels
|
|
62
|
+
* (mail, database) into the ChannelRegistry.
|
|
63
|
+
*
|
|
64
|
+
* Usage in bootstrap/providers.ts:
|
|
65
|
+
* import { notifications } from '@boostkit/notification'
|
|
66
|
+
* export default [..., notifications(), ...]
|
|
67
|
+
*/
|
|
68
|
+
export declare function notifications(): new (app: Application) => ServiceProvider;
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAK5D;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAM,MAAM,GAAG,MAAM,CAAA;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAG,MAAM,CAAA;CACxB;AAID;;;;;GAKG;AACH,8BAAsB,YAAY;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,EAAE;IAE9C,2EAA2E;IAC3E,MAAM,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAE7D,mFAAmF;IACnF,UAAU,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChG;AAID,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxE;AAID,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA8C;IAErE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAIjE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIzD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGlC;AAID,qBAAa,WAAY,YAAW,mBAAmB;IAC/C,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB9E;AAID,qBAAa,eAAgB,YAAW,mBAAmB;IACzD,6CAA6C;IAC7C,SAAS,CAAC,KAAK,SAAiB;IAE1B,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAoB9E;AAID,qBAAa,QAAQ;IACnB;;;;;;OAMG;WACU,IAAI,CACf,WAAW,EAAE,UAAU,GAAG,UAAU,EAAE,EACtC,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;CAoBjB;AAID;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GACjB,aAAa,UAAU,GAAG,UAAU,EAAE,EACtC,cAAc,YAAY,KACzB,OAAO,CAAC,IAAI,CAA6C,CAAA;AAI5D;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAYzE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ServiceProvider } from '@boostkit/core';
|
|
2
|
+
import { MailRegistry } from '@boostkit/mail';
|
|
3
|
+
import { ModelRegistry } from '@boostkit/orm';
|
|
4
|
+
// ─── Notification ──────────────────────────────────────────
|
|
5
|
+
/**
|
|
6
|
+
* Base class for all notifications. Extend this and implement:
|
|
7
|
+
* - `via(notifiable)` — return channel names: 'mail', 'database', etc.
|
|
8
|
+
* - `toMail(notifiable)` — required when 'mail' is in via()
|
|
9
|
+
* - `toDatabase(notifiable)` — required when 'database' is in via()
|
|
10
|
+
*/
|
|
11
|
+
export class Notification {
|
|
12
|
+
}
|
|
13
|
+
// ─── Channel Registry ──────────────────────────────────────
|
|
14
|
+
export class ChannelRegistry {
|
|
15
|
+
static channels = new Map();
|
|
16
|
+
static register(name, channel) {
|
|
17
|
+
this.channels.set(name, channel);
|
|
18
|
+
}
|
|
19
|
+
static get(name) {
|
|
20
|
+
return this.channels.get(name);
|
|
21
|
+
}
|
|
22
|
+
static has(name) {
|
|
23
|
+
return this.channels.has(name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// ─── Mail Channel ──────────────────────────────────────────
|
|
27
|
+
export class MailChannel {
|
|
28
|
+
async send(notifiable, notification) {
|
|
29
|
+
if (!notification.toMail) {
|
|
30
|
+
throw new Error(`[BoostKit Notification] ${notification.constructor.name} uses the 'mail' channel but does not implement toMail().`);
|
|
31
|
+
}
|
|
32
|
+
const adapter = MailRegistry.get();
|
|
33
|
+
if (!adapter) {
|
|
34
|
+
throw new Error('[BoostKit Notification] No mail adapter registered. Add mail() to providers.');
|
|
35
|
+
}
|
|
36
|
+
if (!notifiable.email) {
|
|
37
|
+
throw new Error(`[BoostKit Notification] Notifiable (id=${notifiable.id}) has no email address for mail channel.`);
|
|
38
|
+
}
|
|
39
|
+
const mailable = await notification.toMail(notifiable);
|
|
40
|
+
const from = MailRegistry.getFrom();
|
|
41
|
+
await adapter.send(mailable, { to: [notifiable.email], from });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// ─── Database Channel ──────────────────────────────────────
|
|
45
|
+
export class DatabaseChannel {
|
|
46
|
+
/** Override to use a different table name */
|
|
47
|
+
table = 'notification';
|
|
48
|
+
async send(notifiable, notification) {
|
|
49
|
+
if (!notification.toDatabase) {
|
|
50
|
+
throw new Error(`[BoostKit Notification] ${notification.constructor.name} uses the 'database' channel but does not implement toDatabase().`);
|
|
51
|
+
}
|
|
52
|
+
const data = await notification.toDatabase(notifiable);
|
|
53
|
+
const adapter = ModelRegistry.getAdapter();
|
|
54
|
+
await adapter.query(this.table).create({
|
|
55
|
+
notifiable_id: String(notifiable.id),
|
|
56
|
+
notifiable_type: 'users',
|
|
57
|
+
type: notification.constructor.name,
|
|
58
|
+
data: JSON.stringify(data),
|
|
59
|
+
read_at: null,
|
|
60
|
+
created_at: new Date().toISOString(),
|
|
61
|
+
updated_at: new Date().toISOString(),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// ─── Notifier Facade ───────────────────────────────────────
|
|
66
|
+
export class Notifier {
|
|
67
|
+
/**
|
|
68
|
+
* Send a notification to one or more notifiables.
|
|
69
|
+
*
|
|
70
|
+
* Example:
|
|
71
|
+
* await Notifier.send(user, new WelcomeNotification())
|
|
72
|
+
* await Notifier.send([user1, user2], new NewsletterNotification())
|
|
73
|
+
*/
|
|
74
|
+
static async send(notifiables, notification) {
|
|
75
|
+
const targets = Array.isArray(notifiables) ? notifiables : [notifiables];
|
|
76
|
+
const channels = targets[0] ? notification.via(targets[0]) : [];
|
|
77
|
+
await Promise.all(targets.flatMap(notifiable => notification.via(notifiable).map(async (channelName) => {
|
|
78
|
+
const channel = ChannelRegistry.get(channelName);
|
|
79
|
+
if (!channel) {
|
|
80
|
+
throw new Error(`[BoostKit Notification] Unknown channel "${channelName}". Register it with ChannelRegistry.register().`);
|
|
81
|
+
}
|
|
82
|
+
await channel.send(notifiable, notification);
|
|
83
|
+
})));
|
|
84
|
+
void channels; // suppress unused warning
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// ─── notify() helper ───────────────────────────────────────
|
|
88
|
+
/**
|
|
89
|
+
* Convenience helper for sending notifications.
|
|
90
|
+
*
|
|
91
|
+
* Example:
|
|
92
|
+
* await notify(user, new WelcomeNotification())
|
|
93
|
+
*/
|
|
94
|
+
export const notify = (notifiables, notification) => Notifier.send(notifiables, notification);
|
|
95
|
+
// ─── Service Provider Factory ──────────────────────────────
|
|
96
|
+
/**
|
|
97
|
+
* Returns a NotificationServiceProvider that registers built-in channels
|
|
98
|
+
* (mail, database) into the ChannelRegistry.
|
|
99
|
+
*
|
|
100
|
+
* Usage in bootstrap/providers.ts:
|
|
101
|
+
* import { notifications } from '@boostkit/notification'
|
|
102
|
+
* export default [..., notifications(), ...]
|
|
103
|
+
*/
|
|
104
|
+
export function notifications() {
|
|
105
|
+
class NotificationServiceProvider extends ServiceProvider {
|
|
106
|
+
register() { }
|
|
107
|
+
boot() {
|
|
108
|
+
ChannelRegistry.register('mail', new MailChannel());
|
|
109
|
+
ChannelRegistry.register('database', new DatabaseChannel());
|
|
110
|
+
console.log('[NotificationServiceProvider] booted — channels: mail, database');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return NotificationServiceProvider;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoB,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAc7C,8DAA8D;AAE9D;;;;;GAKG;AACH,MAAM,OAAgB,YAAY;CASjC;AAQD,8DAA8D;AAE9D,MAAM,OAAO,eAAe;IAClB,MAAM,CAAC,QAAQ,GAAqC,IAAI,GAAG,EAAE,CAAA;IAErE,MAAM,CAAC,QAAQ,CAAC,IAAY,EAAE,OAA4B;QACxD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,GA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MAAM,IAAI,KAAK,CACb,4CAA4C,WAAW,iDAAiD,CACzG,CAAA;YACH,CAAC;YACD,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;QAC9C,CAAC,CAAC,CACH,CACF,CAAA;QAED,KAAK,QAAQ,CAAA,CAAC,0BAA0B;IAC1C,CAAC;CACF;AAED,8DAA8D;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,WAAsC,EACtC,YAA0B,EACX,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE5D,8DAA8D;AAE9D;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,2BAA4B,SAAQ,eAAe;QACvD,QAAQ,KAAU,CAAC;QAEnB,IAAI;YACF,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAM,IAAI,WAAW,EAAE,CAAC,CAAA;YACvD,eAAe,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,eAAe,EAAE,CAAC,CAAA;YAC3D,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAA;QAChF,CAAC;KACF;IAED,OAAO,2BAA2B,CAAA;AACpC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@boostkit/notification",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/boostkitjs/boostkit",
|
|
8
|
+
"directory": "packages/notification"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@boostkit/core": "0.0.1",
|
|
24
|
+
"@boostkit/mail": "0.0.1",
|
|
25
|
+
"@boostkit/orm": "0.0.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"typescript": "^5.4.0",
|
|
30
|
+
"tsx": "^4.0.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc",
|
|
34
|
+
"dev": "tsc --watch",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"test": "tsc -p tsconfig.test.json && node --test dist-test/index.test.js; rm -rf dist-test"
|
|
38
|
+
}
|
|
39
|
+
}
|