From 4c6aaa292faf824c3bc66642fa9fa6b4d86a29ce Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 9 Mar 2023 16:55:20 +0800 Subject: [PATCH] refactor(nocodb): import --- packages/nocodb/src/lib/Noco.ts | 3 --- packages/nocodb/src/lib/controllers/base.ctl.ts | 1 - .../nocodb/src/lib/controllers/dbData/helpers.ts | 3 +-- packages/nocodb/src/lib/controllers/filter.ctl.ts | 1 - packages/nocodb/src/lib/controllers/project.ctl.ts | 1 - packages/nocodb/src/lib/controllers/sort.ctl.ts | 1 - .../src/lib/controllers/user/initStrategies.ts | 12 ++++++------ .../nocodb/src/lib/controllers/user/user.ctl.ts | 1 - packages/nocodb/src/lib/controllers/util.ctl.ts | 1 - .../nocodb/src/lib/db/sql-client/lib/KnexClient.ts | 2 +- .../src/lib/db/sql-client/lib/mysql/MysqlClient.ts | 3 --- .../src/lib/db/sql-client/lib/mysql/TidbClient.ts | 3 +-- .../src/lib/db/sql-client/lib/mysql/VitessClient.ts | 3 +-- .../nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts | 2 +- .../db/sql-client/lib/snowflake/SnowflakeClient.ts | 2 +- packages/nocodb/src/lib/db/sql-data-mapper/index.ts | 5 ++--- .../lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts | 1 - .../db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 1 - .../lib/db/sql-data-mapper/lib/sql/CustomKnex.ts | 1 - packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts | 6 +----- .../nocodb/src/lib/db/sql-mgr/code/BaseRender.ts | 13 ------------- .../code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts | 2 -- .../db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts | 1 - .../lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts | 1 - .../src/lib/db/sql-migrator/lib/KnexMigrator.ts | 2 -- .../src/lib/db/sql-migrator/lib/KnexMigratorv2.ts | 8 ++------ .../lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts | 1 - packages/nocodb/src/lib/db/util/FileCollection.ts | 1 - packages/nocodb/src/lib/meta/NcMetaIOImpl.ts | 5 +---- packages/nocodb/src/lib/meta/NcMetaMgr.ts | 4 ++-- packages/nocodb/src/lib/meta/NcMetaMgrEE.ts | 1 - packages/nocodb/src/lib/meta/NcMetaMgrv2.ts | 2 -- packages/nocodb/src/lib/meta/api/index.ts | 2 -- .../meta/helpers/extractProjectIdAndAuthenticate.ts | 1 - .../src/lib/plugins/backblaze/BackblazePlugin.ts | 1 - .../nocodb/src/lib/plugins/discord/DiscordPlugin.ts | 1 - packages/nocodb/src/lib/plugins/gcs/GcsPlugin.ts | 1 - .../lib/plugins/linode/LinodeObjectStoragePlugin.ts | 1 - .../nocodb/src/lib/plugins/mailerSend/MailerSend.ts | 1 - .../src/lib/plugins/mailerSend/MailerSendPlugin.ts | 1 - .../src/lib/plugins/mattermost/MattermostPlugin.ts | 1 - packages/nocodb/src/lib/plugins/mino/MinioPlugin.ts | 1 - .../src/lib/plugins/ovhCloud/OvhCloudPlugin.ts | 1 - packages/nocodb/src/lib/plugins/s3/S3Plugin.ts | 1 - .../plugins/scaleway/ScalewayObjectStoragePlugin.ts | 1 - packages/nocodb/src/lib/plugins/ses/SESPlugin.ts | 1 - .../nocodb/src/lib/plugins/slack/SlackPlugin.ts | 1 - packages/nocodb/src/lib/plugins/smtp/SMTP.ts | 1 - packages/nocodb/src/lib/plugins/smtp/SMTPPlugin.ts | 1 - .../nocodb/src/lib/plugins/spaces/SpacesPlugin.ts | 1 - .../nocodb/src/lib/plugins/teams/TeamsPlugin.ts | 1 - .../nocodb/src/lib/plugins/twilio/TwilioPlugin.ts | 1 - .../plugins/twilioWhatsapp/TwilioWhatsappPlugin.ts | 1 - .../nocodb/src/lib/plugins/upcloud/UpCloudPlugin.ts | 1 - .../nocodb/src/lib/plugins/vultr/VultrPlugin.ts | 1 - packages/nocodb/src/lib/services/column.svc.ts | 1 - packages/nocodb/src/lib/services/hook.svc.ts | 1 - packages/nocodb/src/lib/services/metaDiff.svc.ts | 2 -- .../nocodb/src/lib/services/sync/helpers/job.ts | 5 ----- .../TestResetService/resetMysqlSakilaProject.ts | 1 - .../test/TestResetService/resetPgSakilaProject.ts | 4 ---- packages/nocodb/src/lib/services/user/index.ts | 2 -- .../src/lib/services/user/initAdminFromEnv.ts | 2 +- packages/nocodb/src/lib/services/util.svc.ts | 1 - packages/nocodb/src/lib/utils/Lang.ts | 1 - packages/nocodb/src/lib/utils/NcConfigFactory.ts | 1 - .../nocodb/src/lib/utils/common/BaseApiBuilder.ts | 12 +----------- .../nocodb/src/lib/utils/common/BaseProcedure.ts | 1 - .../nocodb/src/lib/utils/common/NcConnectionMgr.ts | 1 - packages/nocodb/src/lib/utils/common/XcCron.ts | 4 ---- .../nocodb/src/lib/v1-legacy/NcProjectBuilder.ts | 3 --- .../nocodb/src/lib/v1-legacy/gql/GqlApiBuilder.ts | 2 -- .../nocodb/src/lib/v1-legacy/gql/GqlAuthResolver.ts | 6 +++--- .../nocodb/src/lib/v1-legacy/gql/GqlMiddleware.ts | 1 - .../src/lib/v1-legacy/gql/GqlProcedureResolver.ts | 2 -- .../nocodb/src/lib/v1-legacy/gql/GqlResolver.ts | 1 - packages/nocodb/src/lib/v1-legacy/nc.try.ts | 2 -- .../nocodb/src/lib/v1-legacy/plugins/NcPluginMgr.ts | 2 -- .../lib/v1-legacy/plugins/adapters/email/SMTP.ts | 1 - .../lib/v1-legacy/plugins/adapters/storage/Local.ts | 2 -- packages/nocodb/src/lib/v1-legacy/plugins/ses.ts | 1 - .../nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts | 9 +-------- .../nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts | 5 +++-- .../nocodb/src/lib/v1-legacy/rest/RestAuthCtrlEE.ts | 2 -- .../nocodb/src/lib/v1-legacy/rest/RestBaseCtrl.ts | 1 - packages/nocodb/src/lib/v1-legacy/rest/RestCtrl.ts | 2 -- .../src/lib/v1-legacy/rest/RestCtrlBelongsTo.ts | 1 - .../nocodb/src/lib/v1-legacy/rest/RestCtrlCustom.ts | 1 - .../src/lib/v1-legacy/rest/RestCtrlHasMany.ts | 1 - .../nocodb/src/lib/v1-legacy/rest/RestCtrlMin.ts | 1 - .../src/lib/v1-legacy/rest/RestCtrlProcedure.ts | 2 -- .../nocodb/src/lib/v1-legacy/rest/RestCtrlv2.ts | 2 -- .../nocodb/src/lib/version-upgrader/NcUpgrader.ts | 2 +- packages/nocodb/src/run/docker.ts | 1 - packages/nocodb/src/run/dockerRunMysql.ts | 1 - packages/nocodb/src/run/dockerRunPG.ts | 1 - packages/nocodb/src/run/dockerRunPG_CyQuick.ts | 1 - packages/nocodb/src/run/testDocker.ts | 2 +- packages/nocodb/src/run/try.ts | 1 - packages/nocodb/tests/unit/index.test.ts | 1 - packages/nocodb/tests/unit/init/cleanupSakila.ts | 1 - packages/nocodb/tests/unit/init/index.ts | 1 - 102 files changed, 31 insertions(+), 188 deletions(-) diff --git a/packages/nocodb/src/lib/Noco.ts b/packages/nocodb/src/lib/Noco.ts index 4b7f9ca900..85c6ff8b61 100644 --- a/packages/nocodb/src/lib/Noco.ts +++ b/packages/nocodb/src/lib/Noco.ts @@ -2,7 +2,6 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; - import * as Sentry from '@sentry/node'; import bodyParser from 'body-parser'; import clear from 'clear'; @@ -14,14 +13,12 @@ import morgan from 'morgan'; import NcToolGui from 'nc-lib-gui'; import requestIp from 'request-ip'; import { v4 as uuidv4 } from 'uuid'; - import { T } from 'nc-help'; import mkdirp from 'mkdirp'; import { NC_LICENSE_KEY } from './constants'; import Migrator from './db/sql-migrator/lib/KnexMigrator'; import Store from './models/Store'; import NcConfigFactory from './utils/NcConfigFactory'; - import NcProjectBuilderCE from './v1-legacy/NcProjectBuilder'; import NcProjectBuilderEE from './v1-legacy/NcProjectBuilderEE'; import NcMetaImplCE from './meta/NcMetaIOImpl'; diff --git a/packages/nocodb/src/lib/controllers/base.ctl.ts b/packages/nocodb/src/lib/controllers/base.ctl.ts index ad3e459bd0..3c9f11b760 100644 --- a/packages/nocodb/src/lib/controllers/base.ctl.ts +++ b/packages/nocodb/src/lib/controllers/base.ctl.ts @@ -1,7 +1,6 @@ import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import { metaApiMetrics } from '../meta/helpers/apiMetrics'; - import { baseService } from '../services'; import type Base from '../models/Base'; import type { BaseListType } from 'nocodb-sdk'; diff --git a/packages/nocodb/src/lib/controllers/dbData/helpers.ts b/packages/nocodb/src/lib/controllers/dbData/helpers.ts index 1004947829..f36b91be38 100644 --- a/packages/nocodb/src/lib/controllers/dbData/helpers.ts +++ b/packages/nocodb/src/lib/controllers/dbData/helpers.ts @@ -7,13 +7,12 @@ import Model from '../../models/Model'; import View from '../../models/View'; import Base from '../../models/Base'; import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2'; - import Column from '../../models/Column'; import { dataService } from '../../services'; import type LookupColumn from '../../models/LookupColumn'; import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn'; - import type { Request } from 'express'; + export async function getViewAndModelFromRequestByAliasOrId( req: | Request<{ projectName: string; tableName: string; viewName?: string }> diff --git a/packages/nocodb/src/lib/controllers/filter.ctl.ts b/packages/nocodb/src/lib/controllers/filter.ctl.ts index 0423904649..090a19b7dd 100644 --- a/packages/nocodb/src/lib/controllers/filter.ctl.ts +++ b/packages/nocodb/src/lib/controllers/filter.ctl.ts @@ -1,7 +1,6 @@ import { Router } from 'express'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import { metaApiMetrics } from '../meta/helpers/apiMetrics'; - import { filterService } from '../services'; import type { FilterReqType } from 'nocodb-sdk'; import type { Request, Response } from 'express'; diff --git a/packages/nocodb/src/lib/controllers/project.ctl.ts b/packages/nocodb/src/lib/controllers/project.ctl.ts index da626329c3..65132f9600 100644 --- a/packages/nocodb/src/lib/controllers/project.ctl.ts +++ b/packages/nocodb/src/lib/controllers/project.ctl.ts @@ -9,7 +9,6 @@ import Noco from '../Noco'; import Project from '../models/Project'; import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import Filter from '../models/Filter'; - import { projectService } from '../services'; import type { ProjectListType } from 'nocodb-sdk'; import type { ProjectType } from 'nocodb-sdk'; diff --git a/packages/nocodb/src/lib/controllers/sort.ctl.ts b/packages/nocodb/src/lib/controllers/sort.ctl.ts index 24d071aa0d..e39f727d78 100644 --- a/packages/nocodb/src/lib/controllers/sort.ctl.ts +++ b/packages/nocodb/src/lib/controllers/sort.ctl.ts @@ -2,7 +2,6 @@ import { Router } from 'express'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import { metaApiMetrics } from '../meta/helpers/apiMetrics'; - import { sortService } from '../services'; import type { SortListType, SortReqType } from 'nocodb-sdk'; import type { Request, Response } from 'express'; diff --git a/packages/nocodb/src/lib/controllers/user/initStrategies.ts b/packages/nocodb/src/lib/controllers/user/initStrategies.ts index 4d9ac6466f..1804789d76 100644 --- a/packages/nocodb/src/lib/controllers/user/initStrategies.ts +++ b/packages/nocodb/src/lib/controllers/user/initStrategies.ts @@ -5,6 +5,12 @@ import passport from 'passport'; import passportJWT from 'passport-jwt'; import { Strategy as AuthTokenStrategy } from 'passport-auth-token'; import { Strategy as GoogleStrategy } from 'passport-google-oauth20'; +import bcrypt from 'bcryptjs'; +import NocoCache from '../../cache/NocoCache'; +import { ApiToken, Plugin, Project, ProjectUser, User } from '../../models'; +import Noco from '../../Noco'; +import { CacheGetType, CacheScope } from '../../utils/globals'; +import { userService } from '../../services'; const ExtractJwt = passportJWT.ExtractJwt; const JwtStrategy = passportJWT.Strategy; @@ -13,12 +19,6 @@ const jwtOptions = { jwtFromRequest: ExtractJwt.fromHeader('xc-auth'), }; -import bcrypt from 'bcryptjs'; -import NocoCache from '../../cache/NocoCache'; -import { ApiToken, Plugin, Project, ProjectUser, User } from '../../models'; -import Noco from '../../Noco'; -import { CacheGetType, CacheScope } from '../../utils/globals'; -import { userService } from '../../services'; const PassportLocalStrategy = require('passport-local').Strategy; export function initStrategies(router): void { diff --git a/packages/nocodb/src/lib/controllers/user/user.ctl.ts b/packages/nocodb/src/lib/controllers/user/user.ctl.ts index 86b2eeeefe..84d108e2e5 100644 --- a/packages/nocodb/src/lib/controllers/user/user.ctl.ts +++ b/packages/nocodb/src/lib/controllers/user/user.ctl.ts @@ -1,6 +1,5 @@ import { promisify } from 'util'; import * as ejs from 'ejs'; - import passport from 'passport'; import catchError, { NcError } from '../../meta/helpers/catchError'; import extractProjectIdAndAuthenticate from '../../meta/helpers/extractProjectIdAndAuthenticate'; diff --git a/packages/nocodb/src/lib/controllers/util.ctl.ts b/packages/nocodb/src/lib/controllers/util.ctl.ts index 79fd64bebe..474011f3ae 100644 --- a/packages/nocodb/src/lib/controllers/util.ctl.ts +++ b/packages/nocodb/src/lib/controllers/util.ctl.ts @@ -1,4 +1,3 @@ -// // Project CRUD import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import catchError from '../meta/helpers/catchError'; import { utilService } from '../services'; diff --git a/packages/nocodb/src/lib/db/sql-client/lib/KnexClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/KnexClient.ts index 319885de78..fdd9b27cac 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/KnexClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/KnexClient.ts @@ -4,7 +4,6 @@ import { promisify } from 'util'; import path from 'path'; import { knex } from 'knex'; import { T } from 'nc-help'; - import findIndex from 'lodash/findIndex'; import find from 'lodash/find'; import jsonfile from 'jsonfile'; @@ -15,6 +14,7 @@ import Debug from '../../util/Debug'; import * as dataHelp from './data.helper'; import SqlClient from './SqlClient'; import type { Knex } from 'knex'; + const evt = new Emit(); const log = new Debug('KnexClient'); diff --git a/packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts index 1b223bd0bf..320f384c8d 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts @@ -1,7 +1,6 @@ import path from 'path'; import { promisify } from 'util'; import knex from 'knex'; - import isEmpty from 'lodash/isEmpty'; import mapKeys from 'lodash/mapKeys'; import find from 'lodash/find'; @@ -12,10 +11,8 @@ import levenshtein from 'fast-levenshtein'; import Debug from '../../../util/Debug'; import Emit from '../../../util/emit'; import Result from '../../../util/Result'; - import KnexClient from '../KnexClient'; import queries from './mysql.queries'; - import fakerFunctionList from './fakerFunctionList'; import * as findDataType from './findDataTypeMapping'; diff --git a/packages/nocodb/src/lib/db/sql-client/lib/mysql/TidbClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/mysql/TidbClient.ts index 924caf239b..25b6c1f37f 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/mysql/TidbClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/mysql/TidbClient.ts @@ -1,11 +1,10 @@ import _ from 'lodash'; import Debug from '../../../util/Debug'; import Result from '../../../util/Result'; +import MysqlClient from './MysqlClient'; const log = new Debug('TidbClient'); -import MysqlClient from './MysqlClient'; - class Tidb extends MysqlClient { /** * diff --git a/packages/nocodb/src/lib/db/sql-client/lib/mysql/VitessClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/mysql/VitessClient.ts index 17b9a7188c..4387d0e55b 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/mysql/VitessClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/mysql/VitessClient.ts @@ -1,11 +1,10 @@ import _ from 'lodash'; import Debug from '../../../util/Debug'; import Result from '../../../util/Result'; +import MysqlClient from './MysqlClient'; const log = new Debug('VitessClient'); -import MysqlClient from './MysqlClient'; - class Vitess extends MysqlClient { constructor(connectionConfig: any) { super(connectionConfig); diff --git a/packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts index 1bc509ccbc..aa26cbe8d8 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts @@ -1,5 +1,4 @@ import { nanoid } from 'nanoid'; - import knex from 'knex'; import isEmpty from 'lodash/isEmpty'; import mapKeys from 'lodash/mapKeys'; @@ -8,6 +7,7 @@ import KnexClient from '../KnexClient'; import Debug from '../../../util/Debug'; import Result from '../../../util/Result'; import queries from './pg.queries'; + const log = new Debug('PGClient'); class PGClient extends KnexClient { diff --git a/packages/nocodb/src/lib/db/sql-client/lib/snowflake/SnowflakeClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/snowflake/SnowflakeClient.ts index f364e16fcd..0f6dc11f62 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/snowflake/SnowflakeClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/snowflake/SnowflakeClient.ts @@ -1,11 +1,11 @@ import { nanoid } from 'nanoid'; - import _ from 'lodash'; import lodash from 'lodash'; import KnexClient from '../KnexClient'; import Debug from '../../../util/Debug'; import Result from '../../../util/Result'; import queries from './snowflake.queries'; + const log = new Debug('SnowflakeClient'); const rowsToLower = (arr) => { diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/index.ts b/packages/nocodb/src/lib/db/sql-data-mapper/index.ts index a29d7231d3..67cc8e3a91 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/index.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/index.ts @@ -1,6 +1,5 @@ -export { DbFactory } from './lib/DbFactory'; -export { BaseModelSql } from './lib/sql/BaseModelSql'; - import XKnex, { Knex } from './lib/sql/CustomKnex'; +export { DbFactory } from './lib/DbFactory'; +export { BaseModelSql } from './lib/sql/BaseModelSql'; export { XKnex, Knex }; diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts index 34a20c4c27..0f394b6bf9 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts @@ -1,7 +1,6 @@ import autoBind from 'auto-bind'; import _ from 'lodash'; import Validator from 'validator'; - import Papaparse from 'papaparse'; import BaseModel from '../BaseModel'; import formulaQueryBuilder from './formulaQueryBuilderFromString'; diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index e5902ab23c..9f777a217a 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -1,6 +1,5 @@ import autoBind from 'auto-bind'; import _ from 'lodash'; - import DataLoader from 'dataloader'; import { AuditOperationSubTypes, diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts index 891e7b2675..8918e29b1d 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts @@ -2,7 +2,6 @@ import { Knex, knex } from 'knex'; import { SnowflakeClient } from 'nc-help'; import Filter from '../../../../models/Filter'; import type { FilterType } from 'nocodb-sdk'; - import type { BaseModelSql } from './BaseModelSql'; const types = require('pg').types; diff --git a/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts b/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts index 02933d1297..ac88e04e4b 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts @@ -2,7 +2,6 @@ import fs from 'fs'; import path from 'path'; import url from 'url'; import { promisify } from 'util'; - import fsExtra from 'fs-extra'; import importFresh from 'import-fresh'; import inflection from 'inflection'; @@ -10,14 +9,10 @@ import slash from 'slash'; import { T } from 'nc-help'; import { customAlphabet } from 'nanoid'; import SqlClientFactory from '../sql-client/lib/SqlClientFactory'; -// import debug from 'debug'; - import KnexMigrator from '../sql-migrator/lib/KnexMigrator'; -// import {XKnex} from "../sql-data-mapper"; import NcConnectionMgr from '../../utils/common/NcConnectionMgr'; import Debug from '../util/Debug'; import Result from '../util/Result'; - import type MssqlClient from '../sql-client/lib/mssql/MssqlClient'; import type MysqlClient from '../sql-client/lib/mysql/MysqlClient'; import type OracleClient from '../sql-client/lib/oracle/OracleClient'; @@ -26,6 +21,7 @@ import type SnowflakeClient from '../sql-client/lib/snowflake/SnowflakeClient'; import type SqliteClient from '../sql-client/lib/sqlite/SqliteClient'; const randomID = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 20); + const log = new Debug('SqlMgr'); const ToolOps = { diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/BaseRender.ts b/packages/nocodb/src/lib/db/sql-mgr/code/BaseRender.ts index a73b348acc..fb033c755c 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/code/BaseRender.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/code/BaseRender.ts @@ -1,16 +1,3 @@ -// import path from "path"; -// import mkdirp from "mkdirp"; -// import {promisify} from "util"; -// -// import ejs from "ejs"; -// import fs from "fs"; -// import js_beautify from "js-beautify"; -// import fsExtra from "fs-extra"; -// import md5 from "md5"; -// import dayjs from "dayjs";import Emit from "../../sql-migrator/util/emit"; - -// const beautify = js_beautify.js; - import Debug from '../../util/Debug'; import Emit from '../../util/emit'; diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts b/packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts index e9b6e47500..2e6de93b6b 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts @@ -1,7 +1,5 @@ import lodash from 'lodash'; - import BaseRender from '../../BaseRender'; - import { AGG_DEFAULT_COLS, GROUPBY_DEFAULT_COLS } from './schemaHelp'; abstract class BaseGqlXcTsSchema extends BaseRender { diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts b/packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts index d7f867d00a..e896b3da50 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts @@ -1,5 +1,4 @@ import lodash from 'lodash'; - import BaseRender from '../../BaseRender'; import type { Acl } from '../../../../../../interface/config'; diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts b/packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts index 44ac2e238c..7586be33df 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts @@ -1,5 +1,4 @@ import BaseRender from '../../BaseRender'; - import SwaggerTypes from './SwaggerTypes'; class SwaggerXc extends BaseRender { diff --git a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts index c1baacf17f..044f07b3d0 100644 --- a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts +++ b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; - import glob from 'glob'; import Handlebars from 'handlebars'; import mkdirp from 'mkdirp'; @@ -11,7 +10,6 @@ import Debug from '../../util/Debug'; import Emit from '../../util/emit'; import Result from '../../util/Result'; import * as fileHelp from '../../util/file.help'; - import NcConfigFactory from '../../../utils/NcConfigFactory'; import SqlMigrator from './SqlMigrator'; diff --git a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts index 758861a093..e17e555ee3 100644 --- a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts +++ b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts @@ -1,17 +1,11 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; - import glob from 'glob'; import SqlClientFactory from '../../sql-client/lib/SqlClientFactory'; import Debug from '../../util/Debug'; import Emit from '../../util/emit'; -// import Handlebars from 'handlebars'; -// import mkdirp from 'mkdirp'; import * as fileHelp from '../../util/file.help'; - -// import SqlMigrator from './SqlMigrator'; -// import NcConfigFactory from '../../../utils/NcConfigFactory'; import Noco from '../../../Noco'; import Project from '../../../models/Project'; import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2'; @@ -21,7 +15,9 @@ import type { XKnex } from '../../sql-data-mapper'; import type { Knex } from 'knex'; const evt = new Emit(); + const log = new Debug('KnexMigrator'); + const NC_MIGRATION = 'nc_migrations'; /** * Class to create an instance of KnexMigrator diff --git a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts index af3426ea69..e579fe5650 100644 --- a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts +++ b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts @@ -10,7 +10,6 @@ import KnexMigratorv2 from './KnexMigratorv2'; import type Base from '../../../models/Base'; import type { XKnex } from '../../sql-data-mapper'; import type NcMetaIO from '../../../meta/NcMetaIO'; - import type MssqlClient from '../../sql-client/lib/mssql/MssqlClient'; import type MysqlClient from '../../sql-client/lib/mysql/MysqlClient'; import type OracleClient from '../../sql-client/lib/oracle/OracleClient'; diff --git a/packages/nocodb/src/lib/db/util/FileCollection.ts b/packages/nocodb/src/lib/db/util/FileCollection.ts index f2c77e6df7..2b82ca58c8 100644 --- a/packages/nocodb/src/lib/db/util/FileCollection.ts +++ b/packages/nocodb/src/lib/db/util/FileCollection.ts @@ -1,6 +1,5 @@ import fs from 'fs'; import { promisify } from 'util'; - import jsonfile from 'jsonfile'; export default class FileCollection { diff --git a/packages/nocodb/src/lib/meta/NcMetaIOImpl.ts b/packages/nocodb/src/lib/meta/NcMetaIOImpl.ts index 2e4e630416..31000760c6 100644 --- a/packages/nocodb/src/lib/meta/NcMetaIOImpl.ts +++ b/packages/nocodb/src/lib/meta/NcMetaIOImpl.ts @@ -1,9 +1,7 @@ import CryptoJS from 'crypto-js'; import { customAlphabet } from 'nanoid'; - import { XKnex } from '../db/sql-data-mapper'; import XcMigrationSource from '../migrations/XcMigrationSource'; - import NcConnectionMgr from '../utils/common/NcConnectionMgr'; import { MetaTable } from '../utils/globals'; import XcMigrationSourcev2 from '../migrations/XcMigrationSourcev2'; @@ -12,9 +10,8 @@ import type Noco from '../Noco'; import type { Knex } from '../db/sql-data-mapper'; import type { NcConfig } from '../../interface/config'; -// import { nanoid } from 'nanoid'; -/*import { v4 as uuidv4 } from 'uuid';*/ const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 4); + const nanoidv2 = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 14); export default class NcMetaIOImpl extends NcMetaIO { diff --git a/packages/nocodb/src/lib/meta/NcMetaMgr.ts b/packages/nocodb/src/lib/meta/NcMetaMgr.ts index 2a9c166585..3ee7f1a03f 100644 --- a/packages/nocodb/src/lib/meta/NcMetaMgr.ts +++ b/packages/nocodb/src/lib/meta/NcMetaMgr.ts @@ -3,7 +3,6 @@ import path from 'path'; import { promisify } from 'util'; import CryptoJS from 'crypto-js'; import mkdirp from 'mkdirp'; - import archiver from 'archiver'; import axios from 'axios'; import bodyParser from 'body-parser'; @@ -18,7 +17,6 @@ import { ncp } from 'ncp'; import { UITypes } from 'nocodb-sdk'; import { T } from 'nc-help'; import { Result } from '../../interface/config'; - import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory'; import { NcConfigFactory } from '../index'; import ProjectMgr from '../db/sql-mgr/ProjectMgr'; @@ -46,7 +44,9 @@ import type IStorageAdapter from '../../interface/IStorageAdapter'; import type IEmailAdapter from '../../interface/IEmailAdapter'; import type express from 'express'; import type { Handler } from 'express'; + const randomID = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 10); + const XC_PLUGIN_DET = 'XC_PLUGIN_DET'; const NOCO_RELEASE = 'NOCO_RELEASE'; diff --git a/packages/nocodb/src/lib/meta/NcMetaMgrEE.ts b/packages/nocodb/src/lib/meta/NcMetaMgrEE.ts index c0e10ec8ab..c9c02aeb4c 100644 --- a/packages/nocodb/src/lib/meta/NcMetaMgrEE.ts +++ b/packages/nocodb/src/lib/meta/NcMetaMgrEE.ts @@ -1,6 +1,5 @@ import { v4 as uuidv4 } from 'uuid'; import { T } from 'nc-help'; - import NcMetaMgr from './NcMetaMgr'; export default class NcMetaMgrEE extends NcMetaMgr { diff --git a/packages/nocodb/src/lib/meta/NcMetaMgrv2.ts b/packages/nocodb/src/lib/meta/NcMetaMgrv2.ts index 2d8c228ff6..cbed0c3380 100644 --- a/packages/nocodb/src/lib/meta/NcMetaMgrv2.ts +++ b/packages/nocodb/src/lib/meta/NcMetaMgrv2.ts @@ -1,7 +1,6 @@ import bodyParser from 'body-parser'; import { Router } from 'express'; import multer from 'multer'; - import ProjectMgr from '../db/sql-mgr/ProjectMgr'; import { packageVersion } from '../utils/packageVersion'; import projectAcl from '../utils/projectAcl'; @@ -13,7 +12,6 @@ import type NcMetaIO from './NcMetaIO'; import type Noco from '../Noco'; import type { NcConfig } from '../../interface/config'; import type { Handler } from 'express'; -// import ncGetMeta from './handlersv2/ncGetMeta'; export default class NcMetaMgrv2 { public projectConfigs = {}; diff --git a/packages/nocodb/src/lib/meta/api/index.ts b/packages/nocodb/src/lib/meta/api/index.ts index 9900eb9537..4bca9f34dc 100644 --- a/packages/nocodb/src/lib/meta/api/index.ts +++ b/packages/nocodb/src/lib/meta/api/index.ts @@ -25,7 +25,6 @@ import pluginController from '../../controllers/plugin.ctl'; import gridViewColumnController from '../../controllers/views/gridViewColumn.ctl'; import kanbanViewController from '../../controllers/views/kanbanView.ctl'; import { userController } from '../../controllers/user'; -// import extractProjectIdAndAuthenticate from './helpers/extractProjectIdAndAuthenticate'; import utilController from '../../controllers/util.ctl'; import projectUserController from '../../controllers/projectUser.ctl'; import sharedBaseController from '../../controllers/sharedBase.ctl'; @@ -49,7 +48,6 @@ import { publicDataExportController, publicMetaController, } from '../../controllers/publicControllers'; - import swaggerController from '../../controllers/apiDocs'; import { importController, syncSourceController } from '../../controllers/sync'; import mapViewController from '../../controllers/views/mapView.ctl'; diff --git a/packages/nocodb/src/lib/meta/helpers/extractProjectIdAndAuthenticate.ts b/packages/nocodb/src/lib/meta/helpers/extractProjectIdAndAuthenticate.ts index 3ca2d2a139..70fbb75afb 100644 --- a/packages/nocodb/src/lib/meta/helpers/extractProjectIdAndAuthenticate.ts +++ b/packages/nocodb/src/lib/meta/helpers/extractProjectIdAndAuthenticate.ts @@ -1,5 +1,4 @@ import { promisify } from 'util'; - import passport from 'passport'; import Model from '../../models/Model'; import View from '../../models/View'; diff --git a/packages/nocodb/src/lib/plugins/backblaze/BackblazePlugin.ts b/packages/nocodb/src/lib/plugins/backblaze/BackblazePlugin.ts index d47ab6e3a2..9fb2c79681 100644 --- a/packages/nocodb/src/lib/plugins/backblaze/BackblazePlugin.ts +++ b/packages/nocodb/src/lib/plugins/backblaze/BackblazePlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import Backblaze from './Backblaze'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/discord/DiscordPlugin.ts b/packages/nocodb/src/lib/plugins/discord/DiscordPlugin.ts index 1eee332780..81edf21e89 100644 --- a/packages/nocodb/src/lib/plugins/discord/DiscordPlugin.ts +++ b/packages/nocodb/src/lib/plugins/discord/DiscordPlugin.ts @@ -1,5 +1,4 @@ import { XcWebhookNotificationPlugin } from 'nc-plugin'; - import Discord from './Discord'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/gcs/GcsPlugin.ts b/packages/nocodb/src/lib/plugins/gcs/GcsPlugin.ts index 7a3dc95bbf..e2e737db56 100644 --- a/packages/nocodb/src/lib/plugins/gcs/GcsPlugin.ts +++ b/packages/nocodb/src/lib/plugins/gcs/GcsPlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import Gcs from './Gcs'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/linode/LinodeObjectStoragePlugin.ts b/packages/nocodb/src/lib/plugins/linode/LinodeObjectStoragePlugin.ts index 99f56077dd..9ed14375fb 100644 --- a/packages/nocodb/src/lib/plugins/linode/LinodeObjectStoragePlugin.ts +++ b/packages/nocodb/src/lib/plugins/linode/LinodeObjectStoragePlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import LinodeObjectStorage from './LinodeObjectStorage'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/mailerSend/MailerSend.ts b/packages/nocodb/src/lib/plugins/mailerSend/MailerSend.ts index e681e47f8e..158249cb89 100644 --- a/packages/nocodb/src/lib/plugins/mailerSend/MailerSend.ts +++ b/packages/nocodb/src/lib/plugins/mailerSend/MailerSend.ts @@ -1,6 +1,5 @@ import MailerSend, { EmailParams, Recipient } from 'mailersend'; import type { IEmailAdapter } from 'nc-plugin'; - import type { XcEmail } from '../../../interface/IEmailAdapter'; export default class Mailer implements IEmailAdapter { diff --git a/packages/nocodb/src/lib/plugins/mailerSend/MailerSendPlugin.ts b/packages/nocodb/src/lib/plugins/mailerSend/MailerSendPlugin.ts index c3b898ceb0..c8d9ae375e 100644 --- a/packages/nocodb/src/lib/plugins/mailerSend/MailerSendPlugin.ts +++ b/packages/nocodb/src/lib/plugins/mailerSend/MailerSendPlugin.ts @@ -1,5 +1,4 @@ import { XcEmailPlugin } from 'nc-plugin'; - import MailerSend from './MailerSend'; import type { IEmailAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/mattermost/MattermostPlugin.ts b/packages/nocodb/src/lib/plugins/mattermost/MattermostPlugin.ts index dcff6d1f3a..547bd006bc 100644 --- a/packages/nocodb/src/lib/plugins/mattermost/MattermostPlugin.ts +++ b/packages/nocodb/src/lib/plugins/mattermost/MattermostPlugin.ts @@ -1,5 +1,4 @@ import { XcWebhookNotificationPlugin } from 'nc-plugin'; - import Mattermost from './Mattermost'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/mino/MinioPlugin.ts b/packages/nocodb/src/lib/plugins/mino/MinioPlugin.ts index e742305d98..a4126ecf29 100644 --- a/packages/nocodb/src/lib/plugins/mino/MinioPlugin.ts +++ b/packages/nocodb/src/lib/plugins/mino/MinioPlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import Minio from './Minio'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloudPlugin.ts b/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloudPlugin.ts index 729c4137ec..97e1519c85 100644 --- a/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloudPlugin.ts +++ b/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloudPlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import OvhCloud from './OvhCloud'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/s3/S3Plugin.ts b/packages/nocodb/src/lib/plugins/s3/S3Plugin.ts index 9e9f3de44d..457daf3692 100644 --- a/packages/nocodb/src/lib/plugins/s3/S3Plugin.ts +++ b/packages/nocodb/src/lib/plugins/s3/S3Plugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import S3 from './S3'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStoragePlugin.ts b/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStoragePlugin.ts index b3f7f6eec6..a816ad27dc 100644 --- a/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStoragePlugin.ts +++ b/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStoragePlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import ScalewayObjectStorage from './ScalewayObjectStorage'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/ses/SESPlugin.ts b/packages/nocodb/src/lib/plugins/ses/SESPlugin.ts index ba9ab48eb9..a5eb9c8a33 100644 --- a/packages/nocodb/src/lib/plugins/ses/SESPlugin.ts +++ b/packages/nocodb/src/lib/plugins/ses/SESPlugin.ts @@ -1,5 +1,4 @@ import { XcEmailPlugin } from 'nc-plugin'; - import SES from './SES'; import type { IEmailAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/slack/SlackPlugin.ts b/packages/nocodb/src/lib/plugins/slack/SlackPlugin.ts index 65668ad6a3..ee5da18296 100644 --- a/packages/nocodb/src/lib/plugins/slack/SlackPlugin.ts +++ b/packages/nocodb/src/lib/plugins/slack/SlackPlugin.ts @@ -1,5 +1,4 @@ import { XcWebhookNotificationPlugin } from 'nc-plugin'; - import Slack from './Slack'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts index d30fc02b45..bfd3b52849 100644 --- a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts +++ b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts @@ -1,7 +1,6 @@ import nodemailer from 'nodemailer'; import type { IEmailAdapter } from 'nc-plugin'; import type Mail from 'nodemailer/lib/mailer'; - import type { XcEmail } from '../../../interface/IEmailAdapter'; export default class SMTP implements IEmailAdapter { diff --git a/packages/nocodb/src/lib/plugins/smtp/SMTPPlugin.ts b/packages/nocodb/src/lib/plugins/smtp/SMTPPlugin.ts index e4624a5259..ecab3e1bde 100644 --- a/packages/nocodb/src/lib/plugins/smtp/SMTPPlugin.ts +++ b/packages/nocodb/src/lib/plugins/smtp/SMTPPlugin.ts @@ -1,5 +1,4 @@ import { XcEmailPlugin } from 'nc-plugin'; - import SMTP from './SMTP'; import type { IEmailAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/spaces/SpacesPlugin.ts b/packages/nocodb/src/lib/plugins/spaces/SpacesPlugin.ts index f63357621c..ee5d54d313 100644 --- a/packages/nocodb/src/lib/plugins/spaces/SpacesPlugin.ts +++ b/packages/nocodb/src/lib/plugins/spaces/SpacesPlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import Spaces from './Spaces'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/teams/TeamsPlugin.ts b/packages/nocodb/src/lib/plugins/teams/TeamsPlugin.ts index aba2fc9f1c..552f9cc164 100644 --- a/packages/nocodb/src/lib/plugins/teams/TeamsPlugin.ts +++ b/packages/nocodb/src/lib/plugins/teams/TeamsPlugin.ts @@ -1,5 +1,4 @@ import { XcWebhookNotificationPlugin } from 'nc-plugin'; - import Teams from './Teams'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/twilio/TwilioPlugin.ts b/packages/nocodb/src/lib/plugins/twilio/TwilioPlugin.ts index c37b6f8dfe..65fe5f5012 100644 --- a/packages/nocodb/src/lib/plugins/twilio/TwilioPlugin.ts +++ b/packages/nocodb/src/lib/plugins/twilio/TwilioPlugin.ts @@ -1,5 +1,4 @@ import { XcWebhookNotificationPlugin } from 'nc-plugin'; - import Twilio from './Twilio'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/twilioWhatsapp/TwilioWhatsappPlugin.ts b/packages/nocodb/src/lib/plugins/twilioWhatsapp/TwilioWhatsappPlugin.ts index 6149652c6c..ecac857db5 100644 --- a/packages/nocodb/src/lib/plugins/twilioWhatsapp/TwilioWhatsappPlugin.ts +++ b/packages/nocodb/src/lib/plugins/twilioWhatsapp/TwilioWhatsappPlugin.ts @@ -1,5 +1,4 @@ import { XcWebhookNotificationPlugin } from 'nc-plugin'; - import TwilioWhatsapp from './TwilioWhatsapp'; import type { IWebhookNotificationAdapter } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/upcloud/UpCloudPlugin.ts b/packages/nocodb/src/lib/plugins/upcloud/UpCloudPlugin.ts index f074597262..3330805001 100644 --- a/packages/nocodb/src/lib/plugins/upcloud/UpCloudPlugin.ts +++ b/packages/nocodb/src/lib/plugins/upcloud/UpCloudPlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import UpoCloud from './UpoCloud'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/plugins/vultr/VultrPlugin.ts b/packages/nocodb/src/lib/plugins/vultr/VultrPlugin.ts index 114fdb64fe..57c2b42978 100644 --- a/packages/nocodb/src/lib/plugins/vultr/VultrPlugin.ts +++ b/packages/nocodb/src/lib/plugins/vultr/VultrPlugin.ts @@ -1,5 +1,4 @@ import { XcStoragePlugin } from 'nc-plugin'; - import Vultr from './Vultr'; import type { IStorageAdapterV2 } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/services/column.svc.ts b/packages/nocodb/src/lib/services/column.svc.ts index 3da6cba5ed..2af2a49ac5 100644 --- a/packages/nocodb/src/lib/services/column.svc.ts +++ b/packages/nocodb/src/lib/services/column.svc.ts @@ -34,7 +34,6 @@ import KanbanView from '../models/KanbanView'; import Model from '../models/Model'; import Noco from '../Noco'; import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; - import { MetaTable } from '../utils/globals'; import type Project from '../models/Project'; import type LinkToAnotherRecordColumn from '../models/LinkToAnotherRecordColumn'; diff --git a/packages/nocodb/src/lib/services/hook.svc.ts b/packages/nocodb/src/lib/services/hook.svc.ts index 89e94ef38d..b420bdea7d 100644 --- a/packages/nocodb/src/lib/services/hook.svc.ts +++ b/packages/nocodb/src/lib/services/hook.svc.ts @@ -1,7 +1,6 @@ import { T } from 'nc-help'; import { validatePayload } from '../meta/api/helpers'; import { Hook, Model } from '../models'; - import { invokeWebhook } from '../meta/helpers/webhookHelpers'; import populateSamplePayload from '../meta/helpers/populateSamplePayload'; import type { HookReqType, HookTestReqType } from 'nocodb-sdk'; diff --git a/packages/nocodb/src/lib/services/metaDiff.svc.ts b/packages/nocodb/src/lib/services/metaDiff.svc.ts index 50165d4dd7..132dc33d38 100644 --- a/packages/nocodb/src/lib/services/metaDiff.svc.ts +++ b/packages/nocodb/src/lib/services/metaDiff.svc.ts @@ -1,5 +1,3 @@ -// // Project CRUD - import { T } from 'nc-help'; import { isVirtualCol, ModelTypes, RelationTypes, UITypes } from 'nocodb-sdk'; import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; diff --git a/packages/nocodb/src/lib/services/sync/helpers/job.ts b/packages/nocodb/src/lib/services/sync/helpers/job.ts index be6a85ce63..a62cd5644a 100644 --- a/packages/nocodb/src/lib/services/sync/helpers/job.ts +++ b/packages/nocodb/src/lib/services/sync/helpers/job.ts @@ -1,20 +1,15 @@ import { promisify } from 'util'; import { UITypes } from 'nocodb-sdk'; -// import * as sMap from './syncMap'; - import { Api } from 'nocodb-sdk'; - import Airtable from 'airtable'; import jsonfile from 'jsonfile'; import hash from 'object-hash'; import { T } from 'nc-help'; - import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import tinycolor from 'tinycolor2'; import FetchAT from './fetchAT'; import { importData, importLTARData } from './readAndProcessData'; - import EntityMap from './EntityMap'; const writeJsonFileAsync = promisify(jsonfile.writeFile); diff --git a/packages/nocodb/src/lib/services/test/TestResetService/resetMysqlSakilaProject.ts b/packages/nocodb/src/lib/services/test/TestResetService/resetMysqlSakilaProject.ts index bda2414200..3413e3e19f 100644 --- a/packages/nocodb/src/lib/services/test/TestResetService/resetMysqlSakilaProject.ts +++ b/packages/nocodb/src/lib/services/test/TestResetService/resetMysqlSakilaProject.ts @@ -1,7 +1,6 @@ import { promises as fs } from 'fs'; import axios from 'axios'; import { knex } from 'knex'; - import Audit from '../../../models/Audit'; import type { Knex } from 'knex'; import type Project from '../../../models/Project'; diff --git a/packages/nocodb/src/lib/services/test/TestResetService/resetPgSakilaProject.ts b/packages/nocodb/src/lib/services/test/TestResetService/resetPgSakilaProject.ts index ee9fd7e39b..aeb63b45a6 100644 --- a/packages/nocodb/src/lib/services/test/TestResetService/resetPgSakilaProject.ts +++ b/packages/nocodb/src/lib/services/test/TestResetService/resetPgSakilaProject.ts @@ -1,10 +1,6 @@ import { promises as fs } from 'fs'; import axios from 'axios'; import { knex } from 'knex'; - -// const util = require('util'); -// const exec = util.promisify(require('child_process').exec); - import Audit from '../../../models/Audit'; import type Project from '../../../models/Project'; diff --git a/packages/nocodb/src/lib/services/user/index.ts b/packages/nocodb/src/lib/services/user/index.ts index 00dcd2b09c..a082ff9070 100644 --- a/packages/nocodb/src/lib/services/user/index.ts +++ b/packages/nocodb/src/lib/services/user/index.ts @@ -2,9 +2,7 @@ import { promisify } from 'util'; import { validatePassword } from 'nocodb-sdk'; import { OrgUserRoles } from 'nocodb-sdk'; import { T } from 'nc-help'; - import * as ejs from 'ejs'; - import bcrypt from 'bcryptjs'; import { NC_APP_SETTINGS } from '../../constants'; import { validatePayload } from '../../meta/api/helpers'; diff --git a/packages/nocodb/src/lib/services/user/initAdminFromEnv.ts b/packages/nocodb/src/lib/services/user/initAdminFromEnv.ts index c1a205cebd..304d8c9f30 100644 --- a/packages/nocodb/src/lib/services/user/initAdminFromEnv.ts +++ b/packages/nocodb/src/lib/services/user/initAdminFromEnv.ts @@ -1,6 +1,5 @@ import { promisify } from 'util'; import { v4 as uuidv4 } from 'uuid'; - import bcrypt from 'bcryptjs'; import { validatePassword } from 'nocodb-sdk'; import boxen from 'boxen'; @@ -11,6 +10,7 @@ import Noco from '../../Noco'; import { CacheScope, MetaTable } from '../../utils/globals'; const { isEmail } = require('validator'); + const rolesLevel = { owner: 0, creator: 1, editor: 2, commenter: 3, viewer: 4 }; export default async function initAdminFromEnv(_ncMeta = Noco.ncMeta) { diff --git a/packages/nocodb/src/lib/services/util.svc.ts b/packages/nocodb/src/lib/services/util.svc.ts index 2887fcff8a..28b0e98aea 100644 --- a/packages/nocodb/src/lib/services/util.svc.ts +++ b/packages/nocodb/src/lib/services/util.svc.ts @@ -1,5 +1,4 @@ import { compareVersions, validate } from 'compare-versions'; - import { ViewTypes } from 'nocodb-sdk'; import axios from 'axios'; import { Project } from '../models'; diff --git a/packages/nocodb/src/lib/utils/Lang.ts b/packages/nocodb/src/lib/utils/Lang.ts index e92d0e9c27..fecaa5a639 100644 --- a/packages/nocodb/src/lib/utils/Lang.ts +++ b/packages/nocodb/src/lib/utils/Lang.ts @@ -1,5 +1,4 @@ import osLocale from 'os-locale'; - import english from './english.json'; import translated from './translated.json'; diff --git a/packages/nocodb/src/lib/utils/NcConfigFactory.ts b/packages/nocodb/src/lib/utils/NcConfigFactory.ts index c98717659b..bfd748ed0c 100644 --- a/packages/nocodb/src/lib/utils/NcConfigFactory.ts +++ b/packages/nocodb/src/lib/utils/NcConfigFactory.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import { URL } from 'url'; import { promisify } from 'util'; - import * as path from 'path'; import parseDbUrl from 'parse-database-url'; import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory'; diff --git a/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts b/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts index 4d6192d74d..f2861a268b 100644 --- a/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts +++ b/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts @@ -1,17 +1,12 @@ -// import * as fs from "fs"; - import debug from 'debug'; import { Router } from 'express'; import inflection from 'inflection'; -// import Knex from "knex"; import { T } from 'nc-help'; import { UITypes } from 'nocodb-sdk'; import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory'; - import ExpressXcPolicy from '../../db/sql-mgr/code/policies/xc/ExpressXcPolicy'; import NcHelp from '../NcHelp'; import XcCache from '../../v1-legacy/plugins/adapters/cache/XcCache'; - import BaseModel from './BaseModel'; import { XcCron } from './XcCron'; import NcConnectionMgr from './NcConnectionMgr'; @@ -27,12 +22,7 @@ import type NcProjectBuilder from '../../v1-legacy/NcProjectBuilder'; import type { BaseModelSql, XKnex } from '../../db/sql-data-mapper'; import type { Acls, DbConfig, NcConfig } from '../../../interface/config'; import type XcDynamicChanges from '../../../interface/XcDynamicChanges'; -import type { - MysqlClient, - PgClient, - SqlClient, - // SqlClientFactory, -} from 'nc-help'; +import type { MysqlClient, PgClient, SqlClient } from 'nc-help'; const log = debug('nc:api:base'); diff --git a/packages/nocodb/src/lib/utils/common/BaseProcedure.ts b/packages/nocodb/src/lib/utils/common/BaseProcedure.ts index 72faad9097..8f81c2ef6e 100644 --- a/packages/nocodb/src/lib/utils/common/BaseProcedure.ts +++ b/packages/nocodb/src/lib/utils/common/BaseProcedure.ts @@ -1,6 +1,5 @@ import type { GqlApiBuilder } from '../../v1-legacy/gql/GqlApiBuilder'; import type { RestApiBuilder } from '../../v1-legacy/rest/RestApiBuilder'; - import type XcProcedure from './XcProcedure'; export default class BaseProcedure { diff --git a/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts b/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts index b5b9fb6c98..4ce1ff6ac4 100644 --- a/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts +++ b/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts @@ -5,7 +5,6 @@ import { XKnex } from '../../db/sql-data-mapper'; import { defaultConnectionConfig } from '../NcConfigFactory'; import type { NcConfig } from '../../../interface/config'; import type { Knex } from 'knex'; - import type NcMetaIO from '../../meta/NcMetaIO'; export default class NcConnectionMgr { diff --git a/packages/nocodb/src/lib/utils/common/XcCron.ts b/packages/nocodb/src/lib/utils/common/XcCron.ts index cb42a29ac9..2e94cf05d6 100644 --- a/packages/nocodb/src/lib/utils/common/XcCron.ts +++ b/packages/nocodb/src/lib/utils/common/XcCron.ts @@ -1,12 +1,8 @@ import { CronJob } from 'cron'; - import type { NcConfig } from '../../../interface/config'; import type Noco from '../../Noco'; - import type BaseApiBuilder from './BaseApiBuilder'; -// import * as tsc from "typescript"; - export class XcCron { // @ts-ignore private app: Noco; diff --git a/packages/nocodb/src/lib/v1-legacy/NcProjectBuilder.ts b/packages/nocodb/src/lib/v1-legacy/NcProjectBuilder.ts index f78b160601..60401890a1 100644 --- a/packages/nocodb/src/lib/v1-legacy/NcProjectBuilder.ts +++ b/packages/nocodb/src/lib/v1-legacy/NcProjectBuilder.ts @@ -1,14 +1,11 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; - import axios from 'axios'; import { Router } from 'express'; - import { T } from 'nc-help'; import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory'; import Migrator from '../db/sql-migrator/lib/KnexMigrator'; - import { XCEeError } from '../meta/NcMetaMgr'; import NcConnectionMgr from '../utils/common/NcConnectionMgr'; import { GqlApiBuilder } from './gql/GqlApiBuilder'; diff --git a/packages/nocodb/src/lib/v1-legacy/gql/GqlApiBuilder.ts b/packages/nocodb/src/lib/v1-legacy/gql/GqlApiBuilder.ts index a8a9779e15..c58d960bf2 100644 --- a/packages/nocodb/src/lib/v1-legacy/gql/GqlApiBuilder.ts +++ b/packages/nocodb/src/lib/v1-legacy/gql/GqlApiBuilder.ts @@ -5,13 +5,11 @@ import { execute } from 'graphql'; import { GraphQLJSON } from 'graphql-type-json'; import _ from 'lodash'; import { BaseType } from 'xc-core-ts'; - import ExpressXcTsPolicyGql from '../../db/sql-mgr/code/gql-policies/xc-ts/ExpressXcTsPolicyGql'; import GqlXcSchemaFactory from '../../db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory'; import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory'; import NcHelp from '../../utils/NcHelp'; import BaseApiBuilder from '../../utils/common/BaseApiBuilder'; - import { m2mNotChildren, m2mNotChildrenCount } from './GqlCommonResolvers'; import GqlMiddleware from './GqlMiddleware'; import { GqlProcedureResolver } from './GqlProcedureResolver'; diff --git a/packages/nocodb/src/lib/v1-legacy/gql/GqlAuthResolver.ts b/packages/nocodb/src/lib/v1-legacy/gql/GqlAuthResolver.ts index 79d5fe8a46..f365a820b6 100644 --- a/packages/nocodb/src/lib/v1-legacy/gql/GqlAuthResolver.ts +++ b/packages/nocodb/src/lib/v1-legacy/gql/GqlAuthResolver.ts @@ -1,11 +1,9 @@ import { promisify } from 'util'; - import bcrypt from 'bcryptjs'; import * as ejs from 'ejs'; import * as jwt from 'jsonwebtoken'; import passport from 'passport'; import { ExtractJwt, Strategy } from 'passport-jwt'; - import authSchema from './auth/schema'; import type IEmailAdapter from '../../../interface/IEmailAdapter'; import type { DbConfig, NcConfig } from '../../../interface/config'; @@ -13,10 +11,12 @@ import type { Knex, XKnex } from '../../db/sql-data-mapper'; import type Noco from '../../Noco'; const { v4: uuidv4 } = require('uuid'); + const PassportLocalStrategy = require('passport-local').Strategy; + const autoBind = require('auto-bind'); + const { isEmail } = require('validator'); -// import swaggerUi from 'swagger-ui-express'; passport.serializeUser(function ( { id, email, email_verified, roles, provider, firstname, lastname }, diff --git a/packages/nocodb/src/lib/v1-legacy/gql/GqlMiddleware.ts b/packages/nocodb/src/lib/v1-legacy/gql/GqlMiddleware.ts index a7099361a0..45c714d2f2 100644 --- a/packages/nocodb/src/lib/v1-legacy/gql/GqlMiddleware.ts +++ b/packages/nocodb/src/lib/v1-legacy/gql/GqlMiddleware.ts @@ -1,6 +1,5 @@ import autoBind from 'auto-bind'; import Handlebars from 'handlebars'; - import type { Acls } from '../../../interface/config'; export default class GqlMiddleware { diff --git a/packages/nocodb/src/lib/v1-legacy/gql/GqlProcedureResolver.ts b/packages/nocodb/src/lib/v1-legacy/gql/GqlProcedureResolver.ts index 86b36fd1eb..a840345a7d 100644 --- a/packages/nocodb/src/lib/v1-legacy/gql/GqlProcedureResolver.ts +++ b/packages/nocodb/src/lib/v1-legacy/gql/GqlProcedureResolver.ts @@ -1,8 +1,6 @@ import autoBind from 'auto-bind'; - import BaseProcedure from '../../utils/common/BaseProcedure'; import XcProcedure from '../../utils/common/XcProcedure'; - import GqlBaseResolver from './GqlBaseResolver'; import type { GqlApiBuilder } from './GqlApiBuilder'; diff --git a/packages/nocodb/src/lib/v1-legacy/gql/GqlResolver.ts b/packages/nocodb/src/lib/v1-legacy/gql/GqlResolver.ts index 2c183cb2a4..d498f5cf70 100644 --- a/packages/nocodb/src/lib/v1-legacy/gql/GqlResolver.ts +++ b/packages/nocodb/src/lib/v1-legacy/gql/GqlResolver.ts @@ -1,5 +1,4 @@ import autoBind from 'auto-bind'; - import GqlBaseResolver from './GqlBaseResolver'; import GqlMiddleware from './GqlMiddleware'; import type { Acls } from '../../../interface/config'; diff --git a/packages/nocodb/src/lib/v1-legacy/nc.try.ts b/packages/nocodb/src/lib/v1-legacy/nc.try.ts index 373c9bf29b..37ef8e8a62 100644 --- a/packages/nocodb/src/lib/v1-legacy/nc.try.ts +++ b/packages/nocodb/src/lib/v1-legacy/nc.try.ts @@ -1,8 +1,6 @@ import cors from 'cors'; import express from 'express'; - import NcConfigFactory from '../utils/NcConfigFactory'; - import Noco from '../Noco'; export default async function (dbUrl): Promise { diff --git a/packages/nocodb/src/lib/v1-legacy/plugins/NcPluginMgr.ts b/packages/nocodb/src/lib/v1-legacy/plugins/NcPluginMgr.ts index 23cdcc32c2..fdf896496e 100644 --- a/packages/nocodb/src/lib/v1-legacy/plugins/NcPluginMgr.ts +++ b/packages/nocodb/src/lib/v1-legacy/plugins/NcPluginMgr.ts @@ -3,7 +3,6 @@ import { XcStoragePlugin, XcWebhookNotificationPlugin, } from 'nc-plugin'; - import BackblazePluginConfig from '../../plugins/backblaze'; import DiscordPluginConfig from '../../plugins/discord'; import GcsPluginConfig from '../../plugins/gcs'; @@ -26,7 +25,6 @@ import SESPluginConfig from '../../plugins/ses'; import Local from './adapters/storage/Local'; import type Noco from '../../Noco'; import type NcMetaIO from '../../meta/NcMetaIO'; - import type { IEmailAdapter, IStorageAdapter, diff --git a/packages/nocodb/src/lib/v1-legacy/plugins/adapters/email/SMTP.ts b/packages/nocodb/src/lib/v1-legacy/plugins/adapters/email/SMTP.ts index ff42521242..448d044c21 100644 --- a/packages/nocodb/src/lib/v1-legacy/plugins/adapters/email/SMTP.ts +++ b/packages/nocodb/src/lib/v1-legacy/plugins/adapters/email/SMTP.ts @@ -1,7 +1,6 @@ // @ts-ignore import nodemailer from 'nodemailer'; import type Mail from 'nodemailer/lib/mailer'; - import type { XcEmail } from '../../../../../interface/IEmailAdapter'; import type IEmailAdapter from '../../../../../interface/IEmailAdapter'; diff --git a/packages/nocodb/src/lib/v1-legacy/plugins/adapters/storage/Local.ts b/packages/nocodb/src/lib/v1-legacy/plugins/adapters/storage/Local.ts index c529a51c9a..6819c5a0cf 100644 --- a/packages/nocodb/src/lib/v1-legacy/plugins/adapters/storage/Local.ts +++ b/packages/nocodb/src/lib/v1-legacy/plugins/adapters/storage/Local.ts @@ -1,9 +1,7 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; - import mkdirp from 'mkdirp'; - import axios from 'axios'; import NcConfigFactory from '../../../../utils/NcConfigFactory'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; diff --git a/packages/nocodb/src/lib/v1-legacy/plugins/ses.ts b/packages/nocodb/src/lib/v1-legacy/plugins/ses.ts index 4ca9b779c6..2842979cb1 100644 --- a/packages/nocodb/src/lib/v1-legacy/plugins/ses.ts +++ b/packages/nocodb/src/lib/v1-legacy/plugins/ses.ts @@ -1,5 +1,4 @@ // @wingkwong: Deprecated. Moved to nocodb/packages/nocodb/src/plugins/ses instead. Keep this file for migration only. - import { XcActionType, XcType } from 'nocodb-sdk'; import type { XcForm } from 'nocodb-sdk'; diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts index a9632210a1..335bf67cc3 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestApiBuilder.ts @@ -1,13 +1,11 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; - import { URL } from 'url'; import * as ejs from 'ejs'; import { Router } from 'express'; import { glob } from 'glob'; import mkdirp from 'mkdirp'; - import debug from 'debug'; import autoBind from 'auto-bind'; import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory'; @@ -24,7 +22,6 @@ import BaseApiBuilder, { import Column from '../../models/Column'; import { MetaTable } from '../../utils/globals'; import { RestCtrl } from './RestCtrl'; - import { RestCtrlBelongsTo } from './RestCtrlBelongsTo'; import { RestCtrlCustom } from './RestCtrlCustom'; import { RestCtrlHasMany } from './RestCtrlHasMany'; @@ -35,15 +32,11 @@ import type { XcTablesPopulateParams, } from '../../utils/common/BaseApiBuilder'; import type Noco from '../../Noco'; -// import NocoTypeGenerator from '../v1-legacy-resolver/NocoTypeGenerator'; -// import NocoResolverGenerator from '../v1-legacy-resolver/NocoResolverGenerator'; -// import { RestCtrlv2 } from './RestCtrlv2'; -// import registerRestCtrl from './registerRestCtrl'; import type { DbConfig, NcConfig } from '../../../interface/config'; import type NcProjectBuilder from '../NcProjectBuilder'; -// import { BaseModelSqlv2 } from '../../sql-data-mapper/lib/sql/BaseModelSqlv2'; const log = debug('nc:api:rest'); + const NC_CUSTOM_ROUTE_KEY = '__xc_custom'; export class RestApiBuilder extends BaseApiBuilder { diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts index f390b125e8..f150bb1887 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts @@ -9,7 +9,6 @@ import { Strategy as GithubStrategy } from 'passport-github'; import { Strategy as GoogleStrategy } from 'passport-google-oauth20'; import { ExtractJwt, Strategy } from 'passport-jwt'; import validator from 'validator'; - import { Strategy as CustomStrategy } from 'passport-custom'; import axios from 'axios'; import { T } from 'nc-help'; @@ -17,13 +16,15 @@ import XcCache from '../plugins/adapters/cache/XcCache'; import type { DbConfig, NcConfig } from '../../../interface/config'; import type { Knex } from '../../db/sql-data-mapper'; import type Noco from '../../Noco'; - import type NcMetaIO from '../../meta/NcMetaIO'; import type IEmailAdapter from '../../../interface/IEmailAdapter'; const autoBind = require('auto-bind'); + const PassportLocalStrategy = require('passport-local').Strategy; + const { v4: uuidv4 } = require('uuid'); + const { isEmail } = require('validator'); passport.serializeUser(function ( diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrlEE.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrlEE.ts index efeae0b567..dec67eb46d 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrlEE.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrlEE.ts @@ -3,9 +3,7 @@ import { Strategy } from 'passport-jwt'; import { v4 as uuidv4 } from 'uuid'; import validator from 'validator'; import { T } from 'nc-help'; - import XcCache from '../plugins/adapters/cache/XcCache'; - import RestAuthCtrl from './RestAuthCtrl'; export default class RestAuthCtrlEE extends RestAuthCtrl { diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestBaseCtrl.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestBaseCtrl.ts index 387cc43108..a9823e5b87 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestBaseCtrl.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestBaseCtrl.ts @@ -1,6 +1,5 @@ import Handlebars from 'handlebars'; import type { Handler, NextFunction, Request, Response, Router } from 'express'; - import type { Route } from '../../../interface/config'; export abstract class RestBaseCtrl { diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrl.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrl.ts index c7fe24f449..ea0f4dab42 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrl.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrl.ts @@ -2,10 +2,8 @@ import autoBind from 'auto-bind'; import { Router } from 'express'; import { RestBaseCtrl } from './RestBaseCtrl'; import type { NextFunction, Request, Response } from 'express'; - import type { Acl, Acls, Route } from '../../../interface/config'; import type { BaseModelSql } from '../../db/sql-data-mapper'; - import type { BaseModelSqlv2 } from '../../db/sql-data-mapper/lib/sql/BaseModelSqlv2'; function parseHrtimeToSeconds(hrtime) { diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlBelongsTo.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlBelongsTo.ts index 0edfbff046..617d6993c6 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlBelongsTo.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlBelongsTo.ts @@ -1,7 +1,6 @@ import autoBind from 'auto-bind'; import { RestBaseCtrl } from './RestBaseCtrl'; import type { NextFunction, Request, Response } from 'express'; - import type { Acl, Acls, Route } from '../../../interface/config'; import type { BaseModelSql } from '../../db/sql-data-mapper'; diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlCustom.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlCustom.ts index 97576b03aa..23180ad2e7 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlCustom.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlCustom.ts @@ -2,7 +2,6 @@ import autoBind from 'auto-bind'; import { Router } from 'express'; import { RestBaseCtrl } from './RestBaseCtrl'; import type { NextFunction, Request, Response } from 'express'; - import type { Route } from '../../../interface/config'; import type { BaseModelSql } from '../../db/sql-data-mapper'; diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlHasMany.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlHasMany.ts index 56fa122d0a..791ee97f33 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlHasMany.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlHasMany.ts @@ -1,7 +1,6 @@ import autoBind from 'auto-bind'; import { RestBaseCtrl } from './RestBaseCtrl'; import type { NextFunction, Request, Response } from 'express'; - import type { Acl, Acls, Route } from '../../../interface/config'; import type { BaseModelSql } from '../../db/sql-data-mapper'; diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlMin.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlMin.ts index 92d4aad690..e9720b2a0e 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlMin.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlMin.ts @@ -1,6 +1,5 @@ import autoBind from 'auto-bind'; import type { Request, Response, Router } from 'express'; - import type { Acls } from '../../../interface/config'; import type { BaseModelSql } from '../../db/sql-data-mapper'; diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlProcedure.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlProcedure.ts index e2e491fc1c..ae181392fa 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlProcedure.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlProcedure.ts @@ -1,9 +1,7 @@ import autoBind from 'auto-bind'; - import BaseProcedure from '../../utils/common/BaseProcedure'; import XcProcedure from '../../utils/common/XcProcedure'; import type { Handler, NextFunction, Request, Response, Router } from 'express'; - import type { RestApiBuilder } from './RestApiBuilder'; export class RestCtrlProcedure extends BaseProcedure { diff --git a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlv2.ts b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlv2.ts index 05ab899fe1..e8e6e8011d 100644 --- a/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlv2.ts +++ b/packages/nocodb/src/lib/v1-legacy/rest/RestCtrlv2.ts @@ -1,9 +1,7 @@ import autoBind from 'auto-bind'; import type { Router } from 'express'; - import type { Acls } from '../../../interface/config'; import type { BaseModelSql } from '../../db/sql-data-mapper'; - import type { BaseModelSqlv2 } from '../../db/sql-data-mapper/lib/sql/BaseModelSqlv2'; // import { nocoExecute } from '../v1-legacy-resolver/NocoExecute'; diff --git a/packages/nocodb/src/lib/version-upgrader/NcUpgrader.ts b/packages/nocodb/src/lib/version-upgrader/NcUpgrader.ts index 12309f7b86..193f614d49 100644 --- a/packages/nocodb/src/lib/version-upgrader/NcUpgrader.ts +++ b/packages/nocodb/src/lib/version-upgrader/NcUpgrader.ts @@ -6,7 +6,6 @@ import ncAttachmentUpgrader_0104002 from './ncAttachmentUpgrader_0104002'; import ncStickyColumnUpgrader from './ncStickyColumnUpgrader'; import ncFilterUpgrader_0104004 from './ncFilterUpgrader_0104004'; import ncFilterUpgrader_0105003 from './ncFilterUpgrader_0105003'; - import ncFilterUpgrader from './ncFilterUpgrader'; import ncProjectRolesUpgrader from './ncProjectRolesUpgrader'; import ncDataTypesUpgrader from './ncDataTypesUpgrader'; @@ -15,6 +14,7 @@ import ncProjectEnvUpgrader0011045 from './ncProjectEnvUpgrader0011045'; import ncProjectEnvUpgrader from './ncProjectEnvUpgrader'; import type { NcConfig } from '../../interface/config'; import type NcMetaIO from '../meta/NcMetaIO'; + const log = debug('nc:version-upgrader'); export interface NcUpgraderCtx { diff --git a/packages/nocodb/src/run/docker.ts b/packages/nocodb/src/run/docker.ts index 1ddee0e35d..718f78ec42 100644 --- a/packages/nocodb/src/run/docker.ts +++ b/packages/nocodb/src/run/docker.ts @@ -1,6 +1,5 @@ import cors from 'cors'; import express from 'express'; - import Noco from '../lib/Noco'; const server = express(); diff --git a/packages/nocodb/src/run/dockerRunMysql.ts b/packages/nocodb/src/run/dockerRunMysql.ts index 745e837737..60a8d2ab9d 100644 --- a/packages/nocodb/src/run/dockerRunMysql.ts +++ b/packages/nocodb/src/run/dockerRunMysql.ts @@ -1,6 +1,5 @@ import cors from 'cors'; import express from 'express'; - import Noco from '../lib/Noco'; const server = express(); diff --git a/packages/nocodb/src/run/dockerRunPG.ts b/packages/nocodb/src/run/dockerRunPG.ts index d3e7f350d8..4bf9e65a21 100644 --- a/packages/nocodb/src/run/dockerRunPG.ts +++ b/packages/nocodb/src/run/dockerRunPG.ts @@ -1,6 +1,5 @@ import cors from 'cors'; import express from 'express'; - import Noco from '../lib/Noco'; const server = express(); diff --git a/packages/nocodb/src/run/dockerRunPG_CyQuick.ts b/packages/nocodb/src/run/dockerRunPG_CyQuick.ts index 59c30f25a5..b9c11d9209 100644 --- a/packages/nocodb/src/run/dockerRunPG_CyQuick.ts +++ b/packages/nocodb/src/run/dockerRunPG_CyQuick.ts @@ -1,6 +1,5 @@ import cors from 'cors'; import express from 'express'; - import Noco from '../lib/Noco'; const server = express(); diff --git a/packages/nocodb/src/run/testDocker.ts b/packages/nocodb/src/run/testDocker.ts index 890207e9a4..2ff2a88162 100644 --- a/packages/nocodb/src/run/testDocker.ts +++ b/packages/nocodb/src/run/testDocker.ts @@ -1,9 +1,9 @@ import axios from 'axios'; import cors from 'cors'; import express from 'express'; - import Noco from '../lib/Noco'; import User from '../lib/models/User'; + process.env.NC_VERSION = '0009044'; const server = express(); diff --git a/packages/nocodb/src/run/try.ts b/packages/nocodb/src/run/try.ts index 43b37cbcb2..9006ca3fa8 100644 --- a/packages/nocodb/src/run/try.ts +++ b/packages/nocodb/src/run/try.ts @@ -1,6 +1,5 @@ import cors from 'cors'; import express from 'express'; - import { NcConfigFactory, Noco } from '../lib'; process.env.DATABASE_URL = 'mysql://root:password@localhost:3306/sakila'; diff --git a/packages/nocodb/tests/unit/index.test.ts b/packages/nocodb/tests/unit/index.test.ts index 0449a759f7..07a4a08b3e 100644 --- a/packages/nocodb/tests/unit/index.test.ts +++ b/packages/nocodb/tests/unit/index.test.ts @@ -1,5 +1,4 @@ import 'mocha'; - import restTests from './rest/index.test'; import modelTests from './model/index.test'; import TestDbMngr from './TestDbMngr' diff --git a/packages/nocodb/tests/unit/init/cleanupSakila.ts b/packages/nocodb/tests/unit/init/cleanupSakila.ts index 14551d6c82..df977f75a1 100644 --- a/packages/nocodb/tests/unit/init/cleanupSakila.ts +++ b/packages/nocodb/tests/unit/init/cleanupSakila.ts @@ -1,6 +1,5 @@ import Audit from '../../../src/lib/models/Audit'; import Project from '../../../src/lib/models/Project'; - import TestDbMngr from '../TestDbMngr'; const dropTablesOfSakila = async () => { diff --git a/packages/nocodb/tests/unit/init/index.ts b/packages/nocodb/tests/unit/init/index.ts index 55a25a926e..65c5e52067 100644 --- a/packages/nocodb/tests/unit/init/index.ts +++ b/packages/nocodb/tests/unit/init/index.ts @@ -1,7 +1,6 @@ import express from 'express'; import { Noco } from '../../../src/lib'; - import cleanupMeta from './cleanupMeta'; import {cleanUpSakila, resetAndSeedSakila} from './cleanupSakila'; import { createUser } from '../factory/user';