Choices
Turn what people type into choices from your options, for filters, search, and command palettes.
server/utils/forecast-choices.ts
import { defineChoices, toOptions } from 'vite-hub/choices'
import { typesafe } from 'vite-hub/gateways'
// Bridge in: your data becomes options
export const forecast = defineChoices({
gateway: typesafe(), // reads TYPESAFE_API_KEY
groups: {
supplier: {
label: 'Supplier',
options: toOptions(suppliers, {
value: s => s.id,
label: s => s.name,
}),
},
},
})