@samatawy/rules
    Preparing search index...

    Class TypesFileReader

    Reader class for parsing types files that define data structures for input (and output) properties. You should use this class to read types from a text file, where each line (or block) defines a type as a JSON object with a "key" property and either: "type" or "properties" that define the type structure. The reader will parse the file content and return an object containing the successfully parsed types as well as any errors encountered during parsing. The reader supports both line-by-line and block-by-block reading, but blocks are the default and highly recommended. It also includes error handling for invalid syntax and duplicate keys, ensuring that the resulting types object is valid and usable within the rule engine.

    N.B. Declarations need to be in order, otherwise errors will be returned.

    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

    typeParser: TypeParser
    workspace: Workspace

    Methods

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

      Parameters

      • fileContent: string

        The content of the types file to parse.

      Returns TypesFileResult

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