UNPKG

studiocms

Version:

Astro Native CMS for AstroDB. Built from the ground up by the Astro community.

65 lines (64 loc) 3.35 kB
import { Effect, Layer } from '../../effect.js'; import { SMTPMailer } from '../../utils/effects/smtp.js'; import type { ConfigFinal, StudioCMSMailerConfig } from '../sdk/modules/config.js'; /** * Interface representing the options for sending an email. */ export interface MailOptions { /** * The recipient(s) of the email. Can be a single email address or an array of email addresses. */ to: string | string[]; /** * The subject of the email. */ subject: string; /** * The plain text content of the email. Optional. */ text?: string | undefined; /** * The HTML content of the email. Optional. */ html?: string | undefined; } /** * Interface representing an error response from the mailer. */ export interface MailerErrorResponse { error: string; } /** * Interface representing a success response from the mailer. */ export interface MailerSuccessResponse { message: string; } /** * Interface representing the response from a mail verification operation. */ export type MailerResponse = MailerSuccessResponse | MailerErrorResponse; export declare const makeLogger: Effect.Effect<import("astro").AstroIntegrationLogger, never, never>; declare const Logger_base: import("effect/Context").TagClass<Logger, "studiocms/lib/mailer/Logger", import("astro").AstroIntegrationLogger> & Effect.Tag.Proxy<Logger, import("astro").AstroIntegrationLogger> & { use: <X>(body: (_: import("astro").AstroIntegrationLogger) => X) => [X] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, Logger | R> : [X] extends [PromiseLike<infer A_1>] ? Effect.Effect<A_1, import("effect/Cause").UnknownException, Logger> : Effect.Effect<X, never, Logger>; }; export declare class Logger extends Logger_base { static Live: Effect.Effect<import("astro").AstroIntegrationLogger, never, never>; static Layer: Layer.Layer<Logger, never, never>; } declare const Mailer_base: Effect.Service.Class<Mailer, "studiocms/lib/mailer/Mailer", { readonly effect: Effect.Effect<{ getMailerConfigTable: Effect.Effect<import("../sdk/modules/config-types.js").DynamicConfigEntry<StudioCMSMailerConfig> | undefined, import("@withstudiocms/effect/drizzle").LibSQLClientError, never>; updateMailerConfigTable: (config: ConfigFinal<StudioCMSMailerConfig>) => Effect.Effect<MailerErrorResponse | MailerSuccessResponse, never, never>; createMailerConfigTable: (config: ConfigFinal<StudioCMSMailerConfig>) => Effect.Effect<import("../sdk/modules/config-types.js").DynamicConfigEntry<StudioCMSMailerConfig>, import("@withstudiocms/effect/drizzle").LibSQLClientError, never>; sendMail: ({ subject, ...message }: MailOptions) => Effect.Effect<MailerErrorResponse | MailerSuccessResponse, Error, never>; verifyMailConnection: Effect.Effect<MailerErrorResponse | MailerSuccessResponse, Error, never>; isEnabled: Effect.Effect<boolean, import("../sdk/errors.js").SDKCoreError, never>; }, never, SMTPMailer | Logger>; readonly dependencies: readonly [Layer.Layer<Logger, never, never>, Layer.Layer<SMTPMailer, Error, never>]; readonly accessors: true; }>; export declare class Mailer extends Mailer_base { static Provide: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, Error | E, Exclude<R, Mailer>>; } export {};