@easybits.cloud/mailmask 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/index.cjs +37 -1
- package/dist/index.d.cts +130 -6
- package/dist/index.d.ts +130 -6
- package/dist/index.js +37 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,8 +36,20 @@ await mm.send.send(domainId, {
|
|
|
36
36
|
|
|
37
37
|
// List aliases for a domain
|
|
38
38
|
const aliases = await mm.aliases.list(domainId);
|
|
39
|
+
|
|
40
|
+
// Add a domain — returns the DNS records to configure (MX, TXT, DKIM, SPF)
|
|
41
|
+
const { domain, dnsRecords } = await mm.domains.create("yourdomain.com");
|
|
42
|
+
|
|
43
|
+
// An alias with an IMAP mailbox (activated domain): password is returned once
|
|
44
|
+
const inbox = await mm.aliases.create(domainId, { alias: "sales", mailbox: true });
|
|
45
|
+
console.log(inbox.buzon?.password, inbox.buzon?.imap);
|
|
39
46
|
```
|
|
40
47
|
|
|
48
|
+
## MCP
|
|
49
|
+
|
|
50
|
+
The same actions are available to AI agents at `https://www.mailmask.studio/mcp`
|
|
51
|
+
(Streamable HTTP, `Authorization: Bearer mk_...`). See https://www.mailmask.studio/docs#mcp.
|
|
52
|
+
|
|
41
53
|
## More
|
|
42
54
|
|
|
43
55
|
```ts
|
|
@@ -53,7 +65,7 @@ await mm.send.send(domainId, {
|
|
|
53
65
|
await mm.suppressions.list(domainId);
|
|
54
66
|
await mm.suppressions.remove(domainId, "fixed@example.com");
|
|
55
67
|
|
|
56
|
-
// Webhooks (
|
|
68
|
+
// Webhooks (activated domain) — secret is shown once
|
|
57
69
|
const wh = await mm.webhooks.create(domainId, { url: "https://app.example.com/hooks/mailmask", events: ["email.received", "email.delivered", "email.bounced"] });
|
|
58
70
|
|
|
59
71
|
// On your server: verify the signature with the raw body
|
package/dist/index.cjs
CHANGED
|
@@ -60,6 +60,7 @@ var MailMask = class {
|
|
|
60
60
|
this.webhooks = new WebhooksResource(req);
|
|
61
61
|
this.smtp = new SmtpResource(req);
|
|
62
62
|
this.apiKeys = new ApiKeysResource(req);
|
|
63
|
+
this.dns = new DnsResource(req);
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
var DomainsResource = class {
|
|
@@ -85,6 +86,33 @@ var DomainsResource = class {
|
|
|
85
86
|
return this.req(`/api/domains/${id}/verify`, { method: "POST" });
|
|
86
87
|
}
|
|
87
88
|
};
|
|
89
|
+
var DnsResource = class {
|
|
90
|
+
constructor(req) {
|
|
91
|
+
this.req = req;
|
|
92
|
+
}
|
|
93
|
+
list(domainId) {
|
|
94
|
+
return this.req(`/api/domains/${domainId}/dns`);
|
|
95
|
+
}
|
|
96
|
+
createZone(domainId) {
|
|
97
|
+
return this.req(`/api/domains/${domainId}/dns/zone`, { method: "POST" });
|
|
98
|
+
}
|
|
99
|
+
delegation(domainId) {
|
|
100
|
+
return this.req(`/api/domains/${domainId}/dns/delegation`);
|
|
101
|
+
}
|
|
102
|
+
import(domainId) {
|
|
103
|
+
return this.req(`/api/domains/${domainId}/dns/import`, { method: "POST" });
|
|
104
|
+
}
|
|
105
|
+
/** Reemplaza el conjunto: `values` sustituye por completo lo que hubiera en ese nombre y tipo. */
|
|
106
|
+
upsert(domainId, record) {
|
|
107
|
+
return this.req(`/api/domains/${domainId}/dns/records`, { method: "PUT", body: JSON.stringify(record) });
|
|
108
|
+
}
|
|
109
|
+
delete(domainId, name, type) {
|
|
110
|
+
return this.req(`/api/domains/${domainId}/dns/records`, { method: "DELETE", body: JSON.stringify({ name, type }) });
|
|
111
|
+
}
|
|
112
|
+
preset(domainId, preset, target, subdomain) {
|
|
113
|
+
return this.req(`/api/domains/${domainId}/dns/preset`, { method: "POST", body: JSON.stringify({ preset, target, subdomain }) });
|
|
114
|
+
}
|
|
115
|
+
};
|
|
88
116
|
var AliasesResource = class {
|
|
89
117
|
constructor(req) {
|
|
90
118
|
this.req = req;
|
|
@@ -93,7 +121,15 @@ var AliasesResource = class {
|
|
|
93
121
|
return this.req(`/api/domains/${domainId}/alias`);
|
|
94
122
|
}
|
|
95
123
|
create(domainId, input) {
|
|
96
|
-
return this.req(`/api/domains/${domainId}/alias`, { method: "POST", body: JSON.stringify(input) });
|
|
124
|
+
return this.req(`/api/domains/${domainId}/alias`, { method: "POST", body: JSON.stringify({ ...input, destinations: input.destinations ?? [] }) });
|
|
125
|
+
}
|
|
126
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
127
|
+
createMailbox(domainId, alias) {
|
|
128
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "POST" });
|
|
129
|
+
}
|
|
130
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
131
|
+
deleteMailbox(domainId, alias) {
|
|
132
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "DELETE" });
|
|
97
133
|
}
|
|
98
134
|
update(domainId, alias, input) {
|
|
99
135
|
return this.req(`/api/domains/${domainId}/alias/${alias}`, { method: "PUT", body: JSON.stringify(input) });
|
package/dist/index.d.cts
CHANGED
|
@@ -20,6 +20,24 @@ interface Domain {
|
|
|
20
20
|
/** Sólo en `domains.list`: tope de reenvíos por hora del plan. */
|
|
21
21
|
forwardPerHour?: number;
|
|
22
22
|
}
|
|
23
|
+
interface DnsRecord {
|
|
24
|
+
type: "MX" | "TXT" | "CNAME";
|
|
25
|
+
name: string;
|
|
26
|
+
value: string;
|
|
27
|
+
priority?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Respuesta de `domains.create`: el dominio y los registros DNS que hay que poner. */
|
|
30
|
+
interface DomainCreated {
|
|
31
|
+
domain: Domain;
|
|
32
|
+
/** true si es el 2.º dominio sin activar: se guarda pero no reenvía hasta activarlo ($99/mes). */
|
|
33
|
+
requiereActivacion: boolean;
|
|
34
|
+
dnsRecords: {
|
|
35
|
+
mx: DnsRecord;
|
|
36
|
+
verification: DnsRecord;
|
|
37
|
+
dkim: DnsRecord[];
|
|
38
|
+
spf: DnsRecord;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
23
41
|
/** Respuesta de `domains.verify`. */
|
|
24
42
|
interface DomainVerification {
|
|
25
43
|
domain: string;
|
|
@@ -38,11 +56,37 @@ interface Alias {
|
|
|
38
56
|
lastFrom?: string | null;
|
|
39
57
|
lastAt?: string | null;
|
|
40
58
|
createdAt: string;
|
|
59
|
+
/** true si la máscara guarda el correo en un buzón IMAP. */
|
|
60
|
+
mailboxEnabled?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** Credenciales de un buzón IMAP recién creado. La contraseña se muestra una sola vez. */
|
|
63
|
+
interface MailboxCreated {
|
|
64
|
+
email: string;
|
|
65
|
+
password: string;
|
|
66
|
+
quotaBytes: number;
|
|
67
|
+
imap: {
|
|
68
|
+
host: string;
|
|
69
|
+
port: number;
|
|
70
|
+
security: string;
|
|
71
|
+
};
|
|
72
|
+
smtp: {
|
|
73
|
+
host: string;
|
|
74
|
+
port: number;
|
|
75
|
+
security: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** `aliases.create`: el alias, y si pediste buzón, sus credenciales o por qué no se creó. */
|
|
79
|
+
interface AliasCreated extends Alias {
|
|
80
|
+
buzon?: MailboxCreated | null;
|
|
81
|
+
errorBuzon?: string | null;
|
|
41
82
|
}
|
|
42
83
|
interface CreateAliasInput {
|
|
43
84
|
/** Parte local, sin el dominio: "hola" para hola@tudominio.com. `*` para catch-all. */
|
|
44
85
|
alias: string;
|
|
45
|
-
|
|
86
|
+
/** Adónde reenviar. Puede ir vacío sólo si `mailbox` es true. */
|
|
87
|
+
destinations?: string[];
|
|
88
|
+
/** Crear también un buzón IMAP (requiere dominio activado). */
|
|
89
|
+
mailbox?: boolean;
|
|
46
90
|
}
|
|
47
91
|
interface UpdateAliasInput {
|
|
48
92
|
enabled?: boolean;
|
|
@@ -255,6 +299,61 @@ interface ApiKey {
|
|
|
255
299
|
lastUsedAt?: string;
|
|
256
300
|
createdAt: string;
|
|
257
301
|
}
|
|
302
|
+
type DnsRecordType = "A" | "AAAA" | "CNAME" | "TXT" | "MX" | "NS" | "CAA" | "SRV";
|
|
303
|
+
/**
|
|
304
|
+
* Un conjunto de registros con el mismo nombre y tipo. El DNS trabaja así, no con registros
|
|
305
|
+
* sueltos: `values` es la lista completa y al escribirla reemplaza lo que hubiera.
|
|
306
|
+
*/
|
|
307
|
+
interface DnsRRSet {
|
|
308
|
+
name: string;
|
|
309
|
+
type: DnsRecordType;
|
|
310
|
+
ttl: number;
|
|
311
|
+
values: string[];
|
|
312
|
+
}
|
|
313
|
+
interface DnsRRSetAnotado extends DnsRRSet {
|
|
314
|
+
/** Lo pone MailMask para que el correo funcione. */
|
|
315
|
+
managed: boolean;
|
|
316
|
+
editable: boolean;
|
|
317
|
+
managedReason?: string;
|
|
318
|
+
/** Valores que hay que conservar aunque el registro sea editable (el SPF). */
|
|
319
|
+
protectedValues?: string[];
|
|
320
|
+
}
|
|
321
|
+
interface DnsZoneState {
|
|
322
|
+
status: "none" | "pending_delegation" | "active";
|
|
323
|
+
hostedZoneId?: string;
|
|
324
|
+
nameservers?: string[];
|
|
325
|
+
delegated?: boolean;
|
|
326
|
+
}
|
|
327
|
+
interface DnsListResponse {
|
|
328
|
+
zone: DnsZoneState;
|
|
329
|
+
records: DnsRRSetAnotado[];
|
|
330
|
+
/** Presente cuando todavía no hay zona: dice qué hacer. */
|
|
331
|
+
hint?: string;
|
|
332
|
+
}
|
|
333
|
+
interface DnsZoneCreated {
|
|
334
|
+
hostedZoneId: string;
|
|
335
|
+
nameservers: string[];
|
|
336
|
+
/** Lo que copiamos de tu proveedor anterior. Revísalo: puede faltar algo. */
|
|
337
|
+
imported: DnsRRSet[];
|
|
338
|
+
importWarning: string;
|
|
339
|
+
}
|
|
340
|
+
interface DnsDelegation {
|
|
341
|
+
delegated: boolean;
|
|
342
|
+
observed: string[];
|
|
343
|
+
expected: string[];
|
|
344
|
+
}
|
|
345
|
+
interface DnsImportResult {
|
|
346
|
+
found: DnsRRSet[];
|
|
347
|
+
nameservers: string[];
|
|
348
|
+
warning: string;
|
|
349
|
+
}
|
|
350
|
+
interface DnsChangeResult {
|
|
351
|
+
record?: DnsRRSet;
|
|
352
|
+
records?: DnsRRSet[];
|
|
353
|
+
changeId: string;
|
|
354
|
+
propagacion: string;
|
|
355
|
+
}
|
|
356
|
+
type DnsPreset = "vercel" | "netlify" | "github-pages" | "cloudflare-pages" | "render" | "fly" | "redirect-a-www" | "dmarc";
|
|
258
357
|
|
|
259
358
|
declare class MailMaskError extends Error {
|
|
260
359
|
status: number;
|
|
@@ -273,6 +372,7 @@ declare class MailMask {
|
|
|
273
372
|
webhooks: WebhooksResource;
|
|
274
373
|
smtp: SmtpResource;
|
|
275
374
|
apiKeys: ApiKeysResource;
|
|
375
|
+
dns: DnsResource;
|
|
276
376
|
constructor(config: MailMaskConfig);
|
|
277
377
|
}
|
|
278
378
|
type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
|
|
@@ -281,20 +381,44 @@ declare class DomainsResource {
|
|
|
281
381
|
constructor(req: Req);
|
|
282
382
|
list(): Promise<Domain[]>;
|
|
283
383
|
get(id: string): Promise<Domain>;
|
|
284
|
-
create(domain: string): Promise<
|
|
285
|
-
domain: Domain;
|
|
286
|
-
}>;
|
|
384
|
+
create(domain: string): Promise<DomainCreated>;
|
|
287
385
|
delete(id: string): Promise<{
|
|
288
386
|
ok: boolean;
|
|
289
387
|
}>;
|
|
290
388
|
health(id: string): Promise<Record<string, unknown>>;
|
|
291
389
|
verify(id: string): Promise<DomainVerification>;
|
|
292
390
|
}
|
|
391
|
+
declare class DnsResource {
|
|
392
|
+
private req;
|
|
393
|
+
constructor(req: Req);
|
|
394
|
+
list(domainId: string): Promise<DnsListResponse>;
|
|
395
|
+
createZone(domainId: string): Promise<DnsZoneCreated>;
|
|
396
|
+
delegation(domainId: string): Promise<DnsDelegation>;
|
|
397
|
+
import(domainId: string): Promise<DnsImportResult>;
|
|
398
|
+
/** Reemplaza el conjunto: `values` sustituye por completo lo que hubiera en ese nombre y tipo. */
|
|
399
|
+
upsert(domainId: string, record: {
|
|
400
|
+
name: string;
|
|
401
|
+
type: DnsRecordType;
|
|
402
|
+
values: string[];
|
|
403
|
+
ttl?: number;
|
|
404
|
+
}): Promise<DnsChangeResult>;
|
|
405
|
+
delete(domainId: string, name: string, type: DnsRecordType): Promise<{
|
|
406
|
+
ok: boolean;
|
|
407
|
+
changeId: string;
|
|
408
|
+
}>;
|
|
409
|
+
preset(domainId: string, preset: DnsPreset, target?: string, subdomain?: string): Promise<DnsChangeResult>;
|
|
410
|
+
}
|
|
293
411
|
declare class AliasesResource {
|
|
294
412
|
private req;
|
|
295
413
|
constructor(req: Req);
|
|
296
414
|
list(domainId: string): Promise<Alias[]>;
|
|
297
|
-
create(domainId: string, input: CreateAliasInput): Promise<
|
|
415
|
+
create(domainId: string, input: CreateAliasInput): Promise<AliasCreated>;
|
|
416
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
417
|
+
createMailbox(domainId: string, alias: string): Promise<MailboxCreated>;
|
|
418
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
419
|
+
deleteMailbox(domainId: string, alias: string): Promise<{
|
|
420
|
+
ok: boolean;
|
|
421
|
+
}>;
|
|
298
422
|
update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
|
|
299
423
|
delete(domainId: string, alias: string): Promise<{
|
|
300
424
|
ok: boolean;
|
|
@@ -394,4 +518,4 @@ interface WebhookSignatureHeaders {
|
|
|
394
518
|
*/
|
|
395
519
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
396
520
|
|
|
397
|
-
export { type Alias, type ApiKey, type AttachmentRef, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type CreateWebhookInput, type Domain, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
|
|
521
|
+
export { type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BulkJob, type BulkJobCreated, type BulkSendInput, 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 DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,24 @@ interface Domain {
|
|
|
20
20
|
/** Sólo en `domains.list`: tope de reenvíos por hora del plan. */
|
|
21
21
|
forwardPerHour?: number;
|
|
22
22
|
}
|
|
23
|
+
interface DnsRecord {
|
|
24
|
+
type: "MX" | "TXT" | "CNAME";
|
|
25
|
+
name: string;
|
|
26
|
+
value: string;
|
|
27
|
+
priority?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Respuesta de `domains.create`: el dominio y los registros DNS que hay que poner. */
|
|
30
|
+
interface DomainCreated {
|
|
31
|
+
domain: Domain;
|
|
32
|
+
/** true si es el 2.º dominio sin activar: se guarda pero no reenvía hasta activarlo ($99/mes). */
|
|
33
|
+
requiereActivacion: boolean;
|
|
34
|
+
dnsRecords: {
|
|
35
|
+
mx: DnsRecord;
|
|
36
|
+
verification: DnsRecord;
|
|
37
|
+
dkim: DnsRecord[];
|
|
38
|
+
spf: DnsRecord;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
23
41
|
/** Respuesta de `domains.verify`. */
|
|
24
42
|
interface DomainVerification {
|
|
25
43
|
domain: string;
|
|
@@ -38,11 +56,37 @@ interface Alias {
|
|
|
38
56
|
lastFrom?: string | null;
|
|
39
57
|
lastAt?: string | null;
|
|
40
58
|
createdAt: string;
|
|
59
|
+
/** true si la máscara guarda el correo en un buzón IMAP. */
|
|
60
|
+
mailboxEnabled?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** Credenciales de un buzón IMAP recién creado. La contraseña se muestra una sola vez. */
|
|
63
|
+
interface MailboxCreated {
|
|
64
|
+
email: string;
|
|
65
|
+
password: string;
|
|
66
|
+
quotaBytes: number;
|
|
67
|
+
imap: {
|
|
68
|
+
host: string;
|
|
69
|
+
port: number;
|
|
70
|
+
security: string;
|
|
71
|
+
};
|
|
72
|
+
smtp: {
|
|
73
|
+
host: string;
|
|
74
|
+
port: number;
|
|
75
|
+
security: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** `aliases.create`: el alias, y si pediste buzón, sus credenciales o por qué no se creó. */
|
|
79
|
+
interface AliasCreated extends Alias {
|
|
80
|
+
buzon?: MailboxCreated | null;
|
|
81
|
+
errorBuzon?: string | null;
|
|
41
82
|
}
|
|
42
83
|
interface CreateAliasInput {
|
|
43
84
|
/** Parte local, sin el dominio: "hola" para hola@tudominio.com. `*` para catch-all. */
|
|
44
85
|
alias: string;
|
|
45
|
-
|
|
86
|
+
/** Adónde reenviar. Puede ir vacío sólo si `mailbox` es true. */
|
|
87
|
+
destinations?: string[];
|
|
88
|
+
/** Crear también un buzón IMAP (requiere dominio activado). */
|
|
89
|
+
mailbox?: boolean;
|
|
46
90
|
}
|
|
47
91
|
interface UpdateAliasInput {
|
|
48
92
|
enabled?: boolean;
|
|
@@ -255,6 +299,61 @@ interface ApiKey {
|
|
|
255
299
|
lastUsedAt?: string;
|
|
256
300
|
createdAt: string;
|
|
257
301
|
}
|
|
302
|
+
type DnsRecordType = "A" | "AAAA" | "CNAME" | "TXT" | "MX" | "NS" | "CAA" | "SRV";
|
|
303
|
+
/**
|
|
304
|
+
* Un conjunto de registros con el mismo nombre y tipo. El DNS trabaja así, no con registros
|
|
305
|
+
* sueltos: `values` es la lista completa y al escribirla reemplaza lo que hubiera.
|
|
306
|
+
*/
|
|
307
|
+
interface DnsRRSet {
|
|
308
|
+
name: string;
|
|
309
|
+
type: DnsRecordType;
|
|
310
|
+
ttl: number;
|
|
311
|
+
values: string[];
|
|
312
|
+
}
|
|
313
|
+
interface DnsRRSetAnotado extends DnsRRSet {
|
|
314
|
+
/** Lo pone MailMask para que el correo funcione. */
|
|
315
|
+
managed: boolean;
|
|
316
|
+
editable: boolean;
|
|
317
|
+
managedReason?: string;
|
|
318
|
+
/** Valores que hay que conservar aunque el registro sea editable (el SPF). */
|
|
319
|
+
protectedValues?: string[];
|
|
320
|
+
}
|
|
321
|
+
interface DnsZoneState {
|
|
322
|
+
status: "none" | "pending_delegation" | "active";
|
|
323
|
+
hostedZoneId?: string;
|
|
324
|
+
nameservers?: string[];
|
|
325
|
+
delegated?: boolean;
|
|
326
|
+
}
|
|
327
|
+
interface DnsListResponse {
|
|
328
|
+
zone: DnsZoneState;
|
|
329
|
+
records: DnsRRSetAnotado[];
|
|
330
|
+
/** Presente cuando todavía no hay zona: dice qué hacer. */
|
|
331
|
+
hint?: string;
|
|
332
|
+
}
|
|
333
|
+
interface DnsZoneCreated {
|
|
334
|
+
hostedZoneId: string;
|
|
335
|
+
nameservers: string[];
|
|
336
|
+
/** Lo que copiamos de tu proveedor anterior. Revísalo: puede faltar algo. */
|
|
337
|
+
imported: DnsRRSet[];
|
|
338
|
+
importWarning: string;
|
|
339
|
+
}
|
|
340
|
+
interface DnsDelegation {
|
|
341
|
+
delegated: boolean;
|
|
342
|
+
observed: string[];
|
|
343
|
+
expected: string[];
|
|
344
|
+
}
|
|
345
|
+
interface DnsImportResult {
|
|
346
|
+
found: DnsRRSet[];
|
|
347
|
+
nameservers: string[];
|
|
348
|
+
warning: string;
|
|
349
|
+
}
|
|
350
|
+
interface DnsChangeResult {
|
|
351
|
+
record?: DnsRRSet;
|
|
352
|
+
records?: DnsRRSet[];
|
|
353
|
+
changeId: string;
|
|
354
|
+
propagacion: string;
|
|
355
|
+
}
|
|
356
|
+
type DnsPreset = "vercel" | "netlify" | "github-pages" | "cloudflare-pages" | "render" | "fly" | "redirect-a-www" | "dmarc";
|
|
258
357
|
|
|
259
358
|
declare class MailMaskError extends Error {
|
|
260
359
|
status: number;
|
|
@@ -273,6 +372,7 @@ declare class MailMask {
|
|
|
273
372
|
webhooks: WebhooksResource;
|
|
274
373
|
smtp: SmtpResource;
|
|
275
374
|
apiKeys: ApiKeysResource;
|
|
375
|
+
dns: DnsResource;
|
|
276
376
|
constructor(config: MailMaskConfig);
|
|
277
377
|
}
|
|
278
378
|
type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
|
|
@@ -281,20 +381,44 @@ declare class DomainsResource {
|
|
|
281
381
|
constructor(req: Req);
|
|
282
382
|
list(): Promise<Domain[]>;
|
|
283
383
|
get(id: string): Promise<Domain>;
|
|
284
|
-
create(domain: string): Promise<
|
|
285
|
-
domain: Domain;
|
|
286
|
-
}>;
|
|
384
|
+
create(domain: string): Promise<DomainCreated>;
|
|
287
385
|
delete(id: string): Promise<{
|
|
288
386
|
ok: boolean;
|
|
289
387
|
}>;
|
|
290
388
|
health(id: string): Promise<Record<string, unknown>>;
|
|
291
389
|
verify(id: string): Promise<DomainVerification>;
|
|
292
390
|
}
|
|
391
|
+
declare class DnsResource {
|
|
392
|
+
private req;
|
|
393
|
+
constructor(req: Req);
|
|
394
|
+
list(domainId: string): Promise<DnsListResponse>;
|
|
395
|
+
createZone(domainId: string): Promise<DnsZoneCreated>;
|
|
396
|
+
delegation(domainId: string): Promise<DnsDelegation>;
|
|
397
|
+
import(domainId: string): Promise<DnsImportResult>;
|
|
398
|
+
/** Reemplaza el conjunto: `values` sustituye por completo lo que hubiera en ese nombre y tipo. */
|
|
399
|
+
upsert(domainId: string, record: {
|
|
400
|
+
name: string;
|
|
401
|
+
type: DnsRecordType;
|
|
402
|
+
values: string[];
|
|
403
|
+
ttl?: number;
|
|
404
|
+
}): Promise<DnsChangeResult>;
|
|
405
|
+
delete(domainId: string, name: string, type: DnsRecordType): Promise<{
|
|
406
|
+
ok: boolean;
|
|
407
|
+
changeId: string;
|
|
408
|
+
}>;
|
|
409
|
+
preset(domainId: string, preset: DnsPreset, target?: string, subdomain?: string): Promise<DnsChangeResult>;
|
|
410
|
+
}
|
|
293
411
|
declare class AliasesResource {
|
|
294
412
|
private req;
|
|
295
413
|
constructor(req: Req);
|
|
296
414
|
list(domainId: string): Promise<Alias[]>;
|
|
297
|
-
create(domainId: string, input: CreateAliasInput): Promise<
|
|
415
|
+
create(domainId: string, input: CreateAliasInput): Promise<AliasCreated>;
|
|
416
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
417
|
+
createMailbox(domainId: string, alias: string): Promise<MailboxCreated>;
|
|
418
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
419
|
+
deleteMailbox(domainId: string, alias: string): Promise<{
|
|
420
|
+
ok: boolean;
|
|
421
|
+
}>;
|
|
298
422
|
update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
|
|
299
423
|
delete(domainId: string, alias: string): Promise<{
|
|
300
424
|
ok: boolean;
|
|
@@ -394,4 +518,4 @@ interface WebhookSignatureHeaders {
|
|
|
394
518
|
*/
|
|
395
519
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
396
520
|
|
|
397
|
-
export { type Alias, type ApiKey, type AttachmentRef, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type CreateWebhookInput, type Domain, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
|
|
521
|
+
export { type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BulkJob, type BulkJobCreated, type BulkSendInput, 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 DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var MailMask = class {
|
|
|
32
32
|
this.webhooks = new WebhooksResource(req);
|
|
33
33
|
this.smtp = new SmtpResource(req);
|
|
34
34
|
this.apiKeys = new ApiKeysResource(req);
|
|
35
|
+
this.dns = new DnsResource(req);
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
38
|
var DomainsResource = class {
|
|
@@ -57,6 +58,33 @@ var DomainsResource = class {
|
|
|
57
58
|
return this.req(`/api/domains/${id}/verify`, { method: "POST" });
|
|
58
59
|
}
|
|
59
60
|
};
|
|
61
|
+
var DnsResource = class {
|
|
62
|
+
constructor(req) {
|
|
63
|
+
this.req = req;
|
|
64
|
+
}
|
|
65
|
+
list(domainId) {
|
|
66
|
+
return this.req(`/api/domains/${domainId}/dns`);
|
|
67
|
+
}
|
|
68
|
+
createZone(domainId) {
|
|
69
|
+
return this.req(`/api/domains/${domainId}/dns/zone`, { method: "POST" });
|
|
70
|
+
}
|
|
71
|
+
delegation(domainId) {
|
|
72
|
+
return this.req(`/api/domains/${domainId}/dns/delegation`);
|
|
73
|
+
}
|
|
74
|
+
import(domainId) {
|
|
75
|
+
return this.req(`/api/domains/${domainId}/dns/import`, { method: "POST" });
|
|
76
|
+
}
|
|
77
|
+
/** Reemplaza el conjunto: `values` sustituye por completo lo que hubiera en ese nombre y tipo. */
|
|
78
|
+
upsert(domainId, record) {
|
|
79
|
+
return this.req(`/api/domains/${domainId}/dns/records`, { method: "PUT", body: JSON.stringify(record) });
|
|
80
|
+
}
|
|
81
|
+
delete(domainId, name, type) {
|
|
82
|
+
return this.req(`/api/domains/${domainId}/dns/records`, { method: "DELETE", body: JSON.stringify({ name, type }) });
|
|
83
|
+
}
|
|
84
|
+
preset(domainId, preset, target, subdomain) {
|
|
85
|
+
return this.req(`/api/domains/${domainId}/dns/preset`, { method: "POST", body: JSON.stringify({ preset, target, subdomain }) });
|
|
86
|
+
}
|
|
87
|
+
};
|
|
60
88
|
var AliasesResource = class {
|
|
61
89
|
constructor(req) {
|
|
62
90
|
this.req = req;
|
|
@@ -65,7 +93,15 @@ var AliasesResource = class {
|
|
|
65
93
|
return this.req(`/api/domains/${domainId}/alias`);
|
|
66
94
|
}
|
|
67
95
|
create(domainId, input) {
|
|
68
|
-
return this.req(`/api/domains/${domainId}/alias`, { method: "POST", body: JSON.stringify(input) });
|
|
96
|
+
return this.req(`/api/domains/${domainId}/alias`, { method: "POST", body: JSON.stringify({ ...input, destinations: input.destinations ?? [] }) });
|
|
97
|
+
}
|
|
98
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
99
|
+
createMailbox(domainId, alias) {
|
|
100
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "POST" });
|
|
101
|
+
}
|
|
102
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
103
|
+
deleteMailbox(domainId, alias) {
|
|
104
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "DELETE" });
|
|
69
105
|
}
|
|
70
106
|
update(domainId, alias, input) {
|
|
71
107
|
return this.req(`/api/domains/${domainId}/alias/${alias}`, { method: "PUT", body: JSON.stringify(input) });
|