(filters: Record<string, any>, options?: QueryOptions)
| 261 | } |
| 262 | |
| 263 | function parseFilters(filters: Record<string, any>, options?: QueryOptions) { |
| 264 | const joinSession = Object.keys(filters).find(key => { |
| 265 | const baseName = key.replace(/\d+$/, ''); |
| 266 | return ['referrer', ...SESSION_COLUMNS].includes(baseName); |
| 267 | }); |
| 268 | |
| 269 | const cohortFilters = Object.fromEntries( |
| 270 | Object.entries(filters).filter(([key]) => key.startsWith('cohort_')), |
| 271 | ); |
| 272 | |
| 273 | return { |
| 274 | joinSessionQuery: |
| 275 | options?.joinSession || joinSession |
| 276 | ? `inner join session on website_event.session_id = session.session_id and website_event.website_id = session.website_id` |
| 277 | : '', |
| 278 | dateQuery: getDateQuery(filters), |
| 279 | filterQuery: getFilterQuery(filters, options), |
| 280 | queryParams: getQueryParams(filters), |
| 281 | cohortQuery: getCohortQuery(cohortFilters), |
| 282 | excludeBounceQuery: getExcludeBounceQuery(filters), |
| 283 | }; |
| 284 | } |
| 285 | |
| 286 | function getPropertyFilterQuery( |
| 287 | filters: PropertyFilter[] = [], |
no test coverage detected