@easybits.cloud/mailmask 0.4.8 → 0.4.10

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/dist/index.d.ts CHANGED
@@ -1,1189 +1,4 @@
1
- interface MailMaskConfig {
2
- apiKey: string;
3
- baseUrl?: string;
4
- /**
5
- * `fetch` alterno. Sirve para poner un timeout por llamada
6
- * (`AbortSignal.timeout`), reintentos o un proxy, y para probar el SDK
7
- * contra el servidor en proceso sin levantar un puerto.
8
- */
9
- fetch?: typeof fetch;
10
- }
11
- interface Domain {
12
- id: string;
13
- domain: string;
14
- /** Último valor medido. Si `verifiedStatus` es "unknown", no lo afirmes: confírmalo con `domains.health`. */
15
- verified: boolean;
16
- /** Último valor medido. Si `mxStatus` es "unknown", no lo afirmes: confírmalo con `domains.health`. */
17
- mxConfigured: boolean;
18
- registeredViaMailmask: boolean;
19
- createdAt: string;
20
- /** Cuándo se midieron `verified` y `mxConfigured` en vivo (health, verify o el servidor). null = nunca. */
21
- checkedAt?: string | null;
22
- /** "unknown" si la revisión tiene más de 24 h o nunca se hizo. */
23
- mxStatus?: "ok" | "missing" | "unknown";
24
- /** "unknown" si la revisión tiene más de 24 h o nunca se hizo. */
25
- verifiedStatus?: "ok" | "missing" | "unknown";
26
- /** Presente cuando algún estado es "unknown": qué hacer para confirmarlo. */
27
- statusNote?: string;
28
- /** Sólo en `domains.list`: reenvíos del mes en curso. */
29
- monthlyForwards?: number;
30
- /** Sólo en `domains.list`: tope de reenvíos por hora del plan. */
31
- forwardPerHour?: number;
32
- }
33
- interface DnsRecord {
34
- type: "MX" | "TXT" | "CNAME";
35
- name: string;
36
- value: string;
37
- priority?: number;
38
- }
39
- /** Respuesta de `domains.create`: el dominio y los registros DNS que hay que poner. */
40
- interface DomainCreated {
41
- domain: Domain;
42
- /** true si es el 2.º dominio sin activar: se guarda pero no reenvía hasta activarlo ($99/mes). */
43
- requiereActivacion: boolean;
44
- dnsRecords: {
45
- mx: DnsRecord;
46
- verification: DnsRecord;
47
- dkim: DnsRecord[];
48
- spf: DnsRecord;
49
- };
50
- }
51
- /** Respuesta de `domains.verify`. */
52
- interface DomainVerification {
53
- domain: string;
54
- verified: boolean;
55
- dkimVerified: boolean;
56
- /** Si el MX apunta al inbound de SES, medido en la misma llamada; null si el DNS no respondió. */
57
- mxConfigured?: boolean | null;
58
- /** true cuando no se pudo consultar a SES: los campos son el último estado conocido. */
59
- stale?: boolean;
60
- error?: string;
61
- }
62
- /** Nombre público de `Alias` desde la 0.4.5. */
63
- type Address = Alias;
64
- /** Nombre público de `AliasCreated` desde la 0.4.5. */
65
- type AddressCreated = AliasCreated;
66
- /** Nombre público de `CreateAliasInput` desde la 0.4.5. */
67
- type CreateAddressInput = CreateAliasInput;
68
- /** Nombre público de `UpdateAliasInput` desde la 0.4.5. */
69
- type UpdateAddressInput = UpdateAliasInput;
70
- interface Alias {
71
- alias: string;
72
- domainId: string;
73
- destinations: string[];
74
- enabled: boolean;
75
- forwardCount: number;
76
- lastFrom?: string | null;
77
- lastAt?: string | null;
78
- createdAt: string;
79
- /** true si la máscara guarda el correo en un buzón IMAP. */
80
- mailboxEnabled?: boolean;
81
- }
82
- /** Credenciales de un buzón IMAP recién creado. La contraseña se muestra una sola vez. */
83
- interface MailboxCreated {
84
- email: string;
85
- password: string;
86
- quotaBytes: number;
87
- imap: {
88
- host: string;
89
- port: number;
90
- security: string;
91
- };
92
- smtp: {
93
- host: string;
94
- port: number;
95
- security: string;
96
- };
97
- }
98
- /** `aliases.create`: el alias, y si pediste buzón, sus credenciales o por qué no se creó. */
99
- interface AliasCreated extends Alias {
100
- buzon?: MailboxCreated | null;
101
- errorBuzon?: string | null;
102
- }
103
- interface CreateAliasInput {
104
- /** Parte local, sin el dominio: "hola" para hola@tudominio.com. `*` para catch-all. */
105
- alias: string;
106
- /** Adónde reenviar. Puede ir vacío sólo si `mailbox` es true. */
107
- destinations?: string[];
108
- /** Crear también un buzón IMAP (requiere dominio activado). */
109
- mailbox?: boolean;
110
- }
111
- interface UpdateAliasInput {
112
- enabled?: boolean;
113
- destinations?: string[];
114
- }
115
- type RuleField = "to" | "from" | "subject";
116
- type RuleMatch = "contains" | "equals" | "regex";
117
- /** `forward` y `webhook` requieren `target`; `discard` no. */
118
- type RuleAction = "forward" | "webhook" | "discard";
119
- interface Rule {
120
- id: string;
121
- domainId: string;
122
- field: RuleField;
123
- match: RuleMatch;
124
- value: string;
125
- action: RuleAction;
126
- target: string;
127
- priority: number;
128
- enabled: boolean;
129
- createdAt: string;
130
- }
131
- interface CreateRuleInput {
132
- field: RuleField;
133
- /** Los patrones `regex` se validan al guardar: uno peligroso responde 400. */
134
- match: RuleMatch;
135
- value: string;
136
- action: RuleAction;
137
- /** Destino del `forward` o URL del `webhook`. Se ignora con `discard`. */
138
- target?: string;
139
- priority?: number;
140
- enabled?: boolean;
141
- }
142
- interface UpdateRuleInput {
143
- field?: RuleField;
144
- match?: RuleMatch;
145
- value?: string;
146
- action?: RuleAction;
147
- target?: string;
148
- priority?: number;
149
- enabled?: boolean;
150
- }
151
- interface EmailLog {
152
- id: string;
153
- domainId: string;
154
- timestamp: string;
155
- from: string;
156
- to: string;
157
- subject: string;
158
- /** Entrantes: forwarded, discarded, failed, rule_matched. Salientes: sent → delivered | bounced | complained. */
159
- status: "forwarded" | "discarded" | "failed" | "rule_matched" | "sent" | "delivered" | "bounced" | "complained";
160
- forwardedTo: string;
161
- sizeBytes: number;
162
- error?: string;
163
- /** Id interno de SES; cruza el log con los eventos de entrega. Sólo en salientes. */
164
- sesMessageId?: string;
165
- }
166
- interface SendEmailInput {
167
- to: string;
168
- subject: string;
169
- /** Al menos uno de `html`, `body` o `markdown`. Con html y body se manda multipart. HTML máx. 100 KB. */
170
- html?: string;
171
- body?: string;
172
- markdown?: string;
173
- replyTo?: string;
174
- /**
175
- * Parte local de un alias **activo** del dominio. Sin esto el correo sale
176
- * desde `noreply@tudominio.com`.
177
- */
178
- from?: string;
179
- /** Nombre visible del remitente: `Libretas <hola@tudominio.com>`. */
180
- fromName?: string;
181
- /** Copias visibles. Máx. 20; también pasan por la lista de supresión. */
182
- cc?: string[];
183
- /** Copias ocultas. Máx. 20. */
184
- bcc?: string[];
185
- /** `Message-ID` del correo al que se responde, para que el cliente lo enhebre. */
186
- inReplyTo?: string;
187
- /** Cadena `References` del hilo. */
188
- references?: string;
189
- /** Archivos subidos antes con `attachments.upload`. Se borran de S3 al enviarse. */
190
- attachments?: AttachmentRef[];
191
- }
192
- /** Lo que devuelve `attachments.upload`; se pasa tal cual en `SendEmailInput.attachments`. */
193
- interface AttachmentRef {
194
- key: string;
195
- filename: string;
196
- contentType?: string;
197
- }
198
- interface UploadAttachmentInput {
199
- filename: string;
200
- contentType: string;
201
- data: Uint8Array | Blob;
202
- }
203
- interface UploadedAttachment {
204
- ok: boolean;
205
- key: string;
206
- filename: string;
207
- size: number;
208
- }
209
- interface SendOptions {
210
- /**
211
- * Reintentar con la misma clave (máx. 128 caracteres) devuelve la respuesta
212
- * original sin volver a enviar ni consumir cuota, durante 24 h.
213
- */
214
- idempotencyKey?: string;
215
- }
216
- interface Suppression {
217
- email: string;
218
- /** `bounce:Permanent`, `complaint` o `manual`. */
219
- reason: string;
220
- createdAt: string;
221
- }
222
- type WebhookEvent = "email.received" | "email.sent" | "email.delivered" | "email.bounced" | "email.complained";
223
- interface Webhook {
224
- id: string;
225
- domainId: string;
226
- url: string;
227
- events: WebhookEvent[];
228
- enabled: boolean;
229
- createdAt: string;
230
- }
231
- /** Lo que devuelve `webhooks.create`. El `secret` se muestra una sola vez. */
232
- interface WebhookCreated extends Webhook {
233
- secret: string;
234
- }
235
- interface CreateWebhookInput {
236
- /** Debe ser https y pública. */
237
- url: string;
238
- events: WebhookEvent[];
239
- }
240
- interface UpdateWebhookInput {
241
- url?: string;
242
- events?: WebhookEvent[];
243
- enabled?: boolean;
244
- }
245
- interface WebhookDelivery {
246
- id: string;
247
- webhookId: string;
248
- event: WebhookEvent | "ping";
249
- attempts: number;
250
- status: "pending" | "delivered" | "failed";
251
- nextAt: string;
252
- lastError: string | null;
253
- lastStatusCode: number | null;
254
- createdAt: string;
255
- }
256
- /** Cuerpo que recibe tu endpoint. `data` depende del evento. */
257
- interface WebhookPayload<T = Record<string, unknown>> {
258
- event: WebhookEvent | "ping";
259
- domainId: string;
260
- timestamp: string;
261
- data: T;
262
- }
263
- interface BulkSendInput {
264
- recipients: string[];
265
- subject: string;
266
- html: string;
267
- /** Alias activo del dominio; por omisión `noreply`. */
268
- from?: string;
269
- }
270
- /** Lo que devuelve `bulkSend`: el job se encola, todavía no hay estado que leer. */
271
- interface BulkJobCreated {
272
- ok: boolean;
273
- jobId: string;
274
- }
275
- interface BulkJob {
276
- id: string;
277
- domainId: string;
278
- recipients: string[];
279
- subject: string;
280
- html: string;
281
- from: string;
282
- status: string;
283
- totalRecipients: number;
284
- sent: number;
285
- failed: number;
286
- /** Destinatarios saltados por bounce o queja previa: total = sent + failed + skippedSuppressed. */
287
- skippedSuppressed: number;
288
- lastError?: string | null;
289
- createdAt: string;
290
- completedAt?: string | null;
291
- expiresAt: string;
292
- }
293
- interface SmtpCredential {
294
- id: string;
295
- domainId: string;
296
- label: string;
297
- iamUsername: string;
298
- createdAt: string;
299
- }
300
- /**
301
- * Lo que devuelve `smtp.create`. La contraseña se muestra **una sola vez**: no
302
- * se puede volver a consultar, sólo revocar la credencial y crear otra.
303
- */
304
- interface SmtpCredentialCreated {
305
- id: string;
306
- label: string;
307
- server: string;
308
- port: number;
309
- encryption: string;
310
- username: string;
311
- password: string;
312
- createdAt: string;
313
- }
314
- interface ApiKey {
315
- id: string;
316
- name: string;
317
- /** Primeros caracteres de la llave, para identificarla en listados. */
318
- keyPrefix: string;
319
- lastUsedAt?: string;
320
- createdAt: string;
321
- }
322
- type DnsRecordType = "A" | "AAAA" | "CNAME" | "TXT" | "MX" | "NS" | "CAA" | "SRV";
323
- /**
324
- * Un conjunto de registros con el mismo nombre y tipo. El DNS trabaja así, no con registros
325
- * sueltos: `values` es la lista completa y al escribirla reemplaza lo que hubiera.
326
- */
327
- interface DnsRRSet {
328
- name: string;
329
- type: DnsRecordType;
330
- ttl: number;
331
- values: string[];
332
- }
333
- interface DnsRRSetAnotado extends DnsRRSet {
334
- /** Lo pone MailMask para que el correo funcione. */
335
- managed: boolean;
336
- editable: boolean;
337
- managedReason?: string;
338
- /** Valores que hay que conservar aunque el registro sea editable (el SPF). */
339
- protectedValues?: string[];
340
- }
341
- interface DnsZoneState {
342
- status: "none" | "pending_delegation" | "active";
343
- hostedZoneId?: string;
344
- nameservers?: string[];
345
- delegated?: boolean;
346
- }
347
- interface DnsListResponse {
348
- zone: DnsZoneState;
349
- records: DnsRRSetAnotado[];
350
- /** Presente cuando todavía no hay zona: dice qué hacer. */
351
- hint?: string;
352
- }
353
- interface DnsZoneCreated {
354
- hostedZoneId: string;
355
- nameservers: string[];
356
- /** Lo que copiamos de tu proveedor anterior. Revísalo: puede faltar algo. */
357
- imported: DnsRRSet[];
358
- importWarning: string;
359
- }
360
- interface DnsDelegation {
361
- delegated: boolean;
362
- observed: string[];
363
- expected: string[];
364
- }
365
- interface DnsImportResult {
366
- found: DnsRRSet[];
367
- nameservers: string[];
368
- warning: string;
369
- }
370
- interface DnsChangeResult {
371
- record?: DnsRRSet;
372
- records?: DnsRRSet[];
373
- changeId: string;
374
- propagacion: string;
375
- }
376
- type DnsPreset = "vercel" | "netlify" | "github-pages" | "cloudflare-pages" | "render" | "fly" | "redirect-a-www" | "dmarc";
377
- interface DnsSetupRecord {
378
- id: string;
379
- type: "MX" | "TXT" | "CNAME";
380
- /** Relativo al dominio, como lo piden casi todos los paneles ('@', '_amazonses'). */
381
- name: string;
382
- fqdn: string;
383
- value: string;
384
- /** Sólo MX, para paneles con campo de prioridad aparte (entonces el valor es `host`). */
385
- priority?: number;
386
- host?: string;
387
- level: "requerido" | "recomendado" | "opcional";
388
- purpose: string;
389
- benefit?: string;
390
- /** Ayuda en texto con **negritas** estilo markdown. */
391
- hints: string[];
392
- /** Sólo con `live`: si el DNS público ya lo tiene; null = no se pudo consultar. */
393
- ok?: boolean | null;
394
- observed?: string[];
395
- /** SPF: valor fusionado cuando ya existe otro SPF (se edita ése, no se crea otro). */
396
- suggestedValue?: string;
397
- }
398
- interface DnsSetup {
399
- domain: string;
400
- records: DnsSetupRecord[];
401
- live: boolean;
402
- nameservers?: string[];
403
- /** Panel donde se pegan, deducido de los nameservers. */
404
- registrarHint?: {
405
- provider: string;
406
- label: string;
407
- note: string;
408
- } | null;
409
- summary?: string;
410
- }
411
- interface BillingStatus {
412
- subscription: {
413
- plan: string;
414
- status: string;
415
- currentPeriodEnd?: string;
416
- [k: string]: unknown;
417
- };
418
- }
419
- interface Addon {
420
- id: string;
421
- kind: string;
422
- /** Dominio al que aplica; sin él es un add-on legado de toda la cuenta. */
423
- domainId?: string;
424
- status: "pending" | "active" | "cancelled" | "expired";
425
- priceCents: number;
426
- currentPeriodEnd?: string;
427
- createdAt: string;
428
- cancelledAt?: string;
429
- source: "purchase" | "courtesy" | "migration";
430
- }
431
- interface AddonsResponse {
432
- catalog: Record<string, {
433
- price: number;
434
- label: string;
435
- }>;
436
- forSale: string[];
437
- mine: Addon[];
438
- }
439
- /** Liga de pago de MercadoPago. Nada cambia hasta que el usuario la abre y paga. */
440
- interface CheckoutLink {
441
- init_point: string;
442
- addonId: string;
443
- }
444
- interface DomainSearchResult {
445
- available: boolean;
446
- domain: string;
447
- tld: string;
448
- /** Centavos MXN por año. */
449
- price: number;
450
- currency: "MXN";
451
- }
452
- interface TldPrice {
453
- tld: string;
454
- /** Centavos MXN. */
455
- price: number;
456
- renewPrice: number;
457
- transferPrice: number;
458
- popular: boolean;
459
- }
460
- interface DomainRegistrationCreated {
461
- /** Liga de pago de MercadoPago; el registro arranca al pagar. */
462
- initPoint: string;
463
- registrationId: string;
464
- }
465
- interface DomainRegistration {
466
- id: string;
467
- domainId: string | null;
468
- domainName: string;
469
- kind: "register" | "transfer";
470
- status: string;
471
- expiresAt: string | null;
472
- priceCents: number;
473
- renewalStatus: string;
474
- renewalPriceCents: number | null;
475
- nextChargeAt: string | null;
476
- dnsImportStatus: string;
477
- transferAuthCodeHint: string | null;
478
- /** Candado de transferencia (`clientTransferProhibited`); null si aún no se ha leído de AWS. */
479
- transferLock: boolean | null;
480
- /** Mientras está quitado: cuándo se vuelve a poner solo. */
481
- transferUnlockedUntil: string | null;
482
- /** Desde cuándo puede cambiar de registrador (regla de 60 días de ICANN). */
483
- transferEligibleAt: string;
484
- lastError: string | null;
485
- createdAt: string;
486
- [k: string]: unknown;
487
- }
488
- interface TransferRequirement {
489
- texto: string;
490
- ok: boolean | null;
491
- ayuda?: string;
492
- }
493
- interface TransferCheck {
494
- domain: string;
495
- /** Centavos MXN; incluye un año de renovación. */
496
- price: number;
497
- currency: "MXN";
498
- requisitos: TransferRequirement[];
499
- dns: {
500
- found: unknown[];
501
- nameservers?: string[];
502
- warning?: string;
503
- truncado?: boolean;
504
- };
505
- [k: string]: unknown;
506
- }
507
- interface TransferDnsInventory {
508
- records: unknown[];
509
- status: string;
510
- takenAt: string | null;
511
- }
512
- interface RenewalLink {
513
- init_point: string;
514
- nextChargeAt: string;
515
- }
516
- interface DomainMember {
517
- id: string;
518
- domainId: string;
519
- email: string;
520
- name: string;
521
- role: "admin" | "agent";
522
- createdAt: string;
523
- /** Del perfil de su cuenta de MailMask, si lo llenó. */
524
- displayName?: string | null;
525
- avatarUrl?: string | null;
526
- }
527
- interface DomainInvite {
528
- token: string;
529
- email: string;
530
- name: string;
531
- role: "admin" | "agent";
532
- expiresAt: string;
533
- inviteUrl: string;
534
- }
535
- interface CannedReply {
536
- id: string;
537
- domainId: string;
538
- title: string;
539
- /** Markdown. */
540
- body: string;
541
- createdAt: string;
542
- }
543
- /** Perfil de la cuenta de MailMask (el usuario, no una máscara). */
544
- interface AccountProfile {
545
- email: string;
546
- displayName: string | null;
547
- /** Ruta relativa al host de MailMask (`/api/avatar/...`), o null sin foto. */
548
- avatarUrl: string | null;
549
- }
550
- /** Derechos y uso de UN dominio, dentro de `AccountMe.porDominio`. */
551
- interface AccountMeDomainUsage {
552
- id: string;
553
- domain: string;
554
- /** Límites del dominio (sends, aliases, dominios, etc.), por plan y add-ons. */
555
- derechos: Record<string, unknown>;
556
- addons: Addon[];
557
- uso: {
558
- aliases: {
559
- current: number;
560
- limit: number;
561
- };
562
- rules: {
563
- current: number;
564
- limit: number;
565
- };
566
- sends: {
567
- current: number;
568
- limit: number;
569
- };
570
- forwards: {
571
- current: number;
572
- limit: number;
573
- };
574
- mailboxBytes: {
575
- current: number;
576
- limit: number;
577
- };
578
- };
579
- }
580
- /** Respuesta de `account.me()`: identidad de la cuenta y su uso, por dominio y total. */
581
- interface AccountMe extends AccountProfile {
582
- isAdmin: boolean;
583
- assistant: boolean;
584
- domainsCount: number;
585
- emailVerified: boolean;
586
- forwards: {
587
- current: number;
588
- limit: number;
589
- };
590
- subscription: {
591
- plan: string;
592
- status: string;
593
- currentPeriodEnd: string | null;
594
- planLabel: string;
595
- [k: string]: unknown;
596
- };
597
- porDominio: AccountMeDomainUsage[];
598
- addons: Addon[];
599
- planPriceCents: number | null;
600
- addonCatalog: Record<string, {
601
- price: number;
602
- label: string;
603
- }>;
604
- addonsForSale: string[];
605
- lastOrder: Order | null;
606
- usage: {
607
- domains: {
608
- current: number;
609
- limit: number | null;
610
- };
611
- aliasesPerDomain: unknown[];
612
- rulesPerDomain: unknown[];
613
- sendsPerDomain: unknown[];
614
- };
615
- referralSlug?: string | null;
616
- referralStats: ReferralStats;
617
- }
618
- /** Respuesta de `account.export()`: todo el dato del usuario, listo para descargar. */
619
- interface AccountExport {
620
- email: string;
621
- exportedAt: string;
622
- domains: {
623
- domain: string;
624
- domainId: string;
625
- verified: boolean;
626
- aliases: Alias[];
627
- rules: Rule[];
628
- logs: EmailLog[];
629
- }[];
630
- }
631
- /** Respuesta de `domains.uploadImage()`. */
632
- interface UploadedEmailImage {
633
- ok: boolean;
634
- /** Efímera: se borra tras enviarse (o la barre el aseo diario si nunca se usó). */
635
- url: string;
636
- }
637
- type InboxStatus = "open" | "snoozed" | "closed";
638
- interface InboxConversation {
639
- id: string;
640
- domainId: string;
641
- /** El contacto externo (en un hilo que inició el dominio, el destinatario). */
642
- from: string;
643
- /** La máscara del dominio por la que va el hilo (`ventas@tudominio.com`). */
644
- to: string;
645
- subject: string;
646
- status: InboxStatus;
647
- assignedTo?: string;
648
- priority: "normal" | "urgent";
649
- lastMessageAt: string;
650
- messageCount: number;
651
- tags: string[];
652
- deletedAt?: string;
653
- snoozedUntil?: string;
654
- /** Para quien pregunta: hay mensajes que no ha visto. */
655
- unread?: boolean;
656
- /** Sólo en búsqueda: fragmento con la coincidencia. */
657
- snippet?: string;
658
- [k: string]: unknown;
659
- }
660
- interface InboxListOptions {
661
- /** `open`, `snoozed`, `closed`, `unread` (de quien pregunta) o `deleted` (papelera). */
662
- status?: InboxStatus | "unread" | "deleted";
663
- /** Dirección completa de la máscara (`ventas@tudominio.com`). */
664
- to?: string;
665
- assignedTo?: string;
666
- /** Búsqueda en asunto, remitente y cuerpo. Con `q` no hay paginación (tope 50). */
667
- q?: string;
668
- /** Máx. 100. */
669
- limit?: number;
670
- cursor?: string;
671
- }
672
- interface InboxPage {
673
- items: InboxConversation[];
674
- nextCursor: string | null;
675
- /** Máscaras con conversaciones (sólo en la primera página). */
676
- aliases?: string[];
677
- mode: "list" | "search" | "search-degraded";
678
- unreadCount?: number;
679
- [k: string]: unknown;
680
- }
681
- interface InboxAttachment {
682
- index: number;
683
- filename: string;
684
- contentType: string;
685
- size: number;
686
- }
687
- interface InboxMessage {
688
- id: string;
689
- conversationId: string;
690
- from: string;
691
- /** Texto plano. */
692
- body?: string;
693
- html?: string;
694
- direction: "inbound" | "outbound";
695
- createdAt: string;
696
- messageId?: string;
697
- deliveryStatus?: "sent" | "delivered" | "bounced" | "complained";
698
- attachments?: InboxAttachment[];
699
- /** El original ya no está (retención de 90 días o pérdida): `body` puede venir del índice. */
700
- bodyDegraded?: string;
701
- }
702
- interface InboxNote {
703
- id: string;
704
- conversationId: string;
705
- author: string;
706
- body: string;
707
- createdAt: string;
708
- }
709
- interface InboxConversationDetail extends InboxConversation {
710
- messages: InboxMessage[];
711
- notes: InboxNote[];
712
- totalMessages: number;
713
- hasMore: boolean;
714
- }
715
- interface InboxComposeInput {
716
- /** Parte local (o dirección completa) de una máscara activa del dominio. */
717
- fromAlias: string;
718
- to: string;
719
- subject: string;
720
- markdown?: string;
721
- html?: string;
722
- body?: string;
723
- cc?: string[];
724
- bcc?: string[];
725
- attachments?: AttachmentRef[];
726
- }
727
- interface InboxReplyInput {
728
- markdown?: string;
729
- html?: string;
730
- body?: string;
731
- cc?: string[];
732
- bcc?: string[];
733
- /** Cita el último mensaje recibido (por omisión true; sólo con markdown). */
734
- quote?: boolean;
735
- attachments?: AttachmentRef[];
736
- }
737
- interface InboxUpdateInput {
738
- status?: InboxStatus;
739
- /** ISO, futura y a menos de 90 días. Obligatoria con `status: "snoozed"`. */
740
- snoozedUntil?: string;
741
- tags?: string[];
742
- priority?: "normal" | "urgent";
743
- }
744
- interface Order {
745
- id: string;
746
- number: string;
747
- date: string;
748
- kind: string;
749
- concept: string;
750
- subject: string | null;
751
- amountCents: number;
752
- listPriceCents: number | null;
753
- currency: string;
754
- periodStart: string | null;
755
- periodEnd: string | null;
756
- failureReason: string | null;
757
- note: string | null;
758
- reference: string | null;
759
- }
760
- interface OrdersPage {
761
- orders: Order[];
762
- nextCursor: string | null;
763
- invoiceNote: string;
764
- }
765
- interface ReferralStats {
766
- slug?: string | null;
767
- referrals: unknown[];
768
- [k: string]: unknown;
769
- }
770
-
771
- declare class MailMaskError extends Error {
772
- status: number;
773
- constructor(status: number, message: string);
774
- }
775
- declare class MailMask {
776
- private baseUrl;
777
- private apiKey;
778
- domains: DomainsResource;
779
- /** Las direcciones del dominio (máscaras), con reenvío, buzón o ambos. */
780
- addresses: AliasesResource;
781
- /** @deprecated Usa `addresses`; es el mismo recurso y no se va a retirar. */
782
- aliases: AliasesResource;
783
- rules: RulesResource;
784
- logs: LogsResource;
785
- send: SendResource;
786
- attachments: AttachmentsResource;
787
- suppressions: SuppressionsResource;
788
- webhooks: WebhooksResource;
789
- smtp: SmtpResource;
790
- apiKeys: ApiKeysResource;
791
- dns: DnsResource;
792
- billing: BillingResource;
793
- registrations: RegistrationsResource;
794
- transfers: TransfersResource;
795
- members: MembersResource;
796
- signature: SignatureResource;
797
- canned: CannedResource;
798
- account: AccountResource;
799
- inbox: InboxResource;
800
- referrals: ReferralsResource;
801
- constructor(config: MailMaskConfig);
802
- }
803
- type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
804
- declare class DomainsResource {
805
- private req;
806
- constructor(req: Req);
807
- list(): Promise<Domain[]>;
808
- get(id: string): Promise<Domain>;
809
- create(domain: string): Promise<DomainCreated>;
810
- delete(id: string): Promise<{
811
- ok: boolean;
812
- }>;
813
- health(id: string): Promise<Record<string, unknown>>;
814
- verify(id: string): Promise<DomainVerification>;
815
- /** Registros a pegar en el registrador. Con `live` los compara con el DNS público y deduce el panel. */
816
- dnsSetup(id: string, opts?: {
817
- live?: boolean;
818
- }): Promise<DnsSetup>;
819
- /** Logo de la firma (PNG, JPG o WebP; máx. 500 KB). Se ve en todo correo en markdown. */
820
- setLogo(id: string, file: Blob, filename?: string): Promise<{
821
- ok: boolean;
822
- logoUrl: string;
823
- }>;
824
- /** Logo desde un adjunto del chat del asistente (URL firmada de `/api/asistente/files/*`). */
825
- setLogoFromUrl(id: string, url: string): Promise<{
826
- ok: boolean;
827
- logoUrl: string;
828
- }>;
829
- removeLogo(id: string): Promise<{
830
- ok: boolean;
831
- }>;
832
- /** Imagen para incrustar en un correo saliente (PNG, JPG, GIF o WebP; máx. 2 MB). Efímera: se borra tras enviarse o por el barrido diario. */
833
- uploadImage(id: string, file: Blob, filename?: string): Promise<UploadedEmailImage>;
834
- }
835
- declare class DnsResource {
836
- private req;
837
- constructor(req: Req);
838
- list(domainId: string): Promise<DnsListResponse>;
839
- createZone(domainId: string): Promise<DnsZoneCreated>;
840
- delegation(domainId: string): Promise<DnsDelegation>;
841
- import(domainId: string): Promise<DnsImportResult>;
842
- /** Reemplaza el conjunto: `values` sustituye por completo lo que hubiera en ese nombre y tipo. */
843
- upsert(domainId: string, record: {
844
- name: string;
845
- type: DnsRecordType;
846
- values: string[];
847
- ttl?: number;
848
- }): Promise<DnsChangeResult>;
849
- delete(domainId: string, name: string, type: DnsRecordType): Promise<{
850
- ok: boolean;
851
- changeId: string;
852
- }>;
853
- preset(domainId: string, preset: DnsPreset, target?: string, subdomain?: string): Promise<DnsChangeResult>;
854
- }
855
- declare class AliasesResource {
856
- private req;
857
- private raw;
858
- constructor(req: Req, raw: (path: string) => Promise<Response>);
859
- /** Perfil de configuración de Apple Mail (plist) para el buzón de una máscara. */
860
- appleProfile(domainId: string, alias: string): Promise<string>;
861
- /** Exporta el buzón en formato mbox. Devuelve la respuesta en streaming: un buzón puede pesar GB. */
862
- exportMbox(domainId: string, alias: string): Promise<Response>;
863
- list(domainId: string): Promise<Alias[]>;
864
- create(domainId: string, input: CreateAliasInput): Promise<AliasCreated>;
865
- /** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
866
- createMailbox(domainId: string, alias: string): Promise<MailboxCreated>;
867
- /** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
868
- deleteMailbox(domainId: string, alias: string): Promise<{
869
- ok: boolean;
870
- }>;
871
- /** Genera una contraseña nueva para el buzón. Sólo se devuelve aquí; no se guarda. */
872
- resetMailboxPassword(domainId: string, alias: string): Promise<{
873
- password: string;
874
- }>;
875
- update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
876
- delete(domainId: string, alias: string): Promise<{
877
- ok: boolean;
878
- }>;
879
- }
880
- declare class RulesResource {
881
- private req;
882
- constructor(req: Req);
883
- list(domainId: string): Promise<Rule[]>;
884
- create(domainId: string, input: CreateRuleInput): Promise<Rule>;
885
- update(domainId: string, ruleId: string, input: UpdateRuleInput): Promise<Rule>;
886
- delete(domainId: string, ruleId: string): Promise<{
887
- ok: boolean;
888
- }>;
889
- }
890
- declare class LogsResource {
891
- private req;
892
- constructor(req: Req);
893
- /** `limit` por omisión 50, máximo 100. */
894
- list(domainId: string, opts?: {
895
- limit?: number;
896
- }): Promise<EmailLog[]>;
897
- }
898
- declare class SendResource {
899
- private req;
900
- constructor(req: Req);
901
- send(domainId: string, input: SendEmailInput, opts?: SendOptions): Promise<{
902
- ok: boolean;
903
- messageId: string;
904
- sesMessageId: string;
905
- }>;
906
- bulkSend(domainId: string, input: BulkSendInput): Promise<BulkJobCreated>;
907
- bulkStatus(domainId: string, jobId: string): Promise<BulkJob>;
908
- }
909
- declare class AttachmentsResource {
910
- private req;
911
- constructor(req: Req);
912
- /** Máx. 5 MB. Ejecutables bloqueados (415). La llave vale hasta que se envía. */
913
- upload(domainId: string, input: UploadAttachmentInput): Promise<UploadedAttachment>;
914
- /** Desde un adjunto del chat del asistente (URL firmada de `/api/asistente/files/*`). */
915
- uploadFromUrl(domainId: string, url: string, filename?: string): Promise<UploadedAttachment>;
916
- }
917
- declare class SuppressionsResource {
918
- private req;
919
- constructor(req: Req);
920
- list(domainId: string): Promise<Suppression[]>;
921
- add(domainId: string, email: string): Promise<Suppression>;
922
- remove(domainId: string, email: string): Promise<{
923
- ok: boolean;
924
- }>;
925
- }
926
- declare class WebhooksResource {
927
- private req;
928
- constructor(req: Req);
929
- list(domainId: string): Promise<Webhook[]>;
930
- create(domainId: string, input: CreateWebhookInput): Promise<WebhookCreated>;
931
- update(domainId: string, webhookId: string, input: UpdateWebhookInput): Promise<Webhook>;
932
- delete(domainId: string, webhookId: string): Promise<{
933
- ok: boolean;
934
- }>;
935
- /** Encola un `ping`; llega en el siguiente minuto. */
936
- test(domainId: string, webhookId: string): Promise<{
937
- ok: boolean;
938
- deliveryId: string;
939
- }>;
940
- deliveries(domainId: string, webhookId: string): Promise<WebhookDelivery[]>;
941
- }
942
- declare class SmtpResource {
943
- private req;
944
- constructor(req: Req);
945
- list(domainId: string): Promise<SmtpCredential[]>;
946
- create(domainId: string, label: string): Promise<SmtpCredentialCreated>;
947
- revoke(domainId: string, credId: string): Promise<{
948
- ok: boolean;
949
- }>;
950
- }
951
- declare class ApiKeysResource {
952
- private req;
953
- constructor(req: Req);
954
- list(): Promise<ApiKey[]>;
955
- create(name: string): Promise<ApiKey & {
956
- key: string;
957
- }>;
958
- revoke(id: string): Promise<{
959
- ok: boolean;
960
- }>;
961
- }
962
- declare class BillingResource {
963
- private req;
964
- constructor(req: Req);
965
- status(): Promise<BillingStatus>;
966
- addons(): Promise<AddonsResponse>;
967
- /**
968
- * Liga de MercadoPago para un add-on de un dominio (`domain` = activarlo, $99/mes).
969
- * El usuario la abre y paga; hasta entonces no cambia nada.
970
- */
971
- checkout(domainId: string, kind?: "domain" | "storage50" | "sends100", opts?: {
972
- payerEmail?: string;
973
- period?: "monthly" | "annual";
974
- }): Promise<CheckoutLink>;
975
- /** Cancela la suscripción de un add-on; el cupo sigue hasta el fin del periodo pagado. */
976
- cancelAddon(addonId: string): Promise<{
977
- ok: boolean;
978
- activeUntil: string | null;
979
- }>;
980
- /** Historial de cobros, cortesías y cancelaciones (más reciente primero). */
981
- orders(opts?: {
982
- limit?: number;
983
- before?: string;
984
- }): Promise<OrdersPage>;
985
- }
986
- declare class RegistrationsResource {
987
- private req;
988
- constructor(req: Req);
989
- search(domain: string): Promise<DomainSearchResult>;
990
- tlds(): Promise<TldPrice[]>;
991
- /** Crea el registro pendiente y devuelve la liga de pago; el dominio se registra al pagar. */
992
- register(domain: string): Promise<DomainRegistrationCreated>;
993
- list(): Promise<DomainRegistration[]>;
994
- /** Pide el traslado a otro registrador. El código EPP llega por correo al dueño, nunca en la respuesta. */
995
- transferOut(regId: string): Promise<{
996
- ok: boolean;
997
- aviso: string;
998
- }>;
999
- /** Liga de MercadoPago para la suscripción de renovación anual. */
1000
- renewal(regId: string, opts?: {
1001
- payerEmail?: string;
1002
- }): Promise<RenewalLink>;
1003
- /** Deja de cobrar la renovación anual. El dominio sigue vigente hasta su vencimiento. */
1004
- cancelRenewal(regId: string): Promise<{
1005
- ok: boolean;
1006
- aviso: string;
1007
- }>;
1008
- /**
1009
- * Pone el candado de transferencia. Quitarlo no está en el SDK a propósito: sólo se hace
1010
- * desde el panel, con la sesión del dueño y confirmando por correo.
1011
- */
1012
- lock(regId: string): Promise<{
1013
- ok: boolean;
1014
- transferLock: boolean;
1015
- transferUnlockedUntil: null;
1016
- }>;
1017
- }
1018
- declare class TransfersResource {
1019
- private req;
1020
- constructor(req: Req);
1021
- /** Requisitos, precio e inventario del DNS actual. No cobra ni crea nada. */
1022
- check(domain: string): Promise<TransferCheck>;
1023
- dns(regId: string): Promise<TransferDnsInventory>;
1024
- /** Reemplaza el inventario completo (RRSets). Vuelve a quedar pendiente de aprobar. */
1025
- setDns(regId: string, records: {
1026
- name: string;
1027
- type: string;
1028
- ttl?: number;
1029
- values: string[];
1030
- }[]): Promise<{
1031
- records: unknown[];
1032
- }>;
1033
- approveDns(regId: string): Promise<{
1034
- ok: boolean;
1035
- }>;
1036
- resendEmail(regId: string): Promise<{
1037
- ok: boolean;
1038
- }>;
1039
- }
1040
- declare class MembersResource {
1041
- private req;
1042
- constructor(req: Req);
1043
- list(domainId: string): Promise<{
1044
- members: DomainMember[];
1045
- invites: DomainInvite[];
1046
- }>;
1047
- invite(domainId: string, input: {
1048
- email: string;
1049
- name: string;
1050
- role?: "admin" | "agent";
1051
- }): Promise<{
1052
- ok: boolean;
1053
- inviteUrl: string;
1054
- }>;
1055
- remove(domainId: string, memberId: string): Promise<{
1056
- ok: boolean;
1057
- }>;
1058
- cancelInvite(domainId: string, token: string): Promise<{
1059
- ok: boolean;
1060
- }>;
1061
- }
1062
- declare class SignatureResource {
1063
- private req;
1064
- constructor(req: Req);
1065
- get(domainId: string): Promise<{
1066
- signature: string | null;
1067
- }>;
1068
- /** Markdown, máx. 2000 caracteres. Cadena vacía la borra. */
1069
- set(domainId: string, signature: string): Promise<{
1070
- ok: boolean;
1071
- signature: string | null;
1072
- }>;
1073
- }
1074
- declare class CannedResource {
1075
- private req;
1076
- constructor(req: Req);
1077
- list(domainId: string): Promise<CannedReply[]>;
1078
- create(domainId: string, input: {
1079
- title: string;
1080
- body: string;
1081
- }): Promise<CannedReply>;
1082
- delete(domainId: string, cannedId: string): Promise<{
1083
- ok: boolean;
1084
- }>;
1085
- }
1086
- declare class AccountResource {
1087
- private req;
1088
- constructor(req: Req);
1089
- /**
1090
- * Identidad y uso de la cuenta: dominios, derechos por dominio, add-ons y cuotas.
1091
- * Sustituto de `whoami` mientras no exista un endpoint de identidad más chico — ver
1092
- * `docs/agents/mailmask-cli.md`.
1093
- */
1094
- me(): Promise<AccountMe>;
1095
- /** Todo tu dato (alias, reglas y logs de cada dominio) como JSON exportable. */
1096
- export(): Promise<AccountExport>;
1097
- getProfile(): Promise<AccountProfile>;
1098
- /** Nombre visible (máx. 60 caracteres). Cadena vacía lo borra. */
1099
- updateProfile(input: {
1100
- displayName: string | null;
1101
- }): Promise<AccountProfile>;
1102
- /** Foto desde un adjunto que el usuario subió al asistente (URL firmada de `/api/asistente/files/*`). */
1103
- setAvatarFromUrl(url: string): Promise<AccountProfile & {
1104
- ok: boolean;
1105
- }>;
1106
- /** Foto desde bytes (PNG, JPG o WebP; máx. 2 MB). */
1107
- setAvatar(file: Blob, filename?: string): Promise<AccountProfile & {
1108
- ok: boolean;
1109
- }>;
1110
- removeAvatar(): Promise<AccountProfile & {
1111
- ok: boolean;
1112
- }>;
1113
- }
1114
- /**
1115
- * La Bandeja: conversaciones del dominio. Todo pasa por los mismos permisos que la app
1116
- * (dueño, admin o agente invitado) y los mismos topes de envío.
1117
- */
1118
- declare class InboxResource {
1119
- private req;
1120
- private raw;
1121
- constructor(req: Req, raw: (path: string) => Promise<Response>);
1122
- list(domainId: string, opts?: InboxListOptions): Promise<InboxPage>;
1123
- /** Conversación con sus mensajes (los 30 más recientes, o anteriores a `before`). Abrirla la marca leída. */
1124
- get(domainId: string, conversationId: string, opts?: {
1125
- before?: string;
1126
- }): Promise<InboxConversationDetail>;
1127
- /** Un correo nuevo desde una máscara: abre un hilo. Gasta cuota de envío (dominio activado). */
1128
- compose(domainId: string, input: InboxComposeInput): Promise<{
1129
- ok: boolean;
1130
- conversationId: string;
1131
- messageId: string;
1132
- }>;
1133
- /** Responde en el hilo desde la máscara del hilo. No gasta cuota de envío. */
1134
- reply(domainId: string, conversationId: string, input: InboxReplyInput): Promise<{
1135
- ok: boolean;
1136
- messageId: string;
1137
- }>;
1138
- update(domainId: string, conversationId: string, input: InboxUpdateInput): Promise<InboxConversation>;
1139
- markRead(domainId: string, conversationId: string): Promise<{
1140
- ok: boolean;
1141
- unreadCount: number;
1142
- }>;
1143
- /** Sin `assignedTo` la deja sin asignar. */
1144
- assign(domainId: string, conversationId: string, assignedTo?: string): Promise<InboxConversation>;
1145
- /** Nota interna: la ve el equipo, nunca el contacto. */
1146
- addNote(domainId: string, conversationId: string, body: string): Promise<InboxNote>;
1147
- /** A la papelera (se puede restaurar). Máx. 200 por llamada. */
1148
- delete(domainId: string, conversationIds: string[]): Promise<{
1149
- ok: boolean;
1150
- deleted: number;
1151
- }>;
1152
- restore(domainId: string, conversationId: string): Promise<{
1153
- ok: boolean;
1154
- }>;
1155
- metrics(domainId: string, opts?: {
1156
- days?: number;
1157
- }): Promise<Record<string, unknown>>;
1158
- /** Bytes de un adjunto de un mensaje (id del mensaje e índice de `attachments`). */
1159
- attachment(domainId: string, conversationId: string, messageId: string, index: number): Promise<Response>;
1160
- }
1161
- declare class ReferralsResource {
1162
- private req;
1163
- constructor(req: Req);
1164
- get(): Promise<ReferralStats>;
1165
- /** 3-30 caracteres: minúsculas, números y guiones. */
1166
- setSlug(slug: string): Promise<{
1167
- ok: boolean;
1168
- slug: string;
1169
- }>;
1170
- /** Nombre que ven los invitados (2-40 caracteres). */
1171
- setName(name: string): Promise<{
1172
- ok: boolean;
1173
- }>;
1174
- }
1175
-
1176
- interface WebhookSignatureHeaders {
1177
- /** Header `X-MailMask-Signature`, con forma `sha256=<hex>`. */
1178
- signature: string;
1179
- /** Header `X-MailMask-Timestamp`, milisegundos Unix. */
1180
- timestamp: string;
1181
- }
1182
- /**
1183
- * Comprueba que `rawBody` (el cuerpo tal cual llegó, sin parsear) fue firmado
1184
- * con `secret`. Rechaza timestamps con más de `toleranceMs` de diferencia para
1185
- * frenar repeticiones.
1186
- */
1187
- declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
1188
-
1189
- export { type AccountExport, type AccountMe, type AccountMeDomainUsage, type AccountProfile, type Addon, type AddonsResponse, type Address, type AddressCreated, type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BillingStatus, type BulkJob, type BulkJobCreated, type BulkSendInput, type CannedReply, type CheckoutLink, type CreateAddressInput, type CreateAliasInput, type CreateRuleInput, type CreateWebhookInput, type DnsChangeResult, type DnsDelegation, type DnsImportResult, type DnsListResponse, type DnsPreset, type DnsRRSet, type DnsRRSetAnotado, type DnsRecord, type DnsRecordType, type DnsSetup, type DnsSetupRecord, type DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainInvite, type DomainMember, type DomainRegistration, type DomainRegistrationCreated, type DomainSearchResult, type DomainVerification, type EmailLog, type InboxAttachment, type InboxComposeInput, type InboxConversation, type InboxConversationDetail, type InboxListOptions, type InboxMessage, type InboxNote, type InboxPage, type InboxReplyInput, type InboxStatus, type InboxUpdateInput, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type Order, type OrdersPage, type ReferralStats, type RenewalLink, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type TldPrice, type TransferCheck, type TransferDnsInventory, type TransferRequirement, type UpdateAddressInput, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type UploadedEmailImage, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
1
+ export { MailMask, MailMaskError } from "./client.js";
2
+ export { verifyWebhookSignature } from "./verify.js";
3
+ export type { WebhookSignatureHeaders } from "./verify.js";
4
+ export * from "./types.js";