Open History to see the last commit
1import { z } from "zod";
2
3export const API_LATENCY_LOCALSTORAGE_KEY = "__TRYTANSTACKDB_API_DELAY_MS__";
4
5export const apiLatencyInMsSchema = z
6 .enum(["0", "1000", "2000", "5000"])
7 .transform((t) => parseInt(t, 10))
8 .default(1_000)
9 .catch(1_000);
10
11export type ApiLatency = z.infer<typeof apiLatencyInMsSchema>;
12
13export type ApiLatencyOption = {
14 label: string;
15 value: ApiLatency;
16 color: string;
17};
18
19export const apiLatencyOptions: ApiLatencyOption[] = [
20 { label: "No latency", value: 0, color: "green" },
21 { label: "1s", value: 1_000, color: "lime" },
22 { label: "2s", value: 2_000, color: "orange" },
23 { label: "5s", value: 5_000, color: "red" },
24];