Skip to main content
Version: Current

IAct

@rotorsoft/act-root


@rotorsoft/act-root / act/src / IAct

Interface: IAct<TEvents, TActions, TActor, TSchemaReg>

Defined in: libs/act/src/types/action.ts:1110

The reaction-scoped application surface โ€” what reaction handlers receive as their third argument, and the minimal contract host integrations can depend on.

Type Parametersโ€‹

TEventsโ€‹

TEvents extends Schemas = Schemas

Event schemas

TActionsโ€‹

TActions extends Schemas = Schemas

Action schemas

TActorโ€‹

TActor extends Actor = Actor

Actor type extending base Actor

TSchemaRegโ€‹

TSchemaReg extends SchemaRegister<TActions> = SchemaRegister<TActions>

Map of action name โ†’ target state schema, threaded by Act so do returns snapshots typed to the action's state. The default collapses to Schema per action, so annotations written as IAct<TEvents, TActions> keep compiling unchanged.

Methodsโ€‹

do()โ€‹

do<TKey>(action, target, payload, options?): Promise<Snapshot<TSchemaReg[TKey], TEvents>[]>

Defined in: libs/act/src/types/action.ts:1116

Type Parametersโ€‹

TKeyโ€‹

TKey extends string

Parametersโ€‹

actionโ€‹

TKey

targetโ€‹

Target<TActor>

payloadโ€‹

Readonly<TActions[TKey]>

options?โ€‹

DoOptions<TEvents>

Returnsโ€‹

Promise<Snapshot<TSchemaReg[TKey], TEvents>[]>


forget()โ€‹

forget(stream): Promise<{ eventCount: number; }>

Defined in: libs/act/src/types/action.ts:1190

Wipe the sensitive-data payload for every event on the stream โ€” the application-level half of the sensitive-data epic (#566). Delegates to the Store's forget_pii(stream), invalidates the cache entry for the stream, then emits the forgotten lifecycle event.

Throws at build time if the configured Store does not implement forget_pii (its adapter declares pii_isolation: false or omits the method) โ€” operators get a clear "your adapter can't comply with GDPR erasure" signal before the production callsite is exercised.

Idempotent: a second call on an already-wiped stream returns eventCount: 0 and does NOT re-emit forgotten.

Parametersโ€‹

streamโ€‹

string

Target stream to wipe.

Returnsโ€‹

Promise<{ eventCount: number; }>

Count of events whose PII column was set to NULL.


load()โ€‹

Call Signatureโ€‹

load<S>(state, stream, callback?, asOf?): Promise<Snapshot<S, TEvents>>

Defined in: libs/act/src/types/action.ts:1139

Load a state snapshot for a stream. Two shapes:

Anonymous (bare stream) โ€” load(state, stream, callback?, asOf?). The framework default-denies on every PII gate: sensitive event fields come back as [REDACTED], state fields whose names match sensitive event fields are also [REDACTED]. Use this when the caller has no authorization context (background workers, observability probes, etc.).

Auth-aware (LoadTarget) โ€” load(state, {stream, actor, asOf?}, callback?). Symmetric with IAct.do(state, target, payload). The read runs the state's .discloses(predicate) against the supplied actor; sensitive fields come back as plaintext when the predicate returns true, [REDACTED] otherwise. Forgotten events return [SHREDDED] regardless of actor (data is gone, no auth question).

Type Parametersโ€‹
Sโ€‹

S extends Schema

Parametersโ€‹
stateโ€‹

State<S, any, any>

streamโ€‹

string

callback?โ€‹

(snapshot) => void

asOf?โ€‹

AsOf

Returnsโ€‹

Promise<Snapshot<S, TEvents>>

Call Signatureโ€‹

load<S>(state, target, callback?): Promise<Snapshot<S, TEvents>>

Defined in: libs/act/src/types/action.ts:1145

Type Parametersโ€‹
Sโ€‹

S extends Schema

Parametersโ€‹
stateโ€‹

State<S, any, any>

targetโ€‹

LoadTarget<TActor>

callback?โ€‹

(snapshot) => void

Returnsโ€‹

Promise<Snapshot<S, TEvents>>

Call Signatureโ€‹

load(state, stream, callback?, asOf?): Promise<Snapshot<Schema, TEvents>>

Defined in: libs/act/src/types/action.ts:1150

Parametersโ€‹
stateโ€‹

string

streamโ€‹

string

callback?โ€‹

(snapshot) => void

asOf?โ€‹

AsOf

Returnsโ€‹

Promise<Snapshot<Schema, TEvents>>

Call Signatureโ€‹

load(state, target, callback?): Promise<Snapshot<Schema, TEvents>>

Defined in: libs/act/src/types/action.ts:1156

Parametersโ€‹
stateโ€‹

string

targetโ€‹

LoadTarget<TActor>

callback?โ€‹

(snapshot) => void

Returnsโ€‹

Promise<Snapshot<Schema, TEvents>>


query()โ€‹

query(query, callback?): Promise<{ count: number; first?: Committed<TEvents, keyof TEvents>; last?: Committed<TEvents, keyof TEvents>; }>

Defined in: libs/act/src/types/action.ts:1162

Parametersโ€‹

queryโ€‹

Query

callback?โ€‹

(event) => void

Returnsโ€‹

Promise<{ count: number; first?: Committed<TEvents, keyof TEvents>; last?: Committed<TEvents, keyof TEvents>; }>


query_array()โ€‹

query_array(query): Promise<Committed<TEvents, keyof TEvents>[]>

Defined in: libs/act/src/types/action.ts:1171

Parametersโ€‹

queryโ€‹

Query

Returnsโ€‹

Promise<Committed<TEvents, keyof TEvents>[]>