@spfn/notification 0.1.0-beta.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.
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @spfn/notification - Channel Types
3
+ */
4
+ /**
5
+ * Channel types
6
+ */
7
+ type NotificationChannel = 'email' | 'sms' | 'slack' | 'push';
8
+ /**
9
+ * Send result
10
+ */
11
+ interface SendResult {
12
+ success: boolean;
13
+ messageId?: string;
14
+ error?: string;
15
+ }
16
+ /**
17
+ * Channel provider interface
18
+ */
19
+ interface ChannelProvider<TSendParams, TResult = SendResult> {
20
+ name: string;
21
+ send(params: TSendParams): Promise<TResult>;
22
+ }
23
+
24
+ /**
25
+ * @spfn/notification - Email Channel Types
26
+ */
27
+
28
+ /**
29
+ * Parameters for sending email
30
+ */
31
+ interface SendEmailParams {
32
+ /**
33
+ * Recipient email address(es)
34
+ */
35
+ to: string | string[];
36
+ /**
37
+ * Email subject (required if not using template)
38
+ */
39
+ subject?: string;
40
+ /**
41
+ * Template name
42
+ */
43
+ template?: string;
44
+ /**
45
+ * Template data for variable substitution
46
+ */
47
+ data?: Record<string, unknown>;
48
+ /**
49
+ * Plain text content (if not using template)
50
+ */
51
+ text?: string;
52
+ /**
53
+ * HTML content (if not using template)
54
+ */
55
+ html?: string;
56
+ /**
57
+ * From address (overrides default)
58
+ */
59
+ from?: string;
60
+ /**
61
+ * Reply-to address
62
+ */
63
+ replyTo?: string;
64
+ }
65
+ /**
66
+ * Email provider interface
67
+ */
68
+ interface EmailProvider extends ChannelProvider<InternalSendEmailParams, SendResult> {
69
+ name: 'aws-ses' | 'sendgrid' | 'smtp' | string;
70
+ }
71
+ /**
72
+ * Internal send email params (after template rendering)
73
+ */
74
+ interface InternalSendEmailParams {
75
+ to: string[];
76
+ from: string;
77
+ replyTo?: string;
78
+ subject: string;
79
+ text?: string;
80
+ html?: string;
81
+ }
82
+
83
+ /**
84
+ * @spfn/notification - SMS Channel Types
85
+ */
86
+
87
+ /**
88
+ * Parameters for sending SMS
89
+ */
90
+ interface SendSMSParams {
91
+ /**
92
+ * Phone number(s) in E.164 format (e.g., +821012345678)
93
+ */
94
+ to: string | string[];
95
+ /**
96
+ * Template name
97
+ */
98
+ template?: string;
99
+ /**
100
+ * Template data for variable substitution
101
+ */
102
+ data?: Record<string, unknown>;
103
+ /**
104
+ * Message content (if not using template)
105
+ */
106
+ message?: string;
107
+ }
108
+ /**
109
+ * SMS provider interface
110
+ */
111
+ interface SMSProvider extends ChannelProvider<InternalSendSMSParams, SendResult> {
112
+ name: 'aws-sns' | 'twilio' | string;
113
+ }
114
+ /**
115
+ * Internal send SMS params (after template rendering)
116
+ */
117
+ interface InternalSendSMSParams {
118
+ to: string;
119
+ message: string;
120
+ }
121
+
122
+ /**
123
+ * @spfn/notification - Template Types
124
+ */
125
+
126
+ /**
127
+ * Email template content
128
+ */
129
+ interface EmailTemplateContent {
130
+ subject: string;
131
+ html?: string;
132
+ text?: string;
133
+ }
134
+ /**
135
+ * SMS template content
136
+ */
137
+ interface SmsTemplateContent {
138
+ message: string;
139
+ }
140
+ /**
141
+ * Slack template content
142
+ */
143
+ interface SlackTemplateContent {
144
+ text?: string;
145
+ blocks?: unknown[];
146
+ }
147
+ /**
148
+ * Template definition
149
+ */
150
+ interface TemplateDefinition {
151
+ name: string;
152
+ channels: NotificationChannel[];
153
+ email?: EmailTemplateContent;
154
+ sms?: SmsTemplateContent;
155
+ slack?: SlackTemplateContent;
156
+ }
157
+ /**
158
+ * Rendered template result
159
+ */
160
+ interface RenderedTemplate {
161
+ email?: EmailTemplateContent;
162
+ sms?: SmsTemplateContent;
163
+ slack?: SlackTemplateContent;
164
+ }
165
+ /**
166
+ * Template data (variables for substitution)
167
+ */
168
+ type TemplateData = Record<string, unknown>;
169
+
170
+ export type { EmailProvider as E, NotificationChannel as N, RenderedTemplate as R, SendEmailParams as S, TemplateDefinition as T, SendResult as a, SendSMSParams as b, SMSProvider as c, TemplateData as d, EmailTemplateContent as e, SmsTemplateContent as f, SlackTemplateContent as g };
@@ -0,0 +1 @@
1
+ export { e as EmailTemplateContent, N as NotificationChannel, S as SendEmailParams, a as SendResult, b as SendSMSParams, g as SlackTemplateContent, f as SmsTemplateContent, d as TemplateData, T as TemplateDefinition } from './index-D_XTwHmO.js';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}