@easybits.cloud/mailmask 0.4.2 → 0.4.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/dist/index.cjs +26 -0
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +26 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -75,6 +75,7 @@ var MailMask = class {
|
|
|
75
75
|
this.members = new MembersResource(req);
|
|
76
76
|
this.signature = new SignatureResource(req);
|
|
77
77
|
this.canned = new CannedResource(req);
|
|
78
|
+
this.account = new AccountResource(req);
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
var DomainsResource = class {
|
|
@@ -400,6 +401,31 @@ var CannedResource = class {
|
|
|
400
401
|
return this.req(`/api/domains/${domainId}/canned/${cannedId}`, { method: "DELETE" });
|
|
401
402
|
}
|
|
402
403
|
};
|
|
404
|
+
var AccountResource = class {
|
|
405
|
+
constructor(req) {
|
|
406
|
+
this.req = req;
|
|
407
|
+
}
|
|
408
|
+
getProfile() {
|
|
409
|
+
return this.req("/api/profile");
|
|
410
|
+
}
|
|
411
|
+
/** Nombre visible (máx. 60 caracteres). Cadena vacía lo borra. */
|
|
412
|
+
updateProfile(input) {
|
|
413
|
+
return this.req("/api/profile", { method: "PUT", body: JSON.stringify(input) });
|
|
414
|
+
}
|
|
415
|
+
/** Foto desde un adjunto que el usuario subió al asistente (URL firmada de `/api/asistente/files/*`). */
|
|
416
|
+
setAvatarFromUrl(url) {
|
|
417
|
+
return this.req("/api/profile/avatar", { method: "POST", body: JSON.stringify({ fromUrl: url }) });
|
|
418
|
+
}
|
|
419
|
+
/** Foto desde bytes (PNG, JPG o WebP; máx. 2 MB). */
|
|
420
|
+
setAvatar(file, filename = "avatar") {
|
|
421
|
+
const form = new FormData();
|
|
422
|
+
form.append("file", file, filename);
|
|
423
|
+
return this.req("/api/profile/avatar", { method: "POST", body: form });
|
|
424
|
+
}
|
|
425
|
+
removeAvatar() {
|
|
426
|
+
return this.req("/api/profile/avatar", { method: "DELETE" });
|
|
427
|
+
}
|
|
428
|
+
};
|
|
403
429
|
|
|
404
430
|
// src/verify.ts
|
|
405
431
|
function hex(buf) {
|
package/dist/index.d.cts
CHANGED
|
@@ -494,6 +494,9 @@ interface DomainMember {
|
|
|
494
494
|
name: string;
|
|
495
495
|
role: "admin" | "agent";
|
|
496
496
|
createdAt: string;
|
|
497
|
+
/** Del perfil de su cuenta de MailMask, si lo llenó. */
|
|
498
|
+
displayName?: string | null;
|
|
499
|
+
avatarUrl?: string | null;
|
|
497
500
|
}
|
|
498
501
|
interface DomainInvite {
|
|
499
502
|
token: string;
|
|
@@ -511,6 +514,13 @@ interface CannedReply {
|
|
|
511
514
|
body: string;
|
|
512
515
|
createdAt: string;
|
|
513
516
|
}
|
|
517
|
+
/** Perfil de la cuenta de MailMask (el usuario, no una máscara). */
|
|
518
|
+
interface AccountProfile {
|
|
519
|
+
email: string;
|
|
520
|
+
displayName: string | null;
|
|
521
|
+
/** Ruta relativa al host de MailMask (`/api/avatar/...`), o null sin foto. */
|
|
522
|
+
avatarUrl: string | null;
|
|
523
|
+
}
|
|
514
524
|
|
|
515
525
|
declare class MailMaskError extends Error {
|
|
516
526
|
status: number;
|
|
@@ -536,6 +546,7 @@ declare class MailMask {
|
|
|
536
546
|
members: MembersResource;
|
|
537
547
|
signature: SignatureResource;
|
|
538
548
|
canned: CannedResource;
|
|
549
|
+
account: AccountResource;
|
|
539
550
|
constructor(config: MailMaskConfig);
|
|
540
551
|
}
|
|
541
552
|
type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
|
|
@@ -779,6 +790,26 @@ declare class CannedResource {
|
|
|
779
790
|
ok: boolean;
|
|
780
791
|
}>;
|
|
781
792
|
}
|
|
793
|
+
declare class AccountResource {
|
|
794
|
+
private req;
|
|
795
|
+
constructor(req: Req);
|
|
796
|
+
getProfile(): Promise<AccountProfile>;
|
|
797
|
+
/** Nombre visible (máx. 60 caracteres). Cadena vacía lo borra. */
|
|
798
|
+
updateProfile(input: {
|
|
799
|
+
displayName: string | null;
|
|
800
|
+
}): Promise<AccountProfile>;
|
|
801
|
+
/** Foto desde un adjunto que el usuario subió al asistente (URL firmada de `/api/asistente/files/*`). */
|
|
802
|
+
setAvatarFromUrl(url: string): Promise<AccountProfile & {
|
|
803
|
+
ok: boolean;
|
|
804
|
+
}>;
|
|
805
|
+
/** Foto desde bytes (PNG, JPG o WebP; máx. 2 MB). */
|
|
806
|
+
setAvatar(file: Blob, filename?: string): Promise<AccountProfile & {
|
|
807
|
+
ok: boolean;
|
|
808
|
+
}>;
|
|
809
|
+
removeAvatar(): Promise<AccountProfile & {
|
|
810
|
+
ok: boolean;
|
|
811
|
+
}>;
|
|
812
|
+
}
|
|
782
813
|
|
|
783
814
|
interface WebhookSignatureHeaders {
|
|
784
815
|
/** Header `X-MailMask-Signature`, con forma `sha256=<hex>`. */
|
|
@@ -793,4 +824,4 @@ interface WebhookSignatureHeaders {
|
|
|
793
824
|
*/
|
|
794
825
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
795
826
|
|
|
796
|
-
export { type Addon, type AddonsResponse, type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BillingStatus, type BulkJob, type BulkJobCreated, type BulkSendInput, type CannedReply, type CheckoutLink, 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 DnsSetup, type DnsSetupRecord, type DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainInvite, type DomainMember, type DomainRegistration, type DomainRegistrationCreated, type DomainSearchResult, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type RenewalLink, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type TldPrice, type TransferCheck, type TransferDnsInventory, type TransferRequirement, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
|
|
827
|
+
export { type AccountProfile, type Addon, type AddonsResponse, type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BillingStatus, type BulkJob, type BulkJobCreated, type BulkSendInput, type CannedReply, type CheckoutLink, 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 DnsSetup, type DnsSetupRecord, type DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainInvite, type DomainMember, type DomainRegistration, type DomainRegistrationCreated, type DomainSearchResult, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type RenewalLink, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type TldPrice, type TransferCheck, type TransferDnsInventory, type TransferRequirement, 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
|
@@ -494,6 +494,9 @@ interface DomainMember {
|
|
|
494
494
|
name: string;
|
|
495
495
|
role: "admin" | "agent";
|
|
496
496
|
createdAt: string;
|
|
497
|
+
/** Del perfil de su cuenta de MailMask, si lo llenó. */
|
|
498
|
+
displayName?: string | null;
|
|
499
|
+
avatarUrl?: string | null;
|
|
497
500
|
}
|
|
498
501
|
interface DomainInvite {
|
|
499
502
|
token: string;
|
|
@@ -511,6 +514,13 @@ interface CannedReply {
|
|
|
511
514
|
body: string;
|
|
512
515
|
createdAt: string;
|
|
513
516
|
}
|
|
517
|
+
/** Perfil de la cuenta de MailMask (el usuario, no una máscara). */
|
|
518
|
+
interface AccountProfile {
|
|
519
|
+
email: string;
|
|
520
|
+
displayName: string | null;
|
|
521
|
+
/** Ruta relativa al host de MailMask (`/api/avatar/...`), o null sin foto. */
|
|
522
|
+
avatarUrl: string | null;
|
|
523
|
+
}
|
|
514
524
|
|
|
515
525
|
declare class MailMaskError extends Error {
|
|
516
526
|
status: number;
|
|
@@ -536,6 +546,7 @@ declare class MailMask {
|
|
|
536
546
|
members: MembersResource;
|
|
537
547
|
signature: SignatureResource;
|
|
538
548
|
canned: CannedResource;
|
|
549
|
+
account: AccountResource;
|
|
539
550
|
constructor(config: MailMaskConfig);
|
|
540
551
|
}
|
|
541
552
|
type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
|
|
@@ -779,6 +790,26 @@ declare class CannedResource {
|
|
|
779
790
|
ok: boolean;
|
|
780
791
|
}>;
|
|
781
792
|
}
|
|
793
|
+
declare class AccountResource {
|
|
794
|
+
private req;
|
|
795
|
+
constructor(req: Req);
|
|
796
|
+
getProfile(): Promise<AccountProfile>;
|
|
797
|
+
/** Nombre visible (máx. 60 caracteres). Cadena vacía lo borra. */
|
|
798
|
+
updateProfile(input: {
|
|
799
|
+
displayName: string | null;
|
|
800
|
+
}): Promise<AccountProfile>;
|
|
801
|
+
/** Foto desde un adjunto que el usuario subió al asistente (URL firmada de `/api/asistente/files/*`). */
|
|
802
|
+
setAvatarFromUrl(url: string): Promise<AccountProfile & {
|
|
803
|
+
ok: boolean;
|
|
804
|
+
}>;
|
|
805
|
+
/** Foto desde bytes (PNG, JPG o WebP; máx. 2 MB). */
|
|
806
|
+
setAvatar(file: Blob, filename?: string): Promise<AccountProfile & {
|
|
807
|
+
ok: boolean;
|
|
808
|
+
}>;
|
|
809
|
+
removeAvatar(): Promise<AccountProfile & {
|
|
810
|
+
ok: boolean;
|
|
811
|
+
}>;
|
|
812
|
+
}
|
|
782
813
|
|
|
783
814
|
interface WebhookSignatureHeaders {
|
|
784
815
|
/** Header `X-MailMask-Signature`, con forma `sha256=<hex>`. */
|
|
@@ -793,4 +824,4 @@ interface WebhookSignatureHeaders {
|
|
|
793
824
|
*/
|
|
794
825
|
declare function verifyWebhookSignature(secret: string, headers: WebhookSignatureHeaders, rawBody: string, toleranceMs?: number): Promise<boolean>;
|
|
795
826
|
|
|
796
|
-
export { type Addon, type AddonsResponse, type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BillingStatus, type BulkJob, type BulkJobCreated, type BulkSendInput, type CannedReply, type CheckoutLink, 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 DnsSetup, type DnsSetupRecord, type DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainInvite, type DomainMember, type DomainRegistration, type DomainRegistrationCreated, type DomainSearchResult, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type RenewalLink, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type TldPrice, type TransferCheck, type TransferDnsInventory, type TransferRequirement, type UpdateAliasInput, type UpdateRuleInput, type UpdateWebhookInput, type UploadAttachmentInput, type UploadedAttachment, type Webhook, type WebhookCreated, type WebhookDelivery, type WebhookEvent, type WebhookPayload, type WebhookSignatureHeaders, verifyWebhookSignature };
|
|
827
|
+
export { type AccountProfile, type Addon, type AddonsResponse, type Alias, type AliasCreated, type ApiKey, type AttachmentRef, type BillingStatus, type BulkJob, type BulkJobCreated, type BulkSendInput, type CannedReply, type CheckoutLink, 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 DnsSetup, type DnsSetupRecord, type DnsZoneCreated, type DnsZoneState, type Domain, type DomainCreated, type DomainInvite, type DomainMember, type DomainRegistration, type DomainRegistrationCreated, type DomainSearchResult, type DomainVerification, type EmailLog, MailMask, type MailMaskConfig, MailMaskError, type MailboxCreated, type RenewalLink, type Rule, type RuleAction, type RuleField, type RuleMatch, type SendEmailInput, type SendOptions, type SmtpCredential, type SmtpCredentialCreated, type Suppression, type TldPrice, type TransferCheck, type TransferDnsInventory, type TransferRequirement, 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
|
@@ -47,6 +47,7 @@ var MailMask = class {
|
|
|
47
47
|
this.members = new MembersResource(req);
|
|
48
48
|
this.signature = new SignatureResource(req);
|
|
49
49
|
this.canned = new CannedResource(req);
|
|
50
|
+
this.account = new AccountResource(req);
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
var DomainsResource = class {
|
|
@@ -372,6 +373,31 @@ var CannedResource = class {
|
|
|
372
373
|
return this.req(`/api/domains/${domainId}/canned/${cannedId}`, { method: "DELETE" });
|
|
373
374
|
}
|
|
374
375
|
};
|
|
376
|
+
var AccountResource = class {
|
|
377
|
+
constructor(req) {
|
|
378
|
+
this.req = req;
|
|
379
|
+
}
|
|
380
|
+
getProfile() {
|
|
381
|
+
return this.req("/api/profile");
|
|
382
|
+
}
|
|
383
|
+
/** Nombre visible (máx. 60 caracteres). Cadena vacía lo borra. */
|
|
384
|
+
updateProfile(input) {
|
|
385
|
+
return this.req("/api/profile", { method: "PUT", body: JSON.stringify(input) });
|
|
386
|
+
}
|
|
387
|
+
/** Foto desde un adjunto que el usuario subió al asistente (URL firmada de `/api/asistente/files/*`). */
|
|
388
|
+
setAvatarFromUrl(url) {
|
|
389
|
+
return this.req("/api/profile/avatar", { method: "POST", body: JSON.stringify({ fromUrl: url }) });
|
|
390
|
+
}
|
|
391
|
+
/** Foto desde bytes (PNG, JPG o WebP; máx. 2 MB). */
|
|
392
|
+
setAvatar(file, filename = "avatar") {
|
|
393
|
+
const form = new FormData();
|
|
394
|
+
form.append("file", file, filename);
|
|
395
|
+
return this.req("/api/profile/avatar", { method: "POST", body: form });
|
|
396
|
+
}
|
|
397
|
+
removeAvatar() {
|
|
398
|
+
return this.req("/api/profile/avatar", { method: "DELETE" });
|
|
399
|
+
}
|
|
400
|
+
};
|
|
375
401
|
|
|
376
402
|
// src/verify.ts
|
|
377
403
|
function hex(buf) {
|