Open History to see the last commit
1import { MAX_WEBHOOK_DELIVERY_AGE_MINUTES } from "@t3tools/contracts";
2
3export const DEFAULT_WEBHOOK_PROMPT = "Handle this webhook:\n{{body}}";
4
5/** Blank means "no limit"; undefined means the input is not a valid limit, which blocks saving. */
6export function parseMaxDeliveryAge(value: string): number | null | undefined {
7 if (value.trim() === "") return null;
8 const minutes = Number(value.trim());
9 return Number.isInteger(minutes) && minutes > 0 && minutes <= MAX_WEBHOOK_DELIVERY_AGE_MINUTES
10 ? minutes
11 : undefined;
12}