Skip to content

Welshman Docs / @welshman/app / Domain

Class: Domain ​

Defined in: plugins/domain.ts:19

Binds the app's dependencies to @welshman/domain kinds.

Constructors ​

Constructor ​

new Domain(app): Domain

Defined in: plugins/domain.ts:20

Parameters ​

app ​

IApp

Returns ​

Domain

Properties ​

app ​

readonly app: IApp

Defined in: plugins/domain.ts:20

Methods ​

command() ​

command(writer): Promise<Command>

Defined in: plugins/domain.ts:71

Parameters ​

writer ​

EventWriter<any>

Returns ​

Promise<Command>


configure() ​

configure<R, W, Q>(factory): ConfiguredKind<R, W, Q>

Defined in: plugins/domain.ts:27

Type Parameters ​

R ​

R extends BaseEventReader

W ​

W extends EventWriter<R>

Q ​

Q extends EventQuery

Parameters ​

factory ​

KindFactory<R, W, Q>

Returns ​

ConfiguredKind<R, W, Q>


query() ​

query<R, W, Q>(factory): Q

Defined in: plugins/domain.ts:67

Type Parameters ​

R ​

R extends BaseEventReader

W ​

W extends EventWriter<R>

Q ​

Q extends EventQuery

Parameters ​

factory ​

KindFactory<R, W, Q>

Returns ​

Q


reader() ​

reader<R, W, Q>(factory): (event) => ReturnType<R["parse"]>

Defined in: plugins/domain.ts:54

Type Parameters ​

R ​

R extends BaseEventReader

W ​

W extends EventWriter<R>

Q ​

Q extends EventQuery

Parameters ​

factory ​

KindFactory<R, W, Q>

Returns ​

(event) => ReturnType<R["parse"]>


update() ​

update<R, W, Q>(factory, load, fn): Promise<Command>

Defined in: plugins/domain.ts:84

Edit the user's own event of a replaceable kind — a profile, a relay list, a mute list. load supplies the event being replaced, fn makes the edit, and the returned command publishes it.

Type Parameters ​

R ​

R extends BaseEventReader

W ​

W extends EventWriter<R>

Q ​

Q extends EventQuery

Parameters ​

factory ​

KindFactory<R, W, Q>

load ​

(pubkey) => Promise<Maybe<R>>

fn ​

(writer) => void

Returns ​

Promise<Command>


writer() ​

writer<R, W, Q>(factory, reader?): W

Defined in: plugins/domain.ts:60

Type Parameters ​

R ​

R extends BaseEventReader

W ​

W extends EventWriter<R>

Q ​

Q extends EventQuery

Parameters ​

factory ​

KindFactory<R, W, Q>

reader? ​

R

Returns ​

W