The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Domain from "@alchemy.run/domain"; |
| 2 | import * as Schema from "effect/Schema"; |
| 3 | import { NotYours } from "./NotYours.rejection.ts"; |
| 4 | import { Session } from "./Session.middleware.ts"; |
| 5 | import { UserId } from "./User.id.ts"; |
| 6 | |
| 7 | export class NoteWritten extends Domain.Event("NoteWritten", { |
| 8 | text: Schema.String, |
| 9 | author: Schema.String, |
| 10 | }) {} |
| 11 | |
| 12 | /** Write a note in your own notebook. */ |
| 13 | export class WriteNote extends Domain.Command("WriteNote", { |
| 14 | target: UserId, |
| 15 | middleware: [Session], |
| 16 | input: { text: Schema.NonEmptyString }, |
| 17 | events: [NoteWritten], |
| 18 | rejects: [NotYours], |
| 19 | }) {} |