isSuccessfulTransactionPlanResult

function isSuccessfulTransactionPlanResult<
    TContext,
    TTransactionMessage,
>(
    plan,
): plan is SuccessfulTransactionPlanResult<
    TContext,
    TTransactionMessage
>;

Checks if the given transaction plan result is a SuccessfulTransactionPlanResult.

This function verifies that the entire transaction plan result tree contains only successful single transaction results. It recursively checks all nested results to ensure every SingleTransactionPlanResult has a 'successful' status.

Note: This is different from isSuccessfulSingleTransactionPlanResult which checks if a single result is successful. This function checks that the entire plan result tree (including all nested parallel/sequential structures) contains only successful transactions.

Type Parameters

Parameters

ParameterTypeDescription
planTransactionPlanResult<TContext, TTransactionMessage>The transaction plan result to check.

Returns

plan is SuccessfulTransactionPlanResult<TContext, TTransactionMessage>

true if all single transaction results in the tree are successful, false otherwise.

Example

const result: TransactionPlanResult = parallelTransactionPlanResult([
  successfulSingleTransactionPlanResultFromTransaction(messageA, transactionA),
  successfulSingleTransactionPlanResultFromTransaction(messageB, transactionB),
]);
 
if (isSuccessfulTransactionPlanResult(result)) {
  // All transactions were successful.
  result satisfies SuccessfulTransactionPlanResult;
}

See

On this page