import { Inviolet } from "@inviolet/sdk"
const inviolet = new Inviolet({ apiKey: process.env.INVIOLET_API_KEY! })
const decision = await inviolet.intent.evaluate({
userId: "user_2pX9...",
toolCall: {
name: "lookup_user_by_email",
arguments: { email: "alex@example.com" },
},
dataSourceId: "postgres_app_prod",
})
if (decision.outcome !== "allowed") return null
// Use decision.data_elements as the column allowlist for the actual SELECT
const columns = decision.data_elements.join(", ")
// SELECT ${columns} FROM users WHERE email = $1