iya-sts
    Preparing search index...

    The mail channel's messages: the built-in template of every message this service sends, the rules a realm's own template must keep, and the renderer.

    Values are escaped by the renderer, a link is always a placeholder for this service's own address, and the HTML part may load and run nothing. A library that stores nothing.

    Index
    BUILT_IN: TemplateSpec[] = BUILT_IN

    The built-in template of every message, in English: its id, category, title, placeholders, links and three parts.

    CATEGORIES: {
        id: string;
        label: string;
        optional: boolean;
        reason: string;
        what: string;
    }[] = CATEGORIES

    The message categories (security, account, notification), with whether a person may decline each.

    COMMON: string[] = COMMON

    The placeholders every message offers: realm and service.

    LAYOUT_ID: "layout" = LAYOUT_ID

    The id of the layout every message is wrapped in: layout.

    • Finds the built-in template with an id.

      Parameters

      • id: string

        the message's id

      Returns TemplateSpec

      the template, or null

    • Finds a category by id.

      Parameters

      • id: string

        the category's id

      Returns any

      the category, or null

    • Wraps an HTML part in the one document every message is: a language tag and a head that loads nothing.

      Parameters

      • body: string

        the HTML part

      • lang: string

        the language tag; en when absent

      Returns string

      the document

    • Orders the languages to try for a message, best first: each tag of an Accept-Language value and its primary subtag by q, then the realm's default, then en.

      Parameters

      • preferred: string

        the entry's preferredLanguage

      • fallback: string

        the realm's default language

      Returns string[]

      the language tags

    • Lists every {{name}} placeholder in a piece of text, once each.

      Parameters

      • text: string

        the text

      Returns string[]

      the placeholder names

    • Prepares a value for a subject or a text part: every control character, CR and LF above all, becomes a space.

      Parameters

      • value: unknown

        the value

      Returns string

      the text

    • Checks a realm's template against the rules, when it is saved: all three parts, sizes, placeholders the message offers, no address of its own, every link in the text part, and no HTML that loads or runs anything.

      Parameters

      • spec: TemplateSpec

        the built-in template it rewords

      • parts: any

        { subject, text, html }

      Returns string

      one sentence saying what is wrong, or '' when nothing is

    • Renders a template: each placeholder filled with its value, escaped for HTML in the HTML part and stripped of control characters elsewhere. A placeholder with no value renders empty.

      Parameters

      • parts: any

        the template's { subject, text, html }

      • values: any

        every placeholder's raw value, links already absolute

      Returns any

      { subject, text, html }

    • Wraps a rendered message in the layout: its body as {{content}}, unescaped since it was escaped when rendered, and its subject as {{subject}}.

      Parameters

      • layoutParts: any

        the layout's { subject, text, html }

      • rendered: any

        render()'s answer for the message

      • values: any

        the other placeholders' values

      Returns any

      { subject, text, html }