Skip to content

Packages  ›  trotsky  ›  Step

Step class

Represents an abstract step in a sequence managed by the Trotsky framework.

Signature:

typescript
export declare abstract class Step<P = StepBuilder, C = unknown, O = unknown> extends StepBuilder

Extends: StepBuilder

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent)

Constructs a new instance of the Step class

Properties

Property

Modifiers

Type

Description

context

C

Retrieves or sets the current context.

isStepBuilderListEntry

readonly

boolean

Checks if this instance is part of a StepBuilderList.

isStepWhen

readonly

boolean

output

O | null

Retrieves or sets the current output.

Methods

Method

Modifiers

Description

apply()

abstract

Abstract method that must be implemented by subclasses to define the behavior of the step.

back()

Retrieves the parent object of this instance.

clone(rest)

Clones the current step and returns a new instance with the same parameters.

config(key)

Retreive the configuration value for a given key on the current step or inherite the value from the parent step.

config(key, value)

Updates the configuration value for a given key on the current step.

config(config)

Updates the configuration object on the current step.

end()

Ends the sequence of steps.

runHere()

Runs all steps in the sequence and returns the current Step instance.

save(path)

Adds a StepSave step.

tap(interceptor)

Adds a StepTap step.

wait(duration)

Adds a StepWait step.

when(predicate)

Adds a StepWhen step.

withContext(context)

Sets the context.

withOutput(output)

Sets the output.

withParent(parent)

Sets the parent.