resend 6.2.0-canary.3 → 6.2.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.d.mts +17 -107
- package/dist/index.d.ts +17 -107
- package/dist/index.js +15 -58
- package/dist/index.mjs +15 -58
- package/package.json +10 -15
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,7 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
|
23
23
|
readonly rate_limit_exceeded: 429;
|
|
24
24
|
readonly missing_api_key: 401;
|
|
25
25
|
readonly invalid_api_key: 403;
|
|
26
|
+
readonly suspended_api_key: 403;
|
|
26
27
|
readonly invalid_from_address: 403;
|
|
27
28
|
readonly validation_error: 403;
|
|
28
29
|
readonly not_found: 404;
|
|
@@ -168,47 +169,6 @@ type RemoveApiKeyResponse = {
|
|
|
168
169
|
error: ErrorResponse;
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
interface InboundAttachment {
|
|
172
|
-
id: string;
|
|
173
|
-
filename?: string;
|
|
174
|
-
content_type: string;
|
|
175
|
-
content_disposition: 'inline' | 'attachment';
|
|
176
|
-
content_id?: string;
|
|
177
|
-
content: string;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
interface GetAttachmentOptions {
|
|
181
|
-
emailId: string;
|
|
182
|
-
id: string;
|
|
183
|
-
}
|
|
184
|
-
interface GetAttachmentResponseSuccess {
|
|
185
|
-
object: 'attachment';
|
|
186
|
-
data: InboundAttachment;
|
|
187
|
-
}
|
|
188
|
-
type GetAttachmentResponse = {
|
|
189
|
-
data: GetAttachmentResponseSuccess;
|
|
190
|
-
error: null;
|
|
191
|
-
} | {
|
|
192
|
-
data: null;
|
|
193
|
-
error: ErrorResponse;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
type ListAttachmentsOptions = PaginationOptions & {
|
|
197
|
-
emailId: string;
|
|
198
|
-
};
|
|
199
|
-
interface ListAttachmentsResponseSuccess {
|
|
200
|
-
object: 'list';
|
|
201
|
-
has_more: boolean;
|
|
202
|
-
data: InboundAttachment[];
|
|
203
|
-
}
|
|
204
|
-
type ListAttachmentsResponse = {
|
|
205
|
-
data: ListAttachmentsResponseSuccess;
|
|
206
|
-
error: null;
|
|
207
|
-
} | {
|
|
208
|
-
data: null;
|
|
209
|
-
error: ErrorResponse;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
172
|
interface Audience {
|
|
213
173
|
created_at: string;
|
|
214
174
|
id: string;
|
|
@@ -891,50 +851,6 @@ type UpdateEmailResponse = {
|
|
|
891
851
|
error: ErrorResponse;
|
|
892
852
|
};
|
|
893
853
|
|
|
894
|
-
interface GetInboundEmailResponseSuccess {
|
|
895
|
-
object: 'inbound';
|
|
896
|
-
id: string;
|
|
897
|
-
to: string[];
|
|
898
|
-
from: string;
|
|
899
|
-
created_at: string;
|
|
900
|
-
subject: string;
|
|
901
|
-
bcc: string[] | null;
|
|
902
|
-
cc: string[] | null;
|
|
903
|
-
reply_to: string[] | null;
|
|
904
|
-
html: string | null;
|
|
905
|
-
text: string | null;
|
|
906
|
-
headers: Record<string, string>;
|
|
907
|
-
attachments: Array<{
|
|
908
|
-
id: string;
|
|
909
|
-
filename: string;
|
|
910
|
-
content_type: string;
|
|
911
|
-
content_id: string;
|
|
912
|
-
content_disposition: string;
|
|
913
|
-
}>;
|
|
914
|
-
}
|
|
915
|
-
type GetInboundEmailResponse = {
|
|
916
|
-
data: GetInboundEmailResponseSuccess;
|
|
917
|
-
error: null;
|
|
918
|
-
} | {
|
|
919
|
-
data: null;
|
|
920
|
-
error: ErrorResponse;
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
type ListInboundEmailsOptions = PaginationOptions;
|
|
924
|
-
type ListInboundEmail = Omit<GetInboundEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>;
|
|
925
|
-
interface ListInboundEmailsResponseSuccess {
|
|
926
|
-
object: 'list';
|
|
927
|
-
has_more: boolean;
|
|
928
|
-
data: ListInboundEmail[];
|
|
929
|
-
}
|
|
930
|
-
type ListInboundEmailsResponse = {
|
|
931
|
-
data: ListInboundEmailsResponseSuccess;
|
|
932
|
-
error: null;
|
|
933
|
-
} | {
|
|
934
|
-
data: null;
|
|
935
|
-
error: ErrorResponse;
|
|
936
|
-
};
|
|
937
|
-
|
|
938
854
|
declare class ApiKeys {
|
|
939
855
|
private readonly resend;
|
|
940
856
|
constructor(resend: Resend);
|
|
@@ -943,18 +859,6 @@ declare class ApiKeys {
|
|
|
943
859
|
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
944
860
|
}
|
|
945
861
|
|
|
946
|
-
declare class Receiving$1 {
|
|
947
|
-
private readonly resend;
|
|
948
|
-
constructor(resend: Resend);
|
|
949
|
-
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
950
|
-
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
declare class Attachments {
|
|
954
|
-
readonly receiving: Receiving$1;
|
|
955
|
-
constructor(resend: Resend);
|
|
956
|
-
}
|
|
957
|
-
|
|
958
862
|
declare class Audiences {
|
|
959
863
|
private readonly resend;
|
|
960
864
|
constructor(resend: Resend);
|
|
@@ -1018,16 +922,8 @@ type ListEmailsResponse = {
|
|
|
1018
922
|
error: ErrorResponse;
|
|
1019
923
|
};
|
|
1020
924
|
|
|
1021
|
-
declare class Receiving {
|
|
1022
|
-
private readonly resend;
|
|
1023
|
-
constructor(resend: Resend);
|
|
1024
|
-
get(id: string): Promise<GetInboundEmailResponse>;
|
|
1025
|
-
list(options?: ListInboundEmailsOptions): Promise<ListInboundEmailsResponse>;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
925
|
declare class Emails {
|
|
1029
926
|
private readonly resend;
|
|
1030
|
-
readonly receiving: Receiving;
|
|
1031
927
|
constructor(resend: Resend);
|
|
1032
928
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
1033
929
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
@@ -1037,17 +933,31 @@ declare class Emails {
|
|
|
1037
933
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1038
934
|
}
|
|
1039
935
|
|
|
936
|
+
interface Headers {
|
|
937
|
+
id: string;
|
|
938
|
+
timestamp: string;
|
|
939
|
+
signature: string;
|
|
940
|
+
}
|
|
941
|
+
interface VerifyWebhookOptions {
|
|
942
|
+
payload: string;
|
|
943
|
+
headers: Headers;
|
|
944
|
+
webhookSecret: string;
|
|
945
|
+
}
|
|
946
|
+
declare class Webhooks {
|
|
947
|
+
verify(payload: VerifyWebhookOptions): unknown;
|
|
948
|
+
}
|
|
949
|
+
|
|
1040
950
|
declare class Resend {
|
|
1041
951
|
readonly key?: string | undefined;
|
|
1042
952
|
private readonly headers;
|
|
1043
953
|
readonly apiKeys: ApiKeys;
|
|
1044
|
-
readonly attachments: Attachments;
|
|
1045
954
|
readonly audiences: Audiences;
|
|
1046
955
|
readonly batch: Batch;
|
|
1047
956
|
readonly broadcasts: Broadcasts;
|
|
1048
957
|
readonly contacts: Contacts;
|
|
1049
958
|
readonly domains: Domains;
|
|
1050
959
|
readonly emails: Emails;
|
|
960
|
+
readonly webhooks: Webhooks;
|
|
1051
961
|
constructor(key?: string | undefined);
|
|
1052
962
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
1053
963
|
data: T;
|
|
@@ -1093,4 +1003,4 @@ declare class Resend {
|
|
|
1093
1003
|
}>;
|
|
1094
1004
|
}
|
|
1095
1005
|
|
|
1096
|
-
export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type
|
|
1006
|
+
export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type IdempotentRequest, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
|
23
23
|
readonly rate_limit_exceeded: 429;
|
|
24
24
|
readonly missing_api_key: 401;
|
|
25
25
|
readonly invalid_api_key: 403;
|
|
26
|
+
readonly suspended_api_key: 403;
|
|
26
27
|
readonly invalid_from_address: 403;
|
|
27
28
|
readonly validation_error: 403;
|
|
28
29
|
readonly not_found: 404;
|
|
@@ -168,47 +169,6 @@ type RemoveApiKeyResponse = {
|
|
|
168
169
|
error: ErrorResponse;
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
interface InboundAttachment {
|
|
172
|
-
id: string;
|
|
173
|
-
filename?: string;
|
|
174
|
-
content_type: string;
|
|
175
|
-
content_disposition: 'inline' | 'attachment';
|
|
176
|
-
content_id?: string;
|
|
177
|
-
content: string;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
interface GetAttachmentOptions {
|
|
181
|
-
emailId: string;
|
|
182
|
-
id: string;
|
|
183
|
-
}
|
|
184
|
-
interface GetAttachmentResponseSuccess {
|
|
185
|
-
object: 'attachment';
|
|
186
|
-
data: InboundAttachment;
|
|
187
|
-
}
|
|
188
|
-
type GetAttachmentResponse = {
|
|
189
|
-
data: GetAttachmentResponseSuccess;
|
|
190
|
-
error: null;
|
|
191
|
-
} | {
|
|
192
|
-
data: null;
|
|
193
|
-
error: ErrorResponse;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
type ListAttachmentsOptions = PaginationOptions & {
|
|
197
|
-
emailId: string;
|
|
198
|
-
};
|
|
199
|
-
interface ListAttachmentsResponseSuccess {
|
|
200
|
-
object: 'list';
|
|
201
|
-
has_more: boolean;
|
|
202
|
-
data: InboundAttachment[];
|
|
203
|
-
}
|
|
204
|
-
type ListAttachmentsResponse = {
|
|
205
|
-
data: ListAttachmentsResponseSuccess;
|
|
206
|
-
error: null;
|
|
207
|
-
} | {
|
|
208
|
-
data: null;
|
|
209
|
-
error: ErrorResponse;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
172
|
interface Audience {
|
|
213
173
|
created_at: string;
|
|
214
174
|
id: string;
|
|
@@ -891,50 +851,6 @@ type UpdateEmailResponse = {
|
|
|
891
851
|
error: ErrorResponse;
|
|
892
852
|
};
|
|
893
853
|
|
|
894
|
-
interface GetInboundEmailResponseSuccess {
|
|
895
|
-
object: 'inbound';
|
|
896
|
-
id: string;
|
|
897
|
-
to: string[];
|
|
898
|
-
from: string;
|
|
899
|
-
created_at: string;
|
|
900
|
-
subject: string;
|
|
901
|
-
bcc: string[] | null;
|
|
902
|
-
cc: string[] | null;
|
|
903
|
-
reply_to: string[] | null;
|
|
904
|
-
html: string | null;
|
|
905
|
-
text: string | null;
|
|
906
|
-
headers: Record<string, string>;
|
|
907
|
-
attachments: Array<{
|
|
908
|
-
id: string;
|
|
909
|
-
filename: string;
|
|
910
|
-
content_type: string;
|
|
911
|
-
content_id: string;
|
|
912
|
-
content_disposition: string;
|
|
913
|
-
}>;
|
|
914
|
-
}
|
|
915
|
-
type GetInboundEmailResponse = {
|
|
916
|
-
data: GetInboundEmailResponseSuccess;
|
|
917
|
-
error: null;
|
|
918
|
-
} | {
|
|
919
|
-
data: null;
|
|
920
|
-
error: ErrorResponse;
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
type ListInboundEmailsOptions = PaginationOptions;
|
|
924
|
-
type ListInboundEmail = Omit<GetInboundEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>;
|
|
925
|
-
interface ListInboundEmailsResponseSuccess {
|
|
926
|
-
object: 'list';
|
|
927
|
-
has_more: boolean;
|
|
928
|
-
data: ListInboundEmail[];
|
|
929
|
-
}
|
|
930
|
-
type ListInboundEmailsResponse = {
|
|
931
|
-
data: ListInboundEmailsResponseSuccess;
|
|
932
|
-
error: null;
|
|
933
|
-
} | {
|
|
934
|
-
data: null;
|
|
935
|
-
error: ErrorResponse;
|
|
936
|
-
};
|
|
937
|
-
|
|
938
854
|
declare class ApiKeys {
|
|
939
855
|
private readonly resend;
|
|
940
856
|
constructor(resend: Resend);
|
|
@@ -943,18 +859,6 @@ declare class ApiKeys {
|
|
|
943
859
|
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
944
860
|
}
|
|
945
861
|
|
|
946
|
-
declare class Receiving$1 {
|
|
947
|
-
private readonly resend;
|
|
948
|
-
constructor(resend: Resend);
|
|
949
|
-
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
950
|
-
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
declare class Attachments {
|
|
954
|
-
readonly receiving: Receiving$1;
|
|
955
|
-
constructor(resend: Resend);
|
|
956
|
-
}
|
|
957
|
-
|
|
958
862
|
declare class Audiences {
|
|
959
863
|
private readonly resend;
|
|
960
864
|
constructor(resend: Resend);
|
|
@@ -1018,16 +922,8 @@ type ListEmailsResponse = {
|
|
|
1018
922
|
error: ErrorResponse;
|
|
1019
923
|
};
|
|
1020
924
|
|
|
1021
|
-
declare class Receiving {
|
|
1022
|
-
private readonly resend;
|
|
1023
|
-
constructor(resend: Resend);
|
|
1024
|
-
get(id: string): Promise<GetInboundEmailResponse>;
|
|
1025
|
-
list(options?: ListInboundEmailsOptions): Promise<ListInboundEmailsResponse>;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
925
|
declare class Emails {
|
|
1029
926
|
private readonly resend;
|
|
1030
|
-
readonly receiving: Receiving;
|
|
1031
927
|
constructor(resend: Resend);
|
|
1032
928
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
1033
929
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
@@ -1037,17 +933,31 @@ declare class Emails {
|
|
|
1037
933
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1038
934
|
}
|
|
1039
935
|
|
|
936
|
+
interface Headers {
|
|
937
|
+
id: string;
|
|
938
|
+
timestamp: string;
|
|
939
|
+
signature: string;
|
|
940
|
+
}
|
|
941
|
+
interface VerifyWebhookOptions {
|
|
942
|
+
payload: string;
|
|
943
|
+
headers: Headers;
|
|
944
|
+
webhookSecret: string;
|
|
945
|
+
}
|
|
946
|
+
declare class Webhooks {
|
|
947
|
+
verify(payload: VerifyWebhookOptions): unknown;
|
|
948
|
+
}
|
|
949
|
+
|
|
1040
950
|
declare class Resend {
|
|
1041
951
|
readonly key?: string | undefined;
|
|
1042
952
|
private readonly headers;
|
|
1043
953
|
readonly apiKeys: ApiKeys;
|
|
1044
|
-
readonly attachments: Attachments;
|
|
1045
954
|
readonly audiences: Audiences;
|
|
1046
955
|
readonly batch: Batch;
|
|
1047
956
|
readonly broadcasts: Broadcasts;
|
|
1048
957
|
readonly contacts: Contacts;
|
|
1049
958
|
readonly domains: Domains;
|
|
1050
959
|
readonly emails: Emails;
|
|
960
|
+
readonly webhooks: Webhooks;
|
|
1051
961
|
constructor(key?: string | undefined);
|
|
1052
962
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
1053
963
|
data: T;
|
|
@@ -1093,4 +1003,4 @@ declare class Resend {
|
|
|
1093
1003
|
}>;
|
|
1094
1004
|
}
|
|
1095
1005
|
|
|
1096
|
-
export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type
|
|
1006
|
+
export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type IdempotentRequest, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ __export(index_exports, {
|
|
|
84
84
|
module.exports = __toCommonJS(index_exports);
|
|
85
85
|
|
|
86
86
|
// package.json
|
|
87
|
-
var version = "6.2.0
|
|
87
|
+
var version = "6.2.0";
|
|
88
88
|
|
|
89
89
|
// src/common/utils/build-pagination-query.ts
|
|
90
90
|
function buildPaginationQuery(options) {
|
|
@@ -134,38 +134,6 @@ var ApiKeys = class {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
// src/attachments/receiving/receiving.ts
|
|
138
|
-
var Receiving = class {
|
|
139
|
-
constructor(resend) {
|
|
140
|
-
this.resend = resend;
|
|
141
|
-
}
|
|
142
|
-
get(options) {
|
|
143
|
-
return __async(this, null, function* () {
|
|
144
|
-
const { emailId, id } = options;
|
|
145
|
-
const data = yield this.resend.get(
|
|
146
|
-
`/emails/receiving/${emailId}/attachments/${id}`
|
|
147
|
-
);
|
|
148
|
-
return data;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
list(options) {
|
|
152
|
-
return __async(this, null, function* () {
|
|
153
|
-
const { emailId } = options;
|
|
154
|
-
const queryString = buildPaginationQuery(options);
|
|
155
|
-
const url = queryString ? `/emails/receiving/${emailId}/attachments?${queryString}` : `/emails/receiving/${emailId}/attachments`;
|
|
156
|
-
const data = yield this.resend.get(url);
|
|
157
|
-
return data;
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// src/attachments/attachments.ts
|
|
163
|
-
var Attachments = class {
|
|
164
|
-
constructor(resend) {
|
|
165
|
-
this.receiving = new Receiving(resend);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
137
|
// src/audiences/audiences.ts
|
|
170
138
|
var Audiences = class {
|
|
171
139
|
constructor(resend) {
|
|
@@ -525,34 +493,10 @@ var Domains = class {
|
|
|
525
493
|
}
|
|
526
494
|
};
|
|
527
495
|
|
|
528
|
-
// src/emails/receiving/receiving.ts
|
|
529
|
-
var Receiving2 = class {
|
|
530
|
-
constructor(resend) {
|
|
531
|
-
this.resend = resend;
|
|
532
|
-
}
|
|
533
|
-
get(id) {
|
|
534
|
-
return __async(this, null, function* () {
|
|
535
|
-
const data = yield this.resend.get(
|
|
536
|
-
`/emails/receiving/${id}`
|
|
537
|
-
);
|
|
538
|
-
return data;
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
list() {
|
|
542
|
-
return __async(this, arguments, function* (options = {}) {
|
|
543
|
-
const queryString = buildPaginationQuery(options);
|
|
544
|
-
const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving";
|
|
545
|
-
const data = yield this.resend.get(url);
|
|
546
|
-
return data;
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
|
|
551
496
|
// src/emails/emails.ts
|
|
552
497
|
var Emails = class {
|
|
553
498
|
constructor(resend) {
|
|
554
499
|
this.resend = resend;
|
|
555
|
-
this.receiving = new Receiving2(resend);
|
|
556
500
|
}
|
|
557
501
|
send(_0) {
|
|
558
502
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
@@ -609,6 +553,19 @@ var Emails = class {
|
|
|
609
553
|
}
|
|
610
554
|
};
|
|
611
555
|
|
|
556
|
+
// src/webhooks/webhooks.ts
|
|
557
|
+
var import_svix = require("svix");
|
|
558
|
+
var Webhooks = class {
|
|
559
|
+
verify(payload) {
|
|
560
|
+
const webhook = new import_svix.Webhook(payload.webhookSecret);
|
|
561
|
+
return webhook.verify(payload.payload, {
|
|
562
|
+
"svix-id": payload.headers.id,
|
|
563
|
+
"svix-timestamp": payload.headers.timestamp,
|
|
564
|
+
"svix-signature": payload.headers.signature
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
|
|
612
569
|
// src/resend.ts
|
|
613
570
|
var defaultBaseUrl = "https://api.resend.com";
|
|
614
571
|
var defaultUserAgent = `resend-node:${version}`;
|
|
@@ -618,13 +575,13 @@ var Resend = class {
|
|
|
618
575
|
constructor(key) {
|
|
619
576
|
this.key = key;
|
|
620
577
|
this.apiKeys = new ApiKeys(this);
|
|
621
|
-
this.attachments = new Attachments(this);
|
|
622
578
|
this.audiences = new Audiences(this);
|
|
623
579
|
this.batch = new Batch(this);
|
|
624
580
|
this.broadcasts = new Broadcasts(this);
|
|
625
581
|
this.contacts = new Contacts(this);
|
|
626
582
|
this.domains = new Domains(this);
|
|
627
583
|
this.emails = new Emails(this);
|
|
584
|
+
this.webhooks = new Webhooks();
|
|
628
585
|
if (!key) {
|
|
629
586
|
if (typeof process !== "undefined" && process.env) {
|
|
630
587
|
this.key = process.env.RESEND_API_KEY;
|
package/dist/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// package.json
|
|
54
|
-
var version = "6.2.0
|
|
54
|
+
var version = "6.2.0";
|
|
55
55
|
|
|
56
56
|
// src/common/utils/build-pagination-query.ts
|
|
57
57
|
function buildPaginationQuery(options) {
|
|
@@ -101,38 +101,6 @@ var ApiKeys = class {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
// src/attachments/receiving/receiving.ts
|
|
105
|
-
var Receiving = class {
|
|
106
|
-
constructor(resend) {
|
|
107
|
-
this.resend = resend;
|
|
108
|
-
}
|
|
109
|
-
get(options) {
|
|
110
|
-
return __async(this, null, function* () {
|
|
111
|
-
const { emailId, id } = options;
|
|
112
|
-
const data = yield this.resend.get(
|
|
113
|
-
`/emails/receiving/${emailId}/attachments/${id}`
|
|
114
|
-
);
|
|
115
|
-
return data;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
list(options) {
|
|
119
|
-
return __async(this, null, function* () {
|
|
120
|
-
const { emailId } = options;
|
|
121
|
-
const queryString = buildPaginationQuery(options);
|
|
122
|
-
const url = queryString ? `/emails/receiving/${emailId}/attachments?${queryString}` : `/emails/receiving/${emailId}/attachments`;
|
|
123
|
-
const data = yield this.resend.get(url);
|
|
124
|
-
return data;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// src/attachments/attachments.ts
|
|
130
|
-
var Attachments = class {
|
|
131
|
-
constructor(resend) {
|
|
132
|
-
this.receiving = new Receiving(resend);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
104
|
// src/audiences/audiences.ts
|
|
137
105
|
var Audiences = class {
|
|
138
106
|
constructor(resend) {
|
|
@@ -492,34 +460,10 @@ var Domains = class {
|
|
|
492
460
|
}
|
|
493
461
|
};
|
|
494
462
|
|
|
495
|
-
// src/emails/receiving/receiving.ts
|
|
496
|
-
var Receiving2 = class {
|
|
497
|
-
constructor(resend) {
|
|
498
|
-
this.resend = resend;
|
|
499
|
-
}
|
|
500
|
-
get(id) {
|
|
501
|
-
return __async(this, null, function* () {
|
|
502
|
-
const data = yield this.resend.get(
|
|
503
|
-
`/emails/receiving/${id}`
|
|
504
|
-
);
|
|
505
|
-
return data;
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
list() {
|
|
509
|
-
return __async(this, arguments, function* (options = {}) {
|
|
510
|
-
const queryString = buildPaginationQuery(options);
|
|
511
|
-
const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving";
|
|
512
|
-
const data = yield this.resend.get(url);
|
|
513
|
-
return data;
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
|
|
518
463
|
// src/emails/emails.ts
|
|
519
464
|
var Emails = class {
|
|
520
465
|
constructor(resend) {
|
|
521
466
|
this.resend = resend;
|
|
522
|
-
this.receiving = new Receiving2(resend);
|
|
523
467
|
}
|
|
524
468
|
send(_0) {
|
|
525
469
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
@@ -576,6 +520,19 @@ var Emails = class {
|
|
|
576
520
|
}
|
|
577
521
|
};
|
|
578
522
|
|
|
523
|
+
// src/webhooks/webhooks.ts
|
|
524
|
+
import { Webhook } from "svix";
|
|
525
|
+
var Webhooks = class {
|
|
526
|
+
verify(payload) {
|
|
527
|
+
const webhook = new Webhook(payload.webhookSecret);
|
|
528
|
+
return webhook.verify(payload.payload, {
|
|
529
|
+
"svix-id": payload.headers.id,
|
|
530
|
+
"svix-timestamp": payload.headers.timestamp,
|
|
531
|
+
"svix-signature": payload.headers.signature
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
579
536
|
// src/resend.ts
|
|
580
537
|
var defaultBaseUrl = "https://api.resend.com";
|
|
581
538
|
var defaultUserAgent = `resend-node:${version}`;
|
|
@@ -585,13 +542,13 @@ var Resend = class {
|
|
|
585
542
|
constructor(key) {
|
|
586
543
|
this.key = key;
|
|
587
544
|
this.apiKeys = new ApiKeys(this);
|
|
588
|
-
this.attachments = new Attachments(this);
|
|
589
545
|
this.audiences = new Audiences(this);
|
|
590
546
|
this.batch = new Batch(this);
|
|
591
547
|
this.broadcasts = new Broadcasts(this);
|
|
592
548
|
this.contacts = new Contacts(this);
|
|
593
549
|
this.domains = new Domains(this);
|
|
594
550
|
this.emails = new Emails(this);
|
|
551
|
+
this.webhooks = new Webhooks();
|
|
595
552
|
if (!key) {
|
|
596
553
|
if (typeof process !== "undefined" && process.env) {
|
|
597
554
|
this.key = process.env.RESEND_API_KEY;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "6.2.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -31,9 +31,7 @@
|
|
|
31
31
|
"lint": "biome check .",
|
|
32
32
|
"prepublishOnly": "pnpm run build",
|
|
33
33
|
"test": "vitest run",
|
|
34
|
-
"test:watch": "vitest"
|
|
35
|
-
"test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run",
|
|
36
|
-
"test:dev": "cross-env TEST_MODE=dev vitest run"
|
|
34
|
+
"test:watch": "vitest"
|
|
37
35
|
},
|
|
38
36
|
"repository": {
|
|
39
37
|
"type": "git",
|
|
@@ -45,6 +43,9 @@
|
|
|
45
43
|
"url": "https://github.com/resendlabs/resend-node/issues"
|
|
46
44
|
},
|
|
47
45
|
"homepage": "https://github.com/resendlabs/resend-node#readme",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"svix": "1.76.1"
|
|
48
|
+
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"@react-email/render": "*"
|
|
50
51
|
},
|
|
@@ -54,20 +55,14 @@
|
|
|
54
55
|
}
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@biomejs/biome": "2.2.
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@pollyjs/persister-fs": "6.0.6",
|
|
61
|
-
"@types/node": "22.18.9",
|
|
62
|
-
"@types/react": "19.2.0",
|
|
63
|
-
"cross-env": "10.1.0",
|
|
64
|
-
"dotenv": "17.2.3",
|
|
58
|
+
"@biomejs/biome": "2.2.0",
|
|
59
|
+
"@types/node": "22.18.6",
|
|
60
|
+
"@types/react": "19.1.15",
|
|
65
61
|
"pkg-pr-new": "0.0.60",
|
|
66
|
-
"rimraf": "6.0.1",
|
|
67
62
|
"tsup": "8.5.0",
|
|
68
|
-
"typescript": "5.9.
|
|
63
|
+
"typescript": "5.9.2",
|
|
69
64
|
"vitest": "3.2.4",
|
|
70
65
|
"vitest-fetch-mock": "0.4.5"
|
|
71
66
|
},
|
|
72
|
-
"packageManager": "pnpm@10.
|
|
67
|
+
"packageManager": "pnpm@10.17.1"
|
|
73
68
|
}
|