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
Generate a random full name from first name + surname arrays
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
Attendee PII fields
Demo addresses
Demo email addresses
Demo event descriptions
Demo event locations
Demo event names
Demo first names for seed data (combined with surnames for more variety)
Demo group names
Demo holiday names
Demo attendee names (full names for demo mode overrides)
Demo page text (homepage / contact)
Demo phone numbers (UK format)
Demo special instructions
Demo surnames for seed data (combined with first names for more variety)
Demo terms and conditions
Demo website titles
Event metadata fields
Group name field
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";