Revert "Unify workspace dropdowns; Update layouts (#458)"
This reverts commit 4bc8448a1d.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
const MAILER_PROVIDERS = [
|
||||
'nodemailer',
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'server-only';
|
||||
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Mailer, MailerSchema } from '@kit/mailers-shared';
|
||||
|
||||
import { getSMTPConfiguration } from './smtp-configuration';
|
||||
|
||||
type Config = z.output<typeof MailerSchema>;
|
||||
type Config = z.infer<typeof MailerSchema>;
|
||||
|
||||
export function createNodemailerService() {
|
||||
return new Nodemailer();
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import 'server-only';
|
||||
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Mailer, MailerSchema } from '@kit/mailers-shared';
|
||||
|
||||
type Config = z.output<typeof MailerSchema>;
|
||||
type Config = z.infer<typeof MailerSchema>;
|
||||
|
||||
const RESEND_API_KEY = z
|
||||
.string({
|
||||
error: 'Please provide the API key for the Resend API',
|
||||
description: 'The API key for the Resend API',
|
||||
required_error: 'Please provide the API key for the Resend API',
|
||||
})
|
||||
.parse(process.env.RESEND_API_KEY);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { MailerSchema } from './schema/mailer.schema';
|
||||
|
||||
export abstract class Mailer<Res = unknown> {
|
||||
abstract sendEmail(data: z.output<typeof MailerSchema>): Promise<Res>;
|
||||
abstract sendEmail(data: z.infer<typeof MailerSchema>): Promise<Res>;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const MailerSchema = z
|
||||
.object({
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
import 'server-only';
|
||||
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const SmtpConfigSchema = z.object({
|
||||
user: z.string({
|
||||
error: `Please provide the variable EMAIL_USER`,
|
||||
description:
|
||||
'This is the email account to send emails from. This is specific to the email provider.',
|
||||
required_error: `Please provide the variable EMAIL_USER`,
|
||||
}),
|
||||
pass: z.string({
|
||||
error: `Please provide the variable EMAIL_PASSWORD`,
|
||||
description: 'This is the password for the email account',
|
||||
required_error: `Please provide the variable EMAIL_PASSWORD`,
|
||||
}),
|
||||
host: z.string({
|
||||
error: `Please provide the variable EMAIL_HOST`,
|
||||
description: 'This is the SMTP host for the email provider',
|
||||
required_error: `Please provide the variable EMAIL_HOST`,
|
||||
}),
|
||||
port: z.number({
|
||||
error: `Please provide the variable EMAIL_PORT`,
|
||||
description:
|
||||
'This is the port for the email provider. Normally 587 or 465.',
|
||||
required_error: `Please provide the variable EMAIL_PORT`,
|
||||
}),
|
||||
secure: z.boolean({
|
||||
error: `Please provide the variable EMAIL_TLS`,
|
||||
description: 'This is whether the connection is secure or not',
|
||||
required_error: `Please provide the variable EMAIL_TLS`,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user