resend 6.17.2 → 6.18.0

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
@@ -25,7 +25,7 @@ let postal_mime = require("postal-mime");
25
25
  postal_mime = __toESM(postal_mime);
26
26
  let standardwebhooks = require("standardwebhooks");
27
27
  //#region package.json
28
- var version = "6.17.2";
28
+ var version = "6.18.0";
29
29
  //#endregion
30
30
  //#region src/common/utils/build-pagination-query.ts
31
31
  /**
@@ -242,7 +242,7 @@ async function render(node) {
242
242
  }
243
243
  //#endregion
244
244
  //#region src/batch/batch.ts
245
- var Batch = class {
245
+ var Batch$1 = class {
246
246
  constructor(resend) {
247
247
  this.resend = resend;
248
248
  }
@@ -974,6 +974,58 @@ var Segments = class {
974
974
  }
975
975
  };
976
976
  //#endregion
977
+ //#region src/suppressions/batch/batch.ts
978
+ var Batch = class {
979
+ constructor(resend) {
980
+ this.resend = resend;
981
+ }
982
+ async add(options) {
983
+ return this.resend.post("/suppressions/batch/add", options);
984
+ }
985
+ async remove(options) {
986
+ return this.resend.post("/suppressions/batch/remove", options);
987
+ }
988
+ };
989
+ //#endregion
990
+ //#region src/suppressions/suppressions.ts
991
+ const missingIdentifierError = () => ({
992
+ data: null,
993
+ headers: null,
994
+ error: {
995
+ message: "Missing `id` field.",
996
+ statusCode: null,
997
+ name: "missing_required_field"
998
+ }
999
+ });
1000
+ var Suppressions = class {
1001
+ constructor(resend) {
1002
+ this.resend = resend;
1003
+ this.batch = new Batch(resend);
1004
+ }
1005
+ async add(options) {
1006
+ return this.resend.post("/suppressions", options);
1007
+ }
1008
+ async list(options = {}) {
1009
+ const queryString = buildSuppressionsQuery(options);
1010
+ const url = queryString ? `/suppressions?${queryString}` : "/suppressions";
1011
+ return this.resend.get(url);
1012
+ }
1013
+ async get(idOrEmail) {
1014
+ if (!idOrEmail) return missingIdentifierError();
1015
+ return this.resend.get(`/suppressions/${encodeURIComponent(idOrEmail)}`);
1016
+ }
1017
+ async remove(idOrEmail) {
1018
+ if (!idOrEmail) return missingIdentifierError();
1019
+ return this.resend.delete(`/suppressions/${encodeURIComponent(idOrEmail)}`);
1020
+ }
1021
+ };
1022
+ function buildSuppressionsQuery(options) {
1023
+ const { origin, ...pagination } = options;
1024
+ const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
1025
+ if (origin) searchParams.set("origin", origin);
1026
+ return searchParams.toString();
1027
+ }
1028
+ //#endregion
977
1029
  //#region src/common/utils/get-pagination-query-properties.ts
978
1030
  function getPaginationQueryProperties(options = {}) {
979
1031
  const query = new URLSearchParams();
@@ -1157,7 +1209,7 @@ var Resend = class {
1157
1209
  this.apiKeys = new ApiKeys(this);
1158
1210
  this.audiences = this.segments;
1159
1211
  this.automations = new Automations(this);
1160
- this.batch = new Batch(this);
1212
+ this.batch = new Batch$1(this);
1161
1213
  this.broadcasts = new Broadcasts(this);
1162
1214
  this.contactProperties = new ContactProperties(this);
1163
1215
  this.contacts = new Contacts(this);
@@ -1166,6 +1218,7 @@ var Resend = class {
1166
1218
  this.events = new Events(this);
1167
1219
  this.logs = new Logs(this);
1168
1220
  this.oauthGrants = new OAuthGrants(this);
1221
+ this.suppressions = new Suppressions(this);
1169
1222
  this.templates = new Templates(this);
1170
1223
  this.topics = new Topics(this);
1171
1224
  this.webhooks = new Webhooks(this);
@@ -1181,39 +1234,57 @@ var Resend = class {
1181
1234
  "Content-Type": "application/json"
1182
1235
  });
1183
1236
  }
1237
+ logError(error, path, status) {
1238
+ if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") console.error("[Resend API Error]:", {
1239
+ ...status !== void 0 && { status },
1240
+ error,
1241
+ path
1242
+ });
1243
+ }
1184
1244
  async fetchRequest(path, options = {}) {
1185
1245
  try {
1186
1246
  const response = await fetch(`${this.baseUrl}${path}`, options);
1187
1247
  if (!response.ok) try {
1188
1248
  const rawError = await response.text();
1249
+ const parsedError = JSON.parse(rawError);
1250
+ this.logError(parsedError, path, response.status);
1189
1251
  return {
1190
1252
  data: null,
1191
- error: JSON.parse(rawError),
1253
+ error: parsedError,
1192
1254
  headers: Object.fromEntries(response.headers.entries())
1193
1255
  };
1194
1256
  } catch (err) {
1195
- if (err instanceof SyntaxError) return {
1196
- data: null,
1197
- error: {
1257
+ if (err instanceof SyntaxError) {
1258
+ const error = {
1198
1259
  name: "application_error",
1199
1260
  statusCode: response.status,
1200
1261
  message: "Internal server error. We are unable to process your request right now, please try again later."
1201
- },
1202
- headers: Object.fromEntries(response.headers.entries())
1203
- };
1262
+ };
1263
+ this.logError(error, path, response.status);
1264
+ return {
1265
+ data: null,
1266
+ error,
1267
+ headers: Object.fromEntries(response.headers.entries())
1268
+ };
1269
+ }
1204
1270
  const error = {
1205
1271
  message: response.statusText,
1206
1272
  statusCode: response.status,
1207
1273
  name: "application_error"
1208
1274
  };
1209
- if (err instanceof Error) return {
1210
- data: null,
1211
- error: {
1275
+ if (err instanceof Error) {
1276
+ const errorWithMessage = {
1212
1277
  ...error,
1213
1278
  message: err.message
1214
- },
1215
- headers: Object.fromEntries(response.headers.entries())
1216
- };
1279
+ };
1280
+ this.logError(errorWithMessage, path, response.status);
1281
+ return {
1282
+ data: null,
1283
+ error: errorWithMessage,
1284
+ headers: Object.fromEntries(response.headers.entries())
1285
+ };
1286
+ }
1287
+ this.logError(error, path, response.status);
1217
1288
  return {
1218
1289
  data: null,
1219
1290
  error,
@@ -1226,13 +1297,15 @@ var Resend = class {
1226
1297
  headers: Object.fromEntries(response.headers.entries())
1227
1298
  };
1228
1299
  } catch {
1300
+ const error = {
1301
+ name: "application_error",
1302
+ statusCode: null,
1303
+ message: "Unable to fetch data. The request could not be resolved."
1304
+ };
1305
+ this.logError(error, path);
1229
1306
  return {
1230
1307
  data: null,
1231
- error: {
1232
- name: "application_error",
1233
- statusCode: null,
1234
- message: "Unable to fetch data. The request could not be resolved."
1235
- },
1308
+ error,
1236
1309
  headers: null
1237
1310
  };
1238
1311
  }
package/dist/index.d.cts CHANGED
@@ -630,12 +630,12 @@ type Tag = {
630
630
  //#endregion
631
631
  //#region src/batch/interfaces/create-batch-options.interface.d.ts
632
632
  /**
633
- * Email options for batch sending. Same as CreateEmailOptions but without attachments
634
- * and scheduledAt, as these are not supported in the batch API.
633
+ * Email options for batch sending. Same as CreateEmailOptions but without attachments,
634
+ * as these are not supported in the batch API.
635
635
  *
636
636
  * @link https://resend.com/docs/dashboard/emails/batch-sending#limitations
637
637
  */
638
- type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments' | 'scheduledAt'>;
638
+ type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments'>;
639
639
  type CreateBatchOptions = CreateBatchEmailOptions[];
640
640
  interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
641
641
  /**
@@ -1660,7 +1660,7 @@ declare class Automations {
1660
1660
  }
1661
1661
  //#endregion
1662
1662
  //#region src/batch/batch.d.ts
1663
- declare class Batch {
1663
+ declare class Batch$1 {
1664
1664
  private readonly resend;
1665
1665
  constructor(resend: Resend);
1666
1666
  send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
@@ -1868,6 +1868,94 @@ declare class Segments {
1868
1868
  remove(id: string): Promise<RemoveSegmentResponse>;
1869
1869
  }
1870
1870
  //#endregion
1871
+ //#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
1872
+ interface BatchAddSuppressionsOptions {
1873
+ emails: string[];
1874
+ }
1875
+ interface BatchAddSuppressionsResponseSuccess {
1876
+ data: {
1877
+ object: 'suppression';
1878
+ id: string;
1879
+ }[];
1880
+ }
1881
+ type BatchAddSuppressionsResponse = Response<BatchAddSuppressionsResponseSuccess>;
1882
+ //#endregion
1883
+ //#region src/suppressions/batch/interfaces/batch-remove-suppressions.interface.d.ts
1884
+ type BatchRemoveSuppressionsOptions = {
1885
+ emails: string[];
1886
+ ids?: never;
1887
+ } | {
1888
+ ids: string[];
1889
+ emails?: never;
1890
+ };
1891
+ interface BatchRemoveSuppressionsResponseSuccess {
1892
+ data: {
1893
+ object: 'suppression';
1894
+ id: string;
1895
+ deleted: boolean;
1896
+ }[];
1897
+ }
1898
+ type BatchRemoveSuppressionsResponse = Response<BatchRemoveSuppressionsResponseSuccess>;
1899
+ //#endregion
1900
+ //#region src/suppressions/batch/batch.d.ts
1901
+ declare class Batch {
1902
+ private readonly resend;
1903
+ constructor(resend: Resend);
1904
+ add(options: BatchAddSuppressionsOptions): Promise<BatchAddSuppressionsResponse>;
1905
+ remove(options: BatchRemoveSuppressionsOptions): Promise<BatchRemoveSuppressionsResponse>;
1906
+ }
1907
+ //#endregion
1908
+ //#region src/suppressions/interfaces/add-suppression.interface.d.ts
1909
+ interface AddSuppressionOptions {
1910
+ email: string;
1911
+ }
1912
+ interface AddSuppressionResponseSuccess {
1913
+ object: 'suppression';
1914
+ id: string;
1915
+ }
1916
+ type AddSuppressionResponse = Response<AddSuppressionResponseSuccess>;
1917
+ //#endregion
1918
+ //#region src/suppressions/interfaces/suppression-list-entry.d.ts
1919
+ type SuppressionOrigin = 'bounce' | 'complaint' | 'manual';
1920
+ interface SuppressionListEntry {
1921
+ object: 'suppression';
1922
+ id: string;
1923
+ email: string;
1924
+ origin: SuppressionOrigin;
1925
+ source_id: string | null;
1926
+ created_at: string;
1927
+ }
1928
+ //#endregion
1929
+ //#region src/suppressions/interfaces/get-suppression.interface.d.ts
1930
+ type GetSuppressionResponseSuccess = SuppressionListEntry;
1931
+ type GetSuppressionResponse = Response<GetSuppressionResponseSuccess>;
1932
+ //#endregion
1933
+ //#region src/suppressions/interfaces/list-suppressions.interface.d.ts
1934
+ type ListSuppressionsOptions = PaginationOptions & {
1935
+ origin?: SuppressionOrigin;
1936
+ };
1937
+ type ListSuppressionsResponseSuccess = PaginatedData<SuppressionListEntry[]>;
1938
+ type ListSuppressionsResponse = Response<ListSuppressionsResponseSuccess>;
1939
+ //#endregion
1940
+ //#region src/suppressions/interfaces/remove-suppression.interface.d.ts
1941
+ interface RemoveSuppressionResponseSuccess {
1942
+ object: 'suppression';
1943
+ id: string;
1944
+ deleted: boolean;
1945
+ }
1946
+ type RemoveSuppressionResponse = Response<RemoveSuppressionResponseSuccess>;
1947
+ //#endregion
1948
+ //#region src/suppressions/suppressions.d.ts
1949
+ declare class Suppressions {
1950
+ private readonly resend;
1951
+ readonly batch: Batch;
1952
+ constructor(resend: Resend);
1953
+ add(options: AddSuppressionOptions): Promise<AddSuppressionResponse>;
1954
+ list(options?: ListSuppressionsOptions): Promise<ListSuppressionsResponse>;
1955
+ get(idOrEmail: string): Promise<GetSuppressionResponse>;
1956
+ remove(idOrEmail: string): Promise<RemoveSuppressionResponse>;
1957
+ }
1958
+ //#endregion
1871
1959
  //#region src/templates/interfaces/template.d.ts
1872
1960
  interface Template {
1873
1961
  id: string;
@@ -2322,7 +2410,7 @@ declare class Resend {
2322
2410
  */
2323
2411
  readonly audiences: Segments;
2324
2412
  readonly automations: Automations;
2325
- readonly batch: Batch;
2413
+ readonly batch: Batch$1;
2326
2414
  readonly broadcasts: Broadcasts;
2327
2415
  readonly contactProperties: ContactProperties;
2328
2416
  readonly contacts: Contacts;
@@ -2331,10 +2419,12 @@ declare class Resend {
2331
2419
  readonly events: Events;
2332
2420
  readonly logs: Logs;
2333
2421
  readonly oauthGrants: OAuthGrants;
2422
+ readonly suppressions: Suppressions;
2334
2423
  readonly templates: Templates;
2335
2424
  readonly topics: Topics;
2336
2425
  readonly webhooks: Webhooks;
2337
2426
  constructor(key?: string | undefined, options?: ResendOptions);
2427
+ private logError;
2338
2428
  fetchRequest<T>(path: string, options?: {}): Promise<Response<T>>;
2339
2429
  post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<Response<T>>;
2340
2430
  get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
@@ -2343,4 +2433,4 @@ declare class Resend {
2343
2433
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2344
2434
  }
2345
2435
  //#endregion
2346
- 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, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, 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, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, 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, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, 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, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, 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, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, 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, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, 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, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
2436
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, 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, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, 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, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, 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, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, 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, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, 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, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, SuppressionListEntry, SuppressionOrigin, 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, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.d.mts CHANGED
@@ -630,12 +630,12 @@ type Tag = {
630
630
  //#endregion
631
631
  //#region src/batch/interfaces/create-batch-options.interface.d.ts
632
632
  /**
633
- * Email options for batch sending. Same as CreateEmailOptions but without attachments
634
- * and scheduledAt, as these are not supported in the batch API.
633
+ * Email options for batch sending. Same as CreateEmailOptions but without attachments,
634
+ * as these are not supported in the batch API.
635
635
  *
636
636
  * @link https://resend.com/docs/dashboard/emails/batch-sending#limitations
637
637
  */
638
- type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments' | 'scheduledAt'>;
638
+ type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments'>;
639
639
  type CreateBatchOptions = CreateBatchEmailOptions[];
640
640
  interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
641
641
  /**
@@ -1660,7 +1660,7 @@ declare class Automations {
1660
1660
  }
1661
1661
  //#endregion
1662
1662
  //#region src/batch/batch.d.ts
1663
- declare class Batch {
1663
+ declare class Batch$1 {
1664
1664
  private readonly resend;
1665
1665
  constructor(resend: Resend);
1666
1666
  send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
@@ -1868,6 +1868,94 @@ declare class Segments {
1868
1868
  remove(id: string): Promise<RemoveSegmentResponse>;
1869
1869
  }
1870
1870
  //#endregion
1871
+ //#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
1872
+ interface BatchAddSuppressionsOptions {
1873
+ emails: string[];
1874
+ }
1875
+ interface BatchAddSuppressionsResponseSuccess {
1876
+ data: {
1877
+ object: 'suppression';
1878
+ id: string;
1879
+ }[];
1880
+ }
1881
+ type BatchAddSuppressionsResponse = Response<BatchAddSuppressionsResponseSuccess>;
1882
+ //#endregion
1883
+ //#region src/suppressions/batch/interfaces/batch-remove-suppressions.interface.d.ts
1884
+ type BatchRemoveSuppressionsOptions = {
1885
+ emails: string[];
1886
+ ids?: never;
1887
+ } | {
1888
+ ids: string[];
1889
+ emails?: never;
1890
+ };
1891
+ interface BatchRemoveSuppressionsResponseSuccess {
1892
+ data: {
1893
+ object: 'suppression';
1894
+ id: string;
1895
+ deleted: boolean;
1896
+ }[];
1897
+ }
1898
+ type BatchRemoveSuppressionsResponse = Response<BatchRemoveSuppressionsResponseSuccess>;
1899
+ //#endregion
1900
+ //#region src/suppressions/batch/batch.d.ts
1901
+ declare class Batch {
1902
+ private readonly resend;
1903
+ constructor(resend: Resend);
1904
+ add(options: BatchAddSuppressionsOptions): Promise<BatchAddSuppressionsResponse>;
1905
+ remove(options: BatchRemoveSuppressionsOptions): Promise<BatchRemoveSuppressionsResponse>;
1906
+ }
1907
+ //#endregion
1908
+ //#region src/suppressions/interfaces/add-suppression.interface.d.ts
1909
+ interface AddSuppressionOptions {
1910
+ email: string;
1911
+ }
1912
+ interface AddSuppressionResponseSuccess {
1913
+ object: 'suppression';
1914
+ id: string;
1915
+ }
1916
+ type AddSuppressionResponse = Response<AddSuppressionResponseSuccess>;
1917
+ //#endregion
1918
+ //#region src/suppressions/interfaces/suppression-list-entry.d.ts
1919
+ type SuppressionOrigin = 'bounce' | 'complaint' | 'manual';
1920
+ interface SuppressionListEntry {
1921
+ object: 'suppression';
1922
+ id: string;
1923
+ email: string;
1924
+ origin: SuppressionOrigin;
1925
+ source_id: string | null;
1926
+ created_at: string;
1927
+ }
1928
+ //#endregion
1929
+ //#region src/suppressions/interfaces/get-suppression.interface.d.ts
1930
+ type GetSuppressionResponseSuccess = SuppressionListEntry;
1931
+ type GetSuppressionResponse = Response<GetSuppressionResponseSuccess>;
1932
+ //#endregion
1933
+ //#region src/suppressions/interfaces/list-suppressions.interface.d.ts
1934
+ type ListSuppressionsOptions = PaginationOptions & {
1935
+ origin?: SuppressionOrigin;
1936
+ };
1937
+ type ListSuppressionsResponseSuccess = PaginatedData<SuppressionListEntry[]>;
1938
+ type ListSuppressionsResponse = Response<ListSuppressionsResponseSuccess>;
1939
+ //#endregion
1940
+ //#region src/suppressions/interfaces/remove-suppression.interface.d.ts
1941
+ interface RemoveSuppressionResponseSuccess {
1942
+ object: 'suppression';
1943
+ id: string;
1944
+ deleted: boolean;
1945
+ }
1946
+ type RemoveSuppressionResponse = Response<RemoveSuppressionResponseSuccess>;
1947
+ //#endregion
1948
+ //#region src/suppressions/suppressions.d.ts
1949
+ declare class Suppressions {
1950
+ private readonly resend;
1951
+ readonly batch: Batch;
1952
+ constructor(resend: Resend);
1953
+ add(options: AddSuppressionOptions): Promise<AddSuppressionResponse>;
1954
+ list(options?: ListSuppressionsOptions): Promise<ListSuppressionsResponse>;
1955
+ get(idOrEmail: string): Promise<GetSuppressionResponse>;
1956
+ remove(idOrEmail: string): Promise<RemoveSuppressionResponse>;
1957
+ }
1958
+ //#endregion
1871
1959
  //#region src/templates/interfaces/template.d.ts
1872
1960
  interface Template {
1873
1961
  id: string;
@@ -2322,7 +2410,7 @@ declare class Resend {
2322
2410
  */
2323
2411
  readonly audiences: Segments;
2324
2412
  readonly automations: Automations;
2325
- readonly batch: Batch;
2413
+ readonly batch: Batch$1;
2326
2414
  readonly broadcasts: Broadcasts;
2327
2415
  readonly contactProperties: ContactProperties;
2328
2416
  readonly contacts: Contacts;
@@ -2331,10 +2419,12 @@ declare class Resend {
2331
2419
  readonly events: Events;
2332
2420
  readonly logs: Logs;
2333
2421
  readonly oauthGrants: OAuthGrants;
2422
+ readonly suppressions: Suppressions;
2334
2423
  readonly templates: Templates;
2335
2424
  readonly topics: Topics;
2336
2425
  readonly webhooks: Webhooks;
2337
2426
  constructor(key?: string | undefined, options?: ResendOptions);
2427
+ private logError;
2338
2428
  fetchRequest<T>(path: string, options?: {}): Promise<Response<T>>;
2339
2429
  post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<Response<T>>;
2340
2430
  get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
@@ -2343,4 +2433,4 @@ declare class Resend {
2343
2433
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2344
2434
  }
2345
2435
  //#endregion
2346
- 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, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, 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, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, 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, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, 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, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, 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, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, 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, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, 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, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
2436
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, 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, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, 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, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, 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, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, 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, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, 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, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, SuppressionListEntry, SuppressionOrigin, 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, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import PostalMime from "postal-mime";
2
2
  import { Webhook } from "standardwebhooks";
3
3
  //#region package.json
4
- var version = "6.17.2";
4
+ var version = "6.18.0";
5
5
  //#endregion
6
6
  //#region src/common/utils/build-pagination-query.ts
7
7
  /**
@@ -218,7 +218,7 @@ async function render(node) {
218
218
  }
219
219
  //#endregion
220
220
  //#region src/batch/batch.ts
221
- var Batch = class {
221
+ var Batch$1 = class {
222
222
  constructor(resend) {
223
223
  this.resend = resend;
224
224
  }
@@ -950,6 +950,58 @@ var Segments = class {
950
950
  }
951
951
  };
952
952
  //#endregion
953
+ //#region src/suppressions/batch/batch.ts
954
+ var Batch = class {
955
+ constructor(resend) {
956
+ this.resend = resend;
957
+ }
958
+ async add(options) {
959
+ return this.resend.post("/suppressions/batch/add", options);
960
+ }
961
+ async remove(options) {
962
+ return this.resend.post("/suppressions/batch/remove", options);
963
+ }
964
+ };
965
+ //#endregion
966
+ //#region src/suppressions/suppressions.ts
967
+ const missingIdentifierError = () => ({
968
+ data: null,
969
+ headers: null,
970
+ error: {
971
+ message: "Missing `id` field.",
972
+ statusCode: null,
973
+ name: "missing_required_field"
974
+ }
975
+ });
976
+ var Suppressions = class {
977
+ constructor(resend) {
978
+ this.resend = resend;
979
+ this.batch = new Batch(resend);
980
+ }
981
+ async add(options) {
982
+ return this.resend.post("/suppressions", options);
983
+ }
984
+ async list(options = {}) {
985
+ const queryString = buildSuppressionsQuery(options);
986
+ const url = queryString ? `/suppressions?${queryString}` : "/suppressions";
987
+ return this.resend.get(url);
988
+ }
989
+ async get(idOrEmail) {
990
+ if (!idOrEmail) return missingIdentifierError();
991
+ return this.resend.get(`/suppressions/${encodeURIComponent(idOrEmail)}`);
992
+ }
993
+ async remove(idOrEmail) {
994
+ if (!idOrEmail) return missingIdentifierError();
995
+ return this.resend.delete(`/suppressions/${encodeURIComponent(idOrEmail)}`);
996
+ }
997
+ };
998
+ function buildSuppressionsQuery(options) {
999
+ const { origin, ...pagination } = options;
1000
+ const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
1001
+ if (origin) searchParams.set("origin", origin);
1002
+ return searchParams.toString();
1003
+ }
1004
+ //#endregion
953
1005
  //#region src/common/utils/get-pagination-query-properties.ts
954
1006
  function getPaginationQueryProperties(options = {}) {
955
1007
  const query = new URLSearchParams();
@@ -1133,7 +1185,7 @@ var Resend = class {
1133
1185
  this.apiKeys = new ApiKeys(this);
1134
1186
  this.audiences = this.segments;
1135
1187
  this.automations = new Automations(this);
1136
- this.batch = new Batch(this);
1188
+ this.batch = new Batch$1(this);
1137
1189
  this.broadcasts = new Broadcasts(this);
1138
1190
  this.contactProperties = new ContactProperties(this);
1139
1191
  this.contacts = new Contacts(this);
@@ -1142,6 +1194,7 @@ var Resend = class {
1142
1194
  this.events = new Events(this);
1143
1195
  this.logs = new Logs(this);
1144
1196
  this.oauthGrants = new OAuthGrants(this);
1197
+ this.suppressions = new Suppressions(this);
1145
1198
  this.templates = new Templates(this);
1146
1199
  this.topics = new Topics(this);
1147
1200
  this.webhooks = new Webhooks(this);
@@ -1157,39 +1210,57 @@ var Resend = class {
1157
1210
  "Content-Type": "application/json"
1158
1211
  });
1159
1212
  }
1213
+ logError(error, path, status) {
1214
+ if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") console.error("[Resend API Error]:", {
1215
+ ...status !== void 0 && { status },
1216
+ error,
1217
+ path
1218
+ });
1219
+ }
1160
1220
  async fetchRequest(path, options = {}) {
1161
1221
  try {
1162
1222
  const response = await fetch(`${this.baseUrl}${path}`, options);
1163
1223
  if (!response.ok) try {
1164
1224
  const rawError = await response.text();
1225
+ const parsedError = JSON.parse(rawError);
1226
+ this.logError(parsedError, path, response.status);
1165
1227
  return {
1166
1228
  data: null,
1167
- error: JSON.parse(rawError),
1229
+ error: parsedError,
1168
1230
  headers: Object.fromEntries(response.headers.entries())
1169
1231
  };
1170
1232
  } catch (err) {
1171
- if (err instanceof SyntaxError) return {
1172
- data: null,
1173
- error: {
1233
+ if (err instanceof SyntaxError) {
1234
+ const error = {
1174
1235
  name: "application_error",
1175
1236
  statusCode: response.status,
1176
1237
  message: "Internal server error. We are unable to process your request right now, please try again later."
1177
- },
1178
- headers: Object.fromEntries(response.headers.entries())
1179
- };
1238
+ };
1239
+ this.logError(error, path, response.status);
1240
+ return {
1241
+ data: null,
1242
+ error,
1243
+ headers: Object.fromEntries(response.headers.entries())
1244
+ };
1245
+ }
1180
1246
  const error = {
1181
1247
  message: response.statusText,
1182
1248
  statusCode: response.status,
1183
1249
  name: "application_error"
1184
1250
  };
1185
- if (err instanceof Error) return {
1186
- data: null,
1187
- error: {
1251
+ if (err instanceof Error) {
1252
+ const errorWithMessage = {
1188
1253
  ...error,
1189
1254
  message: err.message
1190
- },
1191
- headers: Object.fromEntries(response.headers.entries())
1192
- };
1255
+ };
1256
+ this.logError(errorWithMessage, path, response.status);
1257
+ return {
1258
+ data: null,
1259
+ error: errorWithMessage,
1260
+ headers: Object.fromEntries(response.headers.entries())
1261
+ };
1262
+ }
1263
+ this.logError(error, path, response.status);
1193
1264
  return {
1194
1265
  data: null,
1195
1266
  error,
@@ -1202,13 +1273,15 @@ var Resend = class {
1202
1273
  headers: Object.fromEntries(response.headers.entries())
1203
1274
  };
1204
1275
  } catch {
1276
+ const error = {
1277
+ name: "application_error",
1278
+ statusCode: null,
1279
+ message: "Unable to fetch data. The request could not be resolved."
1280
+ };
1281
+ this.logError(error, path);
1205
1282
  return {
1206
1283
  data: null,
1207
- error: {
1208
- name: "application_error",
1209
- statusCode: null,
1210
- message: "Unable to fetch data. The request could not be resolved."
1211
- },
1284
+ error,
1212
1285
  headers: null
1213
1286
  };
1214
1287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.17.2",
3
+ "version": "6.18.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "homepage": "https://github.com/resend/resend-node#readme",
42
42
  "dependencies": {
43
- "postal-mime": "2.7.4",
43
+ "postal-mime": "2.7.5",
44
44
  "standardwebhooks": "1.0.0"
45
45
  },
46
46
  "peerDependencies": {
@@ -52,23 +52,23 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@biomejs/biome": "2.4.14",
55
+ "@biomejs/biome": "2.5.3",
56
56
  "@pollyjs/adapter-fetch": "6.0.7",
57
57
  "@pollyjs/core": "6.0.6",
58
58
  "@pollyjs/persister-fs": "6.0.6",
59
59
  "@types/mailparser": "3.4.6",
60
- "@types/node": "24.12.2",
61
- "@types/react": "19.2.14",
60
+ "@types/node": "24.13.3",
61
+ "@types/react": "19.2.17",
62
62
  "cross-env": "10.1.0",
63
63
  "dotenv": "17.4.2",
64
64
  "pkg-pr-new": "0.0.66",
65
- "react": "19.2.5",
66
- "react-dom": "19.2.5",
65
+ "react": "19.2.7",
66
+ "react-dom": "19.2.7",
67
67
  "rimraf": "6.1.3",
68
- "tegami": "1.1.2",
68
+ "tegami": "1.2.5",
69
69
  "tsdown": "0.21.10",
70
70
  "typescript": "6.0.3",
71
- "vitest": "4.1.4",
71
+ "vitest": "4.1.10",
72
72
  "vitest-fetch-mock": "0.4.5"
73
73
  },
74
74
  "scripts": {