resend 6.12.3 → 6.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -23,9 +23,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let postal_mime = require("postal-mime");
25
25
  postal_mime = __toESM(postal_mime);
26
- let svix = require("svix");
26
+ let standardwebhooks = require("standardwebhooks");
27
27
  //#region package.json
28
- var version = "6.12.3";
28
+ var version = "6.12.4";
29
29
  //#endregion
30
30
  //#region src/common/utils/build-pagination-query.ts
31
31
  /**
@@ -274,14 +274,14 @@ var Broadcasts = class {
274
274
  this.resend = resend;
275
275
  }
276
276
  async create(payload, options = {}) {
277
- if (payload.react) payload.html = await render(payload.react);
277
+ const html = payload.react ? await render(payload.react) : payload.html;
278
278
  return await this.resend.post("/broadcasts", {
279
279
  name: payload.name,
280
280
  segment_id: payload.segmentId,
281
281
  audience_id: payload.audienceId,
282
282
  preview_text: payload.previewText,
283
283
  from: payload.from,
284
- html: payload.html,
284
+ html,
285
285
  reply_to: payload.replyTo,
286
286
  subject: payload.subject,
287
287
  text: payload.text,
@@ -305,13 +305,13 @@ var Broadcasts = class {
305
305
  return await this.resend.delete(`/broadcasts/${id}`);
306
306
  }
307
307
  async update(id, payload) {
308
- if (payload.react) payload.html = await render(payload.react);
308
+ const html = payload.react ? await render(payload.react) : payload.html;
309
309
  return await this.resend.patch(`/broadcasts/${id}`, {
310
310
  name: payload.name,
311
311
  segment_id: payload.segmentId,
312
312
  audience_id: payload.audienceId,
313
313
  from: payload.from,
314
- html: payload.html,
314
+ html,
315
315
  text: payload.text,
316
316
  subject: payload.subject,
317
317
  reply_to: payload.replyTo,
@@ -803,8 +803,9 @@ var Emails = class {
803
803
  return this.create(payload, options);
804
804
  }
805
805
  async create(payload, options = {}) {
806
- if (payload.react) payload.html = await render(payload.react);
807
- return await this.resend.post("/emails", parseEmailToApiOptions(payload), options);
806
+ const body = { ...payload };
807
+ if (payload.react) body.html = await render(payload.react);
808
+ return await this.resend.post("/emails", parseEmailToApiOptions(body), options);
808
809
  }
809
810
  async get(id) {
810
811
  return await this.resend.get(`/emails/${id}`);
@@ -944,16 +945,9 @@ var Templates = class {
944
945
  return new ChainableTemplateResult(this.performCreate(payload), this.publish.bind(this));
945
946
  }
946
947
  async performCreate(payload) {
947
- if (payload.react) {
948
- if (!this.renderAsync) try {
949
- const { renderAsync } = await import("@react-email/render");
950
- this.renderAsync = renderAsync;
951
- } catch {
952
- throw new Error("Failed to render React component. Make sure to install `@react-email/render`");
953
- }
954
- payload.html = await this.renderAsync(payload.react);
955
- }
956
- return this.resend.post("/templates", parseTemplateToApiOptions(payload));
948
+ const body = { ...payload };
949
+ if (payload.react) body.html = await render(payload.react);
950
+ return this.resend.post("/templates", parseTemplateToApiOptions(body));
957
951
  }
958
952
  async remove(identifier) {
959
953
  return await this.resend.delete(`/templates/${identifier}`);
@@ -1051,10 +1045,10 @@ var Webhooks = class {
1051
1045
  return await this.resend.delete(`/webhooks/${id}`);
1052
1046
  }
1053
1047
  verify(payload) {
1054
- return new svix.Webhook(payload.webhookSecret).verify(payload.payload, {
1055
- "svix-id": payload.headers.id,
1056
- "svix-timestamp": payload.headers.timestamp,
1057
- "svix-signature": payload.headers.signature
1048
+ return new standardwebhooks.Webhook(payload.webhookSecret).verify(payload.payload, {
1049
+ "webhook-id": payload.headers.id,
1050
+ "webhook-timestamp": payload.headers.timestamp,
1051
+ "webhook-signature": payload.headers.signature
1058
1052
  });
1059
1053
  }
1060
1054
  };
@@ -1062,10 +1056,14 @@ var Webhooks = class {
1062
1056
  //#region src/resend.ts
1063
1057
  const defaultBaseUrl = "https://api.resend.com";
1064
1058
  const defaultUserAgent = `resend-node:${version}`;
1065
- const baseUrl = typeof process !== "undefined" && process.env ? process.env.RESEND_BASE_URL || defaultBaseUrl : defaultBaseUrl;
1066
- const userAgent = typeof process !== "undefined" && process.env ? process.env.RESEND_USER_AGENT || defaultUserAgent : defaultUserAgent;
1059
+ function getDefaultBaseUrl() {
1060
+ return typeof process !== "undefined" && process.env ? process.env.RESEND_BASE_URL || defaultBaseUrl : defaultBaseUrl;
1061
+ }
1062
+ function getDefaultUserAgent() {
1063
+ return typeof process !== "undefined" && process.env ? process.env.RESEND_USER_AGENT || defaultUserAgent : defaultUserAgent;
1064
+ }
1067
1065
  var Resend = class {
1068
- constructor(key) {
1066
+ constructor(key, options) {
1069
1067
  this.key = key;
1070
1068
  this.segments = new Segments(this);
1071
1069
  this.apiKeys = new ApiKeys(this);
@@ -1086,15 +1084,17 @@ var Resend = class {
1086
1084
  if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
1087
1085
  if (!this.key) throw new Error("Missing API key. Pass it to the constructor `new Resend(\"re_123\")`");
1088
1086
  }
1087
+ this.baseUrl = options?.baseUrl ?? getDefaultBaseUrl();
1088
+ this.userAgent = options?.userAgent ?? getDefaultUserAgent();
1089
1089
  this.headers = new Headers({
1090
1090
  Authorization: `Bearer ${this.key}`,
1091
- "User-Agent": userAgent,
1091
+ "User-Agent": this.userAgent,
1092
1092
  "Content-Type": "application/json"
1093
1093
  });
1094
1094
  }
1095
1095
  async fetchRequest(path, options = {}) {
1096
1096
  try {
1097
- const response = await fetch(`${baseUrl}${path}`, options);
1097
+ const response = await fetch(`${this.baseUrl}${path}`, options);
1098
1098
  if (!response.ok) try {
1099
1099
  const rawError = await response.text();
1100
1100
  return {
@@ -1192,11 +1192,14 @@ var Resend = class {
1192
1192
  };
1193
1193
  return this.fetchRequest(path, requestOptions);
1194
1194
  }
1195
- async delete(path, query) {
1195
+ async delete(path, query, options = {}) {
1196
+ const headers = new Headers(this.headers);
1197
+ if (options.headers) for (const [key, value] of new Headers(options.headers).entries()) headers.set(key, value);
1196
1198
  const requestOptions = {
1197
1199
  method: "DELETE",
1198
- body: JSON.stringify(query),
1199
- headers: this.headers
1200
+ body: query === void 0 ? void 0 : JSON.stringify(query),
1201
+ ...options,
1202
+ headers
1200
1203
  };
1201
1204
  return this.fetchRequest(path, requestOptions);
1202
1205
  }
package/dist/index.d.cts CHANGED
@@ -30,6 +30,11 @@ interface AttachmentData {
30
30
  expires_at: string;
31
31
  }
32
32
  //#endregion
33
+ //#region src/common/interfaces/delete-option.interface.d.ts
34
+ interface DeleteOptions {
35
+ headers?: HeadersInit;
36
+ }
37
+ //#endregion
33
38
  //#region src/domains/interfaces/domain.d.ts
34
39
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
35
40
  type DomainCapabilityStatus = 'enabled' | 'disabled';
@@ -1785,7 +1790,6 @@ type UpdateTemplateResponse = Response<UpdateTemplateResponseSuccess>;
1785
1790
  //#region src/templates/templates.d.ts
1786
1791
  declare class Templates {
1787
1792
  private readonly resend;
1788
- private renderAsync?;
1789
1793
  constructor(resend: Resend);
1790
1794
  create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>;
1791
1795
  private performCreate;
@@ -1815,7 +1819,7 @@ interface CreateTopicOptions {
1815
1819
  type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
1816
1820
  type CreateTopicResponse = Response<CreateTopicResponseSuccess>;
1817
1821
  //#endregion
1818
- //#region src/topics/interfaces/get-contact.interface.d.ts
1822
+ //#region src/topics/interfaces/get-topic.interface.d.ts
1819
1823
  interface GetTopicOptions {
1820
1824
  id: string;
1821
1825
  }
@@ -2109,8 +2113,14 @@ declare class Webhooks {
2109
2113
  }
2110
2114
  //#endregion
2111
2115
  //#region src/resend.d.ts
2116
+ interface ResendOptions {
2117
+ baseUrl?: string;
2118
+ userAgent?: string;
2119
+ }
2112
2120
  declare class Resend {
2113
2121
  readonly key?: string | undefined;
2122
+ readonly baseUrl: string;
2123
+ readonly userAgent: string;
2114
2124
  private readonly headers;
2115
2125
  readonly segments: Segments;
2116
2126
  readonly apiKeys: ApiKeys;
@@ -2130,13 +2140,13 @@ declare class Resend {
2130
2140
  readonly templates: Templates;
2131
2141
  readonly topics: Topics;
2132
2142
  readonly webhooks: Webhooks;
2133
- constructor(key?: string | undefined);
2143
+ constructor(key?: string | undefined, options?: ResendOptions);
2134
2144
  fetchRequest<T>(path: string, options?: {}): Promise<Response<T>>;
2135
2145
  post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<Response<T>>;
2136
2146
  get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
2137
2147
  put<T>(path: string, entity: unknown, options?: PutOptions): Promise<Response<T>>;
2138
2148
  patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<Response<T>>;
2139
- delete<T>(path: string, query?: unknown): Promise<Response<T>>;
2149
+ delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2140
2150
  }
2141
2151
  //#endregion
2142
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
2152
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.d.mts CHANGED
@@ -30,6 +30,11 @@ interface AttachmentData {
30
30
  expires_at: string;
31
31
  }
32
32
  //#endregion
33
+ //#region src/common/interfaces/delete-option.interface.d.ts
34
+ interface DeleteOptions {
35
+ headers?: HeadersInit;
36
+ }
37
+ //#endregion
33
38
  //#region src/domains/interfaces/domain.d.ts
34
39
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
35
40
  type DomainCapabilityStatus = 'enabled' | 'disabled';
@@ -1785,7 +1790,6 @@ type UpdateTemplateResponse = Response<UpdateTemplateResponseSuccess>;
1785
1790
  //#region src/templates/templates.d.ts
1786
1791
  declare class Templates {
1787
1792
  private readonly resend;
1788
- private renderAsync?;
1789
1793
  constructor(resend: Resend);
1790
1794
  create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>;
1791
1795
  private performCreate;
@@ -1815,7 +1819,7 @@ interface CreateTopicOptions {
1815
1819
  type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
1816
1820
  type CreateTopicResponse = Response<CreateTopicResponseSuccess>;
1817
1821
  //#endregion
1818
- //#region src/topics/interfaces/get-contact.interface.d.ts
1822
+ //#region src/topics/interfaces/get-topic.interface.d.ts
1819
1823
  interface GetTopicOptions {
1820
1824
  id: string;
1821
1825
  }
@@ -2109,8 +2113,14 @@ declare class Webhooks {
2109
2113
  }
2110
2114
  //#endregion
2111
2115
  //#region src/resend.d.ts
2116
+ interface ResendOptions {
2117
+ baseUrl?: string;
2118
+ userAgent?: string;
2119
+ }
2112
2120
  declare class Resend {
2113
2121
  readonly key?: string | undefined;
2122
+ readonly baseUrl: string;
2123
+ readonly userAgent: string;
2114
2124
  private readonly headers;
2115
2125
  readonly segments: Segments;
2116
2126
  readonly apiKeys: ApiKeys;
@@ -2130,13 +2140,13 @@ declare class Resend {
2130
2140
  readonly templates: Templates;
2131
2141
  readonly topics: Topics;
2132
2142
  readonly webhooks: Webhooks;
2133
- constructor(key?: string | undefined);
2143
+ constructor(key?: string | undefined, options?: ResendOptions);
2134
2144
  fetchRequest<T>(path: string, options?: {}): Promise<Response<T>>;
2135
2145
  post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<Response<T>>;
2136
2146
  get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
2137
2147
  put<T>(path: string, entity: unknown, options?: PutOptions): Promise<Response<T>>;
2138
2148
  patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<Response<T>>;
2139
- delete<T>(path: string, query?: unknown): Promise<Response<T>>;
2149
+ delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2140
2150
  }
2141
2151
  //#endregion
2142
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
2152
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import PostalMime from "postal-mime";
2
- import { Webhook } from "svix";
2
+ import { Webhook } from "standardwebhooks";
3
3
  //#region package.json
4
- var version = "6.12.3";
4
+ var version = "6.12.4";
5
5
  //#endregion
6
6
  //#region src/common/utils/build-pagination-query.ts
7
7
  /**
@@ -250,14 +250,14 @@ var Broadcasts = class {
250
250
  this.resend = resend;
251
251
  }
252
252
  async create(payload, options = {}) {
253
- if (payload.react) payload.html = await render(payload.react);
253
+ const html = payload.react ? await render(payload.react) : payload.html;
254
254
  return await this.resend.post("/broadcasts", {
255
255
  name: payload.name,
256
256
  segment_id: payload.segmentId,
257
257
  audience_id: payload.audienceId,
258
258
  preview_text: payload.previewText,
259
259
  from: payload.from,
260
- html: payload.html,
260
+ html,
261
261
  reply_to: payload.replyTo,
262
262
  subject: payload.subject,
263
263
  text: payload.text,
@@ -281,13 +281,13 @@ var Broadcasts = class {
281
281
  return await this.resend.delete(`/broadcasts/${id}`);
282
282
  }
283
283
  async update(id, payload) {
284
- if (payload.react) payload.html = await render(payload.react);
284
+ const html = payload.react ? await render(payload.react) : payload.html;
285
285
  return await this.resend.patch(`/broadcasts/${id}`, {
286
286
  name: payload.name,
287
287
  segment_id: payload.segmentId,
288
288
  audience_id: payload.audienceId,
289
289
  from: payload.from,
290
- html: payload.html,
290
+ html,
291
291
  text: payload.text,
292
292
  subject: payload.subject,
293
293
  reply_to: payload.replyTo,
@@ -779,8 +779,9 @@ var Emails = class {
779
779
  return this.create(payload, options);
780
780
  }
781
781
  async create(payload, options = {}) {
782
- if (payload.react) payload.html = await render(payload.react);
783
- return await this.resend.post("/emails", parseEmailToApiOptions(payload), options);
782
+ const body = { ...payload };
783
+ if (payload.react) body.html = await render(payload.react);
784
+ return await this.resend.post("/emails", parseEmailToApiOptions(body), options);
784
785
  }
785
786
  async get(id) {
786
787
  return await this.resend.get(`/emails/${id}`);
@@ -920,16 +921,9 @@ var Templates = class {
920
921
  return new ChainableTemplateResult(this.performCreate(payload), this.publish.bind(this));
921
922
  }
922
923
  async performCreate(payload) {
923
- if (payload.react) {
924
- if (!this.renderAsync) try {
925
- const { renderAsync } = await import("@react-email/render");
926
- this.renderAsync = renderAsync;
927
- } catch {
928
- throw new Error("Failed to render React component. Make sure to install `@react-email/render`");
929
- }
930
- payload.html = await this.renderAsync(payload.react);
931
- }
932
- return this.resend.post("/templates", parseTemplateToApiOptions(payload));
924
+ const body = { ...payload };
925
+ if (payload.react) body.html = await render(payload.react);
926
+ return this.resend.post("/templates", parseTemplateToApiOptions(body));
933
927
  }
934
928
  async remove(identifier) {
935
929
  return await this.resend.delete(`/templates/${identifier}`);
@@ -1028,9 +1022,9 @@ var Webhooks = class {
1028
1022
  }
1029
1023
  verify(payload) {
1030
1024
  return new Webhook(payload.webhookSecret).verify(payload.payload, {
1031
- "svix-id": payload.headers.id,
1032
- "svix-timestamp": payload.headers.timestamp,
1033
- "svix-signature": payload.headers.signature
1025
+ "webhook-id": payload.headers.id,
1026
+ "webhook-timestamp": payload.headers.timestamp,
1027
+ "webhook-signature": payload.headers.signature
1034
1028
  });
1035
1029
  }
1036
1030
  };
@@ -1038,10 +1032,14 @@ var Webhooks = class {
1038
1032
  //#region src/resend.ts
1039
1033
  const defaultBaseUrl = "https://api.resend.com";
1040
1034
  const defaultUserAgent = `resend-node:${version}`;
1041
- const baseUrl = typeof process !== "undefined" && process.env ? process.env.RESEND_BASE_URL || defaultBaseUrl : defaultBaseUrl;
1042
- const userAgent = typeof process !== "undefined" && process.env ? process.env.RESEND_USER_AGENT || defaultUserAgent : defaultUserAgent;
1035
+ function getDefaultBaseUrl() {
1036
+ return typeof process !== "undefined" && process.env ? process.env.RESEND_BASE_URL || defaultBaseUrl : defaultBaseUrl;
1037
+ }
1038
+ function getDefaultUserAgent() {
1039
+ return typeof process !== "undefined" && process.env ? process.env.RESEND_USER_AGENT || defaultUserAgent : defaultUserAgent;
1040
+ }
1043
1041
  var Resend = class {
1044
- constructor(key) {
1042
+ constructor(key, options) {
1045
1043
  this.key = key;
1046
1044
  this.segments = new Segments(this);
1047
1045
  this.apiKeys = new ApiKeys(this);
@@ -1062,15 +1060,17 @@ var Resend = class {
1062
1060
  if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
1063
1061
  if (!this.key) throw new Error("Missing API key. Pass it to the constructor `new Resend(\"re_123\")`");
1064
1062
  }
1063
+ this.baseUrl = options?.baseUrl ?? getDefaultBaseUrl();
1064
+ this.userAgent = options?.userAgent ?? getDefaultUserAgent();
1065
1065
  this.headers = new Headers({
1066
1066
  Authorization: `Bearer ${this.key}`,
1067
- "User-Agent": userAgent,
1067
+ "User-Agent": this.userAgent,
1068
1068
  "Content-Type": "application/json"
1069
1069
  });
1070
1070
  }
1071
1071
  async fetchRequest(path, options = {}) {
1072
1072
  try {
1073
- const response = await fetch(`${baseUrl}${path}`, options);
1073
+ const response = await fetch(`${this.baseUrl}${path}`, options);
1074
1074
  if (!response.ok) try {
1075
1075
  const rawError = await response.text();
1076
1076
  return {
@@ -1168,11 +1168,14 @@ var Resend = class {
1168
1168
  };
1169
1169
  return this.fetchRequest(path, requestOptions);
1170
1170
  }
1171
- async delete(path, query) {
1171
+ async delete(path, query, options = {}) {
1172
+ const headers = new Headers(this.headers);
1173
+ if (options.headers) for (const [key, value] of new Headers(options.headers).entries()) headers.set(key, value);
1172
1174
  const requestOptions = {
1173
1175
  method: "DELETE",
1174
- body: JSON.stringify(query),
1175
- headers: this.headers
1176
+ body: query === void 0 ? void 0 : JSON.stringify(query),
1177
+ ...options,
1178
+ headers
1176
1179
  };
1177
1180
  return this.fetchRequest(path, requestOptions);
1178
1181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.12.3",
3
+ "version": "6.12.4",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -29,6 +29,19 @@
29
29
  }
30
30
  }
31
31
  },
32
+ "scripts": {
33
+ "build": "tsdown src/index.ts --format esm,cjs --dts",
34
+ "integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
35
+ "lint": "biome check .",
36
+ "lint:fix": "biome check . --write",
37
+ "prepublishOnly": "pnpm run build",
38
+ "test": "vitest run --exclude e2e",
39
+ "test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
40
+ "test:e2e": "vitest run e2e",
41
+ "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
42
+ "test:watch": "vitest --exclude e2e",
43
+ "typecheck": "tsc --noEmit"
44
+ },
32
45
  "repository": {
33
46
  "type": "git",
34
47
  "url": "git+https://github.com/resend/resend-node.git"
@@ -41,7 +54,7 @@
41
54
  "homepage": "https://github.com/resend/resend-node#readme",
42
55
  "dependencies": {
43
56
  "postal-mime": "2.7.4",
44
- "svix": "1.92.2"
57
+ "standardwebhooks": "1.0.0"
45
58
  },
46
59
  "peerDependencies": {
47
60
  "@react-email/render": "*"
@@ -70,16 +83,5 @@
70
83
  "vitest": "4.1.4",
71
84
  "vitest-fetch-mock": "0.4.5"
72
85
  },
73
- "scripts": {
74
- "build": "tsdown src/index.ts --format esm,cjs --dts",
75
- "integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
76
- "lint": "biome check .",
77
- "lint:fix": "biome check . --write",
78
- "test": "vitest run --exclude e2e",
79
- "test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
80
- "test:e2e": "vitest run e2e",
81
- "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
82
- "test:watch": "vitest --exclude e2e",
83
- "typecheck": "tsc --noEmit"
84
- }
85
- }
86
+ "packageManager": "pnpm@10.33.2"
87
+ }