Member Junction
    Preparing search index...

    First-level subclass of EntityDocumentTemplateParserBase used to parse entity document templates with variables, dotted context paths (__Parent), and functions such as Relationship().

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _provider?: IMetadataProvider

    Optional provider override; falls back to Metadata.Provider when not set.

    __cache: Map<string, string> = ...

    Resolved placeholders by cache key, in least-recently-used-first order.

    MaxCachedPlaceholders: 10000 = 10_000

    The most resolved placeholders kept at once. Every record version adds entries (the key includes a hash of the record values), so the least recently used entry is evicted once the cache is full.

    Accessors

    Methods

    • Parses an entity document template and replaces values within ${} placeholders with actual values from the entity record. If template uses Nunjucks {{ }} syntax, it is pre-rendered with the MJ TemplateEngine first.

      Parameters

      • Template: string

        the document template to parse

      • EntityID: string

        the ID of the entity

      • EntityRecord: Record<string, unknown>

        the values for the entity record (may contain __Parent context)

      • ContextUser: UserInfo

        the current user

      Returns Promise<string>

      the evaluated value of the template incorporating fields, nested contexts, and function call(s)

    • Resolves related records for an entity and recursively renders a child Entity Document over each.

      Parameters

      • entityID: string

        ID of the parent entity

      • entityRecord: Record<string, unknown>

        Data of the parent entity record

      • ContextUser: UserInfo

        Current user info

      • relationshipName: string

        Name of the related entity / relationship

      • maxRows: number

        Maximum number of related rows to load

      • entityDocumentName: string

        Name of the child Entity Document to render over each related row

      Returns Promise<string>

      Concatenated rendered output for all related rows, or raw JSON data if no document specified

    • The related rows without the values that must stay out of a derived document. The rendered text is built once and read by many users (an Entity Record Document, autotag content, an inference's context), so two sets of fields are dropped:

      • the fields the render user may not read, and
      • the fields some role that can read the related entity may not read, even when the render user can (the same rule vector sync applies to related rows).

      The join field (by name and by code name) is kept against the second rule: its value is the parent record's own key. The rows are copied where a value is dropped and never modified.

      Parameters

      Returns Record<string, unknown>[]

    • Builds the key a resolved placeholder is cached under. Placeholders such as Relationship() load rows under the caller's permissions, so the key includes the user. It also includes a hash of the record values the placeholder was resolved from: a caller that strips restricted fields from a record must not be served a value resolved earlier from the full record, and a record whose values changed must not be served the old value. Returns null when there is no user ID, in which case the placeholder is resolved without caching.

      Parameters

      • EntityID: string
      • EntityRecordPrimaryKey: string
      • Content: string
      • UserID: string
      • RecordValuesHash: string = ''

        a hash of the record values, from HashRecordValues

      Returns string