Lists
Define a read-only List to let the Sales role
browse web orders in the Dashboard. The output schema defines the
fields returned for each row, and query supplies the current page.
Example
Section titled “Example”import { List, Organisation, Role } from "@pf/process"import { Effect, Schema } from "effect"
export const org = new Organisation({ name: "Demo Store" })const sales = new Role(org, "Sales")
const orders = [ { id: "ORD-101", sku: "ABC-123", quantity: 2 }, { id: "ORD-102", sku: "XYZ-456", quantity: 1 },]
new List(org, "web-orders", { name: "Web orders", purpose: "Browse submitted web orders", roles: [sales], output: { id: Schema.String.annotate({ title: "Order ID" }), sku: Schema.String.annotate({ title: "SKU" }), quantity: Schema.Number.annotate({ title: "Quantity" }), }, query: ({ page, limit }) => { const offset = (page - 1) * limit return Effect.succeed({ items: orders.slice(offset, offset + limit), totalCount: orders.length, }) },})Page numbers start at 1. Return only the requested page in items and
the number of matching records across all pages in totalCount. This
example uses fixed sample data. For a live List, replace the array with a
query against your organisation’s data.