Tide · API

tide.preview

tide.preview performs a dry run of one reflex: it executes the real selection and evaluates every template, but runs no effect and writes no rows. An effect handler may define its own preview, which receives the input and returns a rendering of it; that value appears as render on each unit of the report.

Reflex
{
  id: 'seats.tonight',
  intent: 'At noon, tell each member with seats tonight how many they have.',
  on: {
    clock: { every: 'day', at: '12:00', tz: 'Europe/Vienna' },
  },
  select: {
    query: {
      table: 'bookings',
      night: { $ref: '$.occurrence.key' },
    },
    mode: 'each',
    unitKey: 'member',
  },
  effect: {
    name: 'mail.send',
    input: {
      to: { $ref: '$.row.member' },
      seats: { $ref: '$.row.seats' },
    },
  },
}
Call
await tide.preview('seats.tonight', { now }) // now: 2026-10-24 12:00 in Vienna
Report and side-effect counts
{
  fired: true,
  occurrence: '2026-10-24',
  selected: 3,
  units: [
    {
      unit: 'ada',
      input: { to: 'ada', seats: 1 },
      render: 'To Ada: seats tonight, 1.',
    },
    {
      unit: 'grace',
      input: { to: 'grace', seats: 2 },
      render: 'To Grace: seats tonight, 2.',
    },
    {
      unit: 'linus',
      input: { to: 'linus', seats: 4 },
      render: 'To Linus: seats tonight, 4.',
    },
  ],
  mailsSent: 0,
  rowsWritten: 0,
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.