@easybits.cloud/mailmask 0.3.2 → 0.3.3
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 +9 -1
- package/dist/index.d.cts +54 -6
- package/dist/index.d.ts +54 -6
- package/dist/index.js +9 -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
|
@@ -93,7 +93,15 @@ var AliasesResource = class {
|
|
|
93
93
|
return this.req(`/api/domains/${domainId}/alias`);
|
|
94
94
|
}
|
|
95
95
|
create(domainId, input) {
|
|
96
|
-
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" });
|
|
97
105
|
}
|
|
98
106
|
update(domainId, alias, input) {
|
|
99
107
|
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;
|
|
@@ -281,9 +325,7 @@ declare class DomainsResource {
|
|
|
281
325
|
constructor(req: Req);
|
|
282
326
|
list(): Promise<Domain[]>;
|
|
283
327
|
get(id: string): Promise<Domain>;
|
|
284
|
-
create(domain: string): Promise<
|
|
285
|
-
domain: Domain;
|
|
286
|
-
}>;
|
|
328
|
+
create(domain: string): Promise<DomainCreated>;
|
|
287
329
|
delete(id: string): Promise<{
|
|
288
330
|
ok: boolean;
|
|
289
331
|
}>;
|
|
@@ -294,7 +336,13 @@ declare class AliasesResource {
|
|
|
294
336
|
private req;
|
|
295
337
|
constructor(req: Req);
|
|
296
338
|
list(domainId: string): Promise<Alias[]>;
|
|
297
|
-
create(domainId: string, input: CreateAliasInput): Promise<
|
|
339
|
+
create(domainId: string, input: CreateAliasInput): Promise<AliasCreated>;
|
|
340
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
341
|
+
createMailbox(domainId: string, alias: string): Promise<MailboxCreated>;
|
|
342
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
343
|
+
deleteMailbox(domainId: string, alias: string): Promise<{
|
|
344
|
+
ok: boolean;
|
|
345
|
+
}>;
|
|
298
346
|
update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
|
|
299
347
|
delete(domainId: string, alias: string): Promise<{
|
|
300
348
|
ok: boolean;
|
|
@@ -394,4 +442,4 @@ interface WebhookSignatureHeaders {
|
|
|
394
442
|
*/
|
|
395
443
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
396
444
|
|
|
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 };
|
|
445
|
+
export { type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type CreateWebhookInput, type DnsRecord, 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;
|
|
@@ -281,9 +325,7 @@ declare class DomainsResource {
|
|
|
281
325
|
constructor(req: Req);
|
|
282
326
|
list(): Promise<Domain[]>;
|
|
283
327
|
get(id: string): Promise<Domain>;
|
|
284
|
-
create(domain: string): Promise<
|
|
285
|
-
domain: Domain;
|
|
286
|
-
}>;
|
|
328
|
+
create(domain: string): Promise<DomainCreated>;
|
|
287
329
|
delete(id: string): Promise<{
|
|
288
330
|
ok: boolean;
|
|
289
331
|
}>;
|
|
@@ -294,7 +336,13 @@ declare class AliasesResource {
|
|
|
294
336
|
private req;
|
|
295
337
|
constructor(req: Req);
|
|
296
338
|
list(domainId: string): Promise<Alias[]>;
|
|
297
|
-
create(domainId: string, input: CreateAliasInput): Promise<
|
|
339
|
+
create(domainId: string, input: CreateAliasInput): Promise<AliasCreated>;
|
|
340
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
341
|
+
createMailbox(domainId: string, alias: string): Promise<MailboxCreated>;
|
|
342
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
343
|
+
deleteMailbox(domainId: string, alias: string): Promise<{
|
|
344
|
+
ok: boolean;
|
|
345
|
+
}>;
|
|
298
346
|
update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
|
|
299
347
|
delete(domainId: string, alias: string): Promise<{
|
|
300
348
|
ok: boolean;
|
|
@@ -394,4 +442,4 @@ interface WebhookSignatureHeaders {
|
|
|
394
442
|
*/
|
|
395
443
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
396
444
|
|
|
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 };
|
|
445
|
+
export { type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type CreateWebhookInput, type DnsRecord, 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
|
@@ -65,7 +65,15 @@ var AliasesResource = class {
|
|
|
65
65
|
return this.req(`/api/domains/${domainId}/alias`);
|
|
66
66
|
}
|
|
67
67
|
create(domainId, input) {
|
|
68
|
-
return this.req(`/api/domains/${domainId}/alias`, { method: "POST", body: JSON.stringify(input) });
|
|
68
|
+
return this.req(`/api/domains/${domainId}/alias`, { method: "POST", body: JSON.stringify({ ...input, destinations: input.destinations ?? [] }) });
|
|
69
|
+
}
|
|
70
|
+
/** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
|
|
71
|
+
createMailbox(domainId, alias) {
|
|
72
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "POST" });
|
|
73
|
+
}
|
|
74
|
+
/** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
|
|
75
|
+
deleteMailbox(domainId, alias) {
|
|
76
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "DELETE" });
|
|
69
77
|
}
|
|
70
78
|
update(domainId, alias, input) {
|
|
71
79
|
return this.req(`/api/domains/${domainId}/alias/${alias}`, { method: "PUT", body: JSON.stringify(input) });
|