@easybits.cloud/mailmask 0.4.8 → 0.4.10

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
@@ -81,6 +81,15 @@ import { verifyWebhookSignature } from "@easybits.cloud/mailmask";
81
81
  const ok = await verifyWebhookSignature(secret, { signature: req.headers["x-mailmask-signature"], timestamp: req.headers["x-mailmask-timestamp"] }, rawBody);
82
82
  ```
83
83
 
84
+ ## TypeScript
85
+
86
+ Los tipos publicados se pueden consumir desde **TypeScript 4.9 en adelante**, también con
87
+ `moduleResolution: node` (el clásico, sin `exports`). El paquete se compila con TypeScript 7, pero
88
+ el build baja la única sintaxis que un TS viejo no entiende (`export type *`, de TS 5.0) a su
89
+ equivalente (`scripts/postbuild-dts.mjs`): sin eso, un consumidor con TS ≤ 4.9 falla en su propia
90
+ compilación con `TS1383` y desde aquí no se nota. `npm run check:consumer` arma el paquete con
91
+ `npm pack` y lo compila en un proyecto con TypeScript 4.9.5 para confirmarlo.
92
+
84
93
  ## Docs
85
94
 
86
95
  Full API reference and examples: https://mailmask.studio/docs
@@ -0,0 +1,427 @@
1
+ import type { MailMaskConfig, Domain, DomainCreated, DomainVerification, Alias, AliasCreated, MailboxCreated, CreateAliasInput, UpdateAliasInput, Rule, CreateRuleInput, UpdateRuleInput, EmailLog, SendEmailInput, BulkSendInput, BulkJob, BulkJobCreated, SmtpCredential, SmtpCredentialCreated, ApiKey, SendOptions, UploadAttachmentInput, UploadedAttachment, Suppression, Webhook, WebhookCreated, CreateWebhookInput, UpdateWebhookInput, WebhookDelivery, DnsRecordType, DnsListResponse, DnsZoneCreated, DnsDelegation, DnsImportResult, DnsChangeResult, DnsPreset, DnsPresetPreview, DnsSetup, WebsiteStatus, PublishEasyBitsSiteInput, EasyBitsPublishResult, EasyBitsSiteStatus, EasyBitsUnpublishResult, BillingStatus, AddonsResponse, CheckoutLink, DomainSearchResult, TldPrice, DomainRegistrationCreated, DomainRegistration, TransferCheck, TransferDnsInventory, RenewalLink, DomainMember, DomainInvite, CannedReply, AccountProfile, AccountMe, AccountExport, InboxPage, InboxListOptions, InboxConversation, InboxConversationDetail, InboxComposeInput, InboxReplyInput, InboxUpdateInput, InboxNote, OrdersPage, ReferralStats, UploadedEmailImage } from "./types.js";
2
+ declare class MailMaskError extends Error {
3
+ status: number;
4
+ constructor(status: number, message: string);
5
+ }
6
+ export declare class MailMask {
7
+ private baseUrl;
8
+ private apiKey;
9
+ domains: DomainsResource;
10
+ /** Las direcciones del dominio (máscaras), con reenvío, buzón o ambos. */
11
+ addresses: AliasesResource;
12
+ /** @deprecated Usa `addresses`; es el mismo recurso y no se va a retirar. */
13
+ aliases: AliasesResource;
14
+ rules: RulesResource;
15
+ logs: LogsResource;
16
+ send: SendResource;
17
+ attachments: AttachmentsResource;
18
+ suppressions: SuppressionsResource;
19
+ webhooks: WebhooksResource;
20
+ smtp: SmtpResource;
21
+ apiKeys: ApiKeysResource;
22
+ dns: DnsResource;
23
+ billing: BillingResource;
24
+ registrations: RegistrationsResource;
25
+ transfers: TransfersResource;
26
+ members: MembersResource;
27
+ signature: SignatureResource;
28
+ canned: CannedResource;
29
+ account: AccountResource;
30
+ inbox: InboxResource;
31
+ referrals: ReferralsResource;
32
+ constructor(config: MailMaskConfig);
33
+ }
34
+ type Req = <T>(path: string, opts?: RequestInit) => Promise<T>;
35
+ declare class DomainsResource {
36
+ private req;
37
+ constructor(req: Req);
38
+ list(): Promise<Domain[]>;
39
+ get(id: string): Promise<Domain>;
40
+ create(domain: string): Promise<DomainCreated>;
41
+ delete(id: string): Promise<{
42
+ ok: boolean;
43
+ }>;
44
+ health(id: string): Promise<Record<string, unknown>>;
45
+ verify(id: string): Promise<DomainVerification>;
46
+ /** Registros a pegar en el registrador. Con `live` los compara con el DNS público y deduce el panel. */
47
+ dnsSetup(id: string, opts?: {
48
+ live?: boolean;
49
+ }): Promise<DnsSetup>;
50
+ /** Logo de la firma (PNG, JPG o WebP; máx. 500 KB). Se ve en todo correo en markdown. */
51
+ setLogo(id: string, file: Blob, filename?: string): Promise<{
52
+ ok: boolean;
53
+ logoUrl: string;
54
+ }>;
55
+ /** Logo desde un adjunto del chat del asistente (URL firmada de `/api/asistente/files/*`). */
56
+ setLogoFromUrl(id: string, url: string): Promise<{
57
+ ok: boolean;
58
+ logoUrl: string;
59
+ }>;
60
+ removeLogo(id: string): Promise<{
61
+ ok: boolean;
62
+ }>;
63
+ /**
64
+ * Publica un sitio de EasyBits en el dominio: lo da de alta en EasyBits, escribe sus
65
+ * registros (sin tocar el correo), verifica y, en la raíz, lo asigna. Requiere la cuenta
66
+ * de EasyBits conectada en el navegador; sin ella, 409 con la liga para conectarla.
67
+ */
68
+ publishEasyBitsSite(id: string, input: PublishEasyBitsSiteInput): Promise<EasyBitsPublishResult>;
69
+ /** Quita el sitio: el DNS vuelve a como estaba (lo que cambiaste después no se toca) y se limpia EasyBits. */
70
+ unpublishEasyBitsSite(id: string): Promise<EasyBitsUnpublishResult>;
71
+ /** Qué sitio de EasyBits está publicado en el dominio, si alguno, y si la cuenta está conectada. */
72
+ easyBitsSiteStatus(id: string): Promise<EasyBitsSiteStatus>;
73
+ /** Imagen para incrustar en un correo saliente (PNG, JPG, GIF o WebP; máx. 2 MB). Efímera: se borra tras enviarse o por el barrido diario. */
74
+ uploadImage(id: string, file: Blob, filename?: string): Promise<UploadedEmailImage>;
75
+ }
76
+ declare class DnsResource {
77
+ private req;
78
+ constructor(req: Req);
79
+ list(domainId: string): Promise<DnsListResponse>;
80
+ createZone(domainId: string): Promise<DnsZoneCreated>;
81
+ delegation(domainId: string): Promise<DnsDelegation>;
82
+ import(domainId: string): Promise<DnsImportResult>;
83
+ /** Reemplaza el conjunto: `values` sustituye por completo lo que hubiera en ese nombre y tipo. */
84
+ upsert(domainId: string, record: {
85
+ name: string;
86
+ type: DnsRecordType;
87
+ values: string[];
88
+ ttl?: number;
89
+ }): Promise<DnsChangeResult>;
90
+ delete(domainId: string, name: string, type: DnsRecordType): Promise<{
91
+ ok: boolean;
92
+ changeId: string;
93
+ }>;
94
+ /** Con 'easybits' publica un sitio de la cuenta conectada (`opts.websiteId`), igual que `domains.publishEasyBitsSite`. */
95
+ preset(domainId: string, preset: DnsPreset, target?: string, subdomain?: string, opts?: {
96
+ websiteId?: string;
97
+ placement?: "apex" | "subdomain";
98
+ }): Promise<DnsChangeResult>;
99
+ /** Vista previa de una plantilla: lo que escribiría y lo que hay hoy, sin tocar nada. */
100
+ presetPreview(domainId: string, preset: DnsPreset, target?: string, subdomain?: string, opts?: {
101
+ websiteId?: string;
102
+ placement?: "apex" | "subdomain";
103
+ }): Promise<DnsPresetPreview>;
104
+ /** A dónde apunta el sitio (raíz, www y subdominios), qué plataforma es, qué está mal y si responde por HTTPS. */
105
+ website(domainId: string): Promise<WebsiteStatus>;
106
+ }
107
+ declare class AliasesResource {
108
+ private req;
109
+ private raw;
110
+ constructor(req: Req, raw: (path: string) => Promise<Response>);
111
+ /** Perfil de configuración de Apple Mail (plist) para el buzón de una máscara. */
112
+ appleProfile(domainId: string, alias: string): Promise<string>;
113
+ /** Exporta el buzón en formato mbox. Devuelve la respuesta en streaming: un buzón puede pesar GB. */
114
+ exportMbox(domainId: string, alias: string): Promise<Response>;
115
+ list(domainId: string): Promise<Alias[]>;
116
+ create(domainId: string, input: CreateAliasInput): Promise<AliasCreated>;
117
+ /** Crea un buzón IMAP para una máscara existente. La contraseña sólo se devuelve aquí. */
118
+ createMailbox(domainId: string, alias: string): Promise<MailboxCreated>;
119
+ /** Borra el buzón Y SU CORREO. La máscara debe conservar al menos un destino. */
120
+ deleteMailbox(domainId: string, alias: string): Promise<{
121
+ ok: boolean;
122
+ }>;
123
+ /** Genera una contraseña nueva para el buzón. Sólo se devuelve aquí; no se guarda. */
124
+ resetMailboxPassword(domainId: string, alias: string): Promise<{
125
+ password: string;
126
+ }>;
127
+ update(domainId: string, alias: string, input: UpdateAliasInput): Promise<Alias>;
128
+ delete(domainId: string, alias: string): Promise<{
129
+ ok: boolean;
130
+ }>;
131
+ }
132
+ declare class RulesResource {
133
+ private req;
134
+ constructor(req: Req);
135
+ list(domainId: string): Promise<Rule[]>;
136
+ create(domainId: string, input: CreateRuleInput): Promise<Rule>;
137
+ update(domainId: string, ruleId: string, input: UpdateRuleInput): Promise<Rule>;
138
+ delete(domainId: string, ruleId: string): Promise<{
139
+ ok: boolean;
140
+ }>;
141
+ }
142
+ declare class LogsResource {
143
+ private req;
144
+ constructor(req: Req);
145
+ /** `limit` por omisión 50, máximo 100. */
146
+ list(domainId: string, opts?: {
147
+ limit?: number;
148
+ }): Promise<EmailLog[]>;
149
+ }
150
+ declare class SendResource {
151
+ private req;
152
+ constructor(req: Req);
153
+ send(domainId: string, input: SendEmailInput, opts?: SendOptions): Promise<{
154
+ ok: boolean;
155
+ messageId: string;
156
+ sesMessageId: string;
157
+ }>;
158
+ bulkSend(domainId: string, input: BulkSendInput): Promise<BulkJobCreated>;
159
+ bulkStatus(domainId: string, jobId: string): Promise<BulkJob>;
160
+ }
161
+ declare class AttachmentsResource {
162
+ private req;
163
+ constructor(req: Req);
164
+ /** Máx. 5 MB. Ejecutables bloqueados (415). La llave vale hasta que se envía. */
165
+ upload(domainId: string, input: UploadAttachmentInput): Promise<UploadedAttachment>;
166
+ /** Desde un adjunto del chat del asistente (URL firmada de `/api/asistente/files/*`). */
167
+ uploadFromUrl(domainId: string, url: string, filename?: string): Promise<UploadedAttachment>;
168
+ }
169
+ declare class SuppressionsResource {
170
+ private req;
171
+ constructor(req: Req);
172
+ list(domainId: string): Promise<Suppression[]>;
173
+ add(domainId: string, email: string): Promise<Suppression>;
174
+ remove(domainId: string, email: string): Promise<{
175
+ ok: boolean;
176
+ }>;
177
+ }
178
+ declare class WebhooksResource {
179
+ private req;
180
+ constructor(req: Req);
181
+ list(domainId: string): Promise<Webhook[]>;
182
+ create(domainId: string, input: CreateWebhookInput): Promise<WebhookCreated>;
183
+ update(domainId: string, webhookId: string, input: UpdateWebhookInput): Promise<Webhook>;
184
+ delete(domainId: string, webhookId: string): Promise<{
185
+ ok: boolean;
186
+ }>;
187
+ /** Encola un `ping`; llega en el siguiente minuto. */
188
+ test(domainId: string, webhookId: string): Promise<{
189
+ ok: boolean;
190
+ deliveryId: string;
191
+ }>;
192
+ deliveries(domainId: string, webhookId: string): Promise<WebhookDelivery[]>;
193
+ }
194
+ declare class SmtpResource {
195
+ private req;
196
+ constructor(req: Req);
197
+ list(domainId: string): Promise<SmtpCredential[]>;
198
+ create(domainId: string, label: string): Promise<SmtpCredentialCreated>;
199
+ revoke(domainId: string, credId: string): Promise<{
200
+ ok: boolean;
201
+ }>;
202
+ }
203
+ declare class ApiKeysResource {
204
+ private req;
205
+ constructor(req: Req);
206
+ list(): Promise<ApiKey[]>;
207
+ create(name: string): Promise<ApiKey & {
208
+ key: string;
209
+ }>;
210
+ revoke(id: string): Promise<{
211
+ ok: boolean;
212
+ }>;
213
+ }
214
+ declare class BillingResource {
215
+ private req;
216
+ constructor(req: Req);
217
+ status(): Promise<BillingStatus>;
218
+ addons(): Promise<AddonsResponse>;
219
+ /**
220
+ * Liga de MercadoPago para un add-on de un dominio (`domain` = activarlo, $99/mes).
221
+ * El usuario la abre y paga; hasta entonces no cambia nada.
222
+ */
223
+ checkout(domainId: string, kind?: "domain" | "storage50" | "sends100", opts?: {
224
+ payerEmail?: string;
225
+ period?: "monthly" | "annual";
226
+ }): Promise<CheckoutLink>;
227
+ /** Cancela la suscripción de un add-on; el cupo sigue hasta el fin del periodo pagado. */
228
+ cancelAddon(addonId: string): Promise<{
229
+ ok: boolean;
230
+ activeUntil: string | null;
231
+ }>;
232
+ /** Historial de cobros, cortesías y cancelaciones (más reciente primero). */
233
+ orders(opts?: {
234
+ limit?: number;
235
+ before?: string;
236
+ }): Promise<OrdersPage>;
237
+ }
238
+ declare class RegistrationsResource {
239
+ private req;
240
+ constructor(req: Req);
241
+ search(domain: string): Promise<DomainSearchResult>;
242
+ tlds(): Promise<TldPrice[]>;
243
+ /** Crea el registro pendiente y devuelve la liga de pago; el dominio se registra al pagar. */
244
+ register(domain: string): Promise<DomainRegistrationCreated>;
245
+ list(): Promise<DomainRegistration[]>;
246
+ /** Pide el traslado a otro registrador. El código EPP llega por correo al dueño, nunca en la respuesta. */
247
+ transferOut(regId: string): Promise<{
248
+ ok: boolean;
249
+ aviso: string;
250
+ }>;
251
+ /** Liga de MercadoPago para la suscripción de renovación anual. */
252
+ renewal(regId: string, opts?: {
253
+ payerEmail?: string;
254
+ }): Promise<RenewalLink>;
255
+ /** Deja de cobrar la renovación anual. El dominio sigue vigente hasta su vencimiento. */
256
+ cancelRenewal(regId: string): Promise<{
257
+ ok: boolean;
258
+ aviso: string;
259
+ }>;
260
+ /**
261
+ * Pone el candado de transferencia. Quitarlo no está en el SDK a propósito: sólo se hace
262
+ * desde el panel, con la sesión del dueño y confirmando por correo.
263
+ */
264
+ lock(regId: string): Promise<{
265
+ ok: boolean;
266
+ transferLock: boolean;
267
+ transferUnlockedUntil: null;
268
+ }>;
269
+ }
270
+ declare class TransfersResource {
271
+ private req;
272
+ constructor(req: Req);
273
+ /** Requisitos, precio e inventario del DNS actual. No cobra ni crea nada. */
274
+ check(domain: string): Promise<TransferCheck>;
275
+ dns(regId: string): Promise<TransferDnsInventory>;
276
+ /** Reemplaza el inventario completo (RRSets). Vuelve a quedar pendiente de aprobar. */
277
+ setDns(regId: string, records: {
278
+ name: string;
279
+ type: string;
280
+ ttl?: number;
281
+ values: string[];
282
+ }[]): Promise<{
283
+ records: unknown[];
284
+ }>;
285
+ approveDns(regId: string): Promise<{
286
+ ok: boolean;
287
+ }>;
288
+ resendEmail(regId: string): Promise<{
289
+ ok: boolean;
290
+ }>;
291
+ }
292
+ declare class MembersResource {
293
+ private req;
294
+ constructor(req: Req);
295
+ list(domainId: string): Promise<{
296
+ members: DomainMember[];
297
+ invites: DomainInvite[];
298
+ }>;
299
+ invite(domainId: string, input: {
300
+ email: string;
301
+ name: string;
302
+ role?: "admin" | "agent";
303
+ }): Promise<{
304
+ ok: boolean;
305
+ inviteUrl: string;
306
+ }>;
307
+ remove(domainId: string, memberId: string): Promise<{
308
+ ok: boolean;
309
+ }>;
310
+ cancelInvite(domainId: string, token: string): Promise<{
311
+ ok: boolean;
312
+ }>;
313
+ }
314
+ declare class SignatureResource {
315
+ private req;
316
+ constructor(req: Req);
317
+ get(domainId: string): Promise<{
318
+ signature: string | null;
319
+ }>;
320
+ /** Markdown, máx. 2000 caracteres. Cadena vacía la borra. */
321
+ set(domainId: string, signature: string): Promise<{
322
+ ok: boolean;
323
+ signature: string | null;
324
+ }>;
325
+ }
326
+ declare class CannedResource {
327
+ private req;
328
+ constructor(req: Req);
329
+ list(domainId: string): Promise<CannedReply[]>;
330
+ create(domainId: string, input: {
331
+ title: string;
332
+ body: string;
333
+ }): Promise<CannedReply>;
334
+ delete(domainId: string, cannedId: string): Promise<{
335
+ ok: boolean;
336
+ }>;
337
+ }
338
+ declare class AccountResource {
339
+ private req;
340
+ constructor(req: Req);
341
+ /**
342
+ * Identidad y uso de la cuenta: dominios, derechos por dominio, add-ons y cuotas.
343
+ * Sustituto de `whoami` mientras no exista un endpoint de identidad más chico — ver
344
+ * `docs/agents/mailmask-cli.md`.
345
+ */
346
+ me(): Promise<AccountMe>;
347
+ /** Todo tu dato (alias, reglas y logs de cada dominio) como JSON exportable. */
348
+ export(): Promise<AccountExport>;
349
+ getProfile(): Promise<AccountProfile>;
350
+ /** Nombre visible (máx. 60 caracteres). Cadena vacía lo borra. */
351
+ updateProfile(input: {
352
+ displayName: string | null;
353
+ }): Promise<AccountProfile>;
354
+ /** Foto desde un adjunto que el usuario subió al asistente (URL firmada de `/api/asistente/files/*`). */
355
+ setAvatarFromUrl(url: string): Promise<AccountProfile & {
356
+ ok: boolean;
357
+ }>;
358
+ /** Foto desde bytes (PNG, JPG o WebP; máx. 2 MB). */
359
+ setAvatar(file: Blob, filename?: string): Promise<AccountProfile & {
360
+ ok: boolean;
361
+ }>;
362
+ removeAvatar(): Promise<AccountProfile & {
363
+ ok: boolean;
364
+ }>;
365
+ }
366
+ /**
367
+ * La Bandeja: conversaciones del dominio. Todo pasa por los mismos permisos que la app
368
+ * (dueño, admin o agente invitado) y los mismos topes de envío.
369
+ */
370
+ declare class InboxResource {
371
+ private req;
372
+ private raw;
373
+ constructor(req: Req, raw: (path: string) => Promise<Response>);
374
+ list(domainId: string, opts?: InboxListOptions): Promise<InboxPage>;
375
+ /** Conversación con sus mensajes (los 30 más recientes, o anteriores a `before`). Abrirla la marca leída. */
376
+ get(domainId: string, conversationId: string, opts?: {
377
+ before?: string;
378
+ }): Promise<InboxConversationDetail>;
379
+ /** Un correo nuevo desde una máscara: abre un hilo. Gasta cuota de envío (dominio activado). */
380
+ compose(domainId: string, input: InboxComposeInput): Promise<{
381
+ ok: boolean;
382
+ conversationId: string;
383
+ messageId: string;
384
+ }>;
385
+ /** Responde en el hilo desde la máscara del hilo. No gasta cuota de envío. */
386
+ reply(domainId: string, conversationId: string, input: InboxReplyInput): Promise<{
387
+ ok: boolean;
388
+ messageId: string;
389
+ }>;
390
+ update(domainId: string, conversationId: string, input: InboxUpdateInput): Promise<InboxConversation>;
391
+ markRead(domainId: string, conversationId: string): Promise<{
392
+ ok: boolean;
393
+ unreadCount: number;
394
+ }>;
395
+ /** Sin `assignedTo` la deja sin asignar. */
396
+ assign(domainId: string, conversationId: string, assignedTo?: string): Promise<InboxConversation>;
397
+ /** Nota interna: la ve el equipo, nunca el contacto. */
398
+ addNote(domainId: string, conversationId: string, body: string): Promise<InboxNote>;
399
+ /** A la papelera (se puede restaurar). Máx. 200 por llamada. */
400
+ delete(domainId: string, conversationIds: string[]): Promise<{
401
+ ok: boolean;
402
+ deleted: number;
403
+ }>;
404
+ restore(domainId: string, conversationId: string): Promise<{
405
+ ok: boolean;
406
+ }>;
407
+ metrics(domainId: string, opts?: {
408
+ days?: number;
409
+ }): Promise<Record<string, unknown>>;
410
+ /** Bytes de un adjunto de un mensaje (id del mensaje e índice de `attachments`). */
411
+ attachment(domainId: string, conversationId: string, messageId: string, index: number): Promise<Response>;
412
+ }
413
+ declare class ReferralsResource {
414
+ private req;
415
+ constructor(req: Req);
416
+ get(): Promise<ReferralStats>;
417
+ /** 3-30 caracteres: minúsculas, números y guiones. */
418
+ setSlug(slug: string): Promise<{
419
+ ok: boolean;
420
+ slug: string;
421
+ }>;
422
+ /** Nombre que ven los invitados (2-40 caracteres). */
423
+ setName(name: string): Promise<{
424
+ ok: boolean;
425
+ }>;
426
+ }
427
+ export { MailMaskError };
package/dist/index.cjs CHANGED
@@ -120,6 +120,22 @@ var DomainsResource = class {
120
120
  removeLogo(id) {
121
121
  return this.req(`/api/domains/${id}/logo`, { method: "DELETE" });
122
122
  }
123
+ /**
124
+ * Publica un sitio de EasyBits en el dominio: lo da de alta en EasyBits, escribe sus
125
+ * registros (sin tocar el correo), verifica y, en la raíz, lo asigna. Requiere la cuenta
126
+ * de EasyBits conectada en el navegador; sin ella, 409 con la liga para conectarla.
127
+ */
128
+ publishEasyBitsSite(id, input) {
129
+ return this.req(`/api/domains/${id}/website/easybits`, { method: "POST", body: JSON.stringify(input) });
130
+ }
131
+ /** Quita el sitio: el DNS vuelve a como estaba (lo que cambiaste después no se toca) y se limpia EasyBits. */
132
+ unpublishEasyBitsSite(id) {
133
+ return this.req(`/api/domains/${id}/website/easybits`, { method: "DELETE" });
134
+ }
135
+ /** Qué sitio de EasyBits está publicado en el dominio, si alguno, y si la cuenta está conectada. */
136
+ easyBitsSiteStatus(id) {
137
+ return this.req(`/api/domains/${id}/website/easybits`);
138
+ }
123
139
  /** Imagen para incrustar en un correo saliente (PNG, JPG, GIF o WebP; máx. 2 MB). Efímera: se borra tras enviarse o por el barrido diario. */
124
140
  uploadImage(id, file, filename = "imagen") {
125
141
  const form = new FormData();
@@ -150,8 +166,17 @@ var DnsResource = class {
150
166
  delete(domainId, name, type) {
151
167
  return this.req(`/api/domains/${domainId}/dns/records`, { method: "DELETE", body: JSON.stringify({ name, type }) });
152
168
  }
153
- preset(domainId, preset, target, subdomain) {
154
- return this.req(`/api/domains/${domainId}/dns/preset`, { method: "POST", body: JSON.stringify({ preset, target, subdomain }) });
169
+ /** Con 'easybits' publica un sitio de la cuenta conectada (`opts.websiteId`), igual que `domains.publishEasyBitsSite`. */
170
+ preset(domainId, preset, target, subdomain, opts) {
171
+ return this.req(`/api/domains/${domainId}/dns/preset`, { method: "POST", body: JSON.stringify({ preset, target, subdomain, ...opts }) });
172
+ }
173
+ /** Vista previa de una plantilla: lo que escribiría y lo que hay hoy, sin tocar nada. */
174
+ presetPreview(domainId, preset, target, subdomain, opts) {
175
+ return this.req(`/api/domains/${domainId}/dns/preset`, { method: "POST", body: JSON.stringify({ preset, target, subdomain, ...opts, dryRun: true }) });
176
+ }
177
+ /** A dónde apunta el sitio (raíz, www y subdominios), qué plataforma es, qué está mal y si responde por HTTPS. */
178
+ website(domainId) {
179
+ return this.req(`/api/domains/${domainId}/website`);
155
180
  }
156
181
  };
157
182
  var AliasesResource = class {