diff --git a/packages/nc-gui/lib/constants.ts b/packages/nc-gui/lib/constants.ts index bb98afbaeb..bfaa00720d 100644 --- a/packages/nc-gui/lib/constants.ts +++ b/packages/nc-gui/lib/constants.ts @@ -57,6 +57,7 @@ export const rolePermissions = { fieldsSync: true, gridColUpdate: true, filterSync: true, + filterChildrenRead: true, csvImport: true, apiDocs: true, projectSettings: true, diff --git a/packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts b/packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts index 34779ebbe8..4f01353ba0 100644 --- a/packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts +++ b/packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts @@ -1913,7 +1913,7 @@ class OracleClient extends KnexClient { * @returns {Number} code * @returns {String} message */ - async totalRecords(_args: any = {}) { + async totalRecords(_args: any = {}): Promise { // @ts-ignore const func = this.totalRecords.name; throw new Error('Function not supported for oracle yet'); diff --git a/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts b/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts index 9bbd2fa238..02b5c4e343 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts @@ -17,6 +17,14 @@ import NcConnectionMgr from '../../utils/common/NcConnectionMgr'; import { customAlphabet } from 'nanoid'; 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'; +import type PGClient from '../sql-client/lib/pg/PgClient'; +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'); @@ -337,7 +345,7 @@ export default class SqlMgr { * @returns * @memberof SqlMgr */ - public async projectGetSqlClient(args) { + public async projectGetSqlClient(args): Promise { const func = this.projectGetSqlClient.name; log.api(`${func}:args:`, args); diff --git a/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts b/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts index 89ee530036..8c7d189461 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts @@ -118,7 +118,7 @@ export default class SqlMgrv2 { return sqlMigrationStatements; } - protected async getSqlClient(base: Base): Promise { + protected async getSqlClient(base: Base) { return NcConnectionMgrv2.getSqlClient(base); } } diff --git a/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts b/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts index a5def5c184..82852fed52 100644 --- a/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts +++ b/packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts @@ -52,7 +52,7 @@ export default class SqlMgrv2Trans extends SqlMgrv2 { } } - protected async getSqlClient(base: Base): Promise { + protected async getSqlClient(base: Base) { return NcConnectionMgrv2.getSqlClient(base, this.trx); } 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 cc1ad02a34..cdf4d8f1f1 100644 --- a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts +++ b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; +import { Knex } from 'knex'; import glob from 'glob'; import SqlClientFactory from '../../sql-client/lib/SqlClientFactory'; @@ -428,7 +429,7 @@ export default class KnexMigratorv2 { // } } - protected async getSqlClient(base: Base): Promise { + protected async getSqlClient(base: Base) { return NcConnectionMgrv2.getSqlClient(base); } @@ -753,7 +754,7 @@ export default class KnexMigratorv2 { const vm = this; const trx = sqlClient.knex.isTransaction - ? sqlClient.knex + ? sqlClient.knex as Knex.Transaction : await sqlClient.knex.transaction(); try { for (const query of upStatements) { @@ -920,7 +921,7 @@ export default class KnexMigratorv2 { const vm = this; const trx = sqlClient.knex.isTransaction - ? sqlClient.knex + ? sqlClient.knex as Knex.Transaction : await sqlClient.knex.transaction(); try { for (const query of downStatements) { 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 7bfe6a2bdc..037cf6d559 100644 --- a/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts +++ b/packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts @@ -11,6 +11,13 @@ import Noco from '../../../Noco'; import { XKnex } from '../../sql-data-mapper'; import 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'; +import type PGClient from '../../sql-client/lib/pg/PgClient'; +import type SnowflakeClient from '../../sql-client/lib/snowflake/SnowflakeClient'; +import type SqliteClient from '../../sql-client/lib/sqlite/SqliteClient'; + export default class KnexMigratorv2Tans extends KnexMigratorv2 { protected sqlClient: any; protected ncMeta: NcMetaIO; @@ -24,7 +31,7 @@ export default class KnexMigratorv2Tans extends KnexMigratorv2 { protected get metaDb(): XKnex { return this.ncMeta.knex || Noco.ncMeta.knex; } - protected async getSqlClient(base: Base): Promise { + protected async getSqlClient(base: Base): Promise { return this.sqlClient || NcConnectionMgrv2.getSqlClient(base); } } diff --git a/packages/nocodb/src/lib/meta/NcMetaMgr.ts b/packages/nocodb/src/lib/meta/NcMetaMgr.ts index 02b2d7b607..aecaff7189 100644 --- a/packages/nocodb/src/lib/meta/NcMetaMgr.ts +++ b/packages/nocodb/src/lib/meta/NcMetaMgr.ts @@ -2909,7 +2909,7 @@ export default class NcMetaMgr { } } - protected async projectGetSqlClient(args): Promise { + protected async projectGetSqlClient(args) { const builder = this.getBuilder(args); return builder?.getSqlClient(); } diff --git a/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts b/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts index 210eb61a32..69294bdfc3 100644 --- a/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts +++ b/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts @@ -187,7 +187,7 @@ export default abstract class BaseApiBuilder return this.connectionConfig?.meta?.dbAlias; } - public async getSqlClient(): Promise { + public async getSqlClient() { return NcConnectionMgr.getSqlClient({ dbAlias: this.dbAlias, env: this.config.env, diff --git a/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts b/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts index 9c9c4c55a0..ca7f4fe53d 100644 --- a/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts +++ b/packages/nocodb/src/lib/utils/common/NcConnectionMgr.ts @@ -149,7 +149,7 @@ export default class NcConnectionMgr { env: string; config: NcConfig; projectId: string; - }): Promise { + }) { const knex = this.get({ dbAlias, env, diff --git a/packages/nocodb/src/lib/utils/common/NcConnectionMgrv2.ts b/packages/nocodb/src/lib/utils/common/NcConnectionMgrv2.ts index 06386e3391..bb55673cf6 100644 --- a/packages/nocodb/src/lib/utils/common/NcConnectionMgrv2.ts +++ b/packages/nocodb/src/lib/utils/common/NcConnectionMgrv2.ts @@ -149,7 +149,7 @@ export default class NcConnectionMgrv2 { // return config?.envs?.[env]?.db?.find(db => db?.meta?.dbAlias === dbAlias); // } - public static async getSqlClient(base: Base, _knex = null): Promise { + public static async getSqlClient(base: Base, _knex = null) { const knex = _knex || this.get(base); return SqlClientFactory.create({ knex,