@stacksjs/types 0.70.86 → 0.70.87
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 +19 -5
- package/src/ai.ts +0 -41
- package/src/analytics.ts +0 -58
- package/src/api.ts +0 -77
- package/src/app.ts +0 -189
- package/src/attributes.ts +0 -5
- package/src/auth.ts +0 -161
- package/src/auto-imports.ts +0 -8
- package/src/binary.ts +0 -13
- package/src/cache.ts +0 -325
- package/src/cdn.ts +0 -17
- package/src/chat.ts +0 -193
- package/src/cli.ts +0 -445
- package/src/cloud.ts +0 -381
- package/src/cms.ts +0 -14
- package/src/commerce.ts +0 -18
- package/src/components.ts +0 -62
- package/src/configure.ts +0 -13
- package/src/cors.ts +0 -86
- package/src/cron-jobs.ts +0 -146
- package/src/dashboard.ts +0 -218
- package/src/database.ts +0 -117
- package/src/dependencies.ts +0 -69
- package/src/deploy.ts +0 -17
- package/src/dns.ts +0 -470
- package/src/docs.ts +0 -27
- package/src/email.ts +0 -511
- package/src/env.ts +0 -1
- package/src/errors.ts +0 -110
- package/src/events.ts +0 -37
- package/src/exit-code.ts +0 -10
- package/src/file-systems.ts +0 -70
- package/src/git.ts +0 -133
- package/src/hashing.ts +0 -127
- package/src/helpers.ts +0 -9
- package/src/i18n.ts +0 -121
- package/src/index.ts +0 -80
- package/src/library.ts +0 -911
- package/src/logging.ts +0 -62
- package/src/manifest.ts +0 -9
- package/src/marketing.ts +0 -14
- package/src/model-dashboard-augmentation.ts +0 -51
- package/src/model-names.ts +0 -1
- package/src/model.ts +0 -353
- package/src/monitoring.ts +0 -14
- package/src/native.ts +0 -0
- package/src/notifications.ts +0 -153
- package/src/oauth.ts +0 -488
- package/src/pages.ts +0 -10
- package/src/payments.ts +0 -440
- package/src/phone.ts +0 -78
- package/src/ports.ts +0 -20
- package/src/promise.ts +0 -1
- package/src/push.ts +0 -143
- package/src/queue.ts +0 -413
- package/src/reactivity.ts +0 -1
- package/src/realtime.ts +0 -584
- package/src/request.ts +0 -541
- package/src/response.ts +0 -16
- package/src/router.ts +0 -124
- package/src/saas.ts +0 -33
- package/src/scheduler.ts +0 -1
- package/src/search-engine.ts +0 -251
- package/src/security.ts +0 -23
- package/src/server.ts +0 -16
- package/src/services.ts +0 -211
- package/src/settings-config.ts +0 -10
- package/src/sms.ts +0 -265
- package/src/stack-extensions.ts +0 -184
- package/src/stacks.ts +0 -339
- package/src/storage.ts +0 -173
- package/src/table-names.ts +0 -1
- package/src/tables.ts +0 -57
- package/src/team.ts +0 -8
- package/src/ui.ts +0 -197
- package/src/utils.ts +0 -46
package/src/email.ts
DELETED
|
@@ -1,511 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* i18n bag passed to STX email templates at render time. Stacks emails
|
|
3
|
-
* are STX, not vue-email — keys/values are user-defined per template.
|
|
4
|
-
* The shape is intentionally open: each template declares its own
|
|
5
|
-
* placeholders and the renderer interpolates them as-is.
|
|
6
|
-
*/
|
|
7
|
-
export interface I18n {
|
|
8
|
-
[key: string]: unknown
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface AutoResponderConfig {
|
|
12
|
-
enabled: boolean
|
|
13
|
-
subject: string
|
|
14
|
-
body: string
|
|
15
|
-
schedule?: {
|
|
16
|
-
start?: string
|
|
17
|
-
end?: string
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface EmailFilterRule {
|
|
22
|
-
field: 'from' | 'to' | 'subject' | 'body'
|
|
23
|
-
operator: 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'regex'
|
|
24
|
-
value: string
|
|
25
|
-
action: 'move' | 'delete' | 'forward' | 'label'
|
|
26
|
-
actionValue?: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface MailboxConfig {
|
|
30
|
-
/** Email address (preferred) - e.g., 'chris@stacksjs.com' */
|
|
31
|
-
email?: string
|
|
32
|
-
/** @deprecated Use 'email' instead */
|
|
33
|
-
address?: string
|
|
34
|
-
displayName?: string
|
|
35
|
-
/**
|
|
36
|
-
* Password for IMAP/SMTP authentication.
|
|
37
|
-
* If not provided, will be looked up from MAIL_PASSWORD_<USERNAME> env var.
|
|
38
|
-
* Passwords are stored in AWS Secrets Manager after first deploy.
|
|
39
|
-
*/
|
|
40
|
-
password?: string
|
|
41
|
-
forwardTo?: string[]
|
|
42
|
-
autoResponder?: AutoResponderConfig
|
|
43
|
-
filters?: EmailFilterRule[]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface MailServerInstanceConfig {
|
|
47
|
-
/**
|
|
48
|
-
* EC2 instance type for the mail server
|
|
49
|
-
* @default 't4g.nano' for serverless, 't3.small' for server mode
|
|
50
|
-
*/
|
|
51
|
-
type?: 't4g.nano' | 't4g.micro' | 't4g.small' | 't4g.medium' | 't3.nano' | 't3.micro' | 't3.small' | 't3.medium' | 't3.large' | 't3.xlarge'
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Use spot instance for cost savings (~70% cheaper)
|
|
55
|
-
* Note: Spot instances can be interrupted with 2-minute warning
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
spot?: boolean
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Root volume size in GB
|
|
62
|
-
* @default 8 for serverless, 30 for server mode
|
|
63
|
-
*/
|
|
64
|
-
diskSize?: number
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* SSH key pair name for instance access (optional)
|
|
68
|
-
*/
|
|
69
|
-
keyPair?: string
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface MailServerPortsConfig {
|
|
73
|
-
/**
|
|
74
|
-
* Standard SMTP port
|
|
75
|
-
* @default 25
|
|
76
|
-
*/
|
|
77
|
-
smtp?: number
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* SMTP over TLS (implicit TLS)
|
|
81
|
-
* @default 465
|
|
82
|
-
*/
|
|
83
|
-
smtps?: number
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* SMTP submission port (STARTTLS)
|
|
87
|
-
* @default 587
|
|
88
|
-
*/
|
|
89
|
-
submission?: number
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* IMAP port (plaintext, not recommended)
|
|
93
|
-
* @default 143
|
|
94
|
-
*/
|
|
95
|
-
imap?: number
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* IMAP over TLS
|
|
99
|
-
* @default 993
|
|
100
|
-
*/
|
|
101
|
-
imaps?: number
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* POP3 port (plaintext, not recommended)
|
|
105
|
-
* @default 110
|
|
106
|
-
*/
|
|
107
|
-
pop3?: number
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* POP3 over TLS
|
|
111
|
-
* @default 995
|
|
112
|
-
*/
|
|
113
|
-
pop3s?: number
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @deprecated Use 'submission' instead
|
|
117
|
-
*/
|
|
118
|
-
smtpStartTls?: number
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface MailServerFeaturesConfig {
|
|
122
|
-
/**
|
|
123
|
-
* Enable IMAP server
|
|
124
|
-
* @default true
|
|
125
|
-
*/
|
|
126
|
-
imap?: boolean
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Enable POP3 server
|
|
130
|
-
* @default true
|
|
131
|
-
*/
|
|
132
|
-
pop3?: boolean
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Enable webmail interface (future)
|
|
136
|
-
* @default false
|
|
137
|
-
*/
|
|
138
|
-
webmail?: boolean
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Enable CalDAV for calendar sync
|
|
142
|
-
* @default false
|
|
143
|
-
*/
|
|
144
|
-
calDAV?: boolean
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Enable CardDAV for contacts sync
|
|
148
|
-
* @default false
|
|
149
|
-
*/
|
|
150
|
-
cardDAV?: boolean
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Enable Exchange ActiveSync
|
|
154
|
-
* @default false
|
|
155
|
-
*/
|
|
156
|
-
activeSync?: boolean
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Email category types for automatic email categorization (Gmail-style)
|
|
161
|
-
*/
|
|
162
|
-
export type EmailCategory = 'social' | 'forums' | 'updates' | 'promotions' | 'primary'
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Patterns for matching emails to categories
|
|
166
|
-
*/
|
|
167
|
-
export interface CategoryPatterns {
|
|
168
|
-
/**
|
|
169
|
-
* Domain names to match (e.g., 'facebookmail.com', 'twitter.com')
|
|
170
|
-
* Matched against the sender's email domain
|
|
171
|
-
*/
|
|
172
|
-
domains?: string[]
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Substrings to match in the sender address (e.g., 'notification@', '@social.')
|
|
176
|
-
*/
|
|
177
|
-
substrings?: string[]
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Email headers to match (e.g., { 'list-id': [''], 'precedence': ['list', 'bulk'] })
|
|
181
|
-
* Empty string array means "header exists"
|
|
182
|
-
*/
|
|
183
|
-
headers?: Record<string, string[]>
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Configuration for automatic email categorization
|
|
188
|
-
*/
|
|
189
|
-
export interface EmailCategorizationConfig {
|
|
190
|
-
/**
|
|
191
|
-
* Enable automatic email categorization into Gmail-style folders
|
|
192
|
-
* @default true
|
|
193
|
-
*/
|
|
194
|
-
enabled?: boolean
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Social category patterns (Facebook, Twitter, LinkedIn, etc.)
|
|
198
|
-
*/
|
|
199
|
-
social?: CategoryPatterns
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Forums category patterns (mailing lists, Google Groups, etc.)
|
|
203
|
-
*/
|
|
204
|
-
forums?: CategoryPatterns
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Updates category patterns (GitHub, Stripe, shipping notifications, etc.)
|
|
208
|
-
*/
|
|
209
|
-
updates?: CategoryPatterns
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Promotions category patterns (marketing emails, newsletters, etc.)
|
|
213
|
-
*/
|
|
214
|
-
promotions?: CategoryPatterns
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export interface EmailServerConfig {
|
|
218
|
-
enabled: boolean
|
|
219
|
-
scan?: boolean // spam/virus scanning
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Server mode:
|
|
223
|
-
* - 'server': Full-featured Zig mail server with IMAP, POP3, CalDAV, etc. (default)
|
|
224
|
-
* - 'serverless': Lightweight TypeScript/Bun server (~$3/month)
|
|
225
|
-
* @default 'server'
|
|
226
|
-
*/
|
|
227
|
-
mode?: 'serverless' | 'server'
|
|
228
|
-
|
|
229
|
-
storage?: {
|
|
230
|
-
bucket?: string
|
|
231
|
-
retentionDays?: number
|
|
232
|
-
archiveAfterDays?: number
|
|
233
|
-
}
|
|
234
|
-
forwarding?: Record<string, string[]> // alias -> destinations
|
|
235
|
-
autoResponders?: AutoResponderConfig[]
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Mail server instance configuration
|
|
239
|
-
* Controls the EC2 instance that runs IMAP/SMTP
|
|
240
|
-
*/
|
|
241
|
-
instance?: MailServerInstanceConfig
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Mail server ports configuration
|
|
245
|
-
*/
|
|
246
|
-
ports?: MailServerPortsConfig
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Mail server features (only available in 'server' mode)
|
|
250
|
-
*/
|
|
251
|
-
features?: MailServerFeaturesConfig
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Subdomain for the mail server
|
|
255
|
-
* @default 'mail'
|
|
256
|
-
* @example 'mail' -> mail.yourdomain.com
|
|
257
|
-
*/
|
|
258
|
-
subdomain?: string
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Automatic email categorization (Gmail-style folders)
|
|
262
|
-
* Categorizes incoming emails into Social, Forums, Updates, Promotions folders
|
|
263
|
-
*/
|
|
264
|
-
categorization?: EmailCategorizationConfig
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface EmailNotificationsConfig {
|
|
268
|
-
newEmail?: boolean
|
|
269
|
-
bounces?: boolean
|
|
270
|
-
complaints?: boolean
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export interface EmailOptions {
|
|
274
|
-
from: {
|
|
275
|
-
name: string
|
|
276
|
-
address: string
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
mailboxes: string[] | MailboxConfig[]
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Auto-forwarding rules for received mail, provisioned to the mail server's
|
|
283
|
-
* readable `forwards.json` (re-read on every message — edits take effect
|
|
284
|
-
* with no restart).
|
|
285
|
-
*
|
|
286
|
-
* Key = the delivered mailbox: the full address for a per-domain isolated
|
|
287
|
-
* mailbox (e.g. `'no-reply@acme.com'`), or a bare local-part for a
|
|
288
|
-
* legacy role mailbox (e.g. `'postmaster'`).
|
|
289
|
-
* Value = destination addresses. Targets on a local domain are written
|
|
290
|
-
* straight to that mailbox's Maildir; external targets are relayed.
|
|
291
|
-
* A copy also stays in the source mailbox.
|
|
292
|
-
*
|
|
293
|
-
* @example { 'no-reply@acme.com': ['chris@acme.com'] }
|
|
294
|
-
*/
|
|
295
|
-
forwards?: Record<string, string[]>
|
|
296
|
-
|
|
297
|
-
domain?: string
|
|
298
|
-
|
|
299
|
-
url: string
|
|
300
|
-
charset: string
|
|
301
|
-
|
|
302
|
-
server: EmailServerConfig
|
|
303
|
-
notifications?: EmailNotificationsConfig
|
|
304
|
-
|
|
305
|
-
default: 'log' | 'capture' | 'ses' | 'sendgrid' | 'mailgun' | 'mailtrap' | 'smtp'
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Suppression-list enforcement policy (stacksjs/stacks#1880).
|
|
309
|
-
*
|
|
310
|
-
* - `'strict'` — block all sends to suppressed
|
|
311
|
-
* recipients (default)
|
|
312
|
-
* - `'transactional-allowed'` — block broadcasts; allow messages
|
|
313
|
-
* with `tag: 'transactional'`
|
|
314
|
-
* - `'off'` — never block; the suppression
|
|
315
|
-
* table is just a tracking record
|
|
316
|
-
*
|
|
317
|
-
* The check is opt-in at the table level — apps that haven't
|
|
318
|
-
* created the `email_suppressions` table see "always allowed"
|
|
319
|
-
* with a one-shot warn.
|
|
320
|
-
*/
|
|
321
|
-
suppressionPolicy?: 'strict' | 'transactional-allowed' | 'off'
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* URL prefix the framework's default unsubscribe route mounts
|
|
325
|
-
* under (stacksjs/stacks#1880). Defaults to
|
|
326
|
-
* `/_stacks/email/unsubscribe`. The full link is built as
|
|
327
|
-
* `${app.url}${unsubscribeRoute}/${signed-token}`.
|
|
328
|
-
*/
|
|
329
|
-
unsubscribeRoute?: string
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
export type EmailConfig = Partial<EmailOptions>
|
|
333
|
-
|
|
334
|
-
export interface MailtrapConfig extends EmailDriverConfig {
|
|
335
|
-
token: string
|
|
336
|
-
inboxId?: number
|
|
337
|
-
}
|
|
338
|
-
export interface EmailResult {
|
|
339
|
-
message: string
|
|
340
|
-
success: boolean
|
|
341
|
-
provider: string
|
|
342
|
-
messageId?: string
|
|
343
|
-
/** Additional metadata from the email provider */
|
|
344
|
-
metadata?: Record<string, unknown>
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// Base configuration interface
|
|
348
|
-
export interface EmailDriverConfig {
|
|
349
|
-
maxRetries?: number
|
|
350
|
-
retryTimeout?: number
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/** Options for email template rendering */
|
|
354
|
-
export interface EmailTemplateOptions {
|
|
355
|
-
/** Template variables to replace */
|
|
356
|
-
variables?: Record<string, string | number | boolean | undefined | null>
|
|
357
|
-
/** Layout to wrap the template in */
|
|
358
|
-
layout?: string | false
|
|
359
|
-
/** Subject line for the email */
|
|
360
|
-
subject?: string
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Email driver interface
|
|
364
|
-
export interface EmailDriver {
|
|
365
|
-
/** Driver name */
|
|
366
|
-
name: string
|
|
367
|
-
|
|
368
|
-
/** Send an email */
|
|
369
|
-
send: (message: EmailMessage, options?: EmailTemplateOptions) => Promise<EmailResult>
|
|
370
|
-
|
|
371
|
-
/** Configure the driver */
|
|
372
|
-
configure: (config: EmailDriverConfig) => void
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
export interface EmailMessage {
|
|
376
|
-
/** Sender email address (optional, will use config default if not provided) */
|
|
377
|
-
from?: EmailAddress
|
|
378
|
-
/** Primary recipient(s) */
|
|
379
|
-
to: string | string[] | EmailAddress[]
|
|
380
|
-
/** Carbon copy recipient(s) */
|
|
381
|
-
cc?: string | string[] | EmailAddress[]
|
|
382
|
-
/** Blind carbon copy recipient(s) */
|
|
383
|
-
bcc?: string | string[] | EmailAddress[]
|
|
384
|
-
/**
|
|
385
|
-
* Reply-To address(es) for the outgoing message.
|
|
386
|
-
*
|
|
387
|
-
* Drivers must propagate this to the provider's equivalent field
|
|
388
|
-
* (`ReplyToAddresses` on SES, `h:Reply-To` on Mailgun, `reply_to` on
|
|
389
|
-
* SendGrid, a `Reply-To:` header for SMTP). Previously the field
|
|
390
|
-
* lived as an `as any` stash on the message (stacksjs/stacks#1871 M-4)
|
|
391
|
-
* — promoting it to a first-class slot means drivers can be
|
|
392
|
-
* checked at compile time for coverage.
|
|
393
|
-
*/
|
|
394
|
-
replyTo?: EmailAddress | EmailAddress[] | string | string[]
|
|
395
|
-
/** Email subject line */
|
|
396
|
-
subject: string
|
|
397
|
-
/** Path to email template (Vue component) */
|
|
398
|
-
template?: string
|
|
399
|
-
/** Direct HTML content for the email body */
|
|
400
|
-
html?: string
|
|
401
|
-
/** Plain text fallback (recommended for accessibility) */
|
|
402
|
-
text?: string
|
|
403
|
-
/** Optional attachments */
|
|
404
|
-
attachments?: EmailAttachment[]
|
|
405
|
-
/**
|
|
406
|
-
* Extra raw headers to inject into the outgoing envelope.
|
|
407
|
-
* Used by the newsletter package for `List-Unsubscribe` /
|
|
408
|
-
* `List-Unsubscribe-Post` (RFC 8058). Drivers that don't yet wire
|
|
409
|
-
* this through silently ignore — it never affects transactional
|
|
410
|
-
* sends.
|
|
411
|
-
*/
|
|
412
|
-
headers?: Record<string, string>
|
|
413
|
-
/** Optional callback after successful delivery */
|
|
414
|
-
onSuccess?: () => Promise<{ message: string }> | { message: string }
|
|
415
|
-
/** Optional callback after failed delivery */
|
|
416
|
-
onError?: (error: Error) => Promise<{ message: string }> | { message: string }
|
|
417
|
-
/** Optional custom handler */
|
|
418
|
-
handle?: () => Promise<{ message: string }> | { message: string }
|
|
419
|
-
/**
|
|
420
|
-
* Caller-supplied idempotency key (stacksjs/stacks#1871 M-8).
|
|
421
|
-
*
|
|
422
|
-
* When set, `mail.send()` consults an `email_idempotency` dedup
|
|
423
|
-
* table before dispatching to the driver:
|
|
424
|
-
* - hit: returns the cached EmailResult from the first send
|
|
425
|
-
* - miss: dispatches, then records the result under the key
|
|
426
|
-
*
|
|
427
|
-
* Why it matters: queued send retries (the framework retries 3×
|
|
428
|
-
* with backoff) and external retry loops (webhook handlers that
|
|
429
|
-
* re-fire on transient failures, request POSTs that the user
|
|
430
|
-
* double-clicks) can otherwise deliver the same email multiple
|
|
431
|
-
* times. The key turns those retries into safe no-ops.
|
|
432
|
-
*
|
|
433
|
-
* Construction guidance: derive the key from the business event
|
|
434
|
-
* the email represents — e.g. `welcome:${userId}`,
|
|
435
|
-
* `order-confirmation:${orderId}:${attempt}`, not from message
|
|
436
|
-
* content (which would collide across unrelated sends).
|
|
437
|
-
*
|
|
438
|
-
* The dedup table is opt-in. When the migration hasn't been run
|
|
439
|
-
* yet, the framework warns once and falls back to "send every
|
|
440
|
-
* time" so unrelated apps aren't broken by the new behavior.
|
|
441
|
-
*/
|
|
442
|
-
idempotencyKey?: string
|
|
443
|
-
/**
|
|
444
|
-
* Classification used by the suppression-policy check
|
|
445
|
-
* (stacksjs/stacks#1880). Set to `'transactional'` for messages
|
|
446
|
-
* that should bypass suppression when
|
|
447
|
-
* `email.suppressionPolicy: 'transactional-allowed'` is
|
|
448
|
-
* configured — password resets, billing receipts, magic-link
|
|
449
|
-
* sign-ins.
|
|
450
|
-
*
|
|
451
|
-
* Set to `'broadcast'` (or omit) for marketing / newsletter
|
|
452
|
-
* sends; those get blocked when the recipient is suppressed.
|
|
453
|
-
*
|
|
454
|
-
* Under the default `'strict'` policy this field has no effect
|
|
455
|
-
* — both transactional and broadcast sends get blocked. Apps
|
|
456
|
-
* that need to send password-reset emails to bounced addresses
|
|
457
|
-
* (rare, but legitimate) opt into `'transactional-allowed'` AND
|
|
458
|
-
* tag the message.
|
|
459
|
-
*/
|
|
460
|
-
tag?: 'transactional' | 'broadcast'
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// Email interfaces
|
|
464
|
-
export interface EmailAddress {
|
|
465
|
-
address: string
|
|
466
|
-
name?: string
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
export interface EmailAttachment {
|
|
470
|
-
filename: string
|
|
471
|
-
content: string | Uint8Array
|
|
472
|
-
contentType?: string
|
|
473
|
-
encoding?: 'base64' | 'binary' | 'hex' | 'utf8'
|
|
474
|
-
}
|
|
475
|
-
// Helper functions for all drivers
|
|
476
|
-
|
|
477
|
-
export interface SESConfig extends EmailDriverConfig {
|
|
478
|
-
region: string
|
|
479
|
-
credentials?: {
|
|
480
|
-
accessKeyId: string
|
|
481
|
-
secretAccessKey: string
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// SendGrid implementation
|
|
486
|
-
export interface SendGridConfig extends EmailDriverConfig {
|
|
487
|
-
apiKey: string
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
export interface RenderOptions {
|
|
491
|
-
props?: Record<string, unknown>
|
|
492
|
-
i18n?: I18n
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
export interface MailtrapSuccessResponse {
|
|
496
|
-
success: boolean
|
|
497
|
-
message_ids: string[]
|
|
498
|
-
errors?: never
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
export interface MailtrapErrorResponse {
|
|
502
|
-
success: false
|
|
503
|
-
errors: {
|
|
504
|
-
email?: string[]
|
|
505
|
-
message?: string[]
|
|
506
|
-
[key: string]: string[] | undefined
|
|
507
|
-
}
|
|
508
|
-
message_ids?: never
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
export type MailtrapResponse = MailtrapSuccessResponse | MailtrapErrorResponse
|
package/src/env.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @stacksjs/env/src/types
|
package/src/errors.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// export declare class ValidationError extends Error {
|
|
2
|
-
// messages: any
|
|
3
|
-
// status: number
|
|
4
|
-
// code: string
|
|
5
|
-
// constructor(messages: any, options?: ErrorOptions)
|
|
6
|
-
// get [Symbol.toStringTag](): string
|
|
7
|
-
// toString(): string
|
|
8
|
-
// }
|
|
9
|
-
|
|
10
|
-
export type CommandError = Error
|
|
11
|
-
|
|
12
|
-
export interface ErrorResponse {
|
|
13
|
-
status: number // HTTP status code
|
|
14
|
-
errors: string | object // Error message(s), which can be a string or an object
|
|
15
|
-
stack?: string // Optional stack trace
|
|
16
|
-
name: string
|
|
17
|
-
message: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ErrorOptions {
|
|
21
|
-
messages: {
|
|
22
|
-
'string': string
|
|
23
|
-
'email': string
|
|
24
|
-
'regex': string
|
|
25
|
-
'url': string
|
|
26
|
-
'activeUrl': string
|
|
27
|
-
'alpha': string
|
|
28
|
-
'alphaNumeric': string
|
|
29
|
-
'maxLength': string
|
|
30
|
-
'fixedLength': string
|
|
31
|
-
'confirmed': string
|
|
32
|
-
'endsWith': string
|
|
33
|
-
'startsWith': string
|
|
34
|
-
'sameAs': string
|
|
35
|
-
'notSameAs': string
|
|
36
|
-
'in': string
|
|
37
|
-
'notIn': string
|
|
38
|
-
'ipAddress': string
|
|
39
|
-
'uuid': string
|
|
40
|
-
'ascii': string
|
|
41
|
-
'creditCard': string
|
|
42
|
-
'hexCode': string
|
|
43
|
-
'iban': string
|
|
44
|
-
'jwt': string
|
|
45
|
-
'coordinates': string
|
|
46
|
-
'mobile': string
|
|
47
|
-
'passport': string
|
|
48
|
-
'postalCode': string
|
|
49
|
-
|
|
50
|
-
// boolean
|
|
51
|
-
'boolean': string
|
|
52
|
-
|
|
53
|
-
// number
|
|
54
|
-
'number': string
|
|
55
|
-
'min': string
|
|
56
|
-
'max': string
|
|
57
|
-
'range': string
|
|
58
|
-
'positive': string
|
|
59
|
-
'negative': string
|
|
60
|
-
'decimal': string
|
|
61
|
-
'withoutDecimals': string
|
|
62
|
-
|
|
63
|
-
// date
|
|
64
|
-
'date': string
|
|
65
|
-
'date.equals': string
|
|
66
|
-
'date.after': string
|
|
67
|
-
'date.before': string
|
|
68
|
-
'date.afterOrEqual': string
|
|
69
|
-
'date.beforeOrEqual': string
|
|
70
|
-
'date.sameAs': string
|
|
71
|
-
'date.notSameAs': string
|
|
72
|
-
'date.afterField': string
|
|
73
|
-
|
|
74
|
-
// accepted
|
|
75
|
-
'accepted': string
|
|
76
|
-
|
|
77
|
-
// enum
|
|
78
|
-
'enum': string
|
|
79
|
-
|
|
80
|
-
// literal
|
|
81
|
-
'literal': string
|
|
82
|
-
|
|
83
|
-
// object
|
|
84
|
-
'object': string
|
|
85
|
-
|
|
86
|
-
// record
|
|
87
|
-
'record': string
|
|
88
|
-
'record.min': string
|
|
89
|
-
'record.maxLength': string
|
|
90
|
-
'record.fixedLength': string
|
|
91
|
-
|
|
92
|
-
// array
|
|
93
|
-
'array': string
|
|
94
|
-
'array.min': string
|
|
95
|
-
'array.maxLength': string
|
|
96
|
-
'array.fixedLength': string
|
|
97
|
-
'notEmpty': string
|
|
98
|
-
'distinct': string
|
|
99
|
-
|
|
100
|
-
// tuple
|
|
101
|
-
'tuple': string
|
|
102
|
-
|
|
103
|
-
// union
|
|
104
|
-
'union': string
|
|
105
|
-
'unionGroup': string
|
|
106
|
-
'unionOfTypes': string
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export type ErrorConfig = Partial<ErrorOptions>
|
package/src/events.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Events**
|
|
3
|
-
*
|
|
4
|
-
* This configuration defines all of your events. Because Stacks is fully-typed, you may
|
|
5
|
-
* hover any of the options below and the definitions will be provided. In case you
|
|
6
|
-
* have any questions, feel free to reach out via Discord or GitHub Discussions.
|
|
7
|
-
*
|
|
8
|
-
* @example To fire an event, you may use any of the following approaches:
|
|
9
|
-
* ```ts
|
|
10
|
-
* dispatch('user:registered', { name: 'Chris', email: 'chris@stacksjs.com' })
|
|
11
|
-
*
|
|
12
|
-
* // alternatively, you may use the following:
|
|
13
|
-
* useEvent('user:registered', { name: 'Chris', email: 'chris@stacksjs.com' })
|
|
14
|
-
* events.emit('user:registered', { name: 'Chris', email: 'chris@stacksjs.com' })
|
|
15
|
-
* useEvents.emit('user:registered', { name: 'Chris', email: 'chris@stacksjs.com' })
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @example To capture an event, you may use any of the following approaches:
|
|
19
|
-
* ```ts
|
|
20
|
-
* listen('user:registered', (user) => sendWelcomeEmail(user))
|
|
21
|
-
*
|
|
22
|
-
* // alternatively, you may use the following:
|
|
23
|
-
* useListen('user:registered', (user) => sendWelcomeEmail(user))
|
|
24
|
-
* events.on('user:registered', (user) => sendWelcomeEmail(user))
|
|
25
|
-
* useEvents.on('user:registered', (user) => sendWelcomeEmail(user))
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export interface Events {
|
|
29
|
-
[key: string]: string[]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// `storage/framework/types/events.ts` is a project-generated declaration
|
|
33
|
-
// (one entry per model: `'<name>:created' | '<name>:updated' | …`). Use
|
|
34
|
-
// `export type *` so Bun erases the import at runtime — the file lives in
|
|
35
|
-
// the consumer project, not in the published `@stacksjs/types` package, so
|
|
36
|
-
// a value-level `export *` would fail to resolve once the package ships.
|
|
37
|
-
export type * from '../../../types/events'
|