import { TransactionFlow, TransactionHandlerType, TransactionState } from ".";
/**
 * @typedef {Object} TransactionMetadata
 * @property {string} producer - The id of the producer that created the transaction (transactionModelId).
 * @property {string} reply_to_topic - The topic to reply to for the transaction.
 * @property {string} idempotency_key - The idempotency key of the transaction.
 * @property {string} action - The action of the transaction.
 * @property {TransactionHandlerType} action_type - The type of the transaction.
 * @property {number} attempt - The number of attempts for the transaction.
 * @property {number} timestamp - The timestamp of the transaction.
 */
export declare type TransactionMetadata = {
    producer: string;
    reply_to_topic: string;
    idempotency_key: string;
    action: string;
    action_type: TransactionHandlerType;
    attempt: number;
    timestamp: number;
};
export declare class TransactionPayload {
    metadata: TransactionMetadata;
    data: Record<string, unknown> & {
        _response: Record<string, unknown>;
    };
    /**
     * @param metadata - The metadata of the transaction.
     * @param data - The payload data of the transaction and the response of the previous step if forwardResponse is true.
     */
    constructor(metadata: TransactionMetadata, data: Record<string, unknown> & {
        _response: Record<string, unknown>;
    });
}
/**
 * DistributedTransaction represents a distributed transaction, which is a transaction that is composed of multiple steps that are executed in a specific order.
 */
export declare class DistributedTransaction {
    private flow;
    handler: (actionId: string, handlerType: TransactionHandlerType, payload: TransactionPayload) => Promise<unknown>;
    payload?: any;
    modelId: string;
    transactionId: string;
    errors: {
        action: string;
        handlerType: TransactionHandlerType;
        error: Error | null;
    }[];
    constructor(flow: TransactionFlow, handler: (actionId: string, handlerType: TransactionHandlerType, payload: TransactionPayload) => Promise<unknown>, payload?: any);
    getFlow(): TransactionFlow;
    addError(action: string, handlerType: TransactionHandlerType, error: Error | null): void;
    hasFinished(): boolean;
    getState(): TransactionState;
    get isPartiallyCompleted(): boolean;
    canInvoke(): boolean;
    canRevert(): boolean;
    static keyValueStore: any;
    private static keyPrefix;
    saveCheckpoint(): Promise<void>;
    static loadTransactionFlow(transactionId: string): Promise<TransactionFlow | null>;
    deleteCheckpoint(): Promise<void>;
}
