todo-contracts
oRPC contract for todo: the typed request/response surface todo-service implements and clients call against.
API
todoContract: the oRPC contract for todo procedures.createTodoInputSchema,deleteTodoResultSchema: request and result schemas.- Type:
TodoContractMeta(cache tags, rate limit, andintent, theWorkspaceIntenta caller's role must allow).
| File | Exports |
|---|---|
| todo.contract.ts | todoContract, createTodoInputSchema, deleteTodoResultSchema |
todoContract has four procedures over the portable Todo model (id, title, done, createdAt, ownerId, workspaceId). Every input carries workspaceId, and every procedure declares the intent its intent meta names (checked by createRequireIntent in todo-service).
list(GET /):{ workspaceId }in, the workspace's todos out. Intenttodo:read.create(POST /):{ title, workspaceId }in, the created todo out. Intenttodo:create.complete(POST /{id}/complete): marks a todo done. Intenttodo:complete.delete(DELETE /{id}): removes a todo. Intenttodo:delete; amembermay delete only their own todos (the handler enforces that).
create declares rateLimitContractError (429) and a per-IP rateLimit rule of 30 calls per minute. complete and delete also declare resourceNotFoundContractError for the missing-id case. This is the worked example referenced from CLAUDE.md's "adding an endpoint" recipe.
The named input/result schemas are registered by todo-service as reusable OpenAPI components;
portable entity schemas remain owned by todo-model.
Commands
pnpm nx run todo-contracts:typecheck # type-check the package