Demo mode and seed data generation.

Demo mode replaces real PII with sample data for safe previewing. Seeds populate the database with realistic test listings 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 listings 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
demoBanner

Demo mode banner HTML, built on demand.

f
isDemoMode

Check if demo mode is enabled

f
loadAfterDemoOverrides

Apply demo-mode overrides to the form, then run the loader — the shared prelude of the attendee submit handlers, which 404 when the loader finds nothing (a stale id racing a delete).

f
randomChoice

Pick a random element from an array

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_EMAILS

Demo email addresses

v
DEMO_GROUP_DESCRIPTIONS

Demo group descriptions

v
DEMO_GROUP_NAMES

Demo group names

v
DEMO_HOLIDAY_NAMES

Demo holiday names

v
DEMO_LISTING_DESCRIPTIONS

Demo listing 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.

v
DEMO_LISTING_LOCATIONS

Demo listing locations — pretend rock-venue / festival listings. Procedurally generated from the venue word pools using a seeded PRNG.

v
DEMO_LISTING_NAMES

Demo listing 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.

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_SERVICING_NAMES

Demo servicing-event names (a reason/job for a capacity hold, not a person)

v
DEMO_SPECIAL_INSTRUCTIONS

Demo special instructions

v
DEMO_TERMS

Demo terms and conditions

v
DEMO_WEBSITE_TITLES

Demo website titles

v
GROUP_DEMO_FIELDS

Group name and description fields

v
HOLIDAY_DEMO_FIELDS

Holiday name field

v
LISTING_DEMO_FIELDS

Listing metadata fields

v
LOGISTICS_DEMO_FIELDS

Attendee Logistics tab fields: the address is masked like the attendee form's, and the pinned latitude/longitude are cleared outright — an exact real-world location is PII even beside a masked address.

v
SEED_MAX_ATTENDEES

Max attendees per seeded listing

v
SERVICING_DEMO_FIELDS

Servicing-event fields — name only, and a servicing reason rather than a person's name, so demo mode doesn't turn "Boiler Service" into "Bob Smith".

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