Skip to content

Activity & ACTIVITY

ACTIVITY is the frozen enum of execution mode flags you pass to .do(). Activity is the internal class that wraps each step’s definition — you rarely construct one directly, but it’s exported for completeness.

import {Activity, ACTIVITY} from "@gesslar/actioneer"

A frozen object mapping mode names to numeric flags:

ACTIVITY = Object.freeze({
WHILE: 1,
UNTIL: 2,
SPLIT: 3,
IF: 4,
BREAK: 5,
CONTINUE: 6,
})
FlagMeaning.do() signature
ACTIVITY.WHILELoop while predicate is true (checked before).do(name, ACTIVITY.WHILE, predicate, operation)
ACTIVITY.UNTILLoop until predicate is true (checked after).do(name, ACTIVITY.UNTIL, predicate, operation)
ACTIVITY.SPLITParallel split/rejoin.do(name, ACTIVITY.SPLIT, splitter, rejoiner, operation)
ACTIVITY.IFRun once if predicate is true.do(name, ACTIVITY.IF, predicate, operation)
ACTIVITY.BREAKExit enclosing loop.do(name, ACTIVITY.BREAK, predicate)
ACTIVITY.CONTINUESkip to next loop iteration.do(name, ACTIVITY.CONTINUE, predicate)

The default mode (run once) uses no flag at all: .do(name, operation).

For full explanations and examples, see Activity Modes and Control Flow.

RoleSignatureNotes
operation(context) => unknown | Promise<unknown>The work; may also be a nested ActionBuilder.
predicate(context) => boolean | Promise<boolean>Must return a boolean.
splitter(context) => Array<unknown>Returns one context per parallel task.
rejoiner(originalContext, settledResults) => unknownReceives Promise.allSettled() output.

The Activity class is the internal wrapper that holds a single step’s definition — its name, mode (kind), operation, predicate, and (for SPLIT) the splitter and rejoiner. It’s created for you by ActionBuilder when you call .do(); you don’t normally instantiate it yourself.

It’s exported mainly so the type is available for advanced or introspective use. For everyday pipelines, work through the builder.