beancount
    Preparing search index...

    Class EntryAbstract

    Abstract base class for all Beancount entry types.

    Child classes must implement static fromGenericParseResult method

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new Entry instance.

      Parameters

      • obj: Record<string, unknown>

        Object containing entry properties

      Returns Entry

    Properties

    comment?: string

    Optional comment text associated with this entry

    internalMetadata: Record<string, unknown> = {}

    Internal metadata key-value pairs associated with this entry. These can be anything, are not used in the output, and are meant to be used to allow your pipeline to keep track of an internal property

    type: BeancountEntryType | "comment" | "blankline"

    The type of this entry (e.g., 'open', 'close', 'transaction', 'comment', 'blankline')

    Methods

    • Transforms JSON data before creating an Entry instance. Default implementation returns the input unchanged. Subclasses can override this to handle custom deserialization logic (e.g., converting nested objects, handling dates, etc.).

      Parameters

      • json: Record<string, unknown>

        The JSON data to transform

      Returns Record<string, unknown>

      The transformed data ready for the constructor

    • Converts this entry to a formatted string with aligned columns. Default implementation delegates to toString(). Subclasses can override for custom formatting.

      Parameters

      • _formatOptions: FormatOptions = defaultFormatOptions

        Formatting options (unused in base implementation)

      Returns string

      The formatted string representation of this entry

    • Creates an Entry instance from JSON data. Calls fromJSONData to allow subclasses to transform the data before construction.

      Type Parameters

      Parameters

      • this: new (obj: any) => T
      • jsonString: string

        JSON data representing an entry

      Returns T

      A new instance of the Entry subclass

      Warning: No validation is performed on the JSON input. We assume the JSON is valid and well-formed.

    • Creates an Entry instance from JSON data. Calls fromJSONData to allow subclasses to transform the data before construction.

      Type Parameters

      Parameters

      • this: new (obj: any) => T
      • jsonData: Record<string, unknown>

        object representing an entry

      Returns T

      A new instance of the Entry subclass

      Warning: No validation is performed on the input. We assume the input is valid and well-formed.

    • Creates an Entry instance from a Beancount string. Parses the input string and constructs the appropriate Entry subclass.

      Type Parameters

      Parameters

      • this: EntryConstructor<T>
      • input: string

        A single Beancount entry as a string

      Returns T

      A new instance of the Entry subclass