Skip to main content

IAct

@rotorsoft/act-root


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

Interface: IAct<TEvents, TActions, TActor>

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

Type Parametersโ€‹

TEventsโ€‹

TEvents extends Schemas = Schemas

TActionsโ€‹

TActions extends Schemas = Schemas

TActorโ€‹

TActor extends Actor = Actor

Methodsโ€‹

do()โ€‹

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

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

Type Parametersโ€‹

TKeyโ€‹

TKey extends string

Parametersโ€‹

actionโ€‹

TKey

targetโ€‹

Target<TActor>

payloadโ€‹

Readonly<TActions[TKey]>

options?โ€‹

DoOptions<TEvents>

Returnsโ€‹

Promise<Snapshot<any, any>[]>


forget()โ€‹

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

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

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(state, stream, callback?, asOf?): Promise<Snapshot<any, any>>

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

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).

Parametersโ€‹
stateโ€‹

string | State<any, any, any, string>

streamโ€‹

string

callback?โ€‹

(snapshot) => void

asOf?โ€‹

AsOf

Returnsโ€‹

Promise<Snapshot<any, any>>

Call Signatureโ€‹

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

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

Parametersโ€‹
stateโ€‹

string | State<any, any, any, string>

targetโ€‹

LoadTarget<TActor>

callback?โ€‹

(snapshot) => void

Returnsโ€‹

Promise<Snapshot<any, any>>


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:1066

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:1075

Parametersโ€‹

queryโ€‹

Query

Returnsโ€‹

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