TransactionParser
    Preparing search index...

    Interface ITransactionPackage

    ITransaactionPackage is a helper interface that represents a group of transactions.

    A transaction package uses one copybook and contains transactions that use the same copybook.

    interface ITransactionPackage {
        parser: CopybookParser;
        transactions?: ITransaction[];
        createEmptyTransaction(): void;
        getFirstTransaction(): ITransaction | undefined;
        getLastTransaction(): ITransaction | undefined;
        load(data: Buffer): void;
        loadFile(path: string): void;
        save(path: string): void;
        toBuffer(): Buffer;
        toJson(spaces?: number): string;
    }

    Implemented by

    Index

    Properties

    Instance of CopybookParser that is used to parse the copybook used by this transaction package

    transactions?: ITransaction[]

    Array of ITransaction objects representing the transactions within the current transaction package

    Methods

    • Get the last transaction in the current package, or undefined if no transactions exist.

      Returns ITransaction | undefined

      {(ITransaction | undefined)}

      Convenience method, you can also use:

      transactionPackage.transactions[transactionPackage.transactions.length - 1]
      
    • Load data from a Buffer into transactions.

      The data param can contain multiple transactions in a single buffer and splitBuffer is used to split the buffer into an array of buffers for further processing

      Parameters

      • data: Buffer

      Returns void

    • Save the current transaction package to file.

      The new line character x'15' will be added at the end of each transaction

      Parameters

      • path: string

      Returns void

    • Convert the current transaction package to an array of transactions as JSON string

      Parameters

      • Optionalspaces: number

        Number of spaces to use for indentation

      Returns string

      {string}