Demo mode and seed data generation.
Demo mode replaces real PII with sample data for safe previewing. Seeds populate the database with realistic test events and attendees.
Replace form field values with demo data when demo mode is active. Only replaces fields that are present and non-empty in the form. Mutates and returns the same URLSearchParams for chaining.
Create seed events and attendees using efficient batch writes. Encrypts all data before inserting, matching production behavior. Assigns random ticket quantities (1-4) per attendee without overselling.
Check if demo mode is enabled
Pick a random element from an array
Reset cached demo mode value (for testing and cache invalidation)
Explicitly set demo mode on or off (for testing). Bypasses Deno.env to avoid races between parallel test workers.
Wrap a named resource so create/update apply demo overrides to the form
Maps form field names to arrays of possible demo values
Result of a seed operation
Attendee PII fields
Demo event descriptions — rock-themed gig blurbs assembled from word pools. Like the names above, the list is procedurally generated but seeded so it stays deterministic across runs.
Demo event locations — pretend rock-venue / festival listings. Procedurally generated from the venue word pools using a seeded PRNG.
Demo event names — pretend rock/heavy-metal band listings. Generated procedurally from a seeded PRNG so the list stays deterministic across runs (tests rely on this) but offers far more variety than a hand-curated list while staying on-theme.
Event metadata fields
Group name and description fields
Holiday name field
Max attendees per seeded event
Site contact page fields
Site homepage fields
Terms and conditions field
Usage
import * as mod from "docs/demo.ts";