Setu-TS
    Preparing search index...

    Class TemplateEngine

    A registry of named body templates: {{ variable }} strings and view components, rendered through one render.

    0.1.0

    Index
    • Parameters

      • Optionaltemplates: Readonly<Record<string, MailTemplate>>

        Named templates (from MailPluginOptions.templates)

      • OptionalviewEngine: IViewEngine

        The engine the component arm renders through; required when any template is a component template, and resolved by MailPlugin from CAPABILITIES.VIEW at register()

      Returns TemplateEngine

      If a component template is configured and viewEngine is absent — refused here, at construction, so the failure is a startup failure naming the template and both remedies rather than a throw on the first sendTemplate (the M92 @Render precedent)

    • Renders a template's bodies with data.

      A string template substitutes {{ key }} placeholders and refuses a key absent from data. A component template passes data to each component VERBATIM as its props and performs no missing-key check — a component reads whatever it reads, so an absent key renders as undefined; the compile-time route is engine.render(Component, props) by hand.

      Parameters

      • name: string

        Template name

      • data: Readonly<Record<string, unknown>>

        Interpolation variables, or the component's props

      Returns Promise<RenderedTemplate>

      The rendered html/text bodies that the template defines

      If the template is unknown, or (string arm) a placeholder key is absent from data; a component that throws rejects with the engine's own error unwrapped