From 267e51af55140aa8ed453ace737d573a25800f98 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 31 May 2023 18:28:12 +0800 Subject: [PATCH] refactor(nocodb): lint --- packages/nocodb/src/cache/RedisCacheMgr.ts | 2 +- packages/nocodb/src/cache/RedisMockCacheMgr.ts | 2 +- .../nocodb/src/controllers/api-tokens.controller.ts | 1 - .../nocodb/src/controllers/attachments.controller.ts | 1 - packages/nocodb/src/controllers/audits.controller.ts | 1 - packages/nocodb/src/controllers/bases.controller.ts | 1 - .../src/controllers/bulk-data-alias.controller.ts | 1 - packages/nocodb/src/controllers/columns.controller.ts | 1 - .../src/controllers/data-alias-export.controller.ts | 1 - .../src/controllers/data-alias-nested.controller.ts | 3 --- .../nocodb/src/controllers/data-alias.controller.ts | 1 - packages/nocodb/src/controllers/filters.controller.ts | 2 -- .../nocodb/src/controllers/form-columns.controller.ts | 1 - .../nocodb/src/controllers/galleries.controller.ts | 1 - .../nocodb/src/controllers/grid-columns.controller.ts | 1 - packages/nocodb/src/controllers/grids.controller.ts | 1 - packages/nocodb/src/controllers/maps.controller.ts | 1 - .../nocodb/src/controllers/meta-diffs.controller.ts | 1 - .../src/controllers/model-visibilities.controller.ts | 1 - .../src/controllers/old-datas/old-datas.controller.ts | 1 - packages/nocodb/src/controllers/plugins.controller.ts | 10 +++++----- .../src/controllers/project-users.controller.ts | 1 - .../nocodb/src/controllers/projects.controller.ts | 2 -- .../nocodb/src/controllers/shared-bases.controller.ts | 1 - packages/nocodb/src/controllers/sorts.controller.ts | 1 - packages/nocodb/src/controllers/tables.controller.ts | 1 - .../nocodb/src/controllers/view-columns.controller.ts | 3 +-- packages/nocodb/src/db/BaseModelSql.ts | 6 +++--- packages/nocodb/src/db/BaseModelSqlv2.ts | 11 +---------- packages/nocodb/src/db/CustomKnex.ts | 2 +- packages/nocodb/src/db/conditionV2.ts | 2 +- .../nocodb/src/db/sql-client/lib/SqlClientFactory.ts | 2 -- .../is-upload-allowed.interceptor.ts | 1 - .../extract-project-id.middleware.ts | 8 ++------ packages/nocodb/src/models/Model.ts | 1 - packages/nocodb/src/modules/datas/helpers.ts | 1 - .../jobs/jobs/at-import/helpers/readAndProcessData.ts | 2 -- packages/nocodb/src/modules/users/users.module.ts | 5 +---- packages/nocodb/src/run/docker.ts | 1 - packages/nocodb/src/run/dockerRunPG_CyQuick.ts | 1 - .../nocodb/src/services/bulk-data-alias.service.ts | 5 +---- packages/nocodb/src/services/public-metas.service.ts | 1 - .../version-upgrader/v1-legacy/gql/GqlApiBuilder.ts | 1 - .../version-upgrader/v1-legacy/rest/RestApiBuilder.ts | 5 +---- 44 files changed, 19 insertions(+), 80 deletions(-) diff --git a/packages/nocodb/src/cache/RedisCacheMgr.ts b/packages/nocodb/src/cache/RedisCacheMgr.ts index e0dafae4a1..f5bbda215c 100644 --- a/packages/nocodb/src/cache/RedisCacheMgr.ts +++ b/packages/nocodb/src/cache/RedisCacheMgr.ts @@ -45,7 +45,7 @@ export default class RedisCacheMgr extends CacheMgr { } // @ts-ignore - async get(key: string, type: string, config?: any): Promise { + async get(key: string, type: string): Promise { log(`RedisCacheMgr::get: getting key ${key} with type ${type}`); if (type === CacheGetType.TYPE_ARRAY) { return this.client.smembers(key); diff --git a/packages/nocodb/src/cache/RedisMockCacheMgr.ts b/packages/nocodb/src/cache/RedisMockCacheMgr.ts index c4249ae484..8866895674 100644 --- a/packages/nocodb/src/cache/RedisMockCacheMgr.ts +++ b/packages/nocodb/src/cache/RedisMockCacheMgr.ts @@ -40,7 +40,7 @@ export default class RedisMockCacheMgr extends CacheMgr { } // @ts-ignore - async get(key: string, type: string, config?: any): Promise { + async get(key: string, type: string): Promise { log(`RedisMockCacheMgr::get: getting key ${key} with type ${type}`); if (type === CacheGetType.TYPE_ARRAY) { return this.client.smembers(key); diff --git a/packages/nocodb/src/controllers/api-tokens.controller.ts b/packages/nocodb/src/controllers/api-tokens.controller.ts index 78335e809a..5460edf132 100644 --- a/packages/nocodb/src/controllers/api-tokens.controller.ts +++ b/packages/nocodb/src/controllers/api-tokens.controller.ts @@ -9,7 +9,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { diff --git a/packages/nocodb/src/controllers/attachments.controller.ts b/packages/nocodb/src/controllers/attachments.controller.ts index 69885be5be..92a13109f0 100644 --- a/packages/nocodb/src/controllers/attachments.controller.ts +++ b/packages/nocodb/src/controllers/attachments.controller.ts @@ -30,7 +30,6 @@ export class AttachmentsController { @UploadedFiles() files: Array, @Body() body: any, @Request() req: any, - @Query('path') path: string, ) { const attachments = await this.attachmentsService.upload({ files: files, diff --git a/packages/nocodb/src/controllers/audits.controller.ts b/packages/nocodb/src/controllers/audits.controller.ts index ce0eb18613..816fb8b04f 100644 --- a/packages/nocodb/src/controllers/audits.controller.ts +++ b/packages/nocodb/src/controllers/audits.controller.ts @@ -10,7 +10,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { diff --git a/packages/nocodb/src/controllers/bases.controller.ts b/packages/nocodb/src/controllers/bases.controller.ts index 28b45367a7..2363d170c0 100644 --- a/packages/nocodb/src/controllers/bases.controller.ts +++ b/packages/nocodb/src/controllers/bases.controller.ts @@ -10,7 +10,6 @@ import { UseGuards, } from '@nestjs/common'; import { BaseReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { diff --git a/packages/nocodb/src/controllers/bulk-data-alias.controller.ts b/packages/nocodb/src/controllers/bulk-data-alias.controller.ts index e1202929c3..138941a4d7 100644 --- a/packages/nocodb/src/controllers/bulk-data-alias.controller.ts +++ b/packages/nocodb/src/controllers/bulk-data-alias.controller.ts @@ -10,7 +10,6 @@ import { Response, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/columns.controller.ts b/packages/nocodb/src/controllers/columns.controller.ts index 764be4c4d1..eb9c4e6343 100644 --- a/packages/nocodb/src/controllers/columns.controller.ts +++ b/packages/nocodb/src/controllers/columns.controller.ts @@ -11,7 +11,6 @@ import { UseGuards, } from '@nestjs/common'; import { ColumnReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/data-alias-export.controller.ts b/packages/nocodb/src/controllers/data-alias-export.controller.ts index 42da30027d..7c3a4ad4fa 100644 --- a/packages/nocodb/src/controllers/data-alias-export.controller.ts +++ b/packages/nocodb/src/controllers/data-alias-export.controller.ts @@ -1,6 +1,5 @@ import { Controller, Get, Request, Response, UseGuards } from '@nestjs/common'; import * as XLSX from 'xlsx'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/data-alias-nested.controller.ts b/packages/nocodb/src/controllers/data-alias-nested.controller.ts index 53c11f5f42..4edcd10a5d 100644 --- a/packages/nocodb/src/controllers/data-alias-nested.controller.ts +++ b/packages/nocodb/src/controllers/data-alias-nested.controller.ts @@ -8,7 +8,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, @@ -131,7 +130,6 @@ export class DataAliasNestedController { @Param('projectName') projectName: string, @Param('tableName') tableName: string, @Param('refRowId') refRowId: string, - @Param('relationType') relationType: string, ) { await this.dataAliasNestedService.relationDataRemove({ columnName: columnName, @@ -158,7 +156,6 @@ export class DataAliasNestedController { @Param('projectName') projectName: string, @Param('tableName') tableName: string, @Param('refRowId') refRowId: string, - @Param('relationType') relationType: string, ) { await this.dataAliasNestedService.relationDataAdd({ columnName: columnName, diff --git a/packages/nocodb/src/controllers/data-alias.controller.ts b/packages/nocodb/src/controllers/data-alias.controller.ts index 296b0a12a8..b99348f07d 100644 --- a/packages/nocodb/src/controllers/data-alias.controller.ts +++ b/packages/nocodb/src/controllers/data-alias.controller.ts @@ -11,7 +11,6 @@ import { Response, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { parseHrtimeToSeconds } from '../helpers'; import { diff --git a/packages/nocodb/src/controllers/filters.controller.ts b/packages/nocodb/src/controllers/filters.controller.ts index dc09b0c705..b842c77834 100644 --- a/packages/nocodb/src/controllers/filters.controller.ts +++ b/packages/nocodb/src/controllers/filters.controller.ts @@ -9,14 +9,12 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { FilterReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { Acl, ExtractProjectIdMiddleware, - UseAclMiddleware, } from '../middlewares/extract-project-id/extract-project-id.middleware'; import { FiltersService } from '../services/filters.service'; diff --git a/packages/nocodb/src/controllers/form-columns.controller.ts b/packages/nocodb/src/controllers/form-columns.controller.ts index fbb77e3cfa..960db32ca8 100644 --- a/packages/nocodb/src/controllers/form-columns.controller.ts +++ b/packages/nocodb/src/controllers/form-columns.controller.ts @@ -1,5 +1,4 @@ import { Body, Controller, Param, Patch, UseGuards } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/galleries.controller.ts b/packages/nocodb/src/controllers/galleries.controller.ts index bc95f07070..a951ed84d6 100644 --- a/packages/nocodb/src/controllers/galleries.controller.ts +++ b/packages/nocodb/src/controllers/galleries.controller.ts @@ -9,7 +9,6 @@ import { UseGuards, } from '@nestjs/common'; import { GalleryUpdateReqType, ViewCreateReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/grid-columns.controller.ts b/packages/nocodb/src/controllers/grid-columns.controller.ts index b799f24308..39559f407c 100644 --- a/packages/nocodb/src/controllers/grid-columns.controller.ts +++ b/packages/nocodb/src/controllers/grid-columns.controller.ts @@ -1,6 +1,5 @@ import { Body, Controller, Get, Param, Patch, UseGuards } from '@nestjs/common'; import { GridColumnReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/grids.controller.ts b/packages/nocodb/src/controllers/grids.controller.ts index 9026764fec..2e2da806e8 100644 --- a/packages/nocodb/src/controllers/grids.controller.ts +++ b/packages/nocodb/src/controllers/grids.controller.ts @@ -8,7 +8,6 @@ import { UseGuards, } from '@nestjs/common'; import { ViewCreateReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/maps.controller.ts b/packages/nocodb/src/controllers/maps.controller.ts index 422118aee1..fd5c88d18c 100644 --- a/packages/nocodb/src/controllers/maps.controller.ts +++ b/packages/nocodb/src/controllers/maps.controller.ts @@ -9,7 +9,6 @@ import { UseGuards, } from '@nestjs/common'; import { MapUpdateReqType, ViewCreateReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/meta-diffs.controller.ts b/packages/nocodb/src/controllers/meta-diffs.controller.ts index 6e281d7bf7..5db317e786 100644 --- a/packages/nocodb/src/controllers/meta-diffs.controller.ts +++ b/packages/nocodb/src/controllers/meta-diffs.controller.ts @@ -6,7 +6,6 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/model-visibilities.controller.ts b/packages/nocodb/src/controllers/model-visibilities.controller.ts index dec2e45424..eaeb554110 100644 --- a/packages/nocodb/src/controllers/model-visibilities.controller.ts +++ b/packages/nocodb/src/controllers/model-visibilities.controller.ts @@ -8,7 +8,6 @@ import { Query, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/old-datas/old-datas.controller.ts b/packages/nocodb/src/controllers/old-datas/old-datas.controller.ts index 91ef73f480..eb299fc4a3 100644 --- a/packages/nocodb/src/controllers/old-datas/old-datas.controller.ts +++ b/packages/nocodb/src/controllers/old-datas/old-datas.controller.ts @@ -11,7 +11,6 @@ import { Response, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/plugins.controller.ts b/packages/nocodb/src/controllers/plugins.controller.ts index 59b5256cc1..4361ce2af3 100644 --- a/packages/nocodb/src/controllers/plugins.controller.ts +++ b/packages/nocodb/src/controllers/plugins.controller.ts @@ -14,11 +14,11 @@ import { Acl } from '../middlewares/extract-project-id/extract-project-id.middle import { PluginsService } from '../services/plugins.service'; // todo: move to a interceptor -const blockInCloudMw = (_req, res, next) => { - if (process.env.NC_CLOUD === 'true') { - res.status(403).send('Not allowed'); - } else next(); -}; +// const blockInCloudMw = (_req, res, next) => { +// if (process.env.NC_CLOUD === 'true') { +// res.status(403).send('Not allowed'); +// } else next(); +// }; @Controller() @UseGuards(GlobalGuard) diff --git a/packages/nocodb/src/controllers/project-users.controller.ts b/packages/nocodb/src/controllers/project-users.controller.ts index ca97e8b02c..4917f04704 100644 --- a/packages/nocodb/src/controllers/project-users.controller.ts +++ b/packages/nocodb/src/controllers/project-users.controller.ts @@ -11,7 +11,6 @@ import { UseGuards, } from '@nestjs/common'; import { ProjectUserReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/projects.controller.ts b/packages/nocodb/src/controllers/projects.controller.ts index 7b905cba2e..e8b07623b3 100644 --- a/packages/nocodb/src/controllers/projects.controller.ts +++ b/packages/nocodb/src/controllers/projects.controller.ts @@ -11,7 +11,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import isDocker from 'is-docker'; import { ProjectReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; @@ -19,7 +18,6 @@ import { PagedResponseImpl } from '../helpers/PagedResponse'; import { ExtractProjectIdMiddleware, UseAclMiddleware, - UseProjectIdMiddleware, } from '../middlewares/extract-project-id/extract-project-id.middleware'; import Noco from '../Noco'; import { packageVersion } from '../utils/packageVersion'; diff --git a/packages/nocodb/src/controllers/shared-bases.controller.ts b/packages/nocodb/src/controllers/shared-bases.controller.ts index 02d55bf444..404e934e2f 100644 --- a/packages/nocodb/src/controllers/shared-bases.controller.ts +++ b/packages/nocodb/src/controllers/shared-bases.controller.ts @@ -10,7 +10,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../guards/global/global.guard'; import { Acl, diff --git a/packages/nocodb/src/controllers/sorts.controller.ts b/packages/nocodb/src/controllers/sorts.controller.ts index 974d9b426c..5f5829fe67 100644 --- a/packages/nocodb/src/controllers/sorts.controller.ts +++ b/packages/nocodb/src/controllers/sorts.controller.ts @@ -9,7 +9,6 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { SortReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; diff --git a/packages/nocodb/src/controllers/tables.controller.ts b/packages/nocodb/src/controllers/tables.controller.ts index 2a214956a1..4b2f709f35 100644 --- a/packages/nocodb/src/controllers/tables.controller.ts +++ b/packages/nocodb/src/controllers/tables.controller.ts @@ -11,7 +11,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { TableReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import extractRolesObj from '../utils/extractRolesObj'; diff --git a/packages/nocodb/src/controllers/view-columns.controller.ts b/packages/nocodb/src/controllers/view-columns.controller.ts index a8b272ce40..92a757e927 100644 --- a/packages/nocodb/src/controllers/view-columns.controller.ts +++ b/packages/nocodb/src/controllers/view-columns.controller.ts @@ -8,8 +8,7 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { ColumnReqType, ViewColumnReqType } from 'nocodb-sdk'; -import { AuthGuard } from '@nestjs/passport'; +import { ViewColumnReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { diff --git a/packages/nocodb/src/db/BaseModelSql.ts b/packages/nocodb/src/db/BaseModelSql.ts index 5374056ec3..dc628fa321 100644 --- a/packages/nocodb/src/db/BaseModelSql.ts +++ b/packages/nocodb/src/db/BaseModelSql.ts @@ -1613,7 +1613,7 @@ class BaseModelSql extends BaseModel { } } - async nestedRead(id, { where, fields: fields1, f, ...rest }, trx = null) { + async nestedRead(id, { fields: fields1, f, ...rest }, trx = null) { rest = Object.assign({}, this.defaultNestedQueryParams, rest); const { hm: childs = '', bt: parents = '', mm: many = '' } = rest; @@ -1852,7 +1852,7 @@ class BaseModelSql extends BaseModel { return null; } // @ts-ignore - const { tn, cn, vtn, vcn, vrcn, rtn, rcn } = + const { vtn, vcn, vrcn, rtn, rcn } = this.manyToManyRelations.find(({ vtn }) => assoc === vtn) || {}; const childModel = this.dbModels[rtn]; @@ -1894,7 +1894,7 @@ class BaseModelSql extends BaseModel { return null; } // @ts-ignore - const { tn, cn, vtn, vcn, vrcn, rtn, rcn } = + const { vtn, vcn, vrcn, rtn, rcn } = this.manyToManyRelations.find(({ vtn }) => assoc === vtn) || {}; const childModel = this.dbModels[rtn]; diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 1d8dd24a1f..7d730abc0f 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -19,16 +19,7 @@ import DOMPurify from 'isomorphic-dompurify'; import { v4 as uuidv4 } from 'uuid'; import { NcError } from '../helpers/catchError'; import getAst from '../helpers/getAst'; -import { - Audit, - Base, - Column, - Filter, - Model, - Project, - Sort, - View, -} from '../models'; +import { Audit, Column, Filter, Model, Project, Sort, View } from '../models'; import { sanitize, unsanitize } from '../helpers/sqlSanitize'; import { COMPARISON_OPS, diff --git a/packages/nocodb/src/db/CustomKnex.ts b/packages/nocodb/src/db/CustomKnex.ts index c9c38a9bc9..6217bad256 100644 --- a/packages/nocodb/src/db/CustomKnex.ts +++ b/packages/nocodb/src/db/CustomKnex.ts @@ -1,6 +1,6 @@ import { Knex, knex } from 'knex'; import { SnowflakeClient } from 'nc-help'; -import pg, { types } from 'pg'; +import { types } from 'pg'; import dayjs from 'dayjs'; import Filter from '../models/Filter'; import type { FilterType } from 'nocodb-sdk'; diff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.ts index 810c4ec05e..4234c91a08 100644 --- a/packages/nocodb/src/db/conditionV2.ts +++ b/packages/nocodb/src/db/conditionV2.ts @@ -1,5 +1,5 @@ import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk'; -import dayjs, { extend } from 'dayjs'; +import dayjs from 'dayjs'; // import customParseFormat from 'dayjs/plugin/customParseFormat.js'; import Filter from '../models/Filter'; import { sanitize } from '../helpers/sqlSanitize'; diff --git a/packages/nocodb/src/db/sql-client/lib/SqlClientFactory.ts b/packages/nocodb/src/db/sql-client/lib/SqlClientFactory.ts index 7426582c1b..a15514c839 100644 --- a/packages/nocodb/src/db/sql-client/lib/SqlClientFactory.ts +++ b/packages/nocodb/src/db/sql-client/lib/SqlClientFactory.ts @@ -1,7 +1,5 @@ import fs from 'fs'; import { promisify } from 'util'; -import Noco from '../../../Noco'; -import SqlClientFactoryEE from './ee/SqlClientFactoryEE'; import MySqlClient from './mysql/MysqlClient'; import MssqlClient from './mssql/MssqlClient'; import OracleClient from './oracle/OracleClient'; diff --git a/packages/nocodb/src/interceptors/is-upload-allowed/is-upload-allowed.interceptor.ts b/packages/nocodb/src/interceptors/is-upload-allowed/is-upload-allowed.interceptor.ts index c3e8c75dcf..99c0f09e5a 100644 --- a/packages/nocodb/src/interceptors/is-upload-allowed/is-upload-allowed.interceptor.ts +++ b/packages/nocodb/src/interceptors/is-upload-allowed/is-upload-allowed.interceptor.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk'; -import { throwError } from 'rxjs'; import { NcError } from '../../helpers/catchError'; import Noco from '../../Noco'; import extractRolesObj from '../../utils/extractRolesObj'; diff --git a/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts b/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts index 56e3e56d50..52f9cf9cc6 100644 --- a/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts +++ b/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts @@ -1,10 +1,7 @@ -import { promisify } from 'util'; import { Injectable, SetMetadata, UseInterceptors } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; -import { NextFunction, Request, Response } from 'express'; import { OrgUserRoles } from 'nocodb-sdk'; -import passport from 'passport'; -import { map, throwError } from 'rxjs'; +import { map } from 'rxjs'; import { Column, Filter, @@ -19,8 +16,7 @@ import { } from '../../models'; import extractRolesObj from '../../utils/extractRolesObj'; import projectAcl from '../../utils/projectAcl'; -import catchError, { NcError } from '../catchError'; -import extractProjectIdAndAuthenticate from '../extractProjectIdAndAuthenticate'; +import { NcError } from '../catchError'; import type { Observable } from 'rxjs'; import type { CallHandler, diff --git a/packages/nocodb/src/models/Model.ts b/packages/nocodb/src/models/Model.ts index d12427d846..751ae8a438 100644 --- a/packages/nocodb/src/models/Model.ts +++ b/packages/nocodb/src/models/Model.ts @@ -471,7 +471,6 @@ export default class Model implements TableType { knex, ) { const insertObj = {}; - const base = await Base.get(this.base_id); for (const col of await this.getColumns()) { if (isVirtualCol(col)) continue; let val = diff --git a/packages/nocodb/src/modules/datas/helpers.ts b/packages/nocodb/src/modules/datas/helpers.ts index 271535c9a6..4718d78dc9 100644 --- a/packages/nocodb/src/modules/datas/helpers.ts +++ b/packages/nocodb/src/modules/datas/helpers.ts @@ -12,7 +12,6 @@ import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2'; import type { BaseModelSqlv2 } from '../../db/BaseModelSqlv2'; import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn'; import type LookupColumn from '../../models/LookupColumn'; -import type { Request } from 'express'; export interface PathParams { projectName: string; diff --git a/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/readAndProcessData.ts b/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/readAndProcessData.ts index 2bd3d627c6..c6882a06e8 100644 --- a/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/readAndProcessData.ts +++ b/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/readAndProcessData.ts @@ -21,14 +21,12 @@ async function readAllData({ fields, base, logBasic = (_str) => {}, - services, }: { table: { title?: string }; fields?; base: AirtableBase; logBasic?: (string) => void; logDetailed?: (string) => void; - services: AirtableImportContext; }): Promise { return new Promise((resolve, reject) => { let data = null; diff --git a/packages/nocodb/src/modules/users/users.module.ts b/packages/nocodb/src/modules/users/users.module.ts index bb1da81911..7ee9dc9432 100644 --- a/packages/nocodb/src/modules/users/users.module.ts +++ b/packages/nocodb/src/modules/users/users.module.ts @@ -1,9 +1,6 @@ import { Module } from '@nestjs/common'; import { PassportModule } from '@nestjs/passport'; -import { - GoogleStrategy, - GoogleStrategyProvider, -} from '../../strategies/google.strategy/google.strategy'; +import { GoogleStrategyProvider } from '../../strategies/google.strategy/google.strategy'; import { GlobalModule } from '../global/global.module'; import { UsersService } from '../../services/users/users.service'; import { UsersController } from '../../controllers/users/users.controller'; diff --git a/packages/nocodb/src/run/docker.ts b/packages/nocodb/src/run/docker.ts index d0b513dbd6..a1b2634d57 100644 --- a/packages/nocodb/src/run/docker.ts +++ b/packages/nocodb/src/run/docker.ts @@ -1,4 +1,3 @@ -import axios from 'axios'; import cors from 'cors'; import express from 'express'; import Noco from '../Noco'; diff --git a/packages/nocodb/src/run/dockerRunPG_CyQuick.ts b/packages/nocodb/src/run/dockerRunPG_CyQuick.ts index a8429f4ffc..c8a8131280 100644 --- a/packages/nocodb/src/run/dockerRunPG_CyQuick.ts +++ b/packages/nocodb/src/run/dockerRunPG_CyQuick.ts @@ -1,7 +1,6 @@ import cors from 'cors'; import express from 'express'; import Noco from '../Noco'; -import nocobuild from '../nocobuild'; const server = express(); server.enable('trust proxy'); diff --git a/packages/nocodb/src/services/bulk-data-alias.service.ts b/packages/nocodb/src/services/bulk-data-alias.service.ts index cc77470b23..bf65ef44a6 100644 --- a/packages/nocodb/src/services/bulk-data-alias.service.ts +++ b/packages/nocodb/src/services/bulk-data-alias.service.ts @@ -1,8 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { isSystemColumn, UITypes } from 'nocodb-sdk'; -import * as XLSX from 'xlsx'; -import { NcError } from '../helpers/catchError'; -import { Base, Column, Model, Project, View } from '../models'; +import { Base, Model } from '../models'; import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; import { getViewAndModelByAliasOrId } from '../modules/datas/helpers'; import type { PathParams } from '../modules/datas/helpers'; diff --git a/packages/nocodb/src/services/public-metas.service.ts b/packages/nocodb/src/services/public-metas.service.ts index 0073502bba..59ad1ef7e5 100644 --- a/packages/nocodb/src/services/public-metas.service.ts +++ b/packages/nocodb/src/services/public-metas.service.ts @@ -3,7 +3,6 @@ import { ErrorMessages, RelationTypes, UITypes } from 'nocodb-sdk'; import { NcError } from '../helpers/catchError'; import { Base, Column, Model, Project, View } from '../models'; import type { LinkToAnotherRecordColumn, LookupColumn } from '../models'; -import type { LinkToAnotherRecordType } from 'nocodb-sdk'; @Injectable() export class PublicMetasService { diff --git a/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts b/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts index 6bd3fccba6..c32598e8ed 100644 --- a/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts +++ b/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts @@ -1,4 +1,3 @@ -import debug from 'debug'; import { Router } from 'express'; import GqlXcSchemaFactory from '../../../db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory'; import BaseApiBuilder from '../BaseApiBuilder'; diff --git a/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts b/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts index 7d4dc726b6..918869c37b 100644 --- a/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts +++ b/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts @@ -1,17 +1,14 @@ -import debug from 'debug'; import autoBind from 'auto-bind'; import SwaggerXc from '../../../db/sql-mgr/code/routers/xc-ts/SwaggerXc'; import ExpressXcTsRoutes from '../../../db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes'; import NcHelp from '../../../utils/NcHelp'; -import BaseApiBuilder, { XcTablesPopulateParams } from '../BaseApiBuilder'; +import BaseApiBuilder from '../BaseApiBuilder'; import type { MetaService } from '../../../meta/meta.service'; import type Noco from '../../../Noco'; import type { Router } from 'express'; import type { DbConfig, NcConfig } from '../../../interface/config'; import type NcProjectBuilder from '../NcProjectBuilder'; -const log = debug('nc:api:rest'); - export class RestApiBuilder extends BaseApiBuilder { public readonly type = 'rest';