1.1.0 • Published 3 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
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
1.0.0-beta.2
3 years ago
1.0.0-beta.1
3 years ago
1.0.0-beta.0
3 years ago