@eusend_dev/sdk 0.6.0 → 0.7.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/README.md +2 -0
- package/dist/index.cjs +6 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +21 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -553,6 +553,8 @@ if (error) {
|
|
|
553
553
|
| `PLAN_LIMIT_EXCEEDED` | 403 | Feature not available on your plan |
|
|
554
554
|
| `DOMAIN_NOT_VERIFIED` | 403 | The sender domain is not verified for your organisation |
|
|
555
555
|
| `SENDING_SUSPENDED` | 403 | Sending suspended for your account (high bounce or complaint rate) |
|
|
556
|
+
| `LIST_SEND_HELD` | 403 | Past the unreviewed account's list-send allowance — the rest waits for review |
|
|
557
|
+
| `BROADCAST_HELD` | 403 | Broadcast used its unreviewed allowance; the remainder waits for review |
|
|
556
558
|
| `ALL_SUPPRESSED` | 422 | All recipients are on the suppression list |
|
|
557
559
|
| `SERVICE_PAUSED` | 503 | Sending is temporarily paused platform-wide |
|
|
558
560
|
| `INTERNAL_ERROR` | 500 | Server error |
|
package/dist/index.cjs
CHANGED
|
@@ -235,6 +235,11 @@ var Audiences = class {
|
|
|
235
235
|
deleteContact(audienceId, contactId) {
|
|
236
236
|
return this.client.delete(`/audiences/${audienceId}/contacts/${contactId}`);
|
|
237
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Upsert up to 1000 contacts in one call. Addresses are lowercased and
|
|
240
|
+
* de-duplicated server-side; `count` is the number of rows written and
|
|
241
|
+
* `duplicates` how many repeated addresses were collapsed to get there.
|
|
242
|
+
*/
|
|
238
243
|
batchCreateContacts(audienceId, options) {
|
|
239
244
|
return this.client.post(`/audiences/${audienceId}/contacts/batch`, { contacts: options.contacts.map((c) => ({
|
|
240
245
|
email: c.email,
|
|
@@ -388,7 +393,7 @@ var Broadcasts = class {
|
|
|
388
393
|
//#endregion
|
|
389
394
|
//#region src/eusend.ts
|
|
390
395
|
const DEFAULT_BASE_URL = "https://api.eusend.dev";
|
|
391
|
-
const SDK_VERSION = "0.
|
|
396
|
+
const SDK_VERSION = "0.7.1";
|
|
392
397
|
var Eusend = class {
|
|
393
398
|
constructor(key, options) {
|
|
394
399
|
const apiKey = key ?? (typeof process !== "undefined" ? process.env["EUSEND_API_KEY"] : void 0);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/interfaces.d.ts
|
|
2
|
-
type EusendErrorCode = 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'RATE_LIMITED' | 'MONTHLY_LIMIT_EXCEEDED' | 'DAILY_LIMIT_EXCEEDED' | 'ALL_SUPPRESSED' | 'DOMAIN_NOT_VERIFIED' | 'SENDING_SUSPENDED' | 'SERVICE_PAUSED' | 'ATTACHMENT_STORAGE_ERROR' | 'INTERNAL_ERROR' | 'CONFLICT' | 'PLAN_LIMIT_EXCEEDED' | 'BAD_REQUEST' | 'PAYLOAD_TOO_LARGE' | 'application_error';
|
|
2
|
+
type EusendErrorCode = 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'RATE_LIMITED' | 'MONTHLY_LIMIT_EXCEEDED' | 'DAILY_LIMIT_EXCEEDED' | 'ALL_SUPPRESSED' | 'DOMAIN_NOT_VERIFIED' | 'SENDING_SUSPENDED' | 'SERVICE_PAUSED' | 'LIST_SEND_HELD' | 'BROADCAST_HELD' | 'ATTACHMENT_STORAGE_ERROR' | 'INTERNAL_ERROR' | 'CONFLICT' | 'PLAN_LIMIT_EXCEEDED' | 'BAD_REQUEST' | 'PAYLOAD_TOO_LARGE' | 'application_error';
|
|
3
3
|
interface EusendError {
|
|
4
4
|
message: string;
|
|
5
5
|
statusCode: number | null;
|
|
@@ -204,12 +204,25 @@ interface DnsRecord {
|
|
|
204
204
|
type: string;
|
|
205
205
|
name: string;
|
|
206
206
|
value: string;
|
|
207
|
+
/** MX records only. */
|
|
208
|
+
priority?: number;
|
|
209
|
+
/**
|
|
210
|
+
* `authentication` — required before the domain can send.
|
|
211
|
+
* `policy` — recommended; absence weakens but does not block.
|
|
212
|
+
* `alignment` — optional; publishing all of them enables Return-Path SPF alignment.
|
|
213
|
+
*/
|
|
214
|
+
purpose?: string;
|
|
215
|
+
description?: string;
|
|
207
216
|
}
|
|
208
217
|
interface CreateDomainResponse {
|
|
209
218
|
id: string;
|
|
210
219
|
name: string;
|
|
220
|
+
/**
|
|
221
|
+
* Every record to publish, in presentation order. Prefer this over the individual
|
|
222
|
+
* keys below — it is the only place the optional Return-Path alignment records appear.
|
|
223
|
+
*/
|
|
224
|
+
records: DnsRecord[];
|
|
211
225
|
dkim: DnsRecord;
|
|
212
|
-
spf: DnsRecord;
|
|
213
226
|
dmarc: DnsRecord;
|
|
214
227
|
}
|
|
215
228
|
interface DomainListItem {
|
|
@@ -332,8 +345,14 @@ declare class Audiences {
|
|
|
332
345
|
getContact(audienceId: string, contactId: string): Promise<EusendResponse<Contact>>;
|
|
333
346
|
updateContact(audienceId: string, contactId: string, options: UpdateContactOptions): Promise<EusendResponse<Contact>>;
|
|
334
347
|
deleteContact(audienceId: string, contactId: string): Promise<EusendResponse<Record<string, never>>>;
|
|
348
|
+
/**
|
|
349
|
+
* Upsert up to 1000 contacts in one call. Addresses are lowercased and
|
|
350
|
+
* de-duplicated server-side; `count` is the number of rows written and
|
|
351
|
+
* `duplicates` how many repeated addresses were collapsed to get there.
|
|
352
|
+
*/
|
|
335
353
|
batchCreateContacts(audienceId: string, options: BatchCreateContactsOptions): Promise<EusendResponse<{
|
|
336
354
|
count: number;
|
|
355
|
+
duplicates: number;
|
|
337
356
|
}>>;
|
|
338
357
|
}
|
|
339
358
|
//#endregion
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/interfaces.ts","../src/react-render.ts","../src/emails.ts","../src/batch.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"mappings":";KAAY;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/interfaces.ts","../src/react-render.ts","../src/emails.ts","../src/batch.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"mappings":";KAAY;UAuBK;EACf;EACA;EACA,MAAM;;KAGI,eAAe;EACrB,MAAM;EAAG;EAAa,SAAS;;EAC/B;EAAY,OAAO;EAAa,SAAS;;;;KC5BnC;WACD;WACA;WACA;;;;KCFC;KAYA;UAQK;;EAEf;;;;;;EAMA,mBAAmB;;;;;;EAMnB;;EAEA;;;;;EAKA;;UAGe;;;;;EAKf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;EAMA,QAAQ;EACR;EACA,YAAY;EACZ,UAAU;EACV;EACA;;EAEA,cAAc;;;;;;;;;EASd,uBAAuB;;UAGR;EACf;;UAGe;EACf;;;;;;;;;KAUU;EACN;EAAY;EAAe;;EAC3B;EAAY;EAAe,MAAM;;UAEtB;EACf,MAAM;;UAGS;EACf;EACA,MAAM;EACN,UAAU;EACV;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;EAEA;EACA;EACA,QAAQ;;UAGO;;;EAGf,sBAAsB;;UAGP;EACf;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;UAGe;EACf;EACA;EACA,SAAS;EACT;EACA;;UAGe;EACf,MAAM;EACN;;cAiDW;mBACkB;EAAA,YAAA,QAAQ;EAE/B,KACJ,SAAS,kBAC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AAQ;EACR;EACA,oBAAoB;EACpB;;UAGe;EACf;;UAGe;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA;EACA;;UAGe;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,wBAAwB;EACvC;EACA;EACA;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA;;cAWW;mBACkB;EAAA,YAAA,QAAQ;EAE/B,OAAO,SAAS,yBAAyB,QAAQ,eAAe;EAahE,QAAQ,QAAQ,eAAe;EAMrC,IAAI,aAAa,QAAQ,eAAe;EAIlC,OAAO,YAAY,SAAS,yBAAyB,QAAQ,eAAe;EAclF,KAAK,YAAY,UAAS,uBAA4B,QAAQ,eAAe;EAM7E,OAAO,aAAa,QAAQ,eAAe;EAI3C,OAAO,aAAa,QAAQ,eAAe;;;;UC7I5B;EACf;;cAGW;WACF;mBACQ;WAER,QAAQ;;WAER,OAAO;WACP,SAAS;WACT,SAAS;WACT,WAAW;WACX,WAAW;WACX,UAAU;WACV,YAAY;EAET,YAAA,cAAc,UAAU;EAqB9B,aAAa,GACjB,cACA,OAAM,aACN,eAAc,yBACb,QAAQ,eAAe;EA8C1B,IAAI,GAAG,cAAc,eAAe,yBAAyB,QAAQ,eAAe;EAIpF,KAAK,GACH,cACA,gBACA,eAAe,yBACd,QAAQ,eAAe;EAQ1B,MAAM,GAAG,cAAc,iBAAiB,QAAQ,eAAe;EAO/D,OAAO,GAAG,eAAe,QAAQ,eAAe"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/interfaces.d.ts
|
|
2
|
-
type EusendErrorCode = 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'RATE_LIMITED' | 'MONTHLY_LIMIT_EXCEEDED' | 'DAILY_LIMIT_EXCEEDED' | 'ALL_SUPPRESSED' | 'DOMAIN_NOT_VERIFIED' | 'SENDING_SUSPENDED' | 'SERVICE_PAUSED' | 'ATTACHMENT_STORAGE_ERROR' | 'INTERNAL_ERROR' | 'CONFLICT' | 'PLAN_LIMIT_EXCEEDED' | 'BAD_REQUEST' | 'PAYLOAD_TOO_LARGE' | 'application_error';
|
|
2
|
+
type EusendErrorCode = 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'RATE_LIMITED' | 'MONTHLY_LIMIT_EXCEEDED' | 'DAILY_LIMIT_EXCEEDED' | 'ALL_SUPPRESSED' | 'DOMAIN_NOT_VERIFIED' | 'SENDING_SUSPENDED' | 'SERVICE_PAUSED' | 'LIST_SEND_HELD' | 'BROADCAST_HELD' | 'ATTACHMENT_STORAGE_ERROR' | 'INTERNAL_ERROR' | 'CONFLICT' | 'PLAN_LIMIT_EXCEEDED' | 'BAD_REQUEST' | 'PAYLOAD_TOO_LARGE' | 'application_error';
|
|
3
3
|
interface EusendError {
|
|
4
4
|
message: string;
|
|
5
5
|
statusCode: number | null;
|
|
@@ -204,12 +204,25 @@ interface DnsRecord {
|
|
|
204
204
|
type: string;
|
|
205
205
|
name: string;
|
|
206
206
|
value: string;
|
|
207
|
+
/** MX records only. */
|
|
208
|
+
priority?: number;
|
|
209
|
+
/**
|
|
210
|
+
* `authentication` — required before the domain can send.
|
|
211
|
+
* `policy` — recommended; absence weakens but does not block.
|
|
212
|
+
* `alignment` — optional; publishing all of them enables Return-Path SPF alignment.
|
|
213
|
+
*/
|
|
214
|
+
purpose?: string;
|
|
215
|
+
description?: string;
|
|
207
216
|
}
|
|
208
217
|
interface CreateDomainResponse {
|
|
209
218
|
id: string;
|
|
210
219
|
name: string;
|
|
220
|
+
/**
|
|
221
|
+
* Every record to publish, in presentation order. Prefer this over the individual
|
|
222
|
+
* keys below — it is the only place the optional Return-Path alignment records appear.
|
|
223
|
+
*/
|
|
224
|
+
records: DnsRecord[];
|
|
211
225
|
dkim: DnsRecord;
|
|
212
|
-
spf: DnsRecord;
|
|
213
226
|
dmarc: DnsRecord;
|
|
214
227
|
}
|
|
215
228
|
interface DomainListItem {
|
|
@@ -332,8 +345,14 @@ declare class Audiences {
|
|
|
332
345
|
getContact(audienceId: string, contactId: string): Promise<EusendResponse<Contact>>;
|
|
333
346
|
updateContact(audienceId: string, contactId: string, options: UpdateContactOptions): Promise<EusendResponse<Contact>>;
|
|
334
347
|
deleteContact(audienceId: string, contactId: string): Promise<EusendResponse<Record<string, never>>>;
|
|
348
|
+
/**
|
|
349
|
+
* Upsert up to 1000 contacts in one call. Addresses are lowercased and
|
|
350
|
+
* de-duplicated server-side; `count` is the number of rows written and
|
|
351
|
+
* `duplicates` how many repeated addresses were collapsed to get there.
|
|
352
|
+
*/
|
|
335
353
|
batchCreateContacts(audienceId: string, options: BatchCreateContactsOptions): Promise<EusendResponse<{
|
|
336
354
|
count: number;
|
|
355
|
+
duplicates: number;
|
|
337
356
|
}>>;
|
|
338
357
|
}
|
|
339
358
|
//#endregion
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/interfaces.ts","../src/react-render.ts","../src/emails.ts","../src/batch.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"mappings":";KAAY;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/interfaces.ts","../src/react-render.ts","../src/emails.ts","../src/batch.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"mappings":";KAAY;UAuBK;EACf;EACA;EACA,MAAM;;KAGI,eAAe;EACrB,MAAM;EAAG;EAAa,SAAS;;EAC/B;EAAY,OAAO;EAAa,SAAS;;;;KC5BnC;WACD;WACA;WACA;;;;KCFC;KAYA;UAQK;;EAEf;;;;;;EAMA,mB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;WACF;mBACQ;WAER,QAAQ;;WAER,OAAO;WACP,SAAS;WACT,SAAS;WACT,WAAW;WACX,WAAW;WACX,UAAU;WACV,YAAY;EAET,YAAA,cAAc,UAAU;EAqB9B,aAAa,GACjB,cACA,OAAM,aACN,eAAc,yBACb,QAAQ,eAAe;EA8C1B,IAAI,GAAG,cAAc,eAAe,yBAAyB,QAAQ,eAAe;EAIpF,KAAK,GACH,cACA,gBACA,eAAe,yBACd,QAAQ,eAAe;EAQ1B,MAAM,GAAG,cAAc,iBAAiB,QAAQ,eAAe;EAO/D,OAAO,GAAG,eAAe,QAAQ,eAAe"}
|
package/dist/index.mjs
CHANGED
|
@@ -234,6 +234,11 @@ var Audiences = class {
|
|
|
234
234
|
deleteContact(audienceId, contactId) {
|
|
235
235
|
return this.client.delete(`/audiences/${audienceId}/contacts/${contactId}`);
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Upsert up to 1000 contacts in one call. Addresses are lowercased and
|
|
239
|
+
* de-duplicated server-side; `count` is the number of rows written and
|
|
240
|
+
* `duplicates` how many repeated addresses were collapsed to get there.
|
|
241
|
+
*/
|
|
237
242
|
batchCreateContacts(audienceId, options) {
|
|
238
243
|
return this.client.post(`/audiences/${audienceId}/contacts/batch`, { contacts: options.contacts.map((c) => ({
|
|
239
244
|
email: c.email,
|
|
@@ -387,7 +392,7 @@ var Broadcasts = class {
|
|
|
387
392
|
//#endregion
|
|
388
393
|
//#region src/eusend.ts
|
|
389
394
|
const DEFAULT_BASE_URL = "https://api.eusend.dev";
|
|
390
|
-
const SDK_VERSION = "0.
|
|
395
|
+
const SDK_VERSION = "0.7.1";
|
|
391
396
|
var Eusend = class {
|
|
392
397
|
constructor(key, options) {
|
|
393
398
|
const apiKey = key ?? (typeof process !== "undefined" ? process.env["EUSEND_API_KEY"] : void 0);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/react-render.ts","../src/emails.ts","../src/batch.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"sourcesContent":["// Minimal structural type so the SDK doesn't take a hard dependency on `react`.\n// Real React elements assignable to this; users who pass `react:` are expected to\n// have `react` and `@react-email/render` installed (declared as optional peers).\nexport type ReactEmailElement = {\n readonly type: unknown;\n readonly props: unknown;\n readonly key: string | number | null;\n};\n\nlet renderPromise: Promise<(element: ReactEmailElement) => Promise<string>> | null = null;\n\nasync function getRender(): Promise<(element: ReactEmailElement) => Promise<string>> {\n if (!renderPromise) {\n renderPromise = (async () => {\n try {\n const mod = (await import('@react-email/render')) as {\n render: (element: unknown, options?: { plainText?: boolean }) => Promise<string> | string;\n };\n return (element: ReactEmailElement) => Promise.resolve(mod.render(element));\n } catch {\n throw new Error(\n \"Passing `react:` requires `@react-email/render` and `react` to be installed. \" +\n 'Run: npm install @react-email/render react',\n );\n }\n })();\n }\n return renderPromise;\n}\n\nexport async function renderReactEmail(element: ReactEmailElement): Promise<string> {\n const render = await getRender();\n return render(element);\n}\n","import type { Eusend } from './eusend';\nimport type { EusendErrorCode, EusendResponse } from './interfaces';\nimport { renderReactEmail, type ReactEmailElement } from './react-render';\n\nexport type EmailStatus =\n | 'queued'\n | 'scheduled'\n | 'canceled'\n | 'sending'\n | 'sent'\n | 'delivered'\n | 'bounced'\n | 'complained'\n | 'suppressed'\n | 'failed';\n\nexport type EmailEventType =\n | 'sent'\n | 'delivered'\n | 'opened'\n | 'clicked'\n | 'bounced'\n | 'complained';\n\nexport interface Attachment {\n /** Name the recipient sees for the file, e.g. `invoice.pdf`. */\n filename: string;\n /**\n * File contents. A base64-encoded string (sent as-is) or raw bytes\n * (`Uint8Array`/`Buffer`), which the SDK base64-encodes for you. Provide either\n * `content` or `path`, not both.\n */\n content?: string | Uint8Array;\n /**\n * A URL the server fetches at send time to attach the file. Use instead of\n * `content` when the bytes live on a public URL. Provide either `content` or `path`,\n * not both.\n */\n path?: string;\n /** MIME type, e.g. `application/pdf`. Inferred from the filename when omitted. */\n contentType?: string;\n /**\n * Content-ID for an inline attachment. Set it to reference the file from your\n * HTML with `<img src=\"cid:<contentId>\">` instead of showing it as a download.\n */\n contentId?: string;\n}\n\nexport interface SendEmailOptions {\n /**\n * Sender address. Accepts a bare email (`onboarding@eusend.dev`) or a display-name\n * form (`Acme <onboarding@eusend.dev>`). The domain must be verified on your account.\n */\n from: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string | string[];\n subject?: string;\n html?: string;\n text?: string;\n /**\n * A React Email component. The SDK renders it to HTML locally before sending\n * — the JSX source never travels over the wire. Requires `@react-email/render`\n * and `react` as peer dependencies. Ignored when `html` is also provided.\n */\n react?: ReactEmailElement;\n templateId?: string;\n variables?: Record<string, unknown>;\n headers?: Record<string, string>;\n trackOpens?: boolean;\n trackClicks?: boolean;\n /** File attachments. Up to 20 per message, 10 MB combined. */\n attachments?: Attachment[];\n /**\n * Schedule the send for a future time, at most 30 days out. Accepts a `Date`, an\n * ISO 8601 string, or a natural-language time like `\"in 1 hour\"` or `\"tomorrow at\n * 9am\"` (parsed server-side, same as Resend). Relative phrasings resolve against the\n * server clock in UTC — pass an offset-qualified ISO string when you need an exact\n * instant. The email is created with status `scheduled`; reschedule it with\n * `emails.update()` or call `emails.cancel()` any time before it sends.\n */\n scheduledAt?: string | Date;\n}\n\nexport interface SendEmailRequestOptions {\n idempotencyKey?: string;\n}\n\nexport interface SendEmailResponse {\n id: string;\n}\n\n/**\n * Per-item outcome of a batch send, positionally mapped to the input array:\n * `data[i]` describes `emails[i]`. Items that were queued carry `{ id }`; items\n * that could not be queued carry `{ error, code }` (e.g. an unverified sender\n * domain, all recipients suppressed, or an exhausted send quota). Branch on the\n * presence of `id`.\n */\nexport type BatchItemResult =\n | { id: string; error?: never; code?: never }\n | { id?: never; error: string; code: EusendErrorCode };\n\nexport interface BatchSendResponse {\n data: BatchItemResult[];\n}\n\nexport interface EmailEvent {\n id: string;\n type: EmailEventType;\n metadata: Record<string, unknown>;\n createdAt: string;\n}\n\nexport interface Email {\n id: string;\n from: string;\n to: string[];\n cc: string[];\n bcc: string[];\n replyTo: string[];\n subject: string;\n html: string | null;\n text: string | null;\n status: EmailStatus;\n testMode: boolean;\n templateId: string | null;\n /** Set only for scheduled sends. */\n scheduledAt: string | null;\n createdAt: string;\n events: EmailEvent[];\n}\n\nexport interface UpdateEmailOptions {\n /** The new send time, at most 30 days out — a `Date`, an ISO 8601 string, or natural\n * language like `\"in 1 hour\"` (parsed server-side, same as `emails.send`). */\n scheduledAt: string | Date;\n}\n\nexport interface UpdateEmailResponse {\n id: string;\n status: 'scheduled';\n scheduledAt: string;\n}\n\nexport interface CancelEmailResponse {\n id: string;\n status: 'canceled';\n}\n\nexport interface EmailListItem {\n id: string;\n from: string;\n to: string[];\n subject: string;\n status: EmailStatus;\n testMode: boolean;\n createdAt: string;\n}\n\nexport interface ListEmailsOptions {\n limit?: number;\n cursor?: string;\n status?: EmailStatus;\n from?: string;\n to?: string;\n}\n\nexport interface ListEmailsResponse {\n data: EmailListItem[];\n nextCursor: string | null;\n}\n\nasync function resolveHtml(options: SendEmailOptions): Promise<string | undefined> {\n if (options.html) return options.html;\n if (options.react) return renderReactEmail(options.react);\n return undefined;\n}\n\nfunction encodeAttachmentContent(content: string | Uint8Array): string {\n // A string is assumed to already be base64. Raw bytes are encoded here.\n if (typeof content === 'string') return content;\n if (typeof Buffer !== 'undefined') return Buffer.from(content).toString('base64');\n let binary = '';\n for (const byte of content) binary += String.fromCharCode(byte);\n return btoa(binary);\n}\n\nfunction toIsoString(value: string | Date): string {\n return value instanceof Date ? value.toISOString() : value;\n}\n\nexport async function toApiPayload(options: SendEmailOptions) {\n const html = await resolveHtml(options);\n return {\n from: options.from,\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n reply_to: options.replyTo,\n subject: options.subject,\n html,\n text: options.text,\n template_id: options.templateId,\n variables: options.variables,\n headers: options.headers,\n track_opens: options.trackOpens,\n track_clicks: options.trackClicks,\n attachments: options.attachments?.map((a) => ({\n filename: a.filename,\n content: a.content === undefined ? undefined : encodeAttachmentContent(a.content),\n path: a.path,\n content_type: a.contentType,\n content_id: a.contentId,\n })),\n scheduled_at: options.scheduledAt ? toIsoString(options.scheduledAt) : undefined,\n };\n}\n\nexport class Emails {\n constructor(private readonly client: Eusend) {}\n\n async send(\n options: SendEmailOptions,\n requestOptions?: SendEmailRequestOptions,\n ): Promise<EusendResponse<SendEmailResponse>> {\n const extraHeaders: Record<string, string> = {};\n if (requestOptions?.idempotencyKey) {\n extraHeaders['Idempotency-Key'] = requestOptions.idempotencyKey;\n }\n const payload = await toApiPayload(options);\n return this.client.post<SendEmailResponse>('/emails', payload, extraHeaders);\n }\n\n async list(options: ListEmailsOptions = {}): Promise<EusendResponse<ListEmailsResponse>> {\n const params = new URLSearchParams();\n if (options.limit != null) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n if (options.status) params.set('status', options.status);\n if (options.from) params.set('from', options.from);\n if (options.to) params.set('to', options.to);\n const qs = params.toString();\n\n const res = await this.client.get<{ data: EmailListItem[]; next_cursor: string | null }>(\n qs ? `/emails?${qs}` : '/emails',\n );\n if (res.error) return res;\n return {\n data: { data: res.data.data, nextCursor: res.data.next_cursor },\n error: null,\n headers: res.headers,\n };\n }\n\n get(id: string): Promise<EusendResponse<Email>> {\n return this.client.get<Email>(`/emails/${id}`);\n }\n\n /** Reschedule a scheduled email. Fails once the email has started sending. */\n async update(\n id: string,\n options: UpdateEmailOptions,\n ): Promise<EusendResponse<UpdateEmailResponse>> {\n const res = await this.client.patch<{ id: string; status: 'scheduled'; scheduled_at: string }>(\n `/emails/${id}`,\n { scheduled_at: toIsoString(options.scheduledAt) },\n );\n if (res.error) return res;\n return {\n data: { id: res.data.id, status: res.data.status, scheduledAt: res.data.scheduled_at },\n error: null,\n headers: res.headers,\n };\n }\n\n /** Cancel a scheduled email. Fails once the email has started sending. */\n cancel(id: string): Promise<EusendResponse<CancelEmailResponse>> {\n return this.client.post<CancelEmailResponse>(`/emails/${id}/cancel`, undefined);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\nimport { toApiPayload, type SendEmailOptions, type BatchSendResponse } from './emails';\n\n/**\n * Batch sending — `eusend.batch.send([...])`. The method path mirrors Resend's\n * `resend.batch.send([...])`, so migrating is a mechanical `resend` → `eusend` rename.\n * The HTTP body is a top-level array of email objects (POST /emails/batch), up to 100\n * per request. As with Resend, attachments and `scheduledAt` are not supported on the\n * batch endpoint — send those individually via `emails.send`.\n *\n * The response maps positionally to the input: `data[i]` is `{ id }` when\n * `emails[i]` was queued, or `{ error, code }` when it was not (unverified\n * domain, suppressed recipients, exhausted quota, …) — failed items never fail\n * the whole batch, so branch on the presence of `id` per item.\n */\nexport class Batch {\n constructor(private readonly client: Eusend) {}\n\n async send(emails: SendEmailOptions[]): Promise<EusendResponse<BatchSendResponse>> {\n const payloads = await Promise.all(emails.map(toApiPayload));\n return this.client.post<BatchSendResponse>('/emails/batch', payloads);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type DomainStatus = 'pending' | 'verified' | 'failed';\n\nexport interface DnsRecord {\n type: string;\n name: string;\n value: string;\n}\n\nexport interface CreateDomainResponse {\n id: string;\n name: string;\n dkim: DnsRecord;\n spf: DnsRecord;\n dmarc: DnsRecord;\n}\n\nexport interface DomainListItem {\n id: string;\n name: string;\n status: DomainStatus;\n createdAt: string;\n}\n\nexport interface Domain {\n id: string;\n name: string;\n dkimPublicKey: string;\n dkimSelector: string;\n status: DomainStatus;\n createdAt: string;\n verifiedAt: string | null;\n}\n\nexport class Domains {\n constructor(private readonly client: Eusend) {}\n\n create(name: string): Promise<EusendResponse<CreateDomainResponse>> {\n return this.client.post<CreateDomainResponse>('/domains', { name });\n }\n\n list(): Promise<EusendResponse<DomainListItem[]>> {\n return this.client.get<DomainListItem[]>('/domains');\n }\n\n get(id: string): Promise<EusendResponse<Domain>> {\n return this.client.get<Domain>(`/domains/${id}`);\n }\n\n delete(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.delete<{ message: string }>(`/domains/${id}`);\n }\n\n verify(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.post<{ message: string }>(`/domains/${id}/verify`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport interface CreateApiKeyOptions {\n name: string;\n testMode?: boolean;\n}\n\nexport interface CreateApiKeyResponse {\n id: string;\n name: string;\n key: string;\n prefix: string;\n testMode: boolean;\n createdAt: string;\n}\n\nexport interface ApiKey {\n id: string;\n name: string;\n prefix: string;\n testMode: boolean;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\ntype CreateApiKeyApiResponse = {\n id: string;\n name: string;\n key: string;\n prefix: string;\n test_mode: boolean;\n created_at: string;\n};\n\nexport class ApiKeys {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateApiKeyOptions): Promise<EusendResponse<CreateApiKeyResponse>> {\n const res = await this.client.post<CreateApiKeyApiResponse>('/api-keys', {\n name: options.name,\n test_mode: options.testMode ?? false,\n });\n if (res.error) return res;\n return {\n data: {\n id: res.data.id,\n name: res.data.name,\n key: res.data.key,\n prefix: res.data.prefix,\n testMode: res.data.test_mode,\n createdAt: res.data.created_at,\n },\n error: null,\n headers: res.headers,\n };\n }\n\n list(): Promise<EusendResponse<ApiKey[]>> {\n return this.client.get<ApiKey[]>('/api-keys');\n }\n\n delete(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.delete<{ message: string }>(`/api-keys/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type ContactStatus = 'subscribed' | 'unsubscribed';\n\nexport interface Audience {\n id: string;\n name: string;\n organizationId: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AudienceListItem {\n id: string;\n name: string;\n createdAt: string;\n contactCount: number;\n}\n\nexport interface Contact {\n id: string;\n audienceId: string;\n email: string;\n firstName: string | null;\n lastName: string | null;\n status: ContactStatus;\n unsubscribedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateContactOptions {\n email: string;\n firstName?: string;\n lastName?: string;\n}\n\nexport interface UpdateContactOptions {\n firstName?: string;\n lastName?: string;\n unsubscribed?: boolean;\n}\n\nexport interface ListContactsOptions {\n limit?: number;\n cursor?: string;\n search?: string;\n subscribed?: boolean;\n}\n\nexport interface ListContactsResponse {\n data: Contact[];\n nextCursor: string | null;\n}\n\nexport interface BatchCreateContactsOptions {\n contacts: CreateContactOptions[];\n}\n\nexport class Audiences {\n constructor(private readonly client: Eusend) {}\n\n create(name: string): Promise<EusendResponse<Audience>> {\n return this.client.post<Audience>('/audiences', { name });\n }\n\n async list(): Promise<EusendResponse<AudienceListItem[]>> {\n const res = await this.client.get<{ data: AudienceListItem[] }>('/audiences');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/audiences/${id}`);\n }\n\n createContact(\n audienceId: string,\n options: CreateContactOptions,\n ): Promise<EusendResponse<Contact>> {\n return this.client.post<Contact>(`/audiences/${audienceId}/contacts`, {\n email: options.email,\n first_name: options.firstName,\n last_name: options.lastName,\n });\n }\n\n async listContacts(\n audienceId: string,\n options: ListContactsOptions = {},\n ): Promise<EusendResponse<ListContactsResponse>> {\n const params = new URLSearchParams();\n if (options.limit != null) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n if (options.search) params.set('search', options.search);\n if (options.subscribed != null) params.set('subscribed', String(options.subscribed));\n const qs = params.toString();\n return this.client.get<ListContactsResponse>(\n qs ? `/audiences/${audienceId}/contacts?${qs}` : `/audiences/${audienceId}/contacts`,\n );\n }\n\n getContact(audienceId: string, contactId: string): Promise<EusendResponse<Contact>> {\n return this.client.get<Contact>(`/audiences/${audienceId}/contacts/${contactId}`);\n }\n\n updateContact(\n audienceId: string,\n contactId: string,\n options: UpdateContactOptions,\n ): Promise<EusendResponse<Contact>> {\n return this.client.patch<Contact>(`/audiences/${audienceId}/contacts/${contactId}`, {\n first_name: options.firstName,\n last_name: options.lastName,\n unsubscribed: options.unsubscribed,\n });\n }\n\n deleteContact(\n audienceId: string,\n contactId: string,\n ): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(\n `/audiences/${audienceId}/contacts/${contactId}`,\n );\n }\n\n batchCreateContacts(\n audienceId: string,\n options: BatchCreateContactsOptions,\n ): Promise<EusendResponse<{ count: number }>> {\n return this.client.post<{ count: number }>(`/audiences/${audienceId}/contacts/batch`, {\n contacts: options.contacts.map((c) => ({\n email: c.email,\n first_name: c.firstName,\n last_name: c.lastName,\n })),\n });\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\nimport { renderReactEmail, type ReactEmailElement } from './react-render';\n\ninterface TemplateHtmlOrReact {\n /**\n * A React Email component. The SDK renders it to HTML locally before sending.\n * Requires `@react-email/render` and `react` as peer dependencies.\n * Ignored when `html` is also provided.\n */\n react?: ReactEmailElement;\n}\n\nexport interface CreateTemplateOptions extends TemplateHtmlOrReact {\n name: string;\n subject: string;\n html?: string;\n}\n\nexport interface UpdateTemplateOptions extends TemplateHtmlOrReact {\n name?: string;\n subject?: string;\n html?: string;\n}\n\nexport interface Template {\n id: string;\n name: string;\n subject: string;\n html: string | null;\n reactSource: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface TemplateListItem {\n id: string;\n name: string;\n subject: string;\n createdAt: string;\n updatedAt: string;\n}\n\nasync function resolveTemplateHtml(\n options: TemplateHtmlOrReact & { html?: string },\n): Promise<string | undefined> {\n if (options.html) return options.html;\n if (options.react) return renderReactEmail(options.react);\n return undefined;\n}\n\nexport class Templates {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateTemplateOptions): Promise<EusendResponse<Template>> {\n const html = await resolveTemplateHtml(options);\n if (!html) {\n return {\n data: null,\n error: {\n message: 'Either html or react is required',\n statusCode: null,\n name: 'VALIDATION_ERROR',\n },\n headers: null,\n };\n }\n return this.client.post<Template>('/templates', {\n name: options.name,\n subject: options.subject,\n html,\n });\n }\n\n async list(): Promise<EusendResponse<TemplateListItem[]>> {\n const res = await this.client.get<{ data: TemplateListItem[] }>('/templates');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<Template>> {\n return this.client.get<Template>(`/templates/${id}`);\n }\n\n async update(id: string, options: UpdateTemplateOptions): Promise<EusendResponse<Template>> {\n const html = await resolveTemplateHtml(options);\n return this.client.patch<Template>(`/templates/${id}`, {\n name: options.name,\n subject: options.subject,\n html,\n });\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/templates/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type WebhookEvent =\n | 'email.sent'\n | 'email.delivered'\n | 'email.bounced'\n | 'email.complained'\n | 'email.opened'\n | 'email.clicked'\n | '*';\n\nexport interface CreateWebhookOptions {\n url: string;\n events: WebhookEvent[];\n}\n\nexport interface UpdateWebhookOptions {\n url?: string;\n events?: WebhookEvent[];\n}\n\nexport interface WebhookDelivery {\n id: string;\n webhookId: string;\n emailId: string | null;\n eventType: string;\n payload: Record<string, unknown>;\n status: 'pending' | 'success' | 'failed';\n responseStatus: number | null;\n attempts: number;\n createdAt: string;\n lastAttemptAt: string | null;\n}\n\nexport interface Webhook {\n id: string;\n url: string;\n events: WebhookEvent[];\n createdAt: string;\n}\n\nexport interface WebhookWithDeliveries extends Webhook {\n deliveries: WebhookDelivery[];\n}\n\nexport interface CreateWebhookResponse extends Webhook {\n secret: string;\n}\n\nexport class Webhooks {\n constructor(private readonly client: Eusend) {}\n\n create(options: CreateWebhookOptions): Promise<EusendResponse<CreateWebhookResponse>> {\n return this.client.post<CreateWebhookResponse>('/webhooks', {\n url: options.url,\n events: options.events,\n });\n }\n\n async list(): Promise<EusendResponse<Webhook[]>> {\n const res = await this.client.get<{ data: Webhook[] }>('/webhooks');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<WebhookWithDeliveries>> {\n return this.client.get<WebhookWithDeliveries>(`/webhooks/${id}`);\n }\n\n update(id: string, options: UpdateWebhookOptions): Promise<EusendResponse<Webhook>> {\n return this.client.patch<Webhook>(`/webhooks/${id}`, {\n url: options.url,\n events: options.events,\n });\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/webhooks/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\nimport { renderReactEmail, type ReactEmailElement } from './react-render';\n\nexport type BroadcastStatus =\n | 'draft'\n | 'scheduled'\n | 'sending'\n | 'sent'\n | 'paused'\n | 'cancelled';\n\nexport interface CreateBroadcastOptions {\n name: string;\n audienceId: string;\n /**\n * Sender address. Accepts a bare email (`onboarding@eusend.dev`) or a display-name\n * form (`Acme <onboarding@eusend.dev>`). The domain must be verified on your account.\n */\n from: string;\n subject: string;\n html?: string;\n /**\n * A React Email component. The SDK renders it to HTML locally before sending —\n * the JSX source never travels over the wire. Requires `@react-email/render`\n * and `react` as peer dependencies. Ignored when `html` is also provided.\n */\n react?: ReactEmailElement;\n templateId?: string;\n templateVariables?: Record<string, string>;\n}\n\nexport interface UpdateBroadcastOptions {\n name?: string;\n audienceId?: string;\n from?: string;\n subject?: string;\n html?: string;\n /**\n * See `react` on CreateBroadcastOptions. Rendered to HTML locally before sending.\n */\n react?: ReactEmailElement;\n templateId?: string | null;\n templateVariables?: Record<string, string> | null;\n scheduledAt?: string | null;\n}\n\nexport interface SendBroadcastOptions {\n scheduledAt?: string;\n}\n\nexport interface Broadcast {\n id: string;\n name: string;\n status: BroadcastStatus;\n audienceId: string;\n fromAddress: string;\n subject: string;\n html: string | null;\n templateId: string | null;\n templateVariables: Record<string, string> | null;\n scheduledAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface BroadcastListItem {\n id: string;\n name: string;\n status: BroadcastStatus;\n audienceId: string;\n fromAddress: string;\n subject: string;\n recipientCount: number | null;\n sentCount: number | null;\n scheduledAt: string | null;\n startedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n audienceName: string | null;\n}\n\nexport interface BroadcastDetail extends Broadcast {\n recipientCount: number | null;\n sentCount: number | null;\n startedAt: string | null;\n completedAt: string | null;\n stats: Record<string, number>;\n}\n\nexport interface SendBroadcastResponse {\n id: string;\n status: 'sending' | 'scheduled';\n scheduledAt: string | null;\n}\n\nasync function resolveBroadcastHtml(\n options: { html?: string; react?: ReactEmailElement },\n): Promise<string | undefined> {\n if (options.html) return options.html;\n if (options.react) return renderReactEmail(options.react);\n return undefined;\n}\n\nexport class Broadcasts {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateBroadcastOptions): Promise<EusendResponse<Broadcast>> {\n const html = await resolveBroadcastHtml(options);\n return this.client.post<Broadcast>('/broadcasts', {\n name: options.name,\n audience_id: options.audienceId,\n from: options.from,\n subject: options.subject,\n html,\n template_id: options.templateId,\n template_variables: options.templateVariables,\n });\n }\n\n async list(): Promise<EusendResponse<BroadcastListItem[]>> {\n const res = await this.client.get<{ data: BroadcastListItem[] }>('/broadcasts');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<BroadcastDetail>> {\n return this.client.get<BroadcastDetail>(`/broadcasts/${id}`);\n }\n\n async update(id: string, options: UpdateBroadcastOptions): Promise<EusendResponse<Broadcast>> {\n const html = await resolveBroadcastHtml(options);\n return this.client.patch<Broadcast>(`/broadcasts/${id}`, {\n name: options.name,\n audience_id: options.audienceId,\n from: options.from,\n subject: options.subject,\n html,\n template_id: options.templateId,\n template_variables: options.templateVariables,\n scheduled_at: options.scheduledAt,\n });\n }\n\n send(id: string, options: SendBroadcastOptions = {}): Promise<EusendResponse<SendBroadcastResponse>> {\n return this.client.post<SendBroadcastResponse>(`/broadcasts/${id}/send`, {\n scheduled_at: options.scheduledAt,\n });\n }\n\n cancel(id: string): Promise<EusendResponse<Broadcast>> {\n return this.client.post<Broadcast>(`/broadcasts/${id}/cancel`);\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/broadcasts/${id}`);\n }\n}\n","import type { EusendError, EusendResponse } from './interfaces'\nimport { Emails } from './emails'\nimport { Batch } from './batch'\nimport { Domains } from './domains'\nimport { ApiKeys } from './api-keys'\nimport { Audiences } from './audiences'\nimport { Templates } from './templates'\nimport { Webhooks } from './webhooks'\nimport { Broadcasts } from './broadcasts'\n\nconst DEFAULT_BASE_URL = 'https://api.eusend.dev'\nconst SDK_VERSION = '0.6.0'\n\nexport interface EusendOptions {\n baseUrl?: string\n}\n\nexport class Eusend {\n readonly baseUrl: string\n private readonly apiKey: string\n\n readonly emails: Emails\n /** Batch sending — `client.batch.send([...])`. Mirrors Resend's `resend.batch.send()`. */\n readonly batch: Batch\n readonly domains: Domains\n readonly apiKeys: ApiKeys\n readonly audiences: Audiences\n readonly templates: Templates\n readonly webhooks: Webhooks\n readonly broadcasts: Broadcasts\n\n constructor(key?: string, options?: EusendOptions) {\n const apiKey =\n key ?? (typeof process !== 'undefined' ? process.env['EUSEND_API_KEY'] : undefined)\n if (!apiKey) {\n throw new Error(\n 'Missing Eusend API key. Pass it to the constructor or set the EUSEND_API_KEY environment variable.',\n )\n }\n this.apiKey = apiKey\n this.baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL\n\n this.emails = new Emails(this)\n this.batch = new Batch(this)\n this.domains = new Domains(this)\n this.apiKeys = new ApiKeys(this)\n this.audiences = new Audiences(this)\n this.templates = new Templates(this)\n this.webhooks = new Webhooks(this)\n this.broadcasts = new Broadcasts(this)\n }\n\n async fetchRequest<T>(\n path: string,\n init: RequestInit = {},\n extraHeaders: Record<string, string> = {},\n ): Promise<EusendResponse<T>> {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `eusend-node/${SDK_VERSION}`,\n ...extraHeaders,\n }\n\n try {\n const res = await fetch(`${this.baseUrl}${path}`, { ...init, headers })\n const responseHeaders = Object.fromEntries(res.headers.entries())\n\n if (!res.ok) {\n let error: EusendError\n try {\n const json = (await res.json()) as { error?: string; code?: string }\n error = {\n message: json.error ?? 'Unknown error',\n statusCode: res.status,\n name: (json.code as EusendError['name']) ?? 'INTERNAL_ERROR',\n }\n } catch {\n error = { message: 'Request failed', statusCode: res.status, name: 'INTERNAL_ERROR' }\n }\n return { data: null, error, headers: responseHeaders }\n }\n\n if (res.status === 204 || res.headers.get('content-length') === '0') {\n return { data: {} as T, error: null, headers: responseHeaders }\n }\n\n const data = (await res.json()) as T\n return { data, error: null, headers: responseHeaders }\n } catch {\n return {\n data: null,\n error: {\n message: 'Network request failed. The request could not be resolved.',\n statusCode: null,\n name: 'application_error',\n },\n headers: null,\n }\n }\n }\n\n get<T>(path: string, extraHeaders?: Record<string, string>): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, { method: 'GET' }, extraHeaders)\n }\n\n post<T>(\n path: string,\n body?: unknown,\n extraHeaders?: Record<string, string>,\n ): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(\n path,\n { method: 'POST', body: body != null ? JSON.stringify(body) : undefined },\n extraHeaders,\n )\n }\n\n patch<T>(path: string, body?: unknown): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, {\n method: 'PATCH',\n body: body != null ? JSON.stringify(body) : undefined,\n })\n }\n\n delete<T>(path: string): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, { method: 'DELETE' })\n }\n}\n"],"mappings":";AASA,IAAI,gBAAiF;AAErF,eAAe,YAAsE;CACnF,IAAI,CAAC,eACH,iBAAiB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C4B;EAC5B,OAAO,KAAK,aACV,MACA;GAAE,QAAQ;GAAQ,MAAM,QAAQ,OAAO,KAAK,UAAU,IAAI,IAAI,KAAA;EAAU,GACxE,YACF;CACF;CAEA,MAAS,MAAc,MAA4C;EACjE,OAAO,KAAK,aAAgB,MAAM;GAChC,QAAQ;GACR,MAAM,QAAQ,OAAO,KAAK,UAAU,IAAI,IAAI,KAAA;EAC9C,CAAC;CACH;CAEA,OAAU,MAA0C;EAClD,OAAO,KAAK,aAAgB,MAAM,EAAE,QAAQ,SAAS,CAAC;CACxD;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/react-render.ts","../src/emails.ts","../src/batch.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"sourcesContent":["// Minimal structural type so the SDK doesn't take a hard dependency on `react`.\n// Real React elements assignable to this; users who pass `react:` are expected to\n// have `react` and `@react-email/render` installed (declared as optional peers).\nexport type ReactEmailElement = {\n readonly type: unknown;\n readonly props: unknown;\n readonly key: string | number | null;\n};\n\nlet renderPromise: Promise<(element: ReactEmailElement) => Promise<string>> | null = null;\n\nasync function getRender(): Promise<(element: ReactEmailElement) => Promise<string>> {\n if (!renderPromise) {\n renderPromise = (async () => {\n try {\n const mod = (await import('@react-email/render')) as {\n render: (element: unknown, options?: { plainText?: boolean }) => Promise<string> | string;\n };\n return (element: ReactEmailElement) => Promise.resolve(mod.render(element));\n } catch {\n throw new Error(\n \"Passing `react:` requires `@react-email/render` and `react` to be installed. \" +\n 'Run: npm install @react-email/render react',\n );\n }\n })();\n }\n return renderPromise;\n}\n\nexport async function renderReactEmail(element: ReactEmailElement): Promise<string> {\n const render = await getRender();\n return render(element);\n}\n","import type { Eusend } from './eusend';\nimport type { EusendErrorCode, EusendResponse } from './interfaces';\nimport { renderReactEmail, type ReactEmailElement } from './react-render';\n\nexport type EmailStatus =\n | 'queued'\n | 'scheduled'\n | 'canceled'\n | 'sending'\n | 'sent'\n | 'delivered'\n | 'bounced'\n | 'complained'\n | 'suppressed'\n | 'failed';\n\nexport type EmailEventType =\n | 'sent'\n | 'delivered'\n | 'opened'\n | 'clicked'\n | 'bounced'\n | 'complained';\n\nexport interface Attachment {\n /** Name the recipient sees for the file, e.g. `invoice.pdf`. */\n filename: string;\n /**\n * File contents. A base64-encoded string (sent as-is) or raw bytes\n * (`Uint8Array`/`Buffer`), which the SDK base64-encodes for you. Provide either\n * `content` or `path`, not both.\n */\n content?: string | Uint8Array;\n /**\n * A URL the server fetches at send time to attach the file. Use instead of\n * `content` when the bytes live on a public URL. Provide either `content` or `path`,\n * not both.\n */\n path?: string;\n /** MIME type, e.g. `application/pdf`. Inferred from the filename when omitted. */\n contentType?: string;\n /**\n * Content-ID for an inline attachment. Set it to reference the file from your\n * HTML with `<img src=\"cid:<contentId>\">` instead of showing it as a download.\n */\n contentId?: string;\n}\n\nexport interface SendEmailOptions {\n /**\n * Sender address. Accepts a bare email (`onboarding@eusend.dev`) or a display-name\n * form (`Acme <onboarding@eusend.dev>`). The domain must be verified on your account.\n */\n from: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string | string[];\n subject?: string;\n html?: string;\n text?: string;\n /**\n * A React Email component. The SDK renders it to HTML locally before sending\n * — the JSX source never travels over the wire. Requires `@react-email/render`\n * and `react` as peer dependencies. Ignored when `html` is also provided.\n */\n react?: ReactEmailElement;\n templateId?: string;\n variables?: Record<string, unknown>;\n headers?: Record<string, string>;\n trackOpens?: boolean;\n trackClicks?: boolean;\n /** File attachments. Up to 20 per message, 10 MB combined. */\n attachments?: Attachment[];\n /**\n * Schedule the send for a future time, at most 30 days out. Accepts a `Date`, an\n * ISO 8601 string, or a natural-language time like `\"in 1 hour\"` or `\"tomorrow at\n * 9am\"` (parsed server-side, same as Resend). Relative phrasings resolve against the\n * server clock in UTC — pass an offset-qualified ISO string when you need an exact\n * instant. The email is created with status `scheduled`; reschedule it with\n * `emails.update()` or call `emails.cancel()` any time before it sends.\n */\n scheduledAt?: string | Date;\n}\n\nexport interface SendEmailRequestOptions {\n idempotencyKey?: string;\n}\n\nexport interface SendEmailResponse {\n id: string;\n}\n\n/**\n * Per-item outcome of a batch send, positionally mapped to the input array:\n * `data[i]` describes `emails[i]`. Items that were queued carry `{ id }`; items\n * that could not be queued carry `{ error, code }` (e.g. an unverified sender\n * domain, all recipients suppressed, or an exhausted send quota). Branch on the\n * presence of `id`.\n */\nexport type BatchItemResult =\n | { id: string; error?: never; code?: never }\n | { id?: never; error: string; code: EusendErrorCode };\n\nexport interface BatchSendResponse {\n data: BatchItemResult[];\n}\n\nexport interface EmailEvent {\n id: string;\n type: EmailEventType;\n metadata: Record<string, unknown>;\n createdAt: string;\n}\n\nexport interface Email {\n id: string;\n from: string;\n to: string[];\n cc: string[];\n bcc: string[];\n replyTo: string[];\n subject: string;\n html: string | null;\n text: string | null;\n status: EmailStatus;\n testMode: boolean;\n templateId: string | null;\n /** Set only for scheduled sends. */\n scheduledAt: string | null;\n createdAt: string;\n events: EmailEvent[];\n}\n\nexport interface UpdateEmailOptions {\n /** The new send time, at most 30 days out — a `Date`, an ISO 8601 string, or natural\n * language like `\"in 1 hour\"` (parsed server-side, same as `emails.send`). */\n scheduledAt: string | Date;\n}\n\nexport interface UpdateEmailResponse {\n id: string;\n status: 'scheduled';\n scheduledAt: string;\n}\n\nexport interface CancelEmailResponse {\n id: string;\n status: 'canceled';\n}\n\nexport interface EmailListItem {\n id: string;\n from: string;\n to: string[];\n subject: string;\n status: EmailStatus;\n testMode: boolean;\n createdAt: string;\n}\n\nexport interface ListEmailsOptions {\n limit?: number;\n cursor?: string;\n status?: EmailStatus;\n from?: string;\n to?: string;\n}\n\nexport interface ListEmailsResponse {\n data: EmailListItem[];\n nextCursor: string | null;\n}\n\nasync function resolveHtml(options: SendEmailOptions): Promise<string | undefined> {\n if (options.html) return options.html;\n if (options.react) return renderReactEmail(options.react);\n return undefined;\n}\n\nfunction encodeAttachmentContent(content: string | Uint8Array): string {\n // A string is assumed to already be base64. Raw bytes are encoded here.\n if (typeof content === 'string') return content;\n if (typeof Buffer !== 'undefined') return Buffer.from(content).toString('base64');\n let binary = '';\n for (const byte of content) binary += String.fromCharCode(byte);\n return btoa(binary);\n}\n\nfunction toIsoString(value: string | Date): string {\n return value instanceof Date ? value.toISOString() : value;\n}\n\nexport async function toApiPayload(options: SendEmailOptions) {\n const html = await resolveHtml(options);\n return {\n from: options.from,\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n reply_to: options.replyTo,\n subject: options.subject,\n html,\n text: options.text,\n template_id: options.templateId,\n variables: options.variables,\n headers: options.headers,\n track_opens: options.trackOpens,\n track_clicks: options.trackClicks,\n attachments: options.attachments?.map((a) => ({\n filename: a.filename,\n content: a.content === undefined ? undefined : encodeAttachmentContent(a.content),\n path: a.path,\n content_type: a.contentType,\n content_id: a.contentId,\n })),\n scheduled_at: options.scheduledAt ? toIsoString(options.scheduledAt) : undefined,\n };\n}\n\nexport class Emails {\n constructor(private readonly client: Eusend) {}\n\n async send(\n options: SendEmailOptions,\n requestOptions?: SendEmailRequestOptions,\n ): Promise<EusendResponse<SendEmailResponse>> {\n const extraHeaders: Record<string, string> = {};\n if (requestOptions?.idempotencyKey) {\n extraHeaders['Idempotency-Key'] = requestOptions.idempotencyKey;\n }\n const payload = await toApiPayload(options);\n return this.client.post<SendEmailResponse>('/emails', payload, extraHeaders);\n }\n\n async list(options: ListEmailsOptions = {}): Promise<EusendResponse<ListEmailsResponse>> {\n const params = new URLSearchParams();\n if (options.limit != null) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n if (options.status) params.set('status', options.status);\n if (options.from) params.set('from', options.from);\n if (options.to) params.set('to', options.to);\n const qs = params.toString();\n\n const res = await this.client.get<{ data: EmailListItem[]; next_cursor: string | null }>(\n qs ? `/emails?${qs}` : '/emails',\n );\n if (res.error) return res;\n return {\n data: { data: res.data.data, nextCursor: res.data.next_cursor },\n error: null,\n headers: res.headers,\n };\n }\n\n get(id: string): Promise<EusendResponse<Email>> {\n return this.client.get<Email>(`/emails/${id}`);\n }\n\n /** Reschedule a scheduled email. Fails once the email has started sending. */\n async update(\n id: string,\n options: UpdateEmailOptions,\n ): Promise<EusendResponse<UpdateEmailResponse>> {\n const res = await this.client.patch<{ id: string; status: 'scheduled'; scheduled_at: string }>(\n `/emails/${id}`,\n { scheduled_at: toIsoString(options.scheduledAt) },\n );\n if (res.error) return res;\n return {\n data: { id: res.data.id, status: res.data.status, scheduledAt: res.data.scheduled_at },\n error: null,\n headers: res.headers,\n };\n }\n\n /** Cancel a scheduled email. Fails once the email has started sending. */\n cancel(id: string): Promise<EusendResponse<CancelEmailResponse>> {\n return this.client.post<CancelEmailResponse>(`/emails/${id}/cancel`, undefined);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\nimport { toApiPayload, type SendEmailOptions, type BatchSendResponse } from './emails';\n\n/**\n * Batch sending — `eusend.batch.send([...])`. The method path mirrors Resend's\n * `resend.batch.send([...])`, so migrating is a mechanical `resend` → `eusend` rename.\n * The HTTP body is a top-level array of email objects (POST /emails/batch), up to 100\n * per request. As with Resend, attachments and `scheduledAt` are not supported on the\n * batch endpoint — send those individually via `emails.send`.\n *\n * The response maps positionally to the input: `data[i]` is `{ id }` when\n * `emails[i]` was queued, or `{ error, code }` when it was not (unverified\n * domain, suppressed recipients, exhausted quota, …) — failed items never fail\n * the whole batch, so branch on the presence of `id` per item.\n */\nexport class Batch {\n constructor(private readonly client: Eusend) {}\n\n async send(emails: SendEmailOptions[]): Promise<EusendResponse<BatchSendResponse>> {\n const payloads = await Promise.all(emails.map(toApiPayload));\n return this.client.post<BatchSendResponse>('/emails/batch', payloads);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type DomainStatus = 'pending' | 'verified' | 'failed';\n\nexport interface DnsRecord {\n type: string;\n name: string;\n value: string;\n /** MX records only. */\n priority?: number;\n /**\n * `authentication` — required before the domain can send.\n * `policy` — recommended; absence weakens but does not block.\n * `alignment` — optional; publishing all of them enables Return-Path SPF alignment.\n */\n purpose?: string;\n description?: string;\n}\n\nexport interface CreateDomainResponse {\n id: string;\n name: string;\n /**\n * Every record to publish, in presentation order. Prefer this over the individual\n * keys below — it is the only place the optional Return-Path alignment records appear.\n */\n records: DnsRecord[];\n dkim: DnsRecord;\n dmarc: DnsRecord;\n}\n\nexport interface DomainListItem {\n id: string;\n name: string;\n status: DomainStatus;\n createdAt: string;\n}\n\nexport interface Domain {\n id: string;\n name: string;\n dkimPublicKey: string;\n dkimSelector: string;\n status: DomainStatus;\n createdAt: string;\n verifiedAt: string | null;\n}\n\nexport class Domains {\n constructor(private readonly client: Eusend) {}\n\n create(name: string): Promise<EusendResponse<CreateDomainResponse>> {\n return this.client.post<CreateDomainResponse>('/domains', { name });\n }\n\n list(): Promise<EusendResponse<DomainListItem[]>> {\n return this.client.get<DomainListItem[]>('/domains');\n }\n\n get(id: string): Promise<EusendResponse<Domain>> {\n return this.client.get<Domain>(`/domains/${id}`);\n }\n\n delete(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.delete<{ message: string }>(`/domains/${id}`);\n }\n\n verify(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.post<{ message: string }>(`/domains/${id}/verify`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport interface CreateApiKeyOptions {\n name: string;\n testMode?: boolean;\n}\n\nexport interface CreateApiKeyResponse {\n id: string;\n name: string;\n key: string;\n prefix: string;\n testMode: boolean;\n createdAt: string;\n}\n\nexport interface ApiKey {\n id: string;\n name: string;\n prefix: string;\n testMode: boolean;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\ntype CreateApiKeyApiResponse = {\n id: string;\n name: string;\n key: string;\n prefix: string;\n test_mode: boolean;\n created_at: string;\n};\n\nexport class ApiKeys {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateApiKeyOptions): Promise<EusendResponse<CreateApiKeyResponse>> {\n const res = await this.client.post<CreateApiKeyApiResponse>('/api-keys', {\n name: options.name,\n test_mode: options.testMode ?? false,\n });\n if (res.error) return res;\n return {\n data: {\n id: res.data.id,\n name: res.data.name,\n key: res.data.key,\n prefix: res.data.prefix,\n testMode: res.data.test_mode,\n createdAt: res.data.created_at,\n },\n error: null,\n headers: res.headers,\n };\n }\n\n list(): Promise<EusendResponse<ApiKey[]>> {\n return this.client.get<ApiKey[]>('/api-keys');\n }\n\n delete(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.delete<{ message: string }>(`/api-keys/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type ContactStatus = 'subscribed' | 'unsubscribed';\n\nexport interface Audience {\n id: string;\n name: string;\n organizationId: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AudienceListItem {\n id: string;\n name: string;\n createdAt: string;\n contactCount: number;\n}\n\nexport interface Contact {\n id: string;\n audienceId: string;\n email: string;\n firstName: string | null;\n lastName: string | null;\n status: ContactStatus;\n unsubscribedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateContactOptions {\n email: string;\n firstName?: string;\n lastName?: string;\n}\n\nexport interface UpdateContactOptions {\n firstName?: string;\n lastName?: string;\n unsubscribed?: boolean;\n}\n\nexport interface ListContactsOptions {\n limit?: number;\n cursor?: string;\n search?: string;\n subscribed?: boolean;\n}\n\nexport interface ListContactsResponse {\n data: Contact[];\n nextCursor: string | null;\n}\n\nexport interface BatchCreateContactsOptions {\n contacts: CreateContactOptions[];\n}\n\nexport class Audiences {\n constructor(private readonly client: Eusend) {}\n\n create(name: string): Promise<EusendResponse<Audience>> {\n return this.client.post<Audience>('/audiences', { name });\n }\n\n async list(): Promise<EusendResponse<AudienceListItem[]>> {\n const res = await this.client.get<{ data: AudienceListItem[] }>('/audiences');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/audiences/${id}`);\n }\n\n createContact(\n audienceId: string,\n options: CreateContactOptions,\n ): Promise<EusendResponse<Contact>> {\n return this.client.post<Contact>(`/audiences/${audienceId}/contacts`, {\n email: options.email,\n first_name: options.firstName,\n last_name: options.lastName,\n });\n }\n\n async listContacts(\n audienceId: string,\n options: ListContactsOptions = {},\n ): Promise<EusendResponse<ListContactsResponse>> {\n const params = new URLSearchParams();\n if (options.limit != null) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n if (options.search) params.set('search', options.search);\n if (options.subscribed != null) params.set('subscribed', String(options.subscribed));\n const qs = params.toString();\n return this.client.get<ListContactsResponse>(\n qs ? `/audiences/${audienceId}/contacts?${qs}` : `/audiences/${audienceId}/contacts`,\n );\n }\n\n getContact(audienceId: string, contactId: string): Promise<EusendResponse<Contact>> {\n return this.client.get<Contact>(`/audiences/${audienceId}/contacts/${contactId}`);\n }\n\n updateContact(\n audienceId: string,\n contactId: string,\n options: UpdateContactOptions,\n ): Promise<EusendResponse<Contact>> {\n return this.client.patch<Contact>(`/audiences/${audienceId}/contacts/${contactId}`, {\n first_name: options.firstName,\n last_name: options.lastName,\n unsubscribed: options.unsubscribed,\n });\n }\n\n deleteContact(\n audienceId: string,\n contactId: string,\n ): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(\n `/audiences/${audienceId}/contacts/${contactId}`,\n );\n }\n\n /**\n * Upsert up to 1000 contacts in one call. Addresses are lowercased and\n * de-duplicated server-side; `count` is the number of rows written and\n * `duplicates` how many repeated addresses were collapsed to get there.\n */\n batchCreateContacts(\n audienceId: string,\n options: BatchCreateContactsOptions,\n ): Promise<EusendResponse<{ count: number; duplicates: number }>> {\n return this.client.post<{ count: number; duplicates: number }>(`/audiences/${audienceId}/contacts/batch`, {\n contacts: options.contacts.map((c) => ({\n email: c.email,\n first_name: c.firstName,\n last_name: c.lastName,\n })),\n });\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\nimport { renderReactEmail, type ReactEmailElement } from './react-render';\n\ninterface TemplateHtmlOrReact {\n /**\n * A React Email component. The SDK renders it to HTML locally before sending.\n * Requires `@react-email/render` and `react` as peer dependencies.\n * Ignored when `html` is also provided.\n */\n react?: ReactEmailElement;\n}\n\nexport interface CreateTemplateOptions extends TemplateHtmlOrReact {\n name: string;\n subject: string;\n html?: string;\n}\n\nexport interface UpdateTemplateOptions extends TemplateHtmlOrReact {\n name?: string;\n subject?: string;\n html?: string;\n}\n\nexport interface Template {\n id: string;\n name: string;\n subject: string;\n html: string | null;\n reactSource: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface TemplateListItem {\n id: string;\n name: string;\n subject: string;\n createdAt: string;\n updatedAt: string;\n}\n\nasync function resolveTemplateHtml(\n options: TemplateHtmlOrReact & { html?: string },\n): Promise<string | undefined> {\n if (options.html) return options.html;\n if (options.react) return renderReactEmail(options.react);\n return undefined;\n}\n\nexport class Templates {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateTemplateOptions): Promise<EusendResponse<Template>> {\n const html = await resolveTemplateHtml(options);\n if (!html) {\n return {\n data: null,\n error: {\n message: 'Either html or react is required',\n statusCode: null,\n name: 'VALIDATION_ERROR',\n },\n headers: null,\n };\n }\n return this.client.post<Template>('/templates', {\n name: options.name,\n subject: options.subject,\n html,\n });\n }\n\n async list(): Promise<EusendResponse<TemplateListItem[]>> {\n const res = await this.client.get<{ data: TemplateListItem[] }>('/templates');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<Template>> {\n return this.client.get<Template>(`/templates/${id}`);\n }\n\n async update(id: string, options: UpdateTemplateOptions): Promise<EusendResponse<Template>> {\n const html = await resolveTemplateHtml(options);\n return this.client.patch<Template>(`/templates/${id}`, {\n name: options.name,\n subject: options.subject,\n html,\n });\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/templates/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type WebhookEvent =\n | 'email.sent'\n | 'email.delivered'\n | 'email.bounced'\n | 'email.complained'\n | 'email.opened'\n | 'email.clicked'\n | '*';\n\nexport interface CreateWebhookOptions {\n url: string;\n events: WebhookEvent[];\n}\n\nexport interface UpdateWebhookOptions {\n url?: string;\n events?: WebhookEvent[];\n}\n\nexport interface WebhookDelivery {\n id: string;\n webhookId: string;\n emailId: string | null;\n eventType: string;\n payload: Record<string, unknown>;\n status: 'pending' | 'success' | 'failed';\n responseStatus: number | null;\n attempts: number;\n createdAt: string;\n lastAttemptAt: string | null;\n}\n\nexport interface Webhook {\n id: string;\n url: string;\n events: WebhookEvent[];\n createdAt: string;\n}\n\nexport interface WebhookWithDeliveries extends Webhook {\n deliveries: WebhookDelivery[];\n}\n\nexport interface CreateWebhookResponse extends Webhook {\n secret: string;\n}\n\nexport class Webhooks {\n constructor(private readonly client: Eusend) {}\n\n create(options: CreateWebhookOptions): Promise<EusendResponse<CreateWebhookResponse>> {\n return this.client.post<CreateWebhookResponse>('/webhooks', {\n url: options.url,\n events: options.events,\n });\n }\n\n async list(): Promise<EusendResponse<Webhook[]>> {\n const res = await this.client.get<{ data: Webhook[] }>('/webhooks');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<WebhookWithDeliveries>> {\n return this.client.get<WebhookWithDeliveries>(`/webhooks/${id}`);\n }\n\n update(id: string, options: UpdateWebhookOptions): Promise<EusendResponse<Webhook>> {\n return this.client.patch<Webhook>(`/webhooks/${id}`, {\n url: options.url,\n events: options.events,\n });\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/webhooks/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\nimport { renderReactEmail, type ReactEmailElement } from './react-render';\n\nexport type BroadcastStatus =\n | 'draft'\n | 'scheduled'\n | 'sending'\n | 'sent'\n | 'paused'\n | 'cancelled';\n\nexport interface CreateBroadcastOptions {\n name: string;\n audienceId: string;\n /**\n * Sender address. Accepts a bare email (`onboarding@eusend.dev`) or a display-name\n * form (`Acme <onboarding@eusend.dev>`). The domain must be verified on your account.\n */\n from: string;\n subject: string;\n html?: string;\n /**\n * A React Email component. The SDK renders it to HTML locally before sending —\n * the JSX source never travels over the wire. Requires `@react-email/render`\n * and `react` as peer dependencies. Ignored when `html` is also provided.\n */\n react?: ReactEmailElement;\n templateId?: string;\n templateVariables?: Record<string, string>;\n}\n\nexport interface UpdateBroadcastOptions {\n name?: string;\n audienceId?: string;\n from?: string;\n subject?: string;\n html?: string;\n /**\n * See `react` on CreateBroadcastOptions. Rendered to HTML locally before sending.\n */\n react?: ReactEmailElement;\n templateId?: string | null;\n templateVariables?: Record<string, string> | null;\n scheduledAt?: string | null;\n}\n\nexport interface SendBroadcastOptions {\n scheduledAt?: string;\n}\n\nexport interface Broadcast {\n id: string;\n name: string;\n status: BroadcastStatus;\n audienceId: string;\n fromAddress: string;\n subject: string;\n html: string | null;\n templateId: string | null;\n templateVariables: Record<string, string> | null;\n scheduledAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface BroadcastListItem {\n id: string;\n name: string;\n status: BroadcastStatus;\n audienceId: string;\n fromAddress: string;\n subject: string;\n recipientCount: number | null;\n sentCount: number | null;\n scheduledAt: string | null;\n startedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n audienceName: string | null;\n}\n\nexport interface BroadcastDetail extends Broadcast {\n recipientCount: number | null;\n sentCount: number | null;\n startedAt: string | null;\n completedAt: string | null;\n stats: Record<string, number>;\n}\n\nexport interface SendBroadcastResponse {\n id: string;\n status: 'sending' | 'scheduled';\n scheduledAt: string | null;\n}\n\nasync function resolveBroadcastHtml(\n options: { html?: string; react?: ReactEmailElement },\n): Promise<string | undefined> {\n if (options.html) return options.html;\n if (options.react) return renderReactEmail(options.react);\n return undefined;\n}\n\nexport class Broadcasts {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateBroadcastOptions): Promise<EusendResponse<Broadcast>> {\n const html = await resolveBroadcastHtml(options);\n return this.client.post<Broadcast>('/broadcasts', {\n name: options.name,\n audience_id: options.audienceId,\n from: options.from,\n subject: options.subject,\n html,\n template_id: options.templateId,\n template_variables: options.templateVariables,\n });\n }\n\n async list(): Promise<EusendResponse<BroadcastListItem[]>> {\n const res = await this.client.get<{ data: BroadcastListItem[] }>('/broadcasts');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<BroadcastDetail>> {\n return this.client.get<BroadcastDetail>(`/broadcasts/${id}`);\n }\n\n async update(id: string, options: UpdateBroadcastOptions): Promise<EusendResponse<Broadcast>> {\n const html = await resolveBroadcastHtml(options);\n return this.client.patch<Broadcast>(`/broadcasts/${id}`, {\n name: options.name,\n audience_id: options.audienceId,\n from: options.from,\n subject: options.subject,\n html,\n template_id: options.templateId,\n template_variables: options.templateVariables,\n scheduled_at: options.scheduledAt,\n });\n }\n\n send(id: string, options: SendBroadcastOptions = {}): Promise<EusendResponse<SendBroadcastResponse>> {\n return this.client.post<SendBroadcastResponse>(`/broadcasts/${id}/send`, {\n scheduled_at: options.scheduledAt,\n });\n }\n\n cancel(id: string): Promise<EusendResponse<Broadcast>> {\n return this.client.post<Broadcast>(`/broadcasts/${id}/cancel`);\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/broadcasts/${id}`);\n }\n}\n","import type { EusendError, EusendResponse } from './interfaces'\nimport { Emails } from './emails'\nimport { Batch } from './batch'\nimport { Domains } from './domains'\nimport { ApiKeys } from './api-keys'\nimport { Audiences } from './audiences'\nimport { Templates } from './templates'\nimport { Webhooks } from './webhooks'\nimport { Broadcasts } from './broadcasts'\n\nconst DEFAULT_BASE_URL = 'https://api.eusend.dev'\nconst SDK_VERSION = '0.7.1'\n\nexport interface EusendOptions {\n baseUrl?: string\n}\n\nexport class Eusend {\n readonly baseUrl: string\n private readonly apiKey: string\n\n readonly emails: Emails\n /** Batch sending — `client.batch.send([...])`. Mirrors Resend's `resend.batch.send()`. */\n readonly batch: Batch\n readonly domains: Domains\n readonly apiKeys: ApiKeys\n readonly audiences: Audiences\n readonly templates: Templates\n readonly webhooks: Webhooks\n readonly broadcasts: Broadcasts\n\n constructor(key?: string, options?: EusendOptions) {\n const apiKey =\n key ?? (typeof process !== 'undefined' ? process.env['EUSEND_API_KEY'] : undefined)\n if (!apiKey) {\n throw new Error(\n 'Missing Eusend API key. Pass it to the constructor or set the EUSEND_API_KEY environment variable.',\n )\n }\n this.apiKey = apiKey\n this.baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL\n\n this.emails = new Emails(this)\n this.batch = new Batch(this)\n this.domains = new Domains(this)\n this.apiKeys = new ApiKeys(this)\n this.audiences = new Audiences(this)\n this.templates = new Templates(this)\n this.webhooks = new Webhooks(this)\n this.broadcasts = new Broadcasts(this)\n }\n\n async fetchRequest<T>(\n path: string,\n init: RequestInit = {},\n extraHeaders: Record<string, string> = {},\n ): Promise<EusendResponse<T>> {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `eusend-node/${SDK_VERSION}`,\n ...extraHeaders,\n }\n\n try {\n const res = await fetch(`${this.baseUrl}${path}`, { ...init, headers })\n const responseHeaders = Object.fromEntries(res.headers.entries())\n\n if (!res.ok) {\n let error: EusendError\n try {\n const json = (await res.json()) as { error?: string; code?: string }\n error = {\n message: json.error ?? 'Unknown error',\n statusCode: res.status,\n name: (json.code as EusendError['name']) ?? 'INTERNAL_ERROR',\n }\n } catch {\n error = { message: 'Request failed', statusCode: res.status, name: 'INTERNAL_ERROR' }\n }\n return { data: null, error, headers: responseHeaders }\n }\n\n if (res.status === 204 || res.headers.get('content-length') === '0') {\n return { data: {} as T, error: null, headers: responseHeaders }\n }\n\n const data = (await res.json()) as T\n return { data, error: null, headers: responseHeaders }\n } catch {\n return {\n data: null,\n error: {\n message: 'Network request failed. The request could not be resolved.',\n statusCode: null,\n name: 'application_error',\n },\n headers: null,\n }\n }\n }\n\n get<T>(path: string, extraHeaders?: Record<string, string>): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, { method: 'GET' }, extraHeaders)\n }\n\n post<T>(\n path: string,\n body?: unknown,\n extraHeaders?: Record<string, string>,\n ): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(\n path,\n { method: 'POST', body: body != null ? JSON.stringify(body) : undefined },\n extraHeaders,\n )\n }\n\n patch<T>(path: string, body?: unknown): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, {\n method: 'PATCH',\n body: body != null ? JSON.stringify(body) : undefined,\n })\n }\n\n delete<T>(path: string): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, { method: 'DELETE' })\n }\n}\n"],"mappings":";AASA,IAAI,gBAAiF;AAErF,eAAe,YAAsE;CACnF,IAAI,CAAC,eACH,iBAAiB,YAAY;EAC3B,IAAI;GACF,MAAM,MAAO,MAAM,OAAO;GAG1B,QAAQ,YAA+B,QAAQ,QAAQ,IAAI,OAAO,OAAO,CAAC;EAC5E,QAAQ;GACN,MAAM,IAAI,MACR,yHAEF;EACF;CACF,EAAA,CAAG;CAEL,OAAO;AACT;AAEA,eAAsB,iBAAiB,SAA6C;CAElF,QAAO,MADc,UAAU,EAAA,CACjB,OAAO;AACvB;;;AC6IA,eAAe,YAAY,SAAwD;CACjF,IAAI,QAAQ,MAAM,OAAO,QAAQ;CACjC,IAAI,QAAQ,OAAO,OAAO,iBAAiB,QAAQ,KAAK;AAE1D;AAEA,SAAS,wBAAwB,SAAsC;CAErE,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,OAAO,WAAW,aAAa,OAAO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