@easybits.cloud/mailmask 0.3.3 → 0.4.1
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.cjs +32 -0
- package/dist/index.d.cts +81 -1
- package/dist/index.d.ts +81 -1
- package/dist/index.js +32 -0
- package/package.json +1 -1
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;
|
|
@@ -103,6 +131,10 @@ var AliasesResource = class {
|
|
|
103
131
|
deleteMailbox(domainId, alias) {
|
|
104
132
|
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "DELETE" });
|
|
105
133
|
}
|
|
134
|
+
/** Genera una contraseña nueva para el buzón. Sólo se devuelve aquí; no se guarda. */
|
|
135
|
+
resetMailboxPassword(domainId, alias) {
|
|
136
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox/password`, { method: "POST" });
|
|
137
|
+
}
|
|
106
138
|
update(domainId, alias, input) {
|
|
107
139
|
return this.req(`/api/domains/${domainId}/alias/${alias}`, { method: "PUT", body: JSON.stringify(input) });
|
|
108
140
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -299,6 +299,61 @@ interface ApiKey {
|
|
|
299
299
|
lastUsedAt?: string;
|
|
300
300
|
createdAt: string;
|
|
301
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";
|
|
302
357
|
|
|
303
358
|
declare class MailMaskError extends Error {
|
|
304
359
|
status: number;
|
|
@@ -317,6 +372,7 @@ declare class MailMask {
|
|
|
317
372
|
webhooks: WebhooksResource;
|
|
318
373
|
smtp: SmtpResource;
|
|
319
374
|
apiKeys: ApiKeysResource;
|
|
375
|
+
dns: DnsResource;
|
|
320
376
|
constructor(config: MailMaskConfig);
|
|
321
377
|
}
|
|
322
378
|
type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
|
|
@@ -332,6 +388,26 @@ declare class DomainsResource {
|
|
|
332
388
|
health(id: string): Promise<Record<string, unknown>>;
|
|
333
389
|
verify(id: string): Promise<DomainVerification>;
|
|
334
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
|
+
}
|
|
335
411
|
declare class AliasesResource {
|
|
336
412
|
private req;
|
|
337
413
|
constructor(req: Req);
|
|
@@ -343,6 +419,10 @@ declare class AliasesResource {
|
|
|
343
419
|
deleteMailbox(domainId: string, alias: string): Promise<{
|
|
344
420
|
ok: boolean;
|
|
345
421
|
}>;
|
|
422
|
+
/** Genera una contraseña nueva para el buzón. Sólo se devuelve aquí; no se guarda. */
|
|
423
|
+
resetMailboxPassword(domainId: string, alias: string): Promise<{
|
|
424
|
+
password: string;
|
|
425
|
+
}>;
|
|
346
426
|
update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
|
|
347
427
|
delete(domainId: string, alias: string): Promise<{
|
|
348
428
|
ok: boolean;
|
|
@@ -442,4 +522,4 @@ interface WebhookSignatureHeaders {
|
|
|
442
522
|
*/
|
|
443
523
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
444
524
|
|
|
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 };
|
|
525
|
+
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
|
@@ -299,6 +299,61 @@ interface ApiKey {
|
|
|
299
299
|
lastUsedAt?: string;
|
|
300
300
|
createdAt: string;
|
|
301
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";
|
|
302
357
|
|
|
303
358
|
declare class MailMaskError extends Error {
|
|
304
359
|
status: number;
|
|
@@ -317,6 +372,7 @@ declare class MailMask {
|
|
|
317
372
|
webhooks: WebhooksResource;
|
|
318
373
|
smtp: SmtpResource;
|
|
319
374
|
apiKeys: ApiKeysResource;
|
|
375
|
+
dns: DnsResource;
|
|
320
376
|
constructor(config: MailMaskConfig);
|
|
321
377
|
}
|
|
322
378
|
type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
|
|
@@ -332,6 +388,26 @@ declare class DomainsResource {
|
|
|
332
388
|
health(id: string): Promise<Record<string, unknown>>;
|
|
333
389
|
verify(id: string): Promise<DomainVerification>;
|
|
334
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
|
+
}
|
|
335
411
|
declare class AliasesResource {
|
|
336
412
|
private req;
|
|
337
413
|
constructor(req: Req);
|
|
@@ -343,6 +419,10 @@ declare class AliasesResource {
|
|
|
343
419
|
deleteMailbox(domainId: string, alias: string): Promise<{
|
|
344
420
|
ok: boolean;
|
|
345
421
|
}>;
|
|
422
|
+
/** Genera una contraseña nueva para el buzón. Sólo se devuelve aquí; no se guarda. */
|
|
423
|
+
resetMailboxPassword(domainId: string, alias: string): Promise<{
|
|
424
|
+
password: string;
|
|
425
|
+
}>;
|
|
346
426
|
update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
|
|
347
427
|
delete(domainId: string, alias: string): Promise<{
|
|
348
428
|
ok: boolean;
|
|
@@ -442,4 +522,4 @@ interface WebhookSignatureHeaders {
|
|
|
442
522
|
*/
|
|
443
523
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
444
524
|
|
|
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 };
|
|
525
|
+
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;
|
|
@@ -75,6 +103,10 @@ var AliasesResource = class {
|
|
|
75
103
|
deleteMailbox(domainId, alias) {
|
|
76
104
|
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox`, { method: "DELETE" });
|
|
77
105
|
}
|
|
106
|
+
/** Genera una contraseña nueva para el buzón. Sólo se devuelve aquí; no se guarda. */
|
|
107
|
+
resetMailboxPassword(domainId, alias) {
|
|
108
|
+
return this.req(`/api/domains/${domainId}/alias/${alias}/mailbox/password`, { method: "POST" });
|
|
109
|
+
}
|
|
78
110
|
update(domainId, alias, input) {
|
|
79
111
|
return this.req(`/api/domains/${domainId}/alias/${alias}`, { method: "PUT", body: JSON.stringify(input) });
|
|
80
112
|
}
|