Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fixed linting issues

Blue Mouse5695438299c2
diff --git a/src/analytics/analytics.controller.ts b/src/analytics/analytics.controller.ts
index eef068c38..5fa52a77d 100644
--- a/src/analytics/analytics.controller.ts
+++ b/src/analytics/analytics.controller.ts
@@ -285,7 +285,13 @@ export class AnalyticsController {
this.analyticsService.validateTimebucket(timeBucket)
const [filtersQuery, filtersParams, parsedFilters] =
this.analyticsService.getFiltersQuery(filters)
- const { groupFrom, groupTo } = this.analyticsService.getGroupFromTo(from, to, timeBucket, period, timezone)
+ const { groupFrom, groupTo } = this.analyticsService.getGroupFromTo(
+ from,
+ to,
+ timeBucket,
+ period,
+ timezone,
+ )
await this.analyticsService.checkProjectAccess(pid, uid)
let queryCustoms = `SELECT ev, count() FROM customEV WHERE pid = {pid:FixedString(12)} ${filtersQuery} AND created BETWEEN {groupFrom:String} AND {groupTo:String} GROUP BY ev`
@@ -394,7 +400,13 @@ export class AnalyticsController {
this.analyticsService.validateTimebucket(timeBucket)
const [filtersQuery, filtersParams] =
this.analyticsService.getFiltersQuery(filters)
- const { groupFrom, groupTo } = this.analyticsService.getGroupFromTo(from, to, timeBucket, period, timezone)
+ const { groupFrom, groupTo } = this.analyticsService.getGroupFromTo(
+ from,
+ to,
+ timeBucket,
+ period,
+ timezone,
+ )
await this.analyticsService.checkProjectAccess(pid, uid)
const subQuery = `FROM performance WHERE pid = {pid:FixedString(12)} ${filtersQuery} AND created BETWEEN {groupFrom:String} AND {groupTo:String}`
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index c17bad118..701f0dcb9 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -227,7 +227,7 @@ const generateParamsQuery = (
@Injectable()
export class AnalyticsService {
- constructor(private readonly projectService: ProjectService) { }
+ constructor(private readonly projectService: ProjectService) {}
async checkProjectAccess(pid: string, uid: string | null): Promise<void> {
if (!isSelfhosted) {
@@ -357,7 +357,13 @@ export class AnalyticsService {
return null
}
- getGroupFromTo(from: string, to: string, timeBucket: TimeBucketType, period: string, timezone: string): { groupFrom: string, groupTo: string } {
+ getGroupFromTo(
+ from: string,
+ to: string,
+ timeBucket: TimeBucketType,
+ period: string,
+ timezone: string,
+ ): { groupFrom: string; groupTo: string } {
let groupFrom
let groupTo
@@ -469,10 +475,18 @@ export class AnalyticsService {
return { nodes: [], links: [] }
}
- const nodes: IUserFlowNode[] = Array.from(new Set(results.map((row: any) => row.source)
- .concat(results.map((row: any) => row.target))))
- .map((node: any) => ({ id: node }))
- const links: IUserFlowLink[] = results.map((row: any) => ({ source: row.source, target: row.target, value: row.value }))
+ const nodes: IUserFlowNode[] = Array.from(
+ new Set(
+ results
+ .map((row: any) => row.source)
+ .concat(results.map((row: any) => row.target)),
+ ),
+ ).map((node: any) => ({ id: node }))
+ const links: IUserFlowLink[] = results.map((row: any) => ({
+ source: row.source,
+ target: row.target,
+ value: row.value,
+ }))
return { nodes, links }
}
@@ -562,8 +576,9 @@ export class AnalyticsService {
...params,
[colFilter]: filter,
}
- query += ` ${isExclusive ? 'AND NOT' : 'AND'
- } ${column}={${colFilter}:String}`
+ query += ` ${
+ isExclusive ? 'AND NOT' : 'AND'
+ } ${column}={${colFilter}:String}`
}
return [query, params, parsed]
@@ -801,9 +816,11 @@ export class AnalyticsService {
query += ' UNION ALL '
}
- query += `select ${i} index, count() from customEV where ${paramsData.params.ev_exclusive ? 'NOT' : ''
- } ev = {ev:String} AND pid = {pid:FixedString(12)} and created between '${xM[i]
- }' and '${xM[1 + i]}' ${filtersQuery}`
+ query += `select ${i} index, count() from customEV where ${
+ paramsData.params.ev_exclusive ? 'NOT' : ''
+ } ev = {ev:String} AND pid = {pid:FixedString(12)} and created between '${
+ xM[i]
+ }' and '${xM[1 + i]}' ${filtersQuery}`
}
// @ts-ignore
@@ -844,8 +861,9 @@ export class AnalyticsService {
query += ' UNION ALL '
}
- query += `select ${i} index, unique, count(), avg(sdur) from analytics where pid = {pid:FixedString(12)} and created between '${xM[i]
- }' and '${xM[1 + i]}' ${filtersQuery} group by unique`
+ query += `select ${i} index, unique, count(), avg(sdur) from analytics where pid = {pid:FixedString(12)} and created between '${
+ xM[i]
+ }' and '${xM[1 + i]}' ${filtersQuery} group by unique`
}
// @ts-ignore
@@ -987,8 +1005,9 @@ export class AnalyticsService {
query += ' UNION ALL '
}
- query += `select ${i} index, count() from captcha where pid = {pid:FixedString(12)} and created between '${xM[i]
- }' and '${xM[1 + i]}' ${filtersQuery}`
+ query += `select ${i} index, count() from captcha where pid = {pid:FixedString(12)} and created between '${
+ xM[i]
+ }' and '${xM[1 + i]}' ${filtersQuery}`
}
// @ts-ignore
@@ -1095,8 +1114,9 @@ export class AnalyticsService {
query += ' UNION ALL '
}
- query += `select ${i} index, avg(dns), avg(tls), avg(conn), avg(response), avg(render), avg(domLoad), avg(ttfb) from performance where pid = {pid:FixedString(12)} and created between '${xM[i]
- }' and '${xM[1 + i]}' ${filtersQuery} group by pid`
+ query += `select ${i} index, avg(dns), avg(tls), avg(conn), avg(response), avg(render), avg(domLoad), avg(ttfb) from performance where pid = {pid:FixedString(12)} and created between '${
+ xM[i]
+ }' and '${xM[1 + i]}' ${filtersQuery} group by pid`
}
// @ts-ignore
@@ -1229,8 +1249,9 @@ export class AnalyticsService {
query += ' UNION ALL '
}
- query += `select ${i} index, ev, count() from customEV where pid = {pid:FixedString(12)} and created between '${xM[i]
- }' and '${xM[1 + i]}' ${filtersQuery} group by pid, ev`
+ query += `select ${i} index, ev, count() from customEV where pid = {pid:FixedString(12)} and created between '${
+ xM[i]
+ }' and '${xM[1 + i]}' ${filtersQuery} group by pid, ev`
}
// @ts-ignore
diff --git a/src/common/constants.ts b/src/common/constants.ts
index 931311064..f3ff32107 100644
--- a/src/common/constants.ts
+++ b/src/common/constants.ts
@@ -2,7 +2,6 @@ import { ClickHouse } from 'clickhouse'
import Redis from 'ioredis'
import { hash } from 'blake3'
import * as _toNumber from 'lodash/toNumber'
-import * as _map from 'lodash/map'
import { getSelfhostedUUID } from './utils'