Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
models_pagination
What it is
Shared infrastructure. Typesafe, generic cursor pagination and simple sort methods, shared by almost every list endpoint in the backend.
Start here
src/cursor.rs:Identify,Sortable,SortOn,Paginate/Paginated— the three traits an item/sort method must implement to be paginated, plus the opaque base64 cursor types.src/sort.rs: concrete sort methods (CreatedAt,Frecency,NotifiedAt,TouchedByMe,SimpleSortMethod); Soup extends position values in its own domain for numeric property sorts.src/collections.rs:CollectBy/CollectByIdshelpers.src/axum.rs(featureaxum):BidirectionalCursorextractor.
Scope
- Owns: the cursor encoding, sort trait contracts, and axum query extraction for paginated list endpoints.
- Not here: the actual query/sort implementation for a given entity — that
lives in the owning domain crate (e.g.
soup,messages).
Boundaries
- Depends on: nothing domain-specific — pure pagination machinery
(
base64,ordered-float, optionalaxum/model-error-response). - Used by: most list-returning crates —
ai_tools,calendar_events,call,channels,complete_graph,databases_sql,email,email_db_client,foreign_entity,github_pull_requests,graphql_activity,graphql_calendar,graphql_initiative,graphql_soup,macro_db_client,messages,model,model_notifications,models_email,models_soup,notification,notification_db_client,skills,soup,teams.
Recipes
- Add a new sort method:
src/sort.rs(implSortable/SortOn) → the caller'sIdentifyimpl for its item type → its list query.
Checks
cargo test -p models_pagination(SQLX_OFFLINEunset).
Related
- Rules:
.agents/rules/rust/architecture.md