SliceBuilder
@rotorsoft/act-root / act/src / SliceBuilder
Interface: SliceBuilder<TSchemaReg, TEvents, TActions, TStateMap, TActor, TLanes>
Defined in: libs/act/src/builders/slice-builder.ts:79
Fluent builder interface for composing functional slices.
Provides a chainable API for registering states and projections, and defining reactions scoped to the slice's own events.
Extendsโ
BuilderBase<SliceBuilder<TSchemaReg,TEvents,TActions,TStateMap,TActor,TLanes>,TEvents,TActions,TActor,TLanes>
Type Parametersโ
TSchemaRegโ
TSchemaReg extends SchemaRegister<TActions>
Schema register for states
TEventsโ
TEvents extends Schemas
Event schemas
TActionsโ
TActions extends Schemas
Action schemas
TStateMapโ
TStateMap extends Record<string, Schema> = { }
Map of state names to state schemas
TActorโ
Actor type extending base Actor
TLanesโ
TLanes extends string = typeof DEFAULT_LANE
Propertiesโ
buildโ
build: () =>
Slice<TSchemaReg,TEvents,TActions,TStateMap,TActor,TLanes>
Defined in: libs/act/src/builders/slice-builder.ts:133
Builds and returns the Slice data structure.
Returnsโ
Slice<TSchemaReg, TEvents, TActions, TStateMap, TActor, TLanes>
eventsโ
readonlyevents:EventRegister<TEvents>
Defined in: libs/act/src/builders/builder-base.ts:117
The registered event schemas and their reaction maps.
Inherited fromโ
BuilderBase.events
onโ
on: <
TKey>(event) =>ReactionOn<SliceBuilder<TSchemaReg,TEvents,TActions,TStateMap,TActor,TLanes>,TEvents,TActions,TActor,TLanes,TKey>
Defined in: libs/act/src/builders/builder-base.ts:113
Begins defining a reaction. Chain .do(...) to run immediately, or
.defer(when).do(...) to hold the reaction until a schedule is due
(#1091). .to(...) follows .do(...) in both cases and, for a deferred
reaction, routes it onto its own target so the hold doesn't stall the
stream's other reactions.
Type Parametersโ
TKeyโ
TKey extends string | number | symbol
Parametersโ
eventโ
TKey
Returnsโ
ReactionOn<SliceBuilder<TSchemaReg, TEvents, TActions, TStateMap, TActor, TLanes>, TEvents, TActions, TActor, TLanes, TKey>
Inherited fromโ
BuilderBase.on
withLaneโ
withLane: <
TConfig>(config) =>SliceBuilder<TSchemaReg,TEvents,TActions,TStateMap,TActor,TLanes|TConfig["name"]>
Defined in: libs/act/src/builders/slice-builder.ts:120
Declares a drain lane on this slice (ACT-1103). Merged into the
parent Act's lane set by act().withSlice(slice).
Type Parametersโ
TConfigโ
TConfig extends LaneConfig
Parametersโ
configโ
TConfig
Returnsโ
SliceBuilder<TSchemaReg, TEvents, TActions, TStateMap, TActor, TLanes | TConfig["name"]>
withProjectionโ
withProjection: <
TNewEvents>(projection) =>SliceBuilder
Defined in: libs/act/src/builders/builder-base.ts:101
Registers a standalone projection. Its events must be a subset of events
already registered via .withState() (or .withSlice() on the Act
builder); handlers keep their (event, stream) signature.
Type Parametersโ
TNewEventsโ
TNewEvents extends Schemas
Parametersโ
projectionโ
[Exclude<keyof TNewEvents, keyof TEvents>] extends [never] ? Projection<TNewEvents> : never
Returnsโ
SliceBuilder
Inherited fromโ
BuilderBase.withProjection
withStateโ
withState: <
TNewState,TNewEvents,TNewActions,TNewName>(state) =>SliceBuilder<TSchemaReg& { [K in string | number | symbol]: TNewState },TEvents&TNewEvents,TActions&TNewActions,TStateMap&{ [K in string]: TNewState },TActor,TLanes>
Defined in: libs/act/src/builders/slice-builder.ts:101
Registers a state definition with the slice.
Include every state whose actions your reaction handlers need to dispatch. Duplicate registrations (same state in multiple slices) are handled automatically at composition time.
Type Parametersโ
TNewStateโ
TNewState extends Schema
TNewEventsโ
TNewEvents extends Schemas
TNewActionsโ
TNewActions extends Schemas
TNewNameโ
TNewName extends string = string
Parametersโ
stateโ
State<TNewState, TNewEvents, TNewActions, TNewName>
Returnsโ
SliceBuilder<TSchemaReg & { [K in string | number | symbol]: TNewState }, TEvents & TNewEvents, TActions & TNewActions, TStateMap & { [K in string]: TNewState }, TActor, TLanes>