# moveAndMergeNextAction

## Parameters

- actionToMove: (\`string\`)
- targetAction: (\`string\`)

## Returns

- steps: (\[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) Defines the structure and behavior of a single step within a transaction workflow.

  - depth: (\`number\`)

  - next: (\[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx) \\| \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)\[]) Defines the next step(s) to execute after this step. Can be a single step or an array of steps.

  - parent: (\`null\` \\| \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx))

  - uuid: (\`string\`) A unique identifier for the transaction step.
    This is set automatically when declaring a workflow with "createWorkflow"

  - action: (\`string\`) Specifies the action to be performed in this step.
    "name" is an alias for action when creating a workflow with "createWorkflow".

  - continueOnPermanentFailure: (\`boolean\`) Indicates whether the workflow should continue even if there is a permanent failure in this step.
    In case it is set to true, the the current step will be marked as TransactionStepState.PERMANENT\\\_FAILURE and the next steps will be executed.

  - skipOnPermanentFailure: (\`string\` \\| \`boolean\`) Indicates whether the workflow should skip all subsequent steps in case of a permanent failure in this step.
    In case it is set to true, the next steps of the workflow will not be executed and their status will be marked as TransactionStepState.SKIPPED\\\_FAILURE.
    In case it is a string, the next steps until the step name provided will be skipped and the workflow will be resumed from the step provided.

  - noCompensation: (\`boolean\`) If true, no compensation action will be triggered for this step in case of a failure.

  - maxRetries: (\`number\`) The maximum number of times this step should be retried in case of temporary failures.
    The default is 0 (no retries).

  - autoRetry: (\`boolean\`) If true, the step will be retried automatically in case of a temporary failure.
    The default is true.

  - retryInterval: (\`number\`) The interval (in seconds) between retry attempts after a temporary failure.
    The default is to retry immediately.

  - retryIntervalAwaiting: (\`number\`) The interval (in seconds) to retry a step even if its status is "TransactionStepStatus.WAITING".

  - maxAwaitingRetries: (\`number\`) The maximum number of times to retry a step even if its status is "TransactionStepStatus.WAITING".

  - timeout: (\`number\`) The maximum amount of time (in seconds) to wait for this step to complete.
    This is NOT an execution timeout, the step will always be executed and wait for its response.
    If the response is not received within the timeout set, it will be marked as "TransactionStepStatus.TIMEOUT" and the workflow will be reverted as soon as it receives the response.

  - async: (\`boolean\`) If true, the step is executed asynchronously. This means that the workflow will not wait for the response of this step.
    Async steps require to have their responses set using "setStepSuccess" or "setStepFailure", unless it is combined with "backgroundExecution: true".
    If combined with a timeout, and any response is not set within that interval, the step will be marked as "TransactionStepStatus.TIMEOUT" and the workflow will be reverted immediately.

  - nested: (\`boolean\`) It flags where the step contains a sub transaction inside itself.

  - backgroundExecution: (\`boolean\`) It applies to "async" steps only, allowing them to run in the background and automatically complete without external intervention.
    It is ideal for time-consuming tasks that will be complete after the execution, contrasting with standard "async" operations that require a response to be set in a later stage.

  - compensateAsync: (\`boolean\`) If true, the compensation function for this step is executed asynchronously. Which means, the response has to be set using "setStepSuccess" or "setStepFailure".

  - noWait: (\`boolean\`) If true, the workflow will not wait for their sibling steps to complete before moving to the next step.

  - saveResponse: (\`boolean\`) If true, the response of this step will be stored.
    Default is true.
- hasChanges\_: (\`boolean\`)
- hasChanges: (\`object\`)
- constructor: ((\`steps?\`: \[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)) => \[OrchestratorBuilder]\(../../../classes/workflows.OrchestratorBuilder/page.mdx))
- load: ((\`steps?\`: \[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)) => \`this\`)
- addAction: ((\`action\`: \`string\`, \`options?\`: Partial\&#60;\[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)\&#62;) => \`this\`)
- replaceAction: ((\`existingAction\`: \`string\`, \`action\`: \`string\`, \`options?\`: Partial\&#60;\[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)\&#62;) => \`this\`)
- insertActionBefore: ((\`existingAction\`: \`string\`, \`action\`: \`string\`, \`options?\`: Partial\&#60;\[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)\&#62;) => \`this\`)
- insertActionAfter: ((\`existingAction\`: \`string\`, \`action\`: \`string\`, \`options?\`: Partial\&#60;\[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)\&#62;) => \`this\`)
- appendTo: ((\`step\`: \`string\` \\| \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx), \`newStep\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) => \`this\`)
- appendAction: ((\`action\`: \`string\`, \`to\`: \`string\`, \`options?\`: Partial\&#60;\[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx)\&#62;) => \`this\`)
- move: ((\`actionToMove\`: \`string\`, \`targetAction\`: \`string\`, \`\_\_namedParameters?\`: \`\`\{ runInParallel?: boolean ; mergeNext?: boolean  }\`\`) => \[OrchestratorBuilder]\(../../../classes/workflows.OrchestratorBuilder/page.mdx))
- moveAction: ((\`actionToMove\`: \`string\`, \`targetAction\`: \`string\`) => \[OrchestratorBuilder]\(../../../classes/workflows.OrchestratorBuilder/page.mdx))
- moveAndMergeNextAction: ((\`actionToMove\`: \`string\`, \`targetAction\`: \`string\`) => \[OrchestratorBuilder]\(../../../classes/workflows.OrchestratorBuilder/page.mdx))
- mergeActions: ((\`where\`: \`string\`, ...\`actions\`: \`string\`\[]) => \`this\`)
- deleteAction: ((\`action\`: \`string\`, \`steps?\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) => \`this\`)
- pruneAction: ((\`action\`: \`string\`) => \`this\`)
- findStepByAction: ((\`action\`: \`string\`, \`step?\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) => \`undefined\` \\| \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx))
- findOrThrowStepByAction: ((\`action\`: \`string\`, \`steps?\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) => \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx))
- findParentStepByAction: ((\`action\`: \`string\`, \`step?\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) => \`undefined\` \\| \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx))
- findLastStep: ((\`steps?\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx)) => \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx))
- updateDepths: ((\`startingStep\`: \[InternalStep]\(../../../interfaces/workflows.InternalStep/page.mdx), \`parent\`: \`any\`, \`incr?\`: \`number\`, \`beginFrom?\`: \`number\`) => \`void\`)
- build: (() => \[TransactionStepsDefinition]\(../../../types/workflows.TransactionStepsDefinition/page.mdx))
