The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as Domain from "@alchemy.run/domain"; |
| 2 | import { AccountId } from "../Account/Account.id.ts"; |
| 3 | import { NotPermitted } from "../Account/ChangeOwner.command.ts"; |
| 4 | import { Actor } from "../Actor.ts"; |
| 5 | import { Cents } from "../Money.ts"; |
| 6 | import { Session } from "../Session.middleware.ts"; |
| 7 | import { TransferId } from "./Transfer.id.ts"; |
| 8 | |
| 9 | /** The transfer is not waiting for approval: it never needed it, or it expired. */ |
| 10 | export class NotAwaitingApproval extends Domain.Rejection("NotAwaitingApproval") {} |
| 11 | |
| 12 | /** Carries the transfer so `TransferExecution` can carry it out. */ |
| 13 | export class TransferApproved extends Domain.Event("TransferApproved", { |
| 14 | transferId: TransferId, |
| 15 | from: AccountId, |
| 16 | to: AccountId, |
| 17 | amount: Cents, |
| 18 | requestedBy: Actor, |
| 19 | approvedBy: Actor, |
| 20 | }) {} |
| 21 | |
| 22 | /** A support agent approves a large transfer before its approval window closes. */ |
| 23 | export class ApproveTransfer extends Domain.Command("ApproveTransfer", { |
| 24 | target: TransferId, |
| 25 | middleware: [Session], |
| 26 | events: [TransferApproved], |
| 27 | rejects: [NotAwaitingApproval, NotPermitted], |
| 28 | }) {} |