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.

Functions

f
applyDemoOverrides

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.

f
createSeeds

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.

f
isDemoMode

Check if demo mode is enabled

f
randomChoice

Pick a random element from an array

f
randomName

Generate a random full name from first name + surname arrays

f
resetDemoMode

Reset cached demo mode value (for testing and cache invalidation)

f
setDemoModeForTest

Explicitly set demo mode on or off (for testing). Bypasses Deno.env to avoid races between parallel test workers.

f
wrapResourceForDemo

Wrap a named resource so create/update apply demo overrides to the form

Type Aliases

T
DemoFieldMap

Maps form field names to arrays of possible demo values

T
SeedResult

Result of a seed operation

Variables

v
ATTENDEE_DEMO_FIELDS

Attendee PII fields

v
DEMO_ADDRESSES

Demo addresses

v
DEMO_BANNER

Demo mode banner HTML

v
DEMO_EMAILS

Demo email addresses

v
DEMO_EVENT_DESCRIPTIONS

Demo event descriptions

v
DEMO_EVENT_LOCATIONS

Demo event locations

v
DEMO_EVENT_NAMES

Demo event names

v
DEMO_FIRST_NAMES

Demo first names for seed data (combined with surnames for more variety)

v
DEMO_GROUP_NAMES

Demo group names

v
DEMO_HOLIDAY_NAMES

Demo holiday names

v
DEMO_NAMES

Demo attendee names (full names for demo mode overrides)

v
DEMO_PAGE_TEXT

Demo page text (homepage / contact)

v
DEMO_PHONES

Demo phone numbers (UK format)

v
DEMO_SPECIAL_INSTRUCTIONS

Demo special instructions

v
DEMO_SURNAMES

Demo surnames for seed data (combined with first names for more variety)

v
DEMO_TERMS

Demo terms and conditions

v
DEMO_WEBSITE_TITLES

Demo website titles

v
EVENT_DEMO_FIELDS

Event metadata fields

v
GROUP_DEMO_FIELDS

Group name field

v
HOLIDAY_DEMO_FIELDS

Holiday name field

v
SEED_MAX_ATTENDEES

Max attendees per seeded event

v
SITE_CONTACT_DEMO_FIELDS

Site contact page fields

v
SITE_HOME_DEMO_FIELDS

Site homepage fields

v
TERMS_DEMO_FIELDS

Terms and conditions field