@easybits.cloud/mailmask 0.2.1 → 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 +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +35 -13
- package/dist/index.d.ts +35 -13
- package/dist/index.js +4 -2
- package/package.json +1 -1
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
|
-
|
|
128
|
-
|
|
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,12 @@ 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;
|
|
17
22
|
}
|
|
18
23
|
/** Respuesta de `domains.verify`. */
|
|
19
24
|
interface DomainVerification {
|
|
@@ -30,6 +35,8 @@ interface Alias {
|
|
|
30
35
|
destinations: string[];
|
|
31
36
|
enabled: boolean;
|
|
32
37
|
forwardCount: number;
|
|
38
|
+
lastFrom?: string | null;
|
|
39
|
+
lastAt?: string | null;
|
|
33
40
|
createdAt: string;
|
|
34
41
|
}
|
|
35
42
|
interface CreateAliasInput {
|
|
@@ -41,31 +48,38 @@ interface UpdateAliasInput {
|
|
|
41
48
|
enabled?: boolean;
|
|
42
49
|
destinations?: string[];
|
|
43
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";
|
|
44
55
|
interface Rule {
|
|
45
56
|
id: string;
|
|
46
57
|
domainId: string;
|
|
47
|
-
field:
|
|
48
|
-
match:
|
|
58
|
+
field: RuleField;
|
|
59
|
+
match: RuleMatch;
|
|
49
60
|
value: string;
|
|
50
|
-
action:
|
|
61
|
+
action: RuleAction;
|
|
51
62
|
target: string;
|
|
52
63
|
priority: number;
|
|
53
64
|
enabled: boolean;
|
|
54
65
|
createdAt: string;
|
|
55
66
|
}
|
|
56
67
|
interface CreateRuleInput {
|
|
57
|
-
field:
|
|
58
|
-
|
|
68
|
+
field: RuleField;
|
|
69
|
+
/** Los patrones `regex` se validan al guardar: uno peligroso responde 400. */
|
|
70
|
+
match: RuleMatch;
|
|
59
71
|
value: string;
|
|
60
|
-
action:
|
|
61
|
-
|
|
72
|
+
action: RuleAction;
|
|
73
|
+
/** Destino del `forward` o URL del `webhook`. Se ignora con `discard`. */
|
|
74
|
+
target?: string;
|
|
62
75
|
priority?: number;
|
|
76
|
+
enabled?: boolean;
|
|
63
77
|
}
|
|
64
78
|
interface UpdateRuleInput {
|
|
65
|
-
field?:
|
|
66
|
-
match?:
|
|
79
|
+
field?: RuleField;
|
|
80
|
+
match?: RuleMatch;
|
|
67
81
|
value?: string;
|
|
68
|
-
action?:
|
|
82
|
+
action?: RuleAction;
|
|
69
83
|
target?: string;
|
|
70
84
|
priority?: number;
|
|
71
85
|
enabled?: boolean;
|
|
@@ -79,14 +93,16 @@ interface EmailLog {
|
|
|
79
93
|
subject: string;
|
|
80
94
|
status: string;
|
|
81
95
|
forwardedTo: string;
|
|
96
|
+
sizeBytes: number;
|
|
82
97
|
error?: string;
|
|
83
98
|
}
|
|
84
99
|
interface SendEmailInput {
|
|
85
100
|
to: string;
|
|
86
101
|
subject: string;
|
|
87
|
-
/** Al menos uno de `html` o `
|
|
102
|
+
/** Al menos uno de `html`, `body` o `markdown`. Con html y body se manda multipart. HTML máx. 100 KB. */
|
|
88
103
|
html?: string;
|
|
89
104
|
body?: string;
|
|
105
|
+
markdown?: string;
|
|
90
106
|
replyTo?: string;
|
|
91
107
|
/**
|
|
92
108
|
* Parte local de un alias **activo** del dominio. Sin esto el correo sale
|
|
@@ -150,6 +166,8 @@ interface SmtpCredentialCreated {
|
|
|
150
166
|
interface ApiKey {
|
|
151
167
|
id: string;
|
|
152
168
|
name: string;
|
|
169
|
+
/** Primeros caracteres de la llave, para identificarla en listados. */
|
|
170
|
+
keyPrefix: string;
|
|
153
171
|
lastUsedAt?: string;
|
|
154
172
|
createdAt: string;
|
|
155
173
|
}
|
|
@@ -208,12 +226,16 @@ declare class RulesResource {
|
|
|
208
226
|
declare class LogsResource {
|
|
209
227
|
private req;
|
|
210
228
|
constructor(req: Req);
|
|
211
|
-
|
|
229
|
+
/** `limit` por omisión 50, máximo 100. */
|
|
230
|
+
list(domainId: string, opts?: {
|
|
231
|
+
limit?: number;
|
|
232
|
+
}): Promise<EmailLog[]>;
|
|
212
233
|
}
|
|
213
234
|
declare class SendResource {
|
|
214
235
|
private req;
|
|
215
236
|
constructor(req: Req);
|
|
216
237
|
send(domainId: string, input: SendEmailInput): Promise<{
|
|
238
|
+
ok: boolean;
|
|
217
239
|
messageId: string;
|
|
218
240
|
}>;
|
|
219
241
|
bulkSend(domainId: string, input: BulkSendInput): Promise<BulkJobCreated>;
|
|
@@ -240,4 +262,4 @@ declare class ApiKeysResource {
|
|
|
240
262
|
}>;
|
|
241
263
|
}
|
|
242
264
|
|
|
243
|
-
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 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,12 @@ 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;
|
|
17
22
|
}
|
|
18
23
|
/** Respuesta de `domains.verify`. */
|
|
19
24
|
interface DomainVerification {
|
|
@@ -30,6 +35,8 @@ interface Alias {
|
|
|
30
35
|
destinations: string[];
|
|
31
36
|
enabled: boolean;
|
|
32
37
|
forwardCount: number;
|
|
38
|
+
lastFrom?: string | null;
|
|
39
|
+
lastAt?: string | null;
|
|
33
40
|
createdAt: string;
|
|
34
41
|
}
|
|
35
42
|
interface CreateAliasInput {
|
|
@@ -41,31 +48,38 @@ interface UpdateAliasInput {
|
|
|
41
48
|
enabled?: boolean;
|
|
42
49
|
destinations?: string[];
|
|
43
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";
|
|
44
55
|
interface Rule {
|
|
45
56
|
id: string;
|
|
46
57
|
domainId: string;
|
|
47
|
-
field:
|
|
48
|
-
match:
|
|
58
|
+
field: RuleField;
|
|
59
|
+
match: RuleMatch;
|
|
49
60
|
value: string;
|
|
50
|
-
action:
|
|
61
|
+
action: RuleAction;
|
|
51
62
|
target: string;
|
|
52
63
|
priority: number;
|
|
53
64
|
enabled: boolean;
|
|
54
65
|
createdAt: string;
|
|
55
66
|
}
|
|
56
67
|
interface CreateRuleInput {
|
|
57
|
-
field:
|
|
58
|
-
|
|
68
|
+
field: RuleField;
|
|
69
|
+
/** Los patrones `regex` se validan al guardar: uno peligroso responde 400. */
|
|
70
|
+
match: RuleMatch;
|
|
59
71
|
value: string;
|
|
60
|
-
action:
|
|
61
|
-
|
|
72
|
+
action: RuleAction;
|
|
73
|
+
/** Destino del `forward` o URL del `webhook`. Se ignora con `discard`. */
|
|
74
|
+
target?: string;
|
|
62
75
|
priority?: number;
|
|
76
|
+
enabled?: boolean;
|
|
63
77
|
}
|
|
64
78
|
interface UpdateRuleInput {
|
|
65
|
-
field?:
|
|
66
|
-
match?:
|
|
79
|
+
field?: RuleField;
|
|
80
|
+
match?: RuleMatch;
|
|
67
81
|
value?: string;
|
|
68
|
-
action?:
|
|
82
|
+
action?: RuleAction;
|
|
69
83
|
target?: string;
|
|
70
84
|
priority?: number;
|
|
71
85
|
enabled?: boolean;
|
|
@@ -79,14 +93,16 @@ interface EmailLog {
|
|
|
79
93
|
subject: string;
|
|
80
94
|
status: string;
|
|
81
95
|
forwardedTo: string;
|
|
96
|
+
sizeBytes: number;
|
|
82
97
|
error?: string;
|
|
83
98
|
}
|
|
84
99
|
interface SendEmailInput {
|
|
85
100
|
to: string;
|
|
86
101
|
subject: string;
|
|
87
|
-
/** Al menos uno de `html` o `
|
|
102
|
+
/** Al menos uno de `html`, `body` o `markdown`. Con html y body se manda multipart. HTML máx. 100 KB. */
|
|
88
103
|
html?: string;
|
|
89
104
|
body?: string;
|
|
105
|
+
markdown?: string;
|
|
90
106
|
replyTo?: string;
|
|
91
107
|
/**
|
|
92
108
|
* Parte local de un alias **activo** del dominio. Sin esto el correo sale
|
|
@@ -150,6 +166,8 @@ interface SmtpCredentialCreated {
|
|
|
150
166
|
interface ApiKey {
|
|
151
167
|
id: string;
|
|
152
168
|
name: string;
|
|
169
|
+
/** Primeros caracteres de la llave, para identificarla en listados. */
|
|
170
|
+
keyPrefix: string;
|
|
153
171
|
lastUsedAt?: string;
|
|
154
172
|
createdAt: string;
|
|
155
173
|
}
|
|
@@ -208,12 +226,16 @@ declare class RulesResource {
|
|
|
208
226
|
declare class LogsResource {
|
|
209
227
|
private req;
|
|
210
228
|
constructor(req: Req);
|
|
211
|
-
|
|
229
|
+
/** `limit` por omisión 50, máximo 100. */
|
|
230
|
+
list(domainId: string, opts?: {
|
|
231
|
+
limit?: number;
|
|
232
|
+
}): Promise<EmailLog[]>;
|
|
212
233
|
}
|
|
213
234
|
declare class SendResource {
|
|
214
235
|
private req;
|
|
215
236
|
constructor(req: Req);
|
|
216
237
|
send(domainId: string, input: SendEmailInput): Promise<{
|
|
238
|
+
ok: boolean;
|
|
217
239
|
messageId: string;
|
|
218
240
|
}>;
|
|
219
241
|
bulkSend(domainId: string, input: BulkSendInput): Promise<BulkJobCreated>;
|
|
@@ -240,4 +262,4 @@ declare class ApiKeysResource {
|
|
|
240
262
|
}>;
|
|
241
263
|
}
|
|
242
264
|
|
|
243
|
-
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 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
|
-
|
|
101
|
-
|
|
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 {
|