0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

chore(connector): fix methods params order (#1618)

This commit is contained in:
Darcy Ye 2022-07-20 13:42:52 +08:00 committed by GitHub
parent ad9b3d780c
commit 15af03f45f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 20 deletions

View file

@ -52,20 +52,20 @@ export default class AliyunDmConnector implements EmailConnectorInstance<AliyunD
this.validateConfig(emailConfig); this.validateConfig(emailConfig);
return this.sendMessageBy(address, type, data, emailConfig); return this.sendMessageBy(emailConfig, address, type, data);
}; };
public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => { public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => {
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(address, type, data, config); return this.sendMessageBy(config, address, type, data);
}; };
private readonly sendMessageBy = async ( private readonly sendMessageBy = async (
config: AliyunDmConfig,
address: string, address: string,
type: keyof EmailMessageTypes, type: keyof EmailMessageTypes,
data: EmailMessageTypes[typeof type], data: EmailMessageTypes[typeof type]
config: AliyunDmConfig
) => { ) => {
const { accessKeyId, accessKeySecret, accountName, fromAlias, templates } = config; const { accessKeyId, accessKeySecret, accountName, fromAlias, templates } = config;
const template = templates.find((template) => template.usageType === type); const template = templates.find((template) => template.usageType === type);

View file

@ -47,20 +47,20 @@ export default class AliyunSmsConnector implements SmsConnectorInstance<AliyunSm
this.validateConfig(smsConfig); this.validateConfig(smsConfig);
return this.sendMessageBy(phone, type, data, smsConfig); return this.sendMessageBy(smsConfig, phone, type, data);
}; };
public sendTestMessage: SmsSendTestMessageFunction = async (config, phone, type, data) => { public sendTestMessage: SmsSendTestMessageFunction = async (config, phone, type, data) => {
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(phone, type, data, config); return this.sendMessageBy(config, phone, type, data);
}; };
private readonly sendMessageBy = async ( private readonly sendMessageBy = async (
config: AliyunSmsConfig,
phone: string, phone: string,
type: keyof SmsMessageTypes, type: keyof SmsMessageTypes,
data: SmsMessageTypes[typeof type], data: SmsMessageTypes[typeof type]
config: AliyunSmsConfig
) => { ) => {
const { accessKeyId, accessKeySecret, signName, templates } = config; const { accessKeyId, accessKeySecret, signName, templates } = config;
const template = templates.find(({ usageType }) => usageType === type); const template = templates.find(({ usageType }) => usageType === type);

View file

@ -53,20 +53,20 @@ export default class SendGridMailConnector implements EmailConnectorInstance<Sen
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(address, type, data, config); return this.sendMessageBy(config, address, type, data);
}; };
public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => { public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => {
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(address, type, data, config); return this.sendMessageBy(config, address, type, data);
}; };
private readonly sendMessageBy = async ( private readonly sendMessageBy = async (
config: SendGridMailConfig,
address: string, address: string,
type: keyof EmailMessageTypes, type: keyof EmailMessageTypes,
data: EmailMessageTypes[typeof type], data: EmailMessageTypes[typeof type]
config: SendGridMailConfig
) => { ) => {
const { apiKey, fromEmail, fromName, templates } = config; const { apiKey, fromEmail, fromName, templates } = config;
const template = templates.find((template) => template.usageType === type); const template = templates.find((template) => template.usageType === type);

View file

@ -47,20 +47,20 @@ export default class SmtpConnector implements EmailConnectorInstance<SmtpConfig>
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(address, type, data, config); return this.sendMessageBy(config, address, type, data);
}; };
public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => { public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => {
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(address, type, data, config); return this.sendMessageBy(config, address, type, data);
}; };
private readonly sendMessageBy = async ( private readonly sendMessageBy = async (
config: SmtpConfig,
address: string, address: string,
type: keyof EmailMessageTypes, type: keyof EmailMessageTypes,
data: EmailMessageTypes[typeof type], data: EmailMessageTypes[typeof type]
config: SmtpConfig
) => { ) => {
const { host, port, username, password, fromEmail, replyTo, templates } = config; const { host, port, username, password, fromEmail, replyTo, templates } = config;
const template = templates.find((template) => template.usageType === type); const template = templates.find((template) => template.usageType === type);

View file

@ -46,20 +46,20 @@ export default class TwilioSmsConnector implements SmsConnectorInstance<TwilioSm
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(phone, type, data, config); return this.sendMessageBy(config, phone, type, data);
}; };
public sendTestMessage: SmsSendTestMessageFunction = async (config, phone, type, data) => { public sendTestMessage: SmsSendTestMessageFunction = async (config, phone, type, data) => {
this.validateConfig(config); this.validateConfig(config);
return this.sendMessageBy(phone, type, data, config); return this.sendMessageBy(config, phone, type, data);
}; };
private readonly sendMessageBy = async ( private readonly sendMessageBy = async (
config: TwilioSmsConfig,
phone: string, phone: string,
type: keyof SmsMessageTypes, type: keyof SmsMessageTypes,
data: SmsMessageTypes[typeof type], data: SmsMessageTypes[typeof type]
config: TwilioSmsConfig
) => { ) => {
const { accountSID, authToken, fromMessagingServiceSID, templates } = config; const { accountSID, authToken, fromMessagingServiceSID, templates } = config;
const template = templates.find((template) => template.usageType === type); const template = templates.find((template) => template.usageType === type);