import { defineAction } from "automate.ax"
import { z } from "zod"
const recordProtectedToken = defineAction("Record protected token")
.input(z.object({ itemId: z.string() }))
.retry({ replaySafety: "safe" })
.handler(async ({ input, runtime }) => {
const token = crypto.randomUUID()
await runtime.sendOutput(
{
data: { itemId: input.itemId, token },
type: "issued-token",
},
{ sensitive: { token: true } },
)
await runtime.log({
fields: { itemId: input.itemId, token },
level: "info",
message: `Issued ${token}`,
sensitive: { fields: { token: true }, message: true },
})
})