1.1.0 • Published 4 years ago
cmdo-commands v1.1.0
CMDO Commander
import { Aggregate, commands, Event, events } from "cmdo-commands";
type Account = Aggregate & {
name: string;
email: string;
password: string;
};
commands.set<Account, { name: string; email: string; password: string }>({
type: "CreateAccount",
genesis: true,
reserve: ["email"],
async handler({ name, email, password }, { auditor }) {
this.apply(
new FooCreated(
{
name,
email,
password
},
{
auditor
}
)
);
}
});
class FooCreated extends Event<Account, { name: string; email: string; password: string }> {
public fold(state: Account): Account {
return {
...state,
name: this.data.name,
email: this.data.email,
password: this.data.password
};
}
}
events.set("AccountCreated", FooCreated);
1.1.0
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
5 years ago
1.0.0-beta.2
5 years ago
1.0.0-beta.1
5 years ago
1.0.0-beta.0
5 years ago