📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Fix lodash & code type issues
Blue Mouse2c5dcca91639
diff --git a/backend/apps/production/src/alert/alert.controller.ts b/backend/apps/production/src/alert/alert.controller.tsindex 1f4672034..58532006c 100644--- a/backend/apps/production/src/alert/alert.controller.ts+++ b/backend/apps/production/src/alert/alert.controller.ts@@ -16,10 +16,10 @@ import {} from '@nestjs/common'import { In } from 'typeorm'import { ApiTags, ApiResponse, ApiBearerAuth } from '@nestjs/swagger'-import * as _isEmpty from 'lodash/isEmpty'-import * as _map from 'lodash/map'-import * as _omit from 'lodash/omit'-import * as _pick from 'lodash/pick'+import _isEmpty from 'lodash/isEmpty'+import _map from 'lodash/map'+import _omit from 'lodash/omit'+import _pick from 'lodash/pick'import { UserService } from '../user/user.service'import { ProjectService } from '../project/project.service'@@ -71,6 +71,7 @@ export class AlertController {['project'],)+ // @ts-expect-errorresult.results = _map(result.results, alert => ({..._omit(alert, ['project']),pid: alert.project.id,@@ -143,7 +144,7 @@ export class AlertController {}try {- let alert = new Alert()+ let alert = new Alert() as Partial<Alert>Object.assign(alert, alertDTO)alert = _omit(alert, ['pid'])diff --git a/backend/apps/production/src/analytics/analytics.controller.ts b/backend/apps/production/src/analytics/analytics.controller.tsindex 77cd9cbcc..e52df0439 100644--- a/backend/apps/production/src/analytics/analytics.controller.ts+++ b/backend/apps/production/src/analytics/analytics.controller.ts@@ -1,14 +1,14 @@-import * as _isEmpty from 'lodash/isEmpty'-import * as _isArray from 'lodash/isArray'-import * as _toNumber from 'lodash/toNumber'-import * as _pick from 'lodash/pick'-import * as _includes from 'lodash/includes'-import * as _size from 'lodash/size'-import * as _map from 'lodash/map'-import * as _uniqBy from 'lodash/uniqBy'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as dayjsTimezone from 'dayjs/plugin/timezone'+import _isEmpty from 'lodash/isEmpty'+import _isArray from 'lodash/isArray'+import _toNumber from 'lodash/toNumber'+import _pick from 'lodash/pick'+import _includes from 'lodash/includes'+import _size from 'lodash/size'+import _map from 'lodash/map'+import _uniqBy from 'lodash/uniqBy'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import dayjsTimezone from 'dayjs/plugin/timezone'import { hash } from 'blake3'import {ApiOperation,@@ -33,7 +33,7 @@ import {Response,Header,} from '@nestjs/common'-import * as UAParser from 'ua-parser-js'+import UAParser from 'ua-parser-js'import { isbot } from 'isbot'import { OptionalJwtAccessTokenGuard } from '../auth/guards'diff --git a/backend/apps/production/src/analytics/analytics.service.ts b/backend/apps/production/src/analytics/analytics.service.tsindex 4dc193d8b..a776f714f 100644--- a/backend/apps/production/src/analytics/analytics.service.ts+++ b/backend/apps/production/src/analytics/analytics.service.ts@@ -1,32 +1,32 @@-import * as crypto from 'crypto'-import * as _isEmpty from 'lodash/isEmpty'-import * as _split from 'lodash/split'-import * as _reverse from 'lodash/reverse'-import * as _size from 'lodash/size'-import * as _includes from 'lodash/includes'-import * as _map from 'lodash/map'-import * as _toUpper from 'lodash/toUpper'-import * as _head from 'lodash/head'-import * as _join from 'lodash/join'-import * as _isArray from 'lodash/isArray'-import * as _startsWith from 'lodash/startsWith'-import * as _sortBy from 'lodash/sortBy'-import * as _reduce from 'lodash/reduce'-import * as _keys from 'lodash/keys'-import * as _last from 'lodash/last'-import * as _replace from 'lodash/replace'-import * as _some from 'lodash/some'-import * as _find from 'lodash/find'-import * as _now from 'lodash/now'-import * as _isString from 'lodash/isString'-import * as _values from 'lodash/values'-import * as _round from 'lodash/round'-import * as _filter from 'lodash/filter'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as dayjsTimezone from 'dayjs/plugin/timezone'-import * as isSameOrBefore from 'dayjs/plugin/isSameOrBefore'-import * as ipRangeCheck from 'ip-range-check'+import crypto from 'crypto'+import _isEmpty from 'lodash/isEmpty'+import _split from 'lodash/split'+import _reverse from 'lodash/reverse'+import _size from 'lodash/size'+import _includes from 'lodash/includes'+import _map from 'lodash/map'+import _toUpper from 'lodash/toUpper'+import _head from 'lodash/head'+import _join from 'lodash/join'+import _isArray from 'lodash/isArray'+import _startsWith from 'lodash/startsWith'+import _sortBy from 'lodash/sortBy'+import _reduce from 'lodash/reduce'+import _keys from 'lodash/keys'+import _last from 'lodash/last'+import _replace from 'lodash/replace'+import _some from 'lodash/some'+import _find from 'lodash/find'+import _now from 'lodash/now'+import _isString from 'lodash/isString'+import _values from 'lodash/values'+import _round from 'lodash/round'+import _filter from 'lodash/filter'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import dayjsTimezone from 'dayjs/plugin/timezone'+import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'+import ipRangeCheck from 'ip-range-check'import validator from 'validator'import { hash } from 'blake3'import {@@ -409,7 +409,7 @@ export class AnalyticsService {checkOrigin(project: Project, origin: string): void {// For some reasons the project.origins sometimes may look like [''], let's filter it out// TODO: Properly validate the origins on project update- const origins = _filter(project.origins, Boolean)+ const origins = _filter(project.origins, Boolean) as string[]if (!_isEmpty(origins) && !_isEmpty(origin)) {if (origin === 'null') {@@ -433,7 +433,7 @@ export class AnalyticsService {checkIpBlacklist(project: Project, ip: string): void {// For some reasons the project.ipBlacklist sometimes may look like [''], let's filter it out// TODO: Properly validate the ipBlacklist on project update- const ipBlacklist = _filter(project.ipBlacklist, Boolean)+ const ipBlacklist = _filter(project.ipBlacklist, Boolean) as string[]if (!_isEmpty(ipBlacklist) && ipRangeCheck(ip, ipBlacklist)) {throw new BadRequestException(@@ -618,9 +618,15 @@ export class AnalyticsService {groupTo = djsNow} else {if (period === '1d' || period === '1h') {- groupFrom = djsNow.subtract(parseInt(period, 10), _last(period))+ groupFrom = djsNow.subtract(+ parseInt(period, 10),+ _last(period) as dayjs.ManipulateType,+ )} else {- groupFrom = djsNow.subtract(parseInt(period, 10) - 1, _last(period))+ groupFrom = djsNow.subtract(+ parseInt(period, 10) - 1,+ _last(period) as dayjs.ManipulateType,+ )}groupFrom = groupFrom.startOf(timeBucket)@@ -750,7 +756,7 @@ export class AnalyticsService {return getSessionKey(ip, userAgent, pid, salt)}- async isSessionDurationOpen(sdKey: string): Promise<Array<string | boolean>> {+ async isSessionDurationOpen(sdKey: string): Promise<[string, boolean]> {const sd = await redis.get(sdKey)return [sd, Boolean(sd)]}@@ -1361,7 +1367,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)@@ -1500,7 +1506,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)@@ -1707,7 +1713,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)@@ -1902,7 +1908,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)@@ -4247,7 +4253,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)diff --git a/backend/apps/production/src/analytics/dto/events.dto.ts b/backend/apps/production/src/analytics/dto/events.dto.tsindex 5599988a0..9f394c921 100644--- a/backend/apps/production/src/analytics/dto/events.dto.ts+++ b/backend/apps/production/src/analytics/dto/events.dto.ts@@ -1,6 +1,6 @@-import * as _keys from 'lodash/keys'-import * as _values from 'lodash/values'-import * as _some from 'lodash/some'+import _keys from 'lodash/keys'+import _values from 'lodash/values'+import _some from 'lodash/some'import { ApiProperty } from '@nestjs/swagger'import {IsNotEmpty,diff --git a/backend/apps/production/src/analytics/utils/transformers.ts b/backend/apps/production/src/analytics/utils/transformers.tsindex f88e2d6cd..37af1b160 100644--- a/backend/apps/production/src/analytics/utils/transformers.ts+++ b/backend/apps/production/src/analytics/utils/transformers.ts@@ -1,15 +1,15 @@-import * as _round from 'lodash/round'-import * as _isEmpty from 'lodash/isEmpty'-import * as _keys from 'lodash/keys'-import * as _values from 'lodash/values'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'+import _round from 'lodash/round'+import _isEmpty from 'lodash/isEmpty'+import _keys from 'lodash/keys'+import _values from 'lodash/values'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'dayjs.extend(utc)const processMetaKV = (rawMeta: Record<string, string>,-): { 'meta.key': string | null; 'meta.value': string | null } => {+): { 'meta.key': string[] | null; 'meta.value': string[] | null } => {if (!rawMeta || _isEmpty(rawMeta)) {return {'meta.key': null,diff --git a/backend/apps/production/src/app.module.ts b/backend/apps/production/src/app.module.tsindex 1de585559..3ff80099e 100644--- a/backend/apps/production/src/app.module.ts+++ b/backend/apps/production/src/app.module.ts@@ -1,4 +1,4 @@-import * as _toNumber from 'lodash/toNumber'+import _toNumber from 'lodash/toNumber'import { Module } from '@nestjs/common'import { TypeOrmModule } from '@nestjs/typeorm'import { ConfigModule } from '@nestjs/config'diff --git a/backend/apps/production/src/auth/auth.controller.ts b/backend/apps/production/src/auth/auth.controller.tsindex 68c7fd1eb..bc6449c86 100644--- a/backend/apps/production/src/auth/auth.controller.ts+++ b/backend/apps/production/src/auth/auth.controller.ts@@ -25,7 +25,7 @@ import {ApiBearerAuth,} from '@nestjs/swagger'import { I18nValidationExceptionFilter, I18n, I18nContext } from 'nestjs-i18n'-import * as _pick from 'lodash/pick'+import _pick from 'lodash/pick'import { checkRateLimit, getIPFromHeaders } from '../common/utils'import { UserType, User } from '../user/entities/user.entity'@@ -156,6 +156,7 @@ export class AuthController {await this.authService.sendTelegramNotification(user.id, headers, ip)if (user.isTwoFactorAuthenticationEnabled) {+ // @ts-expect-erroruser = _pick(user, ['isTwoFactorAuthenticationEnabled', 'email'])} else {user = await this.authService.getSharedProjectsForUser(user as User)diff --git a/backend/apps/production/src/auth/auth.service.ts b/backend/apps/production/src/auth/auth.service.tsindex 7b7317b71..e458da4b5 100644--- a/backend/apps/production/src/auth/auth.service.ts+++ b/backend/apps/production/src/auth/auth.service.ts@@ -11,12 +11,12 @@ import axios from 'axios'import { genSalt, hash, compare } from 'bcrypt'import { getCountry } from 'countries-and-timezones'import { Auth } from 'googleapis'-import * as dayjs from 'dayjs'+import dayjs from 'dayjs'import { UAParser } from 'ua-parser-js'-import * as _pick from 'lodash/pick'-import * as _split from 'lodash/split'-import * as _isEmpty from 'lodash/isEmpty'-import * as _find from 'lodash/find'+import _pick from 'lodash/pick'+import _split from 'lodash/split'+import _isEmpty from 'lodash/isEmpty'+import _find from 'lodash/find'import { v4 as uuidv4 } from 'uuid'import {@@ -493,6 +493,7 @@ export class AuthService {)if (user.isTwoFactorAuthenticationEnabled) {+ // @ts-expect-erroruser = _pick(user, ['isTwoFactorAuthenticationEnabled', 'email'])} else {user = await this.getSharedProjectsForUser(user)@@ -944,6 +945,7 @@ export class AuthService {)if (user.isTwoFactorAuthenticationEnabled) {+ // @ts-expect-erroruser = _pick(user, ['isTwoFactorAuthenticationEnabled', 'email'])} else {user = await this.getSharedProjectsForUser(user)diff --git a/backend/apps/production/src/blog/blog.service.ts b/backend/apps/production/src/blog/blog.service.tsindex 333309853..61cf9eac7 100644--- a/backend/apps/production/src/blog/blog.service.ts+++ b/backend/apps/production/src/blog/blog.service.ts@@ -1,16 +1,16 @@import { Injectable } from '@nestjs/common'-import * as _find from 'lodash/find'-import * as _sortBy from 'lodash/sortBy'-import * as _includes from 'lodash/includes'-import * as _endsWith from 'lodash/endsWith'-import * as _filter from 'lodash/filter'-import * as _map from 'lodash/map'-import * as _replace from 'lodash/replace'-import * as _isEmpty from 'lodash/isEmpty'-import * as _last from 'lodash/last'-import * as _size from 'lodash/size'-import * as path from 'path'-import * as fs from 'fs/promises'+import _find from 'lodash/find'+import _sortBy from 'lodash/sortBy'+import _includes from 'lodash/includes'+import _endsWith from 'lodash/endsWith'+import _filter from 'lodash/filter'+import _map from 'lodash/map'+import _replace from 'lodash/replace'+import _isEmpty from 'lodash/isEmpty'+import _last from 'lodash/last'+import _size from 'lodash/size'+import path from 'path'+import fs from 'fs/promises'import { AppLoggerService } from '../logger/logger.service'import { BLOG_POSTS_PATH, BLOG_POSTS_ROOT, redis } from '../common/constants'diff --git a/backend/apps/production/src/captcha/captcha.controller.ts b/backend/apps/production/src/captcha/captcha.controller.tsindex e93460360..c9b42b049 100644--- a/backend/apps/production/src/captcha/captcha.controller.ts+++ b/backend/apps/production/src/captcha/captcha.controller.ts@@ -8,8 +8,8 @@ import {Ip,HttpCode,} from '@nestjs/common'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'import { AppLoggerService } from '../logger/logger.service'import { getIPFromHeaders } from '../common/utils'diff --git a/backend/apps/production/src/captcha/captcha.service.ts b/backend/apps/production/src/captcha/captcha.service.tsindex 8b156cce0..d0b7f6a6f 100644--- a/backend/apps/production/src/captcha/captcha.service.ts+++ b/backend/apps/production/src/captcha/captcha.service.ts@@ -1,13 +1,13 @@import { Injectable, BadRequestException } from '@nestjs/common'import { hash } from 'blake3'-import * as svgCaptcha from 'svg-captcha'-import * as CryptoJS from 'crypto-js'-import * as _toLower from 'lodash/toLower'-import * as UAParser from 'ua-parser-js'-import * as _values from 'lodash/values'-import * as _includes from 'lodash/includes'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'+import svgCaptcha from 'svg-captcha'+import CryptoJS from 'crypto-js'+import _toLower from 'lodash/toLower'+import UAParser from 'ua-parser-js'+import _values from 'lodash/values'+import _includes from 'lodash/includes'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'import { ProjectService } from '../project/project.service'import { AppLoggerService } from '../logger/logger.service'diff --git a/backend/apps/production/src/captcha/utils/transformers.ts b/backend/apps/production/src/captcha/utils/transformers.tsindex 5d7eeebad..508db98e1 100644--- a/backend/apps/production/src/captcha/utils/transformers.ts+++ b/backend/apps/production/src/captcha/utils/transformers.ts@@ -1,5 +1,5 @@-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'dayjs.extend(utc)diff --git a/backend/apps/production/src/common/constants.ts b/backend/apps/production/src/common/constants.tsindex 12a6e15c8..506f48316 100644--- a/backend/apps/production/src/common/constants.ts+++ b/backend/apps/production/src/common/constants.ts@@ -1,7 +1,7 @@import Redis from 'ioredis'-import * as path from 'path'+import path from 'path'import { hash } from 'blake3'-import * as _toNumber from 'lodash/toNumber'+import _toNumber from 'lodash/toNumber'import 'dotenv/config'const { PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, EMAIL_ACTION_ENCRYPTION_KEY } =diff --git a/backend/apps/production/src/common/utils.ts b/backend/apps/production/src/common/utils.tsindex 77bf81a95..2f6bcb6b2 100644--- a/backend/apps/production/src/common/utils.ts+++ b/backend/apps/production/src/common/utils.ts@@ -1,17 +1,17 @@-import * as path from 'path'-import * as fs from 'fs'+import path from 'path'+import fs from 'fs'import { Reader, CityResponse } from 'maxmind'import { HttpException } from '@nestjs/common'import { hash } from 'blake3'import timezones from 'countries-and-timezones'-import * as randomstring from 'randomstring'-import * as _sample from 'lodash/sample'-import * as _toNumber from 'lodash/toNumber'-import * as _replace from 'lodash/replace'-import * as _find from 'lodash/find'-import * as _size from 'lodash/size'-import * as _round from 'lodash/round'-import * as _split from 'lodash/split'+import randomstring from 'randomstring'+import _sample from 'lodash/sample'+import _toNumber from 'lodash/toNumber'+import _replace from 'lodash/replace'+import _find from 'lodash/find'+import _size from 'lodash/size'+import _round from 'lodash/round'+import _split from 'lodash/split'import { redis, isDevelopment, isProxiedByCloudflare } from './constants'diff --git a/backend/apps/production/src/integrations/telegram/scene/projects.scene.ts b/backend/apps/production/src/integrations/telegram/scene/projects.scene.tsindex f256dcc45..840ea644f 100644--- a/backend/apps/production/src/integrations/telegram/scene/projects.scene.ts+++ b/backend/apps/production/src/integrations/telegram/scene/projects.scene.ts@@ -1,8 +1,8 @@import { Ctx, Hears, On, Scene, SceneEnter } from 'nestjs-telegraf'import { Markup } from 'telegraf'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as timezone from 'dayjs/plugin/timezone'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import timezone from 'dayjs/plugin/timezone'import { ProjectService } from '../../../project/project.service'import { UserService } from '../../../user/user.service'import { AnalyticsService } from '../../../analytics/analytics.service'diff --git a/backend/apps/production/src/mailer/mailer.service.ts b/backend/apps/production/src/mailer/mailer.service.tsindex ce7c938d0..b72617eb9 100644--- a/backend/apps/production/src/mailer/mailer.service.ts+++ b/backend/apps/production/src/mailer/mailer.service.ts@@ -1,5 +1,5 @@-import * as fs from 'fs'-import * as path from 'path'+import fs from 'fs'+import path from 'path'import { MailerService as NodeMailerService } from '@nestjs-modules/mailer'import { Injectable } from '@nestjs/common'import handlebars from 'handlebars'diff --git a/backend/apps/production/src/main.ts b/backend/apps/production/src/main.tsindex 525c62a29..949566a41 100644--- a/backend/apps/production/src/main.ts+++ b/backend/apps/production/src/main.ts@@ -2,8 +2,8 @@ import './instrument'import { NestFactory } from '@nestjs/core'import { ValidationPipe, VersioningType } from '@nestjs/common'-import * as cookieParser from 'cookie-parser'-import * as bodyParser from 'body-parser'+import cookieParser from 'cookie-parser'+import bodyParser from 'body-parser'import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'import { getBotToken } from 'nestjs-telegraf'diff --git a/backend/apps/production/src/marketplace/cdn/cdn.service.ts b/backend/apps/production/src/marketplace/cdn/cdn.service.tsindex 94c9689d6..7dd2c4b22 100644--- a/backend/apps/production/src/marketplace/cdn/cdn.service.ts+++ b/backend/apps/production/src/marketplace/cdn/cdn.service.ts@@ -3,7 +3,7 @@ import { unlink, writeFile } from 'fs/promises'import { tmpdir } from 'os'import { ConfigService } from '@nestjs/config'import { Injectable, InternalServerErrorException } from '@nestjs/common'-import * as FormData from 'form-data'+import FormData from 'form-data'import { HttpService } from '@nestjs/axios'@Injectable()diff --git a/backend/apps/production/src/marketplace/comments/comments.controller.ts b/backend/apps/production/src/marketplace/comments/comments.controller.tsindex f788d9c79..86a884d6a 100644--- a/backend/apps/production/src/marketplace/comments/comments.controller.ts+++ b/backend/apps/production/src/marketplace/comments/comments.controller.ts@@ -12,8 +12,8 @@ import {BadRequestException,} from '@nestjs/common'import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'-import * as _includes from 'lodash/includes'-import * as _omit from 'lodash/omit'+import _includes from 'lodash/includes'+import _omit from 'lodash/omit'import { UserService } from '../../user/user.service'import { ExtensionsService } from '../extensions/extensions.service'import { Auth, CurrentUserId } from '../../auth/decorators'@@ -174,6 +174,7 @@ export class CommentsController {return {...replyComment,+ // @ts-expect-errorparentComment: _omit(replyComment.parentComment, ['userId']),isOwner: true,}diff --git a/backend/apps/production/src/marketplace/comments/comments.service.ts b/backend/apps/production/src/marketplace/comments/comments.service.tsindex 1b7a817f2..88462bcfd 100644--- a/backend/apps/production/src/marketplace/comments/comments.service.ts+++ b/backend/apps/production/src/marketplace/comments/comments.service.ts@@ -1,7 +1,7 @@import { Injectable } from '@nestjs/common'import { InjectRepository } from '@nestjs/typeorm'import { FindManyOptions, FindOneOptions, Repository } from 'typeorm'-import * as _isEmpty from 'lodash/isEmpty'+import _isEmpty from 'lodash/isEmpty'import { Comment } from './entities/comment.entity'import { CreateReplyCommentBodyDto } from './dtos/bodies/create-reply.dto'import { UpdateCommentReplyBodyDto } from './dtos/bodies/update-reply.dto'diff --git a/backend/apps/production/src/marketplace/extensions/extensions.controller.ts b/backend/apps/production/src/marketplace/extensions/extensions.controller.tsindex 2c046165e..a25c9e1bc 100644--- a/backend/apps/production/src/marketplace/extensions/extensions.controller.ts+++ b/backend/apps/production/src/marketplace/extensions/extensions.controller.ts@@ -18,8 +18,8 @@ import {import { ApiBearerAuth, ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'import { FormDataRequest } from 'nestjs-form-data'import { Like } from 'typeorm'-import * as _map from 'lodash/map'-import * as _size from 'lodash/size'+import _map from 'lodash/map'+import _size from 'lodash/size'import { CurrentUserId } from '../../auth/decorators/current-user-id.decorator'import { JwtAccessTokenGuard } from '../../auth/guards'import { Auth } from '../../auth/decorators'@@ -107,8 +107,10 @@ export class ExtensionsController {})extensions = _map(extensions, extension => {+ // @ts-expect-errorextension.usersQuantity = _size(extension.users)extension.users = undefined+ // @ts-expect-errorextension.owner = this.extensionsService.filterOwner(extension.owner)return extension})@@ -140,8 +142,10 @@ export class ExtensionsController {await this.extensionsService.getExtensions(queries)extensions = _map(extensions, extension => {+ // @ts-expect-errorextension.usersQuantity = _size(extension.users)extension.users = undefined+ // @ts-expect-errorextension.owner = this.extensionsService.filterOwner(extension.owner)return extension})@@ -182,8 +186,10 @@ export class ExtensionsController {)extensions = _map(extensions, extension => {+ // @ts-expect-errorextension.usersQuantity = _size(extension.users)extension.users = undefined+ // @ts-expect-errorextension.owner = this.extensionsService.filterOwner(extension.owner)return extension})@@ -260,8 +266,10 @@ export class ExtensionsController {)extensions = _map(extensions, extension => {+ // @ts-expect-errorextension.usersQuantity = _size(extension.users)extension.users = undefined+ // @ts-expect-errorextension.owner = this.extensionsService.filterOwner(extension.owner)return extension})@@ -310,8 +318,10 @@ export class ExtensionsController {await this.extensionsService.searchExtension(queries)extensions = _map(extensions, extension => {+ // @ts-expect-errorextension.usersQuantity = _size(extension.users)extension.users = undefined+ // @ts-expect-errorextension.owner = this.extensionsService.filterOwner(extension.owner)return extension})diff --git a/backend/apps/production/src/marketplace/extensions/extensions.service.ts b/backend/apps/production/src/marketplace/extensions/extensions.service.tsindex 9b1940c21..498f8c44e 100644--- a/backend/apps/production/src/marketplace/extensions/extensions.service.ts+++ b/backend/apps/production/src/marketplace/extensions/extensions.service.ts@@ -1,5 +1,5 @@import { ForbiddenException, Injectable } from '@nestjs/common'-import * as _pick from 'lodash/pick'+import _pick from 'lodash/pick'import { InjectRepository } from '@nestjs/typeorm'import { FindManyOptions, FindOneOptions, Like, Repository } from 'typeorm'import { UserService } from 'src/user/user.service'diff --git a/backend/apps/production/src/project/entity/monitor.entity.ts b/backend/apps/production/src/project/entity/monitor.entity.tsindex 373bcf83a..6935d6989 100644--- a/backend/apps/production/src/project/entity/monitor.entity.ts+++ b/backend/apps/production/src/project/entity/monitor.entity.ts@@ -51,7 +51,7 @@ export class MonitorEntity {@Column({ type: 'text', nullable: true })description: string | null- @ManyToOne(() => Project, project => project.monitors, {+ @ManyToOne(() => Project, entity => entity.monitors, {onDelete: 'CASCADE',})project: Projectdiff --git a/backend/apps/production/src/project/project.controller.ts b/backend/apps/production/src/project/project.controller.tsindex 1d4d97571..f3cdd5d7a 100644--- a/backend/apps/production/src/project/project.controller.ts+++ b/backend/apps/production/src/project/project.controller.ts@@ -34,18 +34,18 @@ import {ApiNoContentResponse,} from '@nestjs/swagger'import { Equal, FindConditions, ILike, In } from 'typeorm'-import * as _isEmpty from 'lodash/isEmpty'-import * as _map from 'lodash/map'-import * as _trim from 'lodash/trim'-import * as _size from 'lodash/size'-import * as _includes from 'lodash/includes'-import * as _isBoolean from 'lodash/isBoolean'-import * as _omit from 'lodash/omit'-import * as _split from 'lodash/split'-import * as _head from 'lodash/head'-import * as _filter from 'lodash/filter'-import * as _find from 'lodash/find'-import * as dayjs from 'dayjs'+import _isEmpty from 'lodash/isEmpty'+import _map from 'lodash/map'+import _trim from 'lodash/trim'+import _size from 'lodash/size'+import _includes from 'lodash/includes'+import _isBoolean from 'lodash/isBoolean'+import _omit from 'lodash/omit'+import _split from 'lodash/split'+import _head from 'lodash/head'+import _filter from 'lodash/filter'+import _find from 'lodash/find'+import dayjs from 'dayjs'import { hash } from 'bcrypt'import { JwtAccessTokenGuard } from '../auth/guards'@@ -235,6 +235,7 @@ export class ProjectController {const projects = await this.projectService.find(where)+ // @ts-expect-errorreturn _map(projects, (p: Project) => ({id: p.id,name: p.name,@@ -293,6 +294,7 @@ export class ProjectController {_map(paginated.results, ({ project }) => project.id),)+ // @ts-expect-errorpaginated.results = _map(paginated.results, share => {const project = processProjectUser(share.project)@@ -453,8 +455,8 @@ export class ProjectController {_filter(user.projects,(project: Project) => project.isCaptchaProject,- ) >= maxProjects,- )+ ),+ ) >= maxProjects) {throw new HttpException(`You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,@@ -466,8 +468,8 @@ export class ProjectController {_filter(user.projects,(project: Project) => project.isAnalyticsProject,- ) >= maxProjects,- )+ ),+ ) >= maxProjects) {throw new ForbiddenException(`You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,@@ -526,6 +528,7 @@ export class ProjectController {await this.userService.create(user)+ // @ts-expect-errorreturn _omit(newProject, ['passwordHash'])} catch (reason) {console.error('[ERROR] Failed to create a new project:')@@ -1666,7 +1669,7 @@ export class ProjectController {)const { maxProjects = PROJECTS_MAXIMUM } = user- if (_size(captchaProjects >= maxProjects)) {+ if (_size(captchaProjects) >= maxProjects) {throw new ForbiddenException(`You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,)@@ -1676,6 +1679,7 @@ export class ProjectController {project.isCaptchaEnabled = true}+ // @ts-expect-errorawait this.projectService.update(id, _omit(project, ['share', 'admin']))return _omit(project, ['passwordHash'])@@ -1844,6 +1848,7 @@ export class ProjectController {}}+ // @ts-expect-errorawait this.projectService.update(id, _omit(project, ['share', 'admin']))// await updateProjectRedis(id, project)@@ -1924,6 +1929,7 @@ export class ProjectController {{ project: In(pids) },)+ // @ts-expect-errorresult.results = _map(result.results, monitor => ({..._omit(monitor, ['project']),projectId: monitor.project.id,@@ -2224,6 +2230,7 @@ export class ProjectController {{ project: Equal(project.id) },)+ // @ts-expect-errorresult.results = _map(result.results, monitor => ({..._omit(monitor, ['project']),projectId: monitor.project.id,diff --git a/backend/apps/production/src/project/project.service.ts b/backend/apps/production/src/project/project.service.tsindex 011d65134..514d08a06 100644--- a/backend/apps/production/src/project/project.service.ts+++ b/backend/apps/production/src/project/project.service.ts@@ -1,4 +1,4 @@-import * as net from 'net'+import net from 'net'import {ForbiddenException,Injectable,@@ -13,19 +13,19 @@ import { FindOneOptions, Repository } from 'typeorm'import { customAlphabet } from 'nanoid'import handlebars from 'handlebars'import puppeteer from 'puppeteer'-import * as CryptoJS from 'crypto-js'-import * as _isEmpty from 'lodash/isEmpty'-import * as _size from 'lodash/size'-import * as _join from 'lodash/join'-import * as _map from 'lodash/map'-import * as _pick from 'lodash/pick'-import * as _trim from 'lodash/trim'-import * as _findIndex from 'lodash/findIndex'-import * as _filter from 'lodash/filter'-import * as _includes from 'lodash/includes'-import * as _reduce from 'lodash/reduce'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'+import CryptoJS from 'crypto-js'+import _isEmpty from 'lodash/isEmpty'+import _size from 'lodash/size'+import _join from 'lodash/join'+import _map from 'lodash/map'+import _pick from 'lodash/pick'+import _trim from 'lodash/trim'+import _findIndex from 'lodash/findIndex'+import _filter from 'lodash/filter'+import _includes from 'lodash/includes'+import _reduce from 'lodash/reduce'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'import { compareSync } from 'bcrypt'import { firstValueFrom } from 'rxjs'import { HttpService } from '@nestjs/axios'@@ -135,6 +135,7 @@ export const processProjectUser = (project: Project): Project => {const { user } = share[j]if (user) {+ // @ts-expect-error _pick(user, ['email']) is partial but share[j].user expects full User entityshare[j].user = _pick(user, ['email'])}}@@ -422,7 +423,7 @@ export class ProjectService {return this.projectsRepository.delete(id)}- async deleteMultiple(pids: string[]): Promise<any> {+ async deleteMultiple(pids: string): Promise<any> {return (this.projectsRepository.createQueryBuilder()@@ -1376,8 +1377,8 @@ export class ProjectService {return _filter(filters,({ column }) =>- _includes(ALL_COLUMNS, column) ||- _includes(TRAFFIC_METAKEY_COLUMNS, column),+ _includes(ALL_COLUMNS, column as string) ||+ _includes(TRAFFIC_METAKEY_COLUMNS, column as string),)}diff --git a/backend/apps/production/src/project/repositories/projects-views.repository.ts b/backend/apps/production/src/project/repositories/projects-views.repository.tsindex 386a9fb54..08a8b1a56 100644--- a/backend/apps/production/src/project/repositories/projects-views.repository.ts+++ b/backend/apps/production/src/project/repositories/projects-views.repository.ts@@ -1,8 +1,8 @@import { Injectable } from '@nestjs/common'import { InjectRepository } from '@nestjs/typeorm'import { Repository } from 'typeorm'-import * as _map from 'lodash/map'-import * as _isEmpty from 'lodash/isEmpty'+import _map from 'lodash/map'+import _isEmpty from 'lodash/isEmpty'import { ProjectViewEntity } from '../entity/project-view.entity'import { CreateProjectViewDto, Filter } from '../dto/create-project-view.dto'import { UpdateProjectViewDto } from '../dto/update-project-view.dto'@@ -17,7 +17,9 @@ export class ProjectsViewsRepository {private projectViewCustomEventsRepository: Repository<ProjectViewCustomEventEntity>,) {}- async findViews(projectId: string): Promise<(typeof this.processView)[]> {+ async findViews(+ projectId: string,+ ): Promise<ReturnType<typeof this.processView>[]> {const views = await this.viewsRepository.find({where: { projectId },relations: ['customEvents'],diff --git a/backend/apps/production/src/task-manager/task-manager.service.ts b/backend/apps/production/src/task-manager/task-manager.service.tsindex 3bccfccae..f6be2c327 100644--- a/backend/apps/production/src/task-manager/task-manager.service.ts+++ b/backend/apps/production/src/task-manager/task-manager.service.ts@@ -2,20 +2,20 @@ import { Injectable } from '@nestjs/common'import { Cron, CronExpression } from '@nestjs/schedule'import { IsNull, LessThan, In, Not, Between, MoreThan, Like } from 'typeorm'import { ConfigService } from '@nestjs/config'-import * as Paypal from '@paypal/payouts-sdk'-import * as bcrypt from 'bcrypt'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as _isEmpty from 'lodash/isEmpty'-import * as _isNull from 'lodash/isNull'-import * as _size from 'lodash/size'-import * as _map from 'lodash/map'-import * as _now from 'lodash/now'-import * as _find from 'lodash/find'-import * as _includes from 'lodash/includes'-import * as _toNumber from 'lodash/toNumber'-import * as _reduce from 'lodash/reduce'-import * as _filter from 'lodash/filter'+import Paypal from '@paypal/payouts-sdk'+import bcrypt from 'bcrypt'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import _isEmpty from 'lodash/isEmpty'+import _isNull from 'lodash/isNull'+import _size from 'lodash/size'+import _map from 'lodash/map'+import _now from 'lodash/now'+import _find from 'lodash/find'+import _includes from 'lodash/includes'+import _toNumber from 'lodash/toNumber'+import _reduce from 'lodash/reduce'+import _filter from 'lodash/filter'import { HttpService } from '@nestjs/axios'import { firstValueFrom } from 'rxjs'@@ -146,7 +146,7 @@ const getUsersThatExceedPlanUsage = (users: User[],usage: CHPlanUsage[],allowedExceed = TRAFFIC_SPIKE_ALLOWED_PERCENTAGE,-): User & { usage: number }[] => {+): (User & { usage: number })[] => {const usageMap = _reduce(usage,(acc, value: CHPlanUsage) => ({@@ -169,7 +169,7 @@ const getUsersThatExceedPlanUsage = (}}- return exceedingUsers as User & { usage: number }[]+ return exceedingUsers}const getUserIDsThatExceedPlanUsage = (@@ -202,7 +202,7 @@ const getUserIDsThatExceedPlanUsage = (const getUsersThatExceedContinuously = (users: User[],usage: CHPlanUsage[][],-): User & { usage: any[] }[] => {+): (User & { usage: any[] })[] => {const transformedUsage = _map(usage, (el: CHPlanUsage[]) => {return _reduce(el,@@ -237,7 +237,7 @@ const getUsersThatExceedContinuously = (}}- return exceedingUsers as User & { usage: any[] }[]+ return exceedingUsers}const EMAIL_REPORTS_MAP = {@@ -1428,7 +1428,7 @@ export class TaskManagerService {},items: _reduce(payouts,- (acc, value, key) => {+ (acc, value: any, key) => {acc.push({recipient_type: 'EMAIL',amount: {diff --git a/backend/apps/production/src/user/entities/user.entity.ts b/backend/apps/production/src/user/entities/user.entity.tsindex 58b4b4c1d..a272be6b3 100644--- a/backend/apps/production/src/user/entities/user.entity.ts+++ b/backend/apps/production/src/user/entities/user.entity.ts@@ -53,18 +53,24 @@ export const ACCOUNT_PLANS = {monthlyUsageLimit: 0,maxAlerts: 0,legacy: false,+ pid: null,+ ypid: null,},[PlanCode.free]: {id: PlanCode.free,monthlyUsageLimit: 5000,maxAlerts: 1,legacy: true,+ pid: null,+ ypid: null,},[PlanCode.trial]: {id: PlanCode.trial,monthlyUsageLimit: 10000000,maxAlerts: 50,legacy: false,+ pid: null,+ ypid: null,},[PlanCode.hobby]: {id: PlanCode.hobby,diff --git a/backend/apps/production/src/user/user.controller.ts b/backend/apps/production/src/user/user.controller.tsindex 5d51fd288..ea6fb5281 100644--- a/backend/apps/production/src/user/user.controller.ts+++ b/backend/apps/production/src/user/user.controller.ts@@ -20,16 +20,16 @@ import {} from '@nestjs/common'import { Request } from 'express'import { ApiTags, ApiQuery, ApiResponse, ApiBearerAuth } from '@nestjs/swagger'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as _map from 'lodash/map'-import * as _join from 'lodash/join'-import * as _isNull from 'lodash/isNull'-import * as _isEmpty from 'lodash/isEmpty'-import * as _includes from 'lodash/includes'-import * as _isString from 'lodash/isString'-import * as _omit from 'lodash/omit'-import * as _round from 'lodash/round'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import _map from 'lodash/map'+import _join from 'lodash/join'+import _isNull from 'lodash/isNull'+import _isEmpty from 'lodash/isEmpty'+import _includes from 'lodash/includes'+import _isString from 'lodash/isString'+import _omit from 'lodash/omit'+import _round from 'lodash/round'import { v4 as uuidv4 } from 'uuid'import { HttpService } from '@nestjs/axios'import { catchError, firstValueFrom, map, of } from 'rxjs'diff --git a/backend/apps/production/src/user/user.service.ts b/backend/apps/production/src/user/user.service.tsindex a9a8de085..5da1452de 100644--- a/backend/apps/production/src/user/user.service.ts+++ b/backend/apps/production/src/user/user.service.ts@@ -6,13 +6,13 @@ import {import { InjectRepository } from '@nestjs/typeorm'import { In, Repository } from 'typeorm'import axios from 'axios'-import * as CryptoJS from 'crypto-js'-import * as dayjs from 'dayjs'-import * as _isEmpty from 'lodash/isEmpty'-import * as _size from 'lodash/size'-import * as _omit from 'lodash/omit'-import * as _isNull from 'lodash/isNull'-import * as _toNumber from 'lodash/toNumber'+import CryptoJS from 'crypto-js'+import dayjs from 'dayjs'+import _isEmpty from 'lodash/isEmpty'+import _size from 'lodash/size'+import _omit from 'lodash/omit'+import _isNull from 'lodash/isNull'+import _toNumber from 'lodash/toNumber'import { Pagination, PaginationOptionsInterface } from '../common/pagination'import { PayoutsService } from '../payouts/payouts.service'diff --git a/backend/apps/production/src/webhook/webhook.controller.ts b/backend/apps/production/src/webhook/webhook.controller.tsindex 2c82c22ae..099098544 100644--- a/backend/apps/production/src/webhook/webhook.controller.ts+++ b/backend/apps/production/src/webhook/webhook.controller.ts@@ -9,7 +9,7 @@ import {Ip,} from '@nestjs/common'import { ApiTags } from '@nestjs/swagger'-import * as _find from 'lodash/find'+import _find from 'lodash/find'import { ProjectService } from '../project/project.service'import { getIPFromHeaders } from '../common/utils'diff --git a/backend/apps/production/src/webhook/webhook.service.ts b/backend/apps/production/src/webhook/webhook.service.tsindex b4dcfd697..7defb5afc 100644--- a/backend/apps/production/src/webhook/webhook.service.ts+++ b/backend/apps/production/src/webhook/webhook.service.ts@@ -1,15 +1,15 @@/* eslint-disable no-param-reassign, no-prototype-builtins */-import * as crypto from 'crypto'-import * as Validator from 'sns-payload-validator'+import crypto from 'crypto'+import Validator from 'sns-payload-validator'import {Injectable,BadRequestException,ForbiddenException,} from '@nestjs/common'-import * as Serialize from 'php-serialize'-import * as _includes from 'lodash/includes'-import * as _keys from 'lodash/keys'-import * as _isArray from 'lodash/isArray'+import Serialize from 'php-serialize'+import _includes from 'lodash/includes'+import _keys from 'lodash/keys'+import _isArray from 'lodash/isArray'import { AppLoggerService } from '../logger/logger.service'import { PayoutsService } from '../payouts/payouts.service'import { ProjectService } from '../project/project.service'diff --git a/backend/apps/selfhosted/src/analytics/analytics.controller.ts b/backend/apps/selfhosted/src/analytics/analytics.controller.tsindex 760028bc5..8943177c5 100644--- a/backend/apps/selfhosted/src/analytics/analytics.controller.ts+++ b/backend/apps/selfhosted/src/analytics/analytics.controller.ts@@ -1,13 +1,13 @@-import * as _isEmpty from 'lodash/isEmpty'-import * as _isArray from 'lodash/isArray'-import * as _pick from 'lodash/pick'-import * as _map from 'lodash/map'-import * as _uniqBy from 'lodash/uniqBy'-import * as _includes from 'lodash/includes'-import * as _size from 'lodash/size'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as dayjsTimezone from 'dayjs/plugin/timezone'+import _isEmpty from 'lodash/isEmpty'+import _isArray from 'lodash/isArray'+import _pick from 'lodash/pick'+import _map from 'lodash/map'+import _uniqBy from 'lodash/uniqBy'+import _includes from 'lodash/includes'+import _size from 'lodash/size'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import dayjsTimezone from 'dayjs/plugin/timezone'import { hash } from 'blake3'import {Controller,@@ -26,7 +26,7 @@ import {Response,} from '@nestjs/common'import { ApiTags } from '@nestjs/swagger'-import * as UAParser from 'ua-parser-js'+import UAParser from 'ua-parser-js'import { isbot } from 'isbot'import { OptionalJwtAccessTokenGuard } from '../auth/guards'diff --git a/backend/apps/selfhosted/src/analytics/analytics.service.ts b/backend/apps/selfhosted/src/analytics/analytics.service.tsindex 73ae03ea3..abf54459b 100644--- a/backend/apps/selfhosted/src/analytics/analytics.service.ts+++ b/backend/apps/selfhosted/src/analytics/analytics.service.ts@@ -1,32 +1,32 @@-import * as crypto from 'crypto'-import * as _isEmpty from 'lodash/isEmpty'-import * as _split from 'lodash/split'-import * as _reverse from 'lodash/reverse'-import * as _size from 'lodash/size'-import * as _includes from 'lodash/includes'-import * as _map from 'lodash/map'-import * as _head from 'lodash/head'-import * as _toUpper from 'lodash/toUpper'-import * as _sortBy from 'lodash/sortBy'-import * as _join from 'lodash/join'-import * as _replace from 'lodash/replace'-import * as _last from 'lodash/last'-import * as _some from 'lodash/some'-import * as _find from 'lodash/find'-import * as _isArray from 'lodash/isArray'-import * as _startsWith from 'lodash/startsWith'-import * as _reduce from 'lodash/reduce'-import * as _keys from 'lodash/keys'-import * as _now from 'lodash/now'-import * as _values from 'lodash/values'-import * as _round from 'lodash/round'-import * as _filter from 'lodash/filter'-import * as _isString from 'lodash/isString'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as dayjsTimezone from 'dayjs/plugin/timezone'-import * as isSameOrBefore from 'dayjs/plugin/isSameOrBefore'-import * as ipRangeCheck from 'ip-range-check'+import crypto from 'crypto'+import _isEmpty from 'lodash/isEmpty'+import _split from 'lodash/split'+import _reverse from 'lodash/reverse'+import _size from 'lodash/size'+import _includes from 'lodash/includes'+import _map from 'lodash/map'+import _head from 'lodash/head'+import _toUpper from 'lodash/toUpper'+import _sortBy from 'lodash/sortBy'+import _join from 'lodash/join'+import _replace from 'lodash/replace'+import _last from 'lodash/last'+import _some from 'lodash/some'+import _find from 'lodash/find'+import _isArray from 'lodash/isArray'+import _startsWith from 'lodash/startsWith'+import _reduce from 'lodash/reduce'+import _keys from 'lodash/keys'+import _now from 'lodash/now'+import _values from 'lodash/values'+import _round from 'lodash/round'+import _filter from 'lodash/filter'+import _isString from 'lodash/isString'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import dayjsTimezone from 'dayjs/plugin/timezone'+import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'+import ipRangeCheck from 'ip-range-check'import validator from 'validator'import { hash } from 'blake3'import {@@ -359,7 +359,7 @@ export class AnalyticsService {checkOrigin(project: Project, origin: string): void {// For some reasons the project.origins sometimes may look like [''], let's filter it out// TODO: Properly validate the origins on project update- const origins = _filter(project.origins, Boolean)+ const origins = _filter(project.origins, Boolean) as string[]if (!_isEmpty(origins) && !_isEmpty(origin)) {if (origin === 'null') {@@ -382,7 +382,7 @@ export class AnalyticsService {checkIpBlacklist(project: Project, ip: string): void {// For some reasons the project.ipBlacklist sometimes may look like [''], let's filter it out// TODO: Properly validate the ipBlacklist on project update- const ipBlacklist = _filter(project.ipBlacklist, Boolean)+ const ipBlacklist = _filter(project.ipBlacklist, Boolean) as string[]if (!_isEmpty(ipBlacklist) && ipRangeCheck(ip, ipBlacklist)) {throw new BadRequestException(@@ -577,9 +577,15 @@ export class AnalyticsService {groupTo = djsNow} else {if (period === '1d' || period === '1h') {- groupFrom = djsNow.subtract(parseInt(period, 10), _last(period))+ groupFrom = djsNow.subtract(+ parseInt(period, 10),+ _last(period) as dayjs.ManipulateType,+ )} else {- groupFrom = djsNow.subtract(parseInt(period, 10) - 1, _last(period))+ groupFrom = djsNow.subtract(+ parseInt(period, 10) - 1,+ _last(period) as dayjs.ManipulateType,+ )}groupFrom = groupFrom.startOf(timeBucket)@@ -709,7 +715,7 @@ export class AnalyticsService {return getSessionKey(ip, userAgent, pid, salt)}- async isSessionDurationOpen(sdKey: string): Promise<Array<string | boolean>> {+ async isSessionDurationOpen(sdKey: string): Promise<[string, boolean]> {const sd = await redis.get(sdKey)return [sd, Boolean(sd)]}@@ -1342,7 +1348,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)@@ -1536,7 +1542,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)@@ -3595,7 +3601,7 @@ export class AnalyticsService {.format('YYYY-MM-DD HH:mm:ss')} else {const amountToSubtract = parseInt(period, 10)- const unit = _replace(period, /[0-9]/g, '')+ const unit = _replace(period, /[0-9]/g, '') as dayjs.ManipulateTypenow = dayjs.utc().format('YYYY-MM-DD HH:mm:ss')const periodRaw = dayjs.utc().subtract(amountToSubtract, unit)diff --git a/backend/apps/selfhosted/src/analytics/dto/events.dto.ts b/backend/apps/selfhosted/src/analytics/dto/events.dto.tsindex 5599988a0..9f394c921 100644--- a/backend/apps/selfhosted/src/analytics/dto/events.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/events.dto.ts@@ -1,6 +1,6 @@-import * as _keys from 'lodash/keys'-import * as _values from 'lodash/values'-import * as _some from 'lodash/some'+import _keys from 'lodash/keys'+import _values from 'lodash/values'+import _some from 'lodash/some'import { ApiProperty } from '@nestjs/swagger'import {IsNotEmpty,diff --git a/backend/apps/selfhosted/src/analytics/utils/transformers.ts b/backend/apps/selfhosted/src/analytics/utils/transformers.tsindex f88e2d6cd..37af1b160 100644--- a/backend/apps/selfhosted/src/analytics/utils/transformers.ts+++ b/backend/apps/selfhosted/src/analytics/utils/transformers.ts@@ -1,15 +1,15 @@-import * as _round from 'lodash/round'-import * as _isEmpty from 'lodash/isEmpty'-import * as _keys from 'lodash/keys'-import * as _values from 'lodash/values'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'+import _round from 'lodash/round'+import _isEmpty from 'lodash/isEmpty'+import _keys from 'lodash/keys'+import _values from 'lodash/values'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'dayjs.extend(utc)const processMetaKV = (rawMeta: Record<string, string>,-): { 'meta.key': string | null; 'meta.value': string | null } => {+): { 'meta.key': string[] | null; 'meta.value': string[] | null } => {if (!rawMeta || _isEmpty(rawMeta)) {return {'meta.key': null,diff --git a/backend/apps/selfhosted/src/auth/auth.service.ts b/backend/apps/selfhosted/src/auth/auth.service.tsindex ebf5e8f95..8bb1f0c7d 100644--- a/backend/apps/selfhosted/src/auth/auth.service.ts+++ b/backend/apps/selfhosted/src/auth/auth.service.ts@@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'import { ConfigService } from '@nestjs/config'import { JwtService } from '@nestjs/jwt'import { genSalt, hash } from 'bcrypt'-import * as _isEmpty from 'lodash/isEmpty'+import _isEmpty from 'lodash/isEmpty'import {saveRefreshTokenClickhouse,diff --git a/backend/apps/selfhosted/src/common/constants.ts b/backend/apps/selfhosted/src/common/constants.tsindex d2e7ecde2..cfca56e9e 100644--- a/backend/apps/selfhosted/src/common/constants.ts+++ b/backend/apps/selfhosted/src/common/constants.ts@@ -1,5 +1,5 @@import Redis from 'ioredis'-import * as _toNumber from 'lodash/toNumber'+import _toNumber from 'lodash/toNumber'import { getSelfhostedUUID } from './utils'import 'dotenv/config'diff --git a/backend/apps/selfhosted/src/common/utils.ts b/backend/apps/selfhosted/src/common/utils.tsindex 0780bf6d2..03da4268a 100644--- a/backend/apps/selfhosted/src/common/utils.ts+++ b/backend/apps/selfhosted/src/common/utils.ts@@ -2,21 +2,21 @@ import { NotFoundException, HttpException } from '@nestjs/common'import timezones from 'countries-and-timezones'import { hash } from 'blake3'import { v5 as uuidv5 } from 'uuid'-import * as _join from 'lodash/join'-import * as _filter from 'lodash/filter'-import * as _values from 'lodash/values'-import * as _reduce from 'lodash/reduce'-import * as _keys from 'lodash/keys'-import * as _toNumber from 'lodash/toNumber'-import * as _split from 'lodash/split'-import * as _isEmpty from 'lodash/isEmpty'-import * as _isNil from 'lodash/isNil'-import * as _head from 'lodash/head'-import * as _round from 'lodash/round'-import * as _size from 'lodash/size'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as _map from 'lodash/map'+import _join from 'lodash/join'+import _filter from 'lodash/filter'+import _values from 'lodash/values'+import _reduce from 'lodash/reduce'+import _keys from 'lodash/keys'+import _toNumber from 'lodash/toNumber'+import _split from 'lodash/split'+import _isEmpty from 'lodash/isEmpty'+import _isNil from 'lodash/isNil'+import _head from 'lodash/head'+import _round from 'lodash/round'+import _size from 'lodash/size'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import _map from 'lodash/map'import {redis,diff --git a/backend/apps/selfhosted/src/main.ts b/backend/apps/selfhosted/src/main.tsindex 937a50324..d22d6aaf9 100644--- a/backend/apps/selfhosted/src/main.ts+++ b/backend/apps/selfhosted/src/main.ts@@ -1,6 +1,6 @@import { NestFactory } from '@nestjs/core'import { ValidationPipe, VersioningType } from '@nestjs/common'-import * as cookieParser from 'cookie-parser'+import cookieParser from 'cookie-parser'import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'import { isDevelopment } from './common/constants'diff --git a/backend/apps/selfhosted/src/project/project.controller.ts b/backend/apps/selfhosted/src/project/project.controller.tsindex d3e3cee17..bde79af31 100644--- a/backend/apps/selfhosted/src/project/project.controller.ts+++ b/backend/apps/selfhosted/src/project/project.controller.ts@@ -26,17 +26,17 @@ import {ApiOkResponse,ApiNoContentResponse,} from '@nestjs/swagger'-import * as _isEmpty from 'lodash/isEmpty'-import * as _map from 'lodash/map'-import * as _trim from 'lodash/trim'-import * as _size from 'lodash/size'-import * as _split from 'lodash/split'-import * as _isBoolean from 'lodash/isBoolean'-import * as _omit from 'lodash/omit'-import * as _reduce from 'lodash/reduce'-import * as _head from 'lodash/head'-import * as _includes from 'lodash/includes'-import * as dayjs from 'dayjs'+import _isEmpty from 'lodash/isEmpty'+import _map from 'lodash/map'+import _trim from 'lodash/trim'+import _size from 'lodash/size'+import _split from 'lodash/split'+import _isBoolean from 'lodash/isBoolean'+import _omit from 'lodash/omit'+import _reduce from 'lodash/reduce'+import _head from 'lodash/head'+import _includes from 'lodash/includes'+import dayjs from 'dayjs'import { hash } from 'bcrypt'import { JwtAccessTokenGuard } from '../auth/guards'diff --git a/backend/apps/selfhosted/src/project/project.service.ts b/backend/apps/selfhosted/src/project/project.service.tsindex 52a608a2a..30d0b6f85 100644--- a/backend/apps/selfhosted/src/project/project.service.ts+++ b/backend/apps/selfhosted/src/project/project.service.ts@@ -1,4 +1,4 @@-import * as net from 'net'+import net from 'net'import {ForbiddenException,Injectable,@@ -8,18 +8,18 @@ import {ConflictException,} from '@nestjs/common'import { customAlphabet } from 'nanoid'-import * as _isEmpty from 'lodash/isEmpty'-import * as _isString from 'lodash/isString'-import * as _size from 'lodash/size'-import * as _join from 'lodash/join'-import * as _filter from 'lodash/filter'-import * as _includes from 'lodash/includes'-import * as _find from 'lodash/find'-import * as _map from 'lodash/map'-import * as _isNull from 'lodash/isNull'-import * as _split from 'lodash/split'-import * as _trim from 'lodash/trim'-import * as _reduce from 'lodash/reduce'+import _isEmpty from 'lodash/isEmpty'+import _isString from 'lodash/isString'+import _size from 'lodash/size'+import _join from 'lodash/join'+import _filter from 'lodash/filter'+import _includes from 'lodash/includes'+import _find from 'lodash/find'+import _map from 'lodash/map'+import _isNull from 'lodash/isNull'+import _split from 'lodash/split'+import _trim from 'lodash/trim'+import _reduce from 'lodash/reduce'import { compareSync } from 'bcrypt'import { Project } from './entity/project.entity'diff --git a/backend/apps/selfhosted/src/task-manager/task-manager.service.ts b/backend/apps/selfhosted/src/task-manager/task-manager.service.tsindex feea927c7..4701dddff 100644--- a/backend/apps/selfhosted/src/task-manager/task-manager.service.ts+++ b/backend/apps/selfhosted/src/task-manager/task-manager.service.ts@@ -1,11 +1,11 @@import { Injectable } from '@nestjs/common'import { Cron, CronExpression } from '@nestjs/schedule'-import * as bcrypt from 'bcrypt'-import * as dayjs from 'dayjs'-import * as utc from 'dayjs/plugin/utc'-import * as _size from 'lodash/size'-import * as _map from 'lodash/map'-import * as _now from 'lodash/now'+import bcrypt from 'bcrypt'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import _size from 'lodash/size'+import _map from 'lodash/map'+import _now from 'lodash/now'import { redis, REDIS_SESSION_SALT_KEY } from '../common/constants'import { clickhouse } from '../common/integrations/clickhouse'diff --git a/backend/apps/selfhosted/src/user/entities/user.entity.ts b/backend/apps/selfhosted/src/user/entities/user.entity.tsindex 43b00a70f..6516ad877 100644--- a/backend/apps/selfhosted/src/user/entities/user.entity.ts+++ b/backend/apps/selfhosted/src/user/entities/user.entity.ts@@ -1,4 +1,4 @@-import * as _omit from 'lodash/omit'+import _omit from 'lodash/omit'import { SELFHOSTED_EMAIL, SELFHOSTED_UUID } from '../../common/constants'import { getUserClickhouse } from '../../common/utils'diff --git a/backend/apps/selfhosted/src/user/user.controller.ts b/backend/apps/selfhosted/src/user/user.controller.tsindex 9a07cf77f..8e4e4c07d 100644--- a/backend/apps/selfhosted/src/user/user.controller.ts+++ b/backend/apps/selfhosted/src/user/user.controller.ts@@ -7,7 +7,7 @@ import {BadRequestException,} from '@nestjs/common'import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'-import * as _omit from 'lodash/omit'+import _omit from 'lodash/omit'import { JwtAccessTokenGuard } from '../auth/guards'import {