MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / buildSession

Function buildSession

scripts/seed-events.mjs:464–476  ·  view source on GitHub ↗
(sessionIndex)

Source from the content-addressed store, hash-verified

462// ---------------------------------------------------------------------------
463
464function buildSession(sessionIndex) {
465 const sessionRng = mulberry32(sessionIndex * 9973 + 1337); // deterministic per session
466
467 const identity = generateIdentity(sessionIndex, sessionRng);
468 const group = getGroupForSession(sessionIndex);
469 const ua = makeUniqueUA(pick(USER_AGENTS, sessionRng), sessionIndex);
470 const ip = makeIP(sessionIndex);
471 const product = pick(PRODUCTS, sessionRng);
472 const scenarioFn = SCENARIOS[sessionIndex % SCENARIOS.length];
473 const events = scenarioFn(product);
474
475 return { identity, group, ua, ip, events };
476}
477
478// ---------------------------------------------------------------------------
479// Schedule events across timeline

Callers 1

mainFunction · 0.70

Calls 6

mulberry32Function · 0.85
generateIdentityFunction · 0.85
getGroupForSessionFunction · 0.85
makeUniqueUAFunction · 0.85
makeIPFunction · 0.85
pickFunction · 0.70

Tested by

no test coverage detected