import type { AppContext } from '@voltro/runtime' import { rowHistory } from '@voltro/plugin-row-history' const execute = async (input: { id: string }, ctx: AppContext) => { const rows = await rowHistory(ctx.store, 'documents', input.id, ctx.request.subject.tenantId) return rows.map((r) => ({ version: r.version, op: r.op, title: (r.data?.['title'] as string | undefined) ?? null, content: (r.data?.['content'] as string | undefined) ?? null, changedAt: r.changedAt, })) } export default execute