/** * The `password_reset_tokens` table: its row type and its guard. * * @module */ import type { SQLOutputValue } from "node:sqlite"; /** A row of the `password_reset_tokens` table. */ export interface PasswordResetTokenRow { /** The reset token. */ token: string; /** The id of the user whose password it resets. */ user_id: string; /** When the token stops working. */ expires_at: string; /** When the token was used; null while unused. */ used_at: string | null; /** Any other column the query selects. */ [key: string]: SQLOutputValue; } /** Checks whether `obj` is a {@link PasswordResetTokenRow}. */ export function isPasswordResetTokenRow( obj: unknown, ): obj is PasswordResetTokenRow { return !!obj && typeof obj === "object" && "token" in obj && typeof obj.token === "string" && "user_id" in obj && typeof obj.user_id === "string" && "expires_at" in obj && typeof obj.expires_at === "string" && "used_at" in obj && (obj.used_at === null || typeof obj.used_at === "string"); }