TransactionParser - v0.3.1
    Preparing search index...

    Interface ITransactionPackageEvent

    ITransactionPackageEvent interface is a helper interface to define the events that are submitted during interaction with a TransactionPackage test

    interface ITransactionPackageEvent {
        beforeParsing: { parser: CopybookParser };
        parsingComplete: { parsedCopybook: DataItem[]; parser: CopybookParser };
        transactionCreated: {
            newTransaction: ITransaction;
            parser: CopybookParser;
            transactions: ITransaction[];
        };
        transactionPackageSaved: {
            buffer: Buffer;
            outputPath: string;
            parser: CopybookParser;
            transactions: ITransaction[];
        };
        transactionsLoaded: {
            parser: CopybookParser;
            transactions: ITransaction[];
        };
    }

    Hierarchy (View Summary)

    • IEvent
      • ITransactionPackageEvent
    Index

    Properties

    beforeParsing: { parser: CopybookParser }

    Fired after CopybookParser is initialized and before parsing starts. Can be used to subsribe to parsing events via parser.getEventEmitter() Returns the following values:

    • parser: Instance of CopybookParser that is used to parse the provided copybook

    To receive events related to Copybook parsing, use the parser property, see IParsingEvent for available events

    parsingComplete: { parsedCopybook: DataItem[]; parser: CopybookParser }

    Fired after the copybook provided when creating a transaction package has been parsed Returns the following values:

    • parser: Instance of CopybookParser that is used to parse the provided copybook
    • parsedCopybook: Array of DataItem containing the parsed copybook values
    transactionCreated: {
        newTransaction: ITransaction;
        parser: CopybookParser;
        transactions: ITransaction[];
    }

    Fired when a new transaction is created after the TransactionPackage has been initialized by calling TransactionPackage.createEmptyTransaction

    The following values are returned:

    • parser: Instance of CopybookParser that is used to parse the provided copybook
    • newTransaction: ITransaction that has recently been created
    • transactions: Array of ITransaction containing the transactions that are added to the current transaction package

    newTransaction is included at the last position within the transactions array

    transactionPackageSaved: {
        buffer: Buffer;
        outputPath: string;
        parser: CopybookParser;
        transactions: ITransaction[];
    }

    Fired when a transaction package is stored to a file.

    The following values will be returned:

    • parser: Instance of CopybookParser that is used to parse the provided copybook
    • transactions: Array of ITransaction containing all the transaction that will be written to the output file
    • buffer: Buffer object containing the raw data that will be written to file
    • outputPath: Path where the output will be saved
    transactionsLoaded: { parser: CopybookParser; transactions: ITransaction[] }

    This event is triggered:

    The following values will be returned:

    • parser: Instance of CopybookParser that is used to parse the provided copybook
    • transactions: Array of ITransaction that are loaded

    transactions is possibly an empty array when no transactions are provided. TransactionPackage.load will check if data is provided in the buffer. Within the TransactionPackage constructor, an empty transactions array is created when no transactions are provided