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

Function buildEvent

test/fixtures.ts:89–131  ·  view source on GitHub ↗
(
  now: Date,
  projectId: string,
  id: string,
  name: string,
  profileId: string,
  sessionId: string,
  daysBack: number,
  minutesOffset = 0,
  overrides: Record<string, unknown> = {}
)

Source from the content-addressed store, hash-verified

87}
88
89function buildEvent(
90 now: Date,
91 projectId: string,
92 id: string,
93 name: string,
94 profileId: string,
95 sessionId: string,
96 daysBack: number,
97 minutesOffset = 0,
98 overrides: Record<string, unknown> = {}
99) {
100 return {
101 id,
102 project_id: projectId,
103 profile_id: profileId,
104 name,
105 session_id: sessionId,
106 device_id: `dev-${profileId.replace('profile-', '')}`,
107 created_at: timeAgo(now, daysBack, minutesOffset),
108 path: '/',
109 origin: 'https://example.com',
110 referrer: '',
111 referrer_name: '',
112 referrer_type: '',
113 revenue: 0,
114 duration: 0,
115 properties: {},
116 groups: [],
117 country: 'US',
118 city: '',
119 region: '',
120 sdk_name: 'web',
121 sdk_version: '1.0.0',
122 os: '',
123 os_version: '',
124 browser: 'Chrome',
125 browser_version: '',
126 device: 'desktop',
127 brand: '',
128 model: '',
129 ...overrides,
130 };
131}
132
133function buildSession(
134 now: Date,

Callers 1

insertFixturesFunction · 0.70

Calls 2

replaceMethod · 0.80
timeAgoFunction · 0.70

Tested by

no test coverage detected