@samatawy/rules
    Preparing search index...

    Class ConstantsFileReader

    Reader class for parsing constants files that define key-value pairs of constants to be used within the rule engine. You should use this class to read constants from a text file, where each line (or block) defines a constant in the format "CONST KEY = VALUE" or "KEY = VALUE". The reader will parse the file content and return an object containing the successfully parsed constants as well as any errors encountered during parsing. The reader supports both line-by-line and block-by-block reading, allowing for flexible formatting of the constants file. It also includes error handling for invalid syntax and duplicate keys, ensuring that the resulting constants object is valid and usable within the rule engine.

    N.B. This is a transactional safe reader. If you provide a workspace and select the option accept: 'all', then that workplace will not be affected if any errors are encountered.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    workspace: Workspace

    Methods

    • Parse the content of a constants file and return the result, including the successfully parsed constants and any errors encountered during parsing. If a Workspace was passed in options, that Workspace will be changed to reflect successful declarations.

      Parameters

      • fileContent: string

        The content of the constants file to parse.

      Returns ConstantsFileResult

      The result of parsing, including the successfully parsed constants and any errors encountered.