flattenInstructionPlan
Retrieves all individual SingleInstructionPlan and MessagePackerInstructionPlan instances from an instruction plan tree.
This function recursively traverses any nested structure of instruction plans and extracts all the leaf plans they contain. It's useful when you need to access all the individual instructions or message packers that will be executed, regardless of their organization in the plan tree (parallel or sequential).
Parameters
| Parameter | Type | Description |
|---|---|---|
instructionPlan | InstructionPlan | The instruction plan to extract leaf plans from |
Returns
(
| Readonly<{
getMessagePacker: () => MessagePacker;
kind: "messagePacker";
planType: "instructionPlan";
}>
| Readonly<{
instruction: Instruction;
kind: "single";
planType: "instructionPlan";
}>)[]
An array of all single and message packer instruction plans contained in the tree