Skip to content

basalt / activity/src / ActivityRule

Interface: ActivityRule<K> ​

Defined in: activity/src/index.ts:122

Records a feed line from a domain event.

The same shape @basaltkit/search uses for syncRule and @basaltkit/realtime for bridgeRule, and for the same reason: the domain emits, this package listens, and neither knows the other. Without it the natural answer to "record this" is to call activity from inside the service, which couples the domain to the package the other two teach you to keep at arm's length.

Type Parameters ​

K ​

K extends keyof BasaltHooks & string = keyof BasaltHooks & string

Properties ​

causer? ​

> optional causer?: (payload) => string | undefined

Defined in: activity/src/index.ts:133

Who did it. Defaults to ctx().user.id.

Parameters ​

payload ​

BasaltHooks[K]

Returns ​

string | undefined


description ​

> description: (payload) => string | null

Defined in: activity/src/index.ts:129

The line itself. Return null to record nothing for this event.

Parameters ​

payload ​

BasaltHooks[K]

Returns ​

string | null


hook ​

> hook: K

Defined in: activity/src/index.ts:123


log? ​

> optional log?: string

Defined in: activity/src/index.ts:125

Which log the line belongs to. Default: 'default'.


properties? ​

> optional properties?: (payload) => Record<string, unknown> | undefined

Defined in: activity/src/index.ts:131

Structured detail alongside the prose.

Parameters ​

payload ​

BasaltHooks[K]

Returns ​

Record<string, unknown> | undefined


subject? ​

> optional subject?: (payload) => { id: string; type: string; } | null

Defined in: activity/src/index.ts:127

What the line is about.

Parameters ​

payload ​

BasaltHooks[K]

Returns ​

{ id: string; type: string; } | null

Released under the MIT License.