rebrand to useSend (#210)
This commit is contained in:
@@ -85,7 +85,8 @@ function generateKeyPair() {
|
||||
export async function addDomain(
|
||||
domain: string,
|
||||
region: string,
|
||||
sesTenantId?: string
|
||||
sesTenantId?: string,
|
||||
dkimSelector: string = "usesend",
|
||||
) {
|
||||
const sesClient = getSesClient(region);
|
||||
|
||||
@@ -93,7 +94,7 @@ export async function addDomain(
|
||||
const command = new CreateEmailIdentityCommand({
|
||||
EmailIdentity: domain,
|
||||
DkimSigningAttributes: {
|
||||
DomainSigningSelector: "unsend",
|
||||
DomainSigningSelector: dkimSelector,
|
||||
DomainSigningPrivateKey: privateKey,
|
||||
},
|
||||
});
|
||||
@@ -114,13 +115,13 @@ export async function addDomain(
|
||||
});
|
||||
|
||||
const tenantResourceAssociationResponse = await sesClient.send(
|
||||
tenantResourceAssociationCommand
|
||||
tenantResourceAssociationCommand,
|
||||
);
|
||||
|
||||
if (tenantResourceAssociationResponse.$metadata.httpStatusCode !== 200) {
|
||||
logger.error(
|
||||
{ tenantResourceAssociationResponse },
|
||||
"Failed to associate domain with tenant"
|
||||
"Failed to associate domain with tenant",
|
||||
);
|
||||
throw new Error("Failed to associate domain with tenant");
|
||||
}
|
||||
@@ -132,7 +133,7 @@ export async function addDomain(
|
||||
) {
|
||||
logger.error(
|
||||
{ response, emailIdentityResponse },
|
||||
"Failed to create domain identity"
|
||||
"Failed to create domain identity",
|
||||
);
|
||||
throw new Error("Failed to create domain identity");
|
||||
}
|
||||
@@ -143,7 +144,7 @@ export async function addDomain(
|
||||
export async function deleteDomain(
|
||||
domain: string,
|
||||
region: string,
|
||||
sesTenantId?: string
|
||||
sesTenantId?: string,
|
||||
) {
|
||||
const sesClient = getSesClient(region);
|
||||
|
||||
@@ -155,13 +156,13 @@ export async function deleteDomain(
|
||||
});
|
||||
|
||||
const tenantResourceAssociationResponse = await sesClient.send(
|
||||
tenantResourceAssociationCommand
|
||||
tenantResourceAssociationCommand,
|
||||
);
|
||||
|
||||
if (tenantResourceAssociationResponse.$metadata.httpStatusCode !== 200) {
|
||||
logger.error(
|
||||
{ tenantResourceAssociationResponse },
|
||||
"Failed to delete tenant resource association"
|
||||
"Failed to delete tenant resource association",
|
||||
);
|
||||
throw new Error("Failed to delete tenant resource association");
|
||||
}
|
||||
@@ -233,7 +234,9 @@ export async function sendRawEmail({
|
||||
bcc,
|
||||
headers: {
|
||||
"X-Entity-Ref-ID": nanoid(),
|
||||
...(emailId ? { "X-Unsend-Email-ID": emailId } : {}),
|
||||
...(emailId
|
||||
? { "X-Usesend-Email-ID": emailId, "X-Unsend-Email-ID": emailId }
|
||||
: {}),
|
||||
...(unsubUrl
|
||||
? {
|
||||
"List-Unsubscribe": `<${unsubUrl}>`,
|
||||
@@ -289,7 +292,7 @@ export async function addWebhookConfiguration(
|
||||
configName: string,
|
||||
topicArn: string,
|
||||
eventTypes: EventType[],
|
||||
region: string
|
||||
region: string,
|
||||
) {
|
||||
const sesClient = getSesClient(region);
|
||||
|
||||
@@ -305,7 +308,7 @@ export async function addWebhookConfiguration(
|
||||
|
||||
const command = new CreateConfigurationSetEventDestinationCommand({
|
||||
ConfigurationSetName: configName, // required
|
||||
EventDestinationName: "unsend_destination", // required
|
||||
EventDestinationName: "usesend_destination", // required
|
||||
EventDestination: {
|
||||
Enabled: true,
|
||||
MatchingEventTypes: eventTypes,
|
||||
|
||||
Reference in New Issue
Block a user