@easybits.cloud/mailmask 0.2.0 → 0.2.2

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 CHANGED
@@ -31,7 +31,7 @@ await mm.send.send(domainId, {
31
31
  fromName: "Acme", // optional display name: Acme <hello@yourdomain.com>
32
32
  to: "client@example.com",
33
33
  subject: "Welcome!",
34
- html: "<p>Thanks for signing up.</p>",
34
+ html: "<p>Thanks for signing up.</p>", // or `body` (plain text) / `markdown`
35
35
  });
36
36
 
37
37
  // List aliases for a domain
package/dist/index.cjs CHANGED
@@ -124,8 +124,10 @@ var LogsResource = class {
124
124
  constructor(req) {
125
125
  this.req = req;
126
126
  }
127
- list(domainId) {
128
- return this.req(`/api/domains/${domainId}/logs`);
127
+ /** `limit` por omisión 50, máximo 100. */
128
+ list(domainId, opts) {
129
+ const qs = opts?.limit ? `?limit=${encodeURIComponent(opts.limit)}` : "";
130
+ return this.req(`/api/domains/${domainId}/logs${qs}`);
129
131
  }
130
132
  };
131
133
  var SendResource = class {
package/dist/index.d.cts CHANGED
@@ -13,7 +13,21 @@ interface Domain {
13
13
  domain: string;
14
14
  verified: boolean;
15
15
  mxConfigured: boolean;
16
+ registeredViaMailmask: boolean;
16
17
  createdAt: string;
18
+ /** Sólo en `domains.list`: reenvíos del mes en curso. */
19
+ monthlyForwards?: number;
20
+ /** Sólo en `domains.list`: tope de reenvíos por hora del plan. */
21
+ forwardPerHour?: number;
22
+ }
23
+ /** Respuesta de `domains.verify`. */
24
+ interface DomainVerification {
25
+ domain: string;
26
+ verified: boolean;
27
+ dkimVerified: boolean;
28
+ /** true cuando no se pudo consultar a SES: los campos son el último estado conocido. */
29
+ stale?: boolean;
30
+ error?: string;
17
31
  }
18
32
  interface Alias {
19
33
  alias: string;
@@ -21,6 +35,8 @@ interface Alias {
21
35
  destinations: string[];
22
36
  enabled: boolean;
23
37
  forwardCount: number;
38
+ lastFrom?: string | null;
39
+ lastAt?: string | null;
24
40
  createdAt: string;
25
41
  }
26
42
  interface CreateAliasInput {
@@ -32,31 +48,38 @@ interface UpdateAliasInput {
32
48
  enabled?: boolean;
33
49
  destinations?: string[];
34
50
  }
51
+ type RuleField = "to" | "from" | "subject";
52
+ type RuleMatch = "contains" | "equals" | "regex";
53
+ /** `forward` y `webhook` requieren `target`; `discard` no. */
54
+ type RuleAction = "forward" | "webhook" | "discard";
35
55
  interface Rule {
36
56
  id: string;
37
57
  domainId: string;
38
- field: "to" | "from" | "subject";
39
- match: string;
58
+ field: RuleField;
59
+ match: RuleMatch;
40
60
  value: string;
41
- action: string;
61
+ action: RuleAction;
42
62
  target: string;
43
63
  priority: number;
44
64
  enabled: boolean;
45
65
  createdAt: string;
46
66
  }
47
67
  interface CreateRuleInput {
48
- field: "to" | "from" | "subject";
49
- match: string;
68
+ field: RuleField;
69
+ /** Los patrones `regex` se validan al guardar: uno peligroso responde 400. */
70
+ match: RuleMatch;
50
71
  value: string;
51
- action: string;
52
- target: string;
72
+ action: RuleAction;
73
+ /** Destino del `forward` o URL del `webhook`. Se ignora con `discard`. */
74
+ target?: string;
53
75
  priority?: number;
76
+ enabled?: boolean;
54
77
  }
55
78
  interface UpdateRuleInput {
56
- field?: "to" | "from" | "subject";
57
- match?: string;
79
+ field?: RuleField;
80
+ match?: RuleMatch;
58
81
  value?: string;
59
- action?: string;
82
+ action?: RuleAction;
60
83
  target?: string;
61
84
  priority?: number;
62
85
  enabled?: boolean;
@@ -70,14 +93,16 @@ interface EmailLog {
70
93
  subject: string;
71
94
  status: string;
72
95
  forwardedTo: string;
96
+ sizeBytes: number;
73
97
  error?: string;
74
98
  }
75
99
  interface SendEmailInput {
76
100
  to: string;
77
101
  subject: string;
78
- /** Al menos uno de `html` o `body`. Con los dos se manda multipart. */
102
+ /** Al menos uno de `html`, `body` o `markdown`. Con html y body se manda multipart. HTML máx. 100 KB. */
79
103
  html?: string;
80
104
  body?: string;
105
+ markdown?: string;
81
106
  replyTo?: string;
82
107
  /**
83
108
  * Parte local de un alias **activo** del dominio. Sin esto el correo sale
@@ -141,6 +166,8 @@ interface SmtpCredentialCreated {
141
166
  interface ApiKey {
142
167
  id: string;
143
168
  name: string;
169
+ /** Primeros caracteres de la llave, para identificarla en listados. */
170
+ keyPrefix: string;
144
171
  lastUsedAt?: string;
145
172
  createdAt: string;
146
173
  }
@@ -174,7 +201,7 @@ declare class DomainsResource {
174
201
  ok: boolean;
175
202
  }>;
176
203
  health(id: string): Promise<Record<string, unknown>>;
177
- verify(id: string): Promise<Record<string, unknown>>;
204
+ verify(id: string): Promise<DomainVerification>;
178
205
  }
179
206
  declare class AliasesResource {
180
207
  private req;
@@ -199,12 +226,16 @@ declare class RulesResource {
199
226
  declare class LogsResource {
200
227
  private req;
201
228
  constructor(req: Req);
202
- list(domainId: string): Promise<EmailLog[]>;
229
+ /** `limit` por omisión 50, máximo 100. */
230
+ list(domainId: string, opts?: {
231
+ limit?: number;
232
+ }): Promise<EmailLog[]>;
203
233
  }
204
234
  declare class SendResource {
205
235
  private req;
206
236
  constructor(req: Req);
207
237
  send(domainId: string, input: SendEmailInput): Promise<{
238
+ ok: boolean;
208
239
  messageId: string;
209
240
  }>;
210
241
  bulkSend(domainId: string, input: BulkSendInput): Promise<BulkJobCreated>;
@@ -231,4 +262,4 @@ declare class ApiKeysResource {
231
262
  }>;
232
263
  }
233
264
 
234
- export { type Alias, type ApiKey, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type Domain, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type Rule, type SendEmailInput, type SmtpCredential, type SmtpCredentialCreated, type UpdateAliasInput, type UpdateRuleInput };
265
+ export { type Alias, type ApiKey, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type Domain, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SmtpCredential, type SmtpCredentialCreated, type UpdateAliasInput, type UpdateRuleInput };
package/dist/index.d.ts CHANGED
@@ -13,7 +13,21 @@ interface Domain {
13
13
  domain: string;
14
14
  verified: boolean;
15
15
  mxConfigured: boolean;
16
+ registeredViaMailmask: boolean;
16
17
  createdAt: string;
18
+ /** Sólo en `domains.list`: reenvíos del mes en curso. */
19
+ monthlyForwards?: number;
20
+ /** Sólo en `domains.list`: tope de reenvíos por hora del plan. */
21
+ forwardPerHour?: number;
22
+ }
23
+ /** Respuesta de `domains.verify`. */
24
+ interface DomainVerification {
25
+ domain: string;
26
+ verified: boolean;
27
+ dkimVerified: boolean;
28
+ /** true cuando no se pudo consultar a SES: los campos son el último estado conocido. */
29
+ stale?: boolean;
30
+ error?: string;
17
31
  }
18
32
  interface Alias {
19
33
  alias: string;
@@ -21,6 +35,8 @@ interface Alias {
21
35
  destinations: string[];
22
36
  enabled: boolean;
23
37
  forwardCount: number;
38
+ lastFrom?: string | null;
39
+ lastAt?: string | null;
24
40
  createdAt: string;
25
41
  }
26
42
  interface CreateAliasInput {
@@ -32,31 +48,38 @@ interface UpdateAliasInput {
32
48
  enabled?: boolean;
33
49
  destinations?: string[];
34
50
  }
51
+ type RuleField = "to" | "from" | "subject";
52
+ type RuleMatch = "contains" | "equals" | "regex";
53
+ /** `forward` y `webhook` requieren `target`; `discard` no. */
54
+ type RuleAction = "forward" | "webhook" | "discard";
35
55
  interface Rule {
36
56
  id: string;
37
57
  domainId: string;
38
- field: "to" | "from" | "subject";
39
- match: string;
58
+ field: RuleField;
59
+ match: RuleMatch;
40
60
  value: string;
41
- action: string;
61
+ action: RuleAction;
42
62
  target: string;
43
63
  priority: number;
44
64
  enabled: boolean;
45
65
  createdAt: string;
46
66
  }
47
67
  interface CreateRuleInput {
48
- field: "to" | "from" | "subject";
49
- match: string;
68
+ field: RuleField;
69
+ /** Los patrones `regex` se validan al guardar: uno peligroso responde 400. */
70
+ match: RuleMatch;
50
71
  value: string;
51
- action: string;
52
- target: string;
72
+ action: RuleAction;
73
+ /** Destino del `forward` o URL del `webhook`. Se ignora con `discard`. */
74
+ target?: string;
53
75
  priority?: number;
76
+ enabled?: boolean;
54
77
  }
55
78
  interface UpdateRuleInput {
56
- field?: "to" | "from" | "subject";
57
- match?: string;
79
+ field?: RuleField;
80
+ match?: RuleMatch;
58
81
  value?: string;
59
- action?: string;
82
+ action?: RuleAction;
60
83
  target?: string;
61
84
  priority?: number;
62
85
  enabled?: boolean;
@@ -70,14 +93,16 @@ interface EmailLog {
70
93
  subject: string;
71
94
  status: string;
72
95
  forwardedTo: string;
96
+ sizeBytes: number;
73
97
  error?: string;
74
98
  }
75
99
  interface SendEmailInput {
76
100
  to: string;
77
101
  subject: string;
78
- /** Al menos uno de `html` o `body`. Con los dos se manda multipart. */
102
+ /** Al menos uno de `html`, `body` o `markdown`. Con html y body se manda multipart. HTML máx. 100 KB. */
79
103
  html?: string;
80
104
  body?: string;
105
+ markdown?: string;
81
106
  replyTo?: string;
82
107
  /**
83
108
  * Parte local de un alias **activo** del dominio. Sin esto el correo sale
@@ -141,6 +166,8 @@ interface SmtpCredentialCreated {
141
166
  interface ApiKey {
142
167
  id: string;
143
168
  name: string;
169
+ /** Primeros caracteres de la llave, para identificarla en listados. */
170
+ keyPrefix: string;
144
171
  lastUsedAt?: string;
145
172
  createdAt: string;
146
173
  }
@@ -174,7 +201,7 @@ declare class DomainsResource {
174
201
  ok: boolean;
175
202
  }>;
176
203
  health(id: string): Promise<Record<string, unknown>>;
177
- verify(id: string): Promise<Record<string, unknown>>;
204
+ verify(id: string): Promise<DomainVerification>;
178
205
  }
179
206
  declare class AliasesResource {
180
207
  private req;
@@ -199,12 +226,16 @@ declare class RulesResource {
199
226
  declare class LogsResource {
200
227
  private req;
201
228
  constructor(req: Req);
202
- list(domainId: string): Promise<EmailLog[]>;
229
+ /** `limit` por omisión 50, máximo 100. */
230
+ list(domainId: string, opts?: {
231
+ limit?: number;
232
+ }): Promise<EmailLog[]>;
203
233
  }
204
234
  declare class SendResource {
205
235
  private req;
206
236
  constructor(req: Req);
207
237
  send(domainId: string, input: SendEmailInput): Promise<{
238
+ ok: boolean;
208
239
  messageId: string;
209
240
  }>;
210
241
  bulkSend(domainId: string, input: BulkSendInput): Promise<BulkJobCreated>;
@@ -231,4 +262,4 @@ declare class ApiKeysResource {
231
262
  }>;
232
263
  }
233
264
 
234
- export { type Alias, type ApiKey, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type Domain, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type Rule, type SendEmailInput, type SmtpCredential, type SmtpCredentialCreated, type UpdateAliasInput, type UpdateRuleInput };
265
+ export { type Alias, type ApiKey, type BulkJob, type BulkJobCreated, type BulkSendInput, type CreateAliasInput, type CreateRuleInput, type Domain, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SmtpCredential, type SmtpCredentialCreated, type UpdateAliasInput, type UpdateRuleInput };
package/dist/index.js CHANGED
@@ -97,8 +97,10 @@ var LogsResource = class {
97
97
  constructor(req) {
98
98
  this.req = req;
99
99
  }
100
- list(domainId) {
101
- return this.req(`/api/domains/${domainId}/logs`);
100
+ /** `limit` por omisión 50, máximo 100. */
101
+ list(domainId, opts) {
102
+ const qs = opts?.limit ? `?limit=${encodeURIComponent(opts.limit)}` : "";
103
+ return this.req(`/api/domains/${domainId}/logs${qs}`);
102
104
  }
103
105
  };
104
106
  var SendResource = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easybits.cloud/mailmask",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Official SDK for the MailMask email alias/forwarding API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",