Browse Source

Merge pull request #5267 from nocodb/refactor/sort-import

refactor: sort import
pull/5268/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
8841eee677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      packages/nocodb/.eslintrc.json
  2. 2
      packages/nocodb/package-lock.json
  3. 2
      packages/nocodb/package.json
  4. 22
      packages/nocodb/src/lib/Noco.ts
  5. 4
      packages/nocodb/src/lib/cache/NocoCache.ts
  6. 2
      packages/nocodb/src/lib/cache/RedisCacheMgr.ts
  7. 2
      packages/nocodb/src/lib/cache/RedisMockCacheMgr.ts
  8. 2
      packages/nocodb/src/lib/controllers/apiDocs/index.ts
  9. 2
      packages/nocodb/src/lib/controllers/apiToken.ctl.ts
  10. 4
      packages/nocodb/src/lib/controllers/attachment.ctl.ts
  11. 2
      packages/nocodb/src/lib/controllers/audit.ctl.ts
  12. 6
      packages/nocodb/src/lib/controllers/base.ctl.ts
  13. 2
      packages/nocodb/src/lib/controllers/cache.ctl.ts
  14. 4
      packages/nocodb/src/lib/controllers/column.ctl.ts
  15. 2
      packages/nocodb/src/lib/controllers/dbData/bulkDataAlias.ctl.ts
  16. 2
      packages/nocodb/src/lib/controllers/dbData/data.ctl.ts
  17. 2
      packages/nocodb/src/lib/controllers/dbData/dataAlias.ctl.ts
  18. 2
      packages/nocodb/src/lib/controllers/dbData/dataAliasExport.ctl.ts
  19. 2
      packages/nocodb/src/lib/controllers/dbData/dataAliasNested.ctl.ts
  20. 10
      packages/nocodb/src/lib/controllers/dbData/helpers.ts
  21. 4
      packages/nocodb/src/lib/controllers/dbData/oldData.ctl.ts
  22. 2
      packages/nocodb/src/lib/controllers/export.ctl.ts
  23. 4
      packages/nocodb/src/lib/controllers/filter.ctl.ts
  24. 6
      packages/nocodb/src/lib/controllers/hook.ctl.ts
  25. 2
      packages/nocodb/src/lib/controllers/hookFilter.ctl.ts
  26. 2
      packages/nocodb/src/lib/controllers/metaDiff.ctl.ts
  27. 2
      packages/nocodb/src/lib/controllers/orgToken.ctl.ts
  28. 4
      packages/nocodb/src/lib/controllers/plugin.ctl.ts
  29. 12
      packages/nocodb/src/lib/controllers/project.ctl.ts
  30. 2
      packages/nocodb/src/lib/controllers/projectUser.ctl.ts
  31. 2
      packages/nocodb/src/lib/controllers/publicControllers/publicData.ctl.ts
  32. 4
      packages/nocodb/src/lib/controllers/publicControllers/publicDataExport.ctl.ts
  33. 2
      packages/nocodb/src/lib/controllers/publicControllers/publicMeta.ctl.ts
  34. 4
      packages/nocodb/src/lib/controllers/sort.ctl.ts
  35. 4
      packages/nocodb/src/lib/controllers/sync/import.ctl.ts
  36. 2
      packages/nocodb/src/lib/controllers/sync/sync.ctl.ts
  37. 4
      packages/nocodb/src/lib/controllers/table.ctl.ts
  38. 2
      packages/nocodb/src/lib/controllers/test.ctl.ts
  39. 4
      packages/nocodb/src/lib/controllers/user/initStrategies.ts
  40. 4
      packages/nocodb/src/lib/controllers/user/user.ctl.ts
  41. 2
      packages/nocodb/src/lib/controllers/util.ctl.ts
  42. 4
      packages/nocodb/src/lib/controllers/view.ctl.ts
  43. 2
      packages/nocodb/src/lib/controllers/viewColumn.ctl.ts
  44. 4
      packages/nocodb/src/lib/controllers/views/formView.ctl.ts
  45. 2
      packages/nocodb/src/lib/controllers/views/formViewColumn.ctl.ts
  46. 4
      packages/nocodb/src/lib/controllers/views/galleryView.ctl.ts
  47. 2
      packages/nocodb/src/lib/controllers/views/gridView.ctl.ts
  48. 2
      packages/nocodb/src/lib/controllers/views/gridViewColumn.ctl.ts
  49. 6
      packages/nocodb/src/lib/controllers/views/kanbanView.ctl.ts
  50. 4
      packages/nocodb/src/lib/controllers/views/mapView.ctl.ts
  51. 14
      packages/nocodb/src/lib/db/sql-client/lib/KnexClient.ts
  52. 5
      packages/nocodb/src/lib/db/sql-client/lib/SqlClientFactory.ts
  53. 2
      packages/nocodb/src/lib/db/sql-client/lib/ee/SqlClientFactoryEE.ts
  54. 5
      packages/nocodb/src/lib/db/sql-client/lib/mssql/MssqlClient.ts
  55. 15
      packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts
  56. 4
      packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts
  57. 6
      packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts
  58. 2
      packages/nocodb/src/lib/db/sql-client/lib/pg/YugabyteClient.ts
  59. 2
      packages/nocodb/src/lib/db/sql-client/lib/snowflake/SnowflakeClient.ts
  60. 10
      packages/nocodb/src/lib/db/sql-client/lib/sqlite/SqliteClient.ts
  61. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts
  62. 54
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  63. 6
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts
  64. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts
  65. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
  66. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mssql.ts
  67. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts
  68. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts
  69. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts
  70. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/genRollupSelect.ts
  71. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/genRollupSelectv2.ts
  72. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts
  73. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/mapFunctionName.ts
  74. 10
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts
  75. 2
      packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts
  76. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts
  77. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaFactory.ts
  78. 2
      packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts
  79. 2
      packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts
  80. 4
      packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts
  81. 2
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts
  82. 6
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts
  83. 4
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts
  84. 2
      packages/nocodb/src/lib/jobs/EmitteryJobsMgr.ts
  85. 2
      packages/nocodb/src/lib/jobs/NocoJobs.ts
  86. 8
      packages/nocodb/src/lib/meta/NcMetaIOImpl.ts
  87. 34
      packages/nocodb/src/lib/meta/NcMetaMgr.ts
  88. 10
      packages/nocodb/src/lib/meta/NcMetaMgrv2.ts
  89. 4
      packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts
  90. 8
      packages/nocodb/src/lib/meta/api/helpers/columnHelpers.ts
  91. 8
      packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts
  92. 10
      packages/nocodb/src/lib/meta/api/index.ts
  93. 4
      packages/nocodb/src/lib/meta/handlersv2/ncCreateLookup.ts
  94. 2
      packages/nocodb/src/lib/meta/handlersv2/ncGetMeta.ts
  95. 21
      packages/nocodb/src/lib/meta/helpers/NcPluginMgrv2.ts
  96. 2
      packages/nocodb/src/lib/meta/helpers/addFormulaErrorIfMissingColumn.ts
  97. 2
      packages/nocodb/src/lib/meta/helpers/apiMetrics.ts
  98. 2
      packages/nocodb/src/lib/meta/helpers/getColumnPropsFromUIDT.ts
  99. 2
      packages/nocodb/src/lib/meta/helpers/getColumnUiType.ts
  100. 2
      packages/nocodb/src/lib/meta/helpers/getHandler.ts
  101. Some files were not shown because too many files have changed in this diff Show More

30
packages/nocodb/.eslintrc.json

@ -7,18 +7,8 @@
"env": { "env": {
"es6": true "es6": true
}, },
"ignorePatterns": [ "ignorePatterns": ["node_modules", "build", "coverage", "dist", "nc"],
"node_modules", "plugins": ["import", "eslint-comments", "functional"],
"build",
"coverage",
"dist",
"nc"
],
"plugins": [
"import",
"eslint-comments",
"functional"
],
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:eslint-comments/recommended", "plugin:eslint-comments/recommended",
@ -47,6 +37,21 @@
"ignoreCase": true "ignoreCase": true
} }
], ],
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
]
}
],
"@typescript-eslint/no-this-alias": "off", "@typescript-eslint/no-this-alias": "off",
// todo: enable // todo: enable
@ -57,7 +62,6 @@
"no-useless-catch": "off", "no-useless-catch": "off",
"no-empty": "off", "no-empty": "off",
"@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-empty-function": "off",
"import/order": "off",
"@typescript-eslint/consistent-type-imports": "warn" "@typescript-eslint/consistent-type-imports": "warn"
} }
} }

2
packages/nocodb/package-lock.json generated

@ -121,7 +121,7 @@
"eslint-config-prettier": "^6.15.0", "eslint-config-prettier": "^6.15.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^3.0.2", "eslint-plugin-functional": "^3.0.2",
"eslint-plugin-import": "^2.22.0", "eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"mocha": "^10.1.0", "mocha": "^10.1.0",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",

2
packages/nocodb/package.json

@ -162,7 +162,7 @@
"eslint-config-prettier": "^6.15.0", "eslint-config-prettier": "^6.15.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^3.0.2", "eslint-plugin-functional": "^3.0.2",
"eslint-plugin-import": "^2.22.0", "eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"mocha": "^10.1.0", "mocha": "^10.1.0",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",

22
packages/nocodb/src/lib/Noco.ts

@ -9,43 +9,43 @@ import clear from 'clear';
import cookieParser from 'cookie-parser'; import cookieParser from 'cookie-parser';
import debug from 'debug'; import debug from 'debug';
import * as express from 'express'; import * as express from 'express';
import type { Router } from 'express';
import importFresh from 'import-fresh'; import importFresh from 'import-fresh';
import morgan from 'morgan'; import morgan from 'morgan';
import NcToolGui from 'nc-lib-gui'; import NcToolGui from 'nc-lib-gui';
import requestIp from 'request-ip'; import requestIp from 'request-ip';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import type { NcConfig } from '../interface/config'; import { T } from 'nc-help';
import mkdirp from 'mkdirp';
import { NC_LICENSE_KEY } from './constants'; import { NC_LICENSE_KEY } from './constants';
import Migrator from './db/sql-migrator/lib/KnexMigrator'; import Migrator from './db/sql-migrator/lib/KnexMigrator';
import Store from './models/Store'; import Store from './models/Store';
import NcConfigFactory from './utils/NcConfigFactory'; import NcConfigFactory from './utils/NcConfigFactory';
import { T } from 'nc-help';
import NcProjectBuilderCE from './v1-legacy/NcProjectBuilder'; import NcProjectBuilderCE from './v1-legacy/NcProjectBuilder';
import NcProjectBuilderEE from './v1-legacy/NcProjectBuilderEE'; import NcProjectBuilderEE from './v1-legacy/NcProjectBuilderEE';
import type { GqlApiBuilder } from './v1-legacy/gql/GqlApiBuilder';
import type NcMetaIO from './meta/NcMetaIO';
import NcMetaImplCE from './meta/NcMetaIOImpl'; import NcMetaImplCE from './meta/NcMetaIOImpl';
import NcMetaImplEE from './meta/NcMetaIOImplEE'; import NcMetaImplEE from './meta/NcMetaIOImplEE';
import type NcMetaMgrCE from './meta/NcMetaMgr';
import type NcMetaMgrEE from './meta/NcMetaMgrEE';
import type { RestApiBuilder } from './v1-legacy/rest/RestApiBuilder';
import RestAuthCtrlCE from './v1-legacy/rest/RestAuthCtrl'; import RestAuthCtrlCE from './v1-legacy/rest/RestAuthCtrl';
import RestAuthCtrlEE from './v1-legacy/rest/RestAuthCtrlEE'; import RestAuthCtrlEE from './v1-legacy/rest/RestAuthCtrlEE';
import mkdirp from 'mkdirp';
import MetaAPILogger from './meta/MetaAPILogger'; import MetaAPILogger from './meta/MetaAPILogger';
import NcUpgrader from './version-upgrader/NcUpgrader'; import NcUpgrader from './version-upgrader/NcUpgrader';
import type NcMetaMgrv2 from './meta/NcMetaMgrv2';
import NocoCache from './cache/NocoCache'; import NocoCache from './cache/NocoCache';
import registerMetaApis from './meta/api'; import registerMetaApis from './meta/api';
import NcPluginMgrv2 from './meta/helpers/NcPluginMgrv2'; import NcPluginMgrv2 from './meta/helpers/NcPluginMgrv2';
import User from './models/User'; import User from './models/User';
import type * as http from 'http';
import weAreHiring from './utils/weAreHiring'; import weAreHiring from './utils/weAreHiring';
import getInstance from './utils/getInstance'; import getInstance from './utils/getInstance';
import initAdminFromEnv from './services/user/initAdminFromEnv'; import initAdminFromEnv from './services/user/initAdminFromEnv';
import type * as http from 'http';
import type NcMetaMgrv2 from './meta/NcMetaMgrv2';
import type { RestApiBuilder } from './v1-legacy/rest/RestApiBuilder';
import type NcMetaMgrEE from './meta/NcMetaMgrEE';
import type NcMetaMgrCE from './meta/NcMetaMgr';
import type NcMetaIO from './meta/NcMetaIO';
import type { GqlApiBuilder } from './v1-legacy/gql/GqlApiBuilder';
import type { NcConfig } from '../interface/config';
import type { Router } from 'express';
const log = debug('nc:app'); const log = debug('nc:app');
require('dotenv').config(); require('dotenv').config();

4
packages/nocodb/src/lib/cache/NocoCache.ts vendored

@ -1,7 +1,7 @@
import type CacheMgr from './CacheMgr'; import { CacheGetType } from '../utils/globals';
import RedisCacheMgr from './RedisCacheMgr'; import RedisCacheMgr from './RedisCacheMgr';
import RedisMockCacheMgr from './RedisMockCacheMgr'; import RedisMockCacheMgr from './RedisMockCacheMgr';
import { CacheGetType } from '../utils/globals'; import type CacheMgr from './CacheMgr';
export default class NocoCache { export default class NocoCache {
private static client: CacheMgr; private static client: CacheMgr;

2
packages/nocodb/src/lib/cache/RedisCacheMgr.ts vendored

@ -1,7 +1,7 @@
import debug from 'debug'; import debug from 'debug';
import CacheMgr from './CacheMgr';
import Redis from 'ioredis'; import Redis from 'ioredis';
import { CacheDelDirection, CacheGetType, CacheScope } from '../utils/globals'; import { CacheDelDirection, CacheGetType, CacheScope } from '../utils/globals';
import CacheMgr from './CacheMgr';
const log = debug('nc:cache'); const log = debug('nc:cache');

2
packages/nocodb/src/lib/cache/RedisMockCacheMgr.ts vendored

@ -1,7 +1,7 @@
import debug from 'debug'; import debug from 'debug';
import CacheMgr from './CacheMgr';
import Redis from 'ioredis-mock'; import Redis from 'ioredis-mock';
import { CacheDelDirection, CacheGetType, CacheScope } from '../utils/globals'; import { CacheDelDirection, CacheGetType, CacheScope } from '../utils/globals';
import CacheMgr from './CacheMgr';
const log = debug('nc:cache'); const log = debug('nc:cache');
export default class RedisMockCacheMgr extends CacheMgr { export default class RedisMockCacheMgr extends CacheMgr {

2
packages/nocodb/src/lib/controllers/apiDocs/index.ts

@ -1,8 +1,8 @@
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { swaggerService } from '../../services';
import getSwaggerHtml from './swaggerHtml'; import getSwaggerHtml from './swaggerHtml';
import getRedocHtml from './redocHtml'; import getRedocHtml from './redocHtml';
import { swaggerService } from '../../services';
async function swaggerJson(req, res) { async function swaggerJson(req, res) {
const swagger = await swaggerService.swaggerJson({ const swagger = await swaggerService.swaggerJson({

2
packages/nocodb/src/lib/controllers/apiToken.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { apiTokenService } from '../services'; import { apiTokenService } from '../services';
import type { Request, Response } from 'express';
export async function apiTokenList(req: Request, res: Response) { export async function apiTokenList(req: Request, res: Response) {
res.json(await apiTokenService.apiTokenList({ userId: req['user'].id })); res.json(await apiTokenService.apiTokenList({ userId: req['user'].id }));

4
packages/nocodb/src/lib/controllers/attachment.ctl.ts

@ -1,8 +1,7 @@
import type { Request, Response } from 'express'; import path from 'path';
import { Router } from 'express'; import { Router } from 'express';
import multer from 'multer'; import multer from 'multer';
import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk'; import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk';
import path from 'path';
import Noco from '../Noco'; import Noco from '../Noco';
import { MetaTable } from '../utils/globals'; import { MetaTable } from '../utils/globals';
import extractProjectIdAndAuthenticate from '../meta/helpers/extractProjectIdAndAuthenticate'; import extractProjectIdAndAuthenticate from '../meta/helpers/extractProjectIdAndAuthenticate';
@ -10,6 +9,7 @@ import catchError, { NcError } from '../meta/helpers/catchError';
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants'; import { NC_ATTACHMENT_FIELD_SIZE } from '../constants';
import { getCacheMiddleware } from '../meta/api/helpers'; import { getCacheMiddleware } from '../meta/api/helpers';
import { attachmentService } from '../services'; import { attachmentService } from '../services';
import type { Request, Response } from 'express';
const isUploadAllowedMw = async (req: Request, _res: Response, next: any) => { const isUploadAllowedMw = async (req: Request, _res: Response, next: any) => {
if (!req['user']?.id) { if (!req['user']?.id) {

2
packages/nocodb/src/lib/controllers/audit.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import Audit from '../models/Audit'; import Audit from '../models/Audit';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { auditService } from '../services'; import { auditService } from '../services';
import type { Request, Response } from 'express';
export async function commentRow(req: Request<any, any>, res) { export async function commentRow(req: Request<any, any>, res) {
res.json( res.json(

6
packages/nocodb/src/lib/controllers/base.ctl.ts

@ -1,11 +1,11 @@
import type { Request, Response } from 'express';
import type { BaseListType } from 'nocodb-sdk';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type Base from '../models/Base';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { baseService } from '../services'; import { baseService } from '../services';
import type Base from '../models/Base';
import type { BaseListType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
async function baseGet(req: Request<any>, res: Response<Base>) { async function baseGet(req: Request<any>, res: Response<Base>) {
const base = await baseService.baseGetWithConfig({ const base = await baseService.baseGetWithConfig({

2
packages/nocodb/src/lib/controllers/cache.ctl.ts

@ -1,5 +1,5 @@
import catchError from '../meta/helpers/catchError';
import { Router } from 'express'; import { Router } from 'express';
import catchError from '../meta/helpers/catchError';
import { cacheService } from '../services'; import { cacheService } from '../services';
export async function cacheGet(_, res) { export async function cacheGet(_, res) {

4
packages/nocodb/src/lib/controllers/column.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { ColumnReqType, TableType, UITypes } from 'nocodb-sdk';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { columnService } from '../services'; import { columnService } from '../services';
import type { ColumnReqType, TableType, UITypes } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function columnGet(req: Request, res: Response) { export async function columnGet(req: Request, res: Response) {
res.json(await columnService.columnGet({ columnId: req.params.columnId })); res.json(await columnService.columnGet({ columnId: req.params.columnId }));

2
packages/nocodb/src/lib/controllers/dbData/bulkDataAlias.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { bulkDataService } from '../../services'; import { bulkDataService } from '../../services';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics'; import apiMetrics from '../../meta/helpers/apiMetrics';
import type { Request, Response } from 'express';
async function bulkDataInsert(req: Request, res: Response) { async function bulkDataInsert(req: Request, res: Response) {
res.json( res.json(

2
packages/nocodb/src/lib/controllers/dbData/data.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { dataService } from '../../services'; import { dataService } from '../../services';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics'; import apiMetrics from '../../meta/helpers/apiMetrics';
import type { Request, Response } from 'express';
export async function dataList(req: Request, res: Response) { export async function dataList(req: Request, res: Response) {
res.json( res.json(

2
packages/nocodb/src/lib/controllers/dbData/dataAlias.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { dataService } from '../../services'; import { dataService } from '../../services';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics'; import apiMetrics from '../../meta/helpers/apiMetrics';
import { parseHrtimeToSeconds } from '../../meta/api/helpers'; import { parseHrtimeToSeconds } from '../../meta/api/helpers';
import type { Request, Response } from 'express';
// todo: Handle the error case where view doesnt belong to model // todo: Handle the error case where view doesnt belong to model
async function dataList(req: Request, res: Response) { async function dataList(req: Request, res: Response) {

2
packages/nocodb/src/lib/controllers/dbData/dataAliasExport.ctl.ts

@ -1,4 +1,3 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import apiMetrics from '../../meta/helpers/apiMetrics'; import apiMetrics from '../../meta/helpers/apiMetrics';
@ -6,6 +5,7 @@ import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { View } from '../../models'; import { View } from '../../models';
import { extractCsvData, extractXlsxData } from '../../services/dbData/helpers'; import { extractCsvData, extractXlsxData } from '../../services/dbData/helpers';
import { getViewAndModelFromRequestByAliasOrId } from './helpers'; import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import type { Request, Response } from 'express';
async function excelDataExport(req: Request, res: Response) { async function excelDataExport(req: Request, res: Response) {
const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);

2
packages/nocodb/src/lib/controllers/dbData/dataAliasNested.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics'; import apiMetrics from '../../meta/helpers/apiMetrics';
import { dataAliasNestedService } from '../../services'; import { dataAliasNestedService } from '../../services';
import type { Request, Response } from 'express';
// todo: handle case where the given column is not ltar // todo: handle case where the given column is not ltar
export async function mmList(req: Request, res: Response) { export async function mmList(req: Request, res: Response) {

10
packages/nocodb/src/lib/controllers/dbData/helpers.ts

@ -1,19 +1,19 @@
import { isSystemColumn, UITypes } from 'nocodb-sdk';
import * as XLSX from 'xlsx';
import papaparse from 'papaparse';
import { NcError } from '../../meta/helpers/catchError'; import { NcError } from '../../meta/helpers/catchError';
import Project from '../../models/Project'; import Project from '../../models/Project';
import Model from '../../models/Model'; import Model from '../../models/Model';
import View from '../../models/View'; import View from '../../models/View';
import type { Request } from 'express';
import Base from '../../models/Base'; import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { isSystemColumn, UITypes } from 'nocodb-sdk';
import * as XLSX from 'xlsx';
import Column from '../../models/Column'; import Column from '../../models/Column';
import { dataService } from '../../services';
import type LookupColumn from '../../models/LookupColumn'; import type LookupColumn from '../../models/LookupColumn';
import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import papaparse from 'papaparse'; import type { Request } from 'express';
import { dataService } from '../../services';
export async function getViewAndModelFromRequestByAliasOrId( export async function getViewAndModelFromRequestByAliasOrId(
req: req:
| Request<{ projectName: string; tableName: string; viewName?: string }> | Request<{ projectName: string; tableName: string; viewName?: string }>

4
packages/nocodb/src/lib/controllers/dbData/oldData.ctl.ts

@ -1,7 +1,6 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import Model from '../../models/Model';
import { nocoExecute } from 'nc-help'; import { nocoExecute } from 'nc-help';
import Model from '../../models/Model';
import Base from '../../models/Base'; import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import View from '../../models/View'; import View from '../../models/View';
@ -10,6 +9,7 @@ import Project from '../../models/Project';
import { NcError } from '../../meta/helpers/catchError'; import { NcError } from '../../meta/helpers/catchError';
import apiMetrics from '../../meta/helpers/apiMetrics'; import apiMetrics from '../../meta/helpers/apiMetrics';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst'; import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
import type { Request, Response } from 'express';
export async function dataList(req: Request, res: Response) { export async function dataList(req: Request, res: Response) {
const { model, view } = await getViewAndModelFromRequest(req); const { model, view } = await getViewAndModelFromRequest(req);

2
packages/nocodb/src/lib/controllers/export.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import View from '../models/View'; import View from '../models/View';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { extractCsvData } from './dbData/helpers'; import { extractCsvData } from './dbData/helpers';
import type { Request, Response } from 'express';
async function exportCsv(req: Request, res: Response) { async function exportCsv(req: Request, res: Response) {
const view = await View.get(req.params.viewId); const view = await View.get(req.params.viewId);

4
packages/nocodb/src/lib/controllers/filter.ctl.ts

@ -1,10 +1,10 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { FilterReqType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { filterService } from '../services'; import { filterService } from '../services';
import type { FilterReqType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// @ts-ignore // @ts-ignore
export async function filterGet(req: Request, res: Response) { export async function filterGet(req: Request, res: Response) {

6
packages/nocodb/src/lib/controllers/hook.ctl.ts

@ -1,11 +1,11 @@
import catchError from '../meta/helpers/catchError';
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { HookListType, HookType } from 'nocodb-sdk'; import catchError from '../meta/helpers/catchError';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { hookService } from '../services'; import { hookService } from '../services';
import type { HookListType, HookType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function hookList( export async function hookList(
req: Request<any, any, any>, req: Request<any, any, any>,

2
packages/nocodb/src/lib/controllers/hookFilter.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { T } from 'nc-help'; import { T } from 'nc-help';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { hookFilterService } from '../services'; import { hookFilterService } from '../services';
import type { Request, Response } from 'express';
export async function filterGet(req: Request, res: Response) { export async function filterGet(req: Request, res: Response) {
const filter = await hookFilterService.filterGet({ const filter = await hookFilterService.filterGet({

2
packages/nocodb/src/lib/controllers/metaDiff.ctl.ts

@ -1,5 +1,5 @@
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { metaDiffService } from '../services'; import { metaDiffService } from '../services';

2
packages/nocodb/src/lib/controllers/orgToken.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getConditionalHandler } from '../meta/helpers/getHandler'; import { getConditionalHandler } from '../meta/helpers/getHandler';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { orgTokenService, orgTokenServiceEE } from '../services'; import { orgTokenService, orgTokenServiceEE } from '../services';
import type { Request, Response } from 'express';
async function apiTokenList(req, res) { async function apiTokenList(req, res) {
res.json( res.json(

4
packages/nocodb/src/lib/controllers/plugin.ctl.ts

@ -1,10 +1,10 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { PluginType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { pluginService } from '../services'; import { pluginService } from '../services';
import type { PluginType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function pluginList(_req: Request, res: Response) { export async function pluginList(_req: Request, res: Response) {
res.json(new PagedResponseImpl(await pluginService.pluginList())); res.json(new PagedResponseImpl(await pluginService.pluginList()));

12
packages/nocodb/src/lib/controllers/project.ctl.ts

@ -1,19 +1,19 @@
import type { Request, Response } from 'express';
import type { ProjectType } from 'nocodb-sdk';
import Project from '../models/Project';
import type { ProjectListType } from 'nocodb-sdk';
import { packageVersion } from '../utils/packageVersion';
import { T } from 'nc-help'; import { T } from 'nc-help';
import isDocker from 'is-docker';
import { packageVersion } from '../utils/packageVersion';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import ProjectUser from '../models/ProjectUser'; import ProjectUser from '../models/ProjectUser';
import Noco from '../Noco'; import Noco from '../Noco';
import isDocker from 'is-docker'; import Project from '../models/Project';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import Filter from '../models/Filter'; import Filter from '../models/Filter';
import { projectService } from '../services'; import { projectService } from '../services';
import type { ProjectListType } from 'nocodb-sdk';
import type { ProjectType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// // Project CRUD // // Project CRUD

2
packages/nocodb/src/lib/controllers/projectUser.ctl.ts

@ -1,5 +1,5 @@
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { projectUserService } from '../services'; import { projectUserService } from '../services';

2
packages/nocodb/src/lib/controllers/publicControllers/publicData.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import multer from 'multer'; import multer from 'multer';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants'; import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
import catchError from '../../meta/helpers/catchError'; import catchError from '../../meta/helpers/catchError';
import { publicDataService } from '../../services'; import { publicDataService } from '../../services';
import type { Request, Response } from 'express';
export async function dataList(req: Request, res: Response) { export async function dataList(req: Request, res: Response) {
const pagedResponse = await publicDataService.dataList({ const pagedResponse = await publicDataService.dataList({

4
packages/nocodb/src/lib/controllers/publicControllers/publicDataExport.ctl.ts

@ -1,4 +1,3 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { nocoExecute } from 'nc-help'; import { nocoExecute } from 'nc-help';
@ -6,9 +5,10 @@ import papaparse from 'papaparse';
import { ErrorMessages, isSystemColumn, UITypes, ViewTypes } from 'nocodb-sdk'; import { ErrorMessages, isSystemColumn, UITypes, ViewTypes } from 'nocodb-sdk';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst'; import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
import catchError, { NcError } from '../../meta/helpers/catchError'; import catchError, { NcError } from '../../meta/helpers/catchError';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../../models';
import { Base, Column, Model, View } from '../../models'; import { Base, Column, Model, View } from '../../models';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../../models';
import type { Request, Response } from 'express';
async function exportExcel(req: Request, res: Response) { async function exportExcel(req: Request, res: Response) {
const view = await View.getByUUID(req.params.publicDataUuid); const view = await View.getByUUID(req.params.publicDataUuid);

2
packages/nocodb/src/lib/controllers/publicControllers/publicMeta.ctl.ts

@ -1,7 +1,7 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import catchError from '../../meta/helpers/catchError'; import catchError from '../../meta/helpers/catchError';
import { publicMetaService } from '../../services'; import { publicMetaService } from '../../services';
import type { Request, Response } from 'express';
export async function viewMetaGet(req: Request, res: Response) { export async function viewMetaGet(req: Request, res: Response) {
res.json( res.json(

4
packages/nocodb/src/lib/controllers/sort.ctl.ts

@ -1,11 +1,11 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { SortListType, SortReqType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { sortService } from '../services'; import { sortService } from '../services';
import type { SortListType, SortReqType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// @ts-ignore // @ts-ignore
export async function sortList( export async function sortList(

4
packages/nocodb/src/lib/controllers/sync/import.ctl.ts

@ -1,12 +1,12 @@
import type { Request, Router } from 'express';
// import { Queue } from 'bullmq'; // import { Queue } from 'bullmq';
// import axios from 'axios'; // import axios from 'axios';
import catchError, { NcError } from '../../meta/helpers/catchError'; import catchError, { NcError } from '../../meta/helpers/catchError';
import type { Server } from 'socket.io';
import NocoJobs from '../../jobs/NocoJobs'; import NocoJobs from '../../jobs/NocoJobs';
import { SyncSource } from '../../models'; import { SyncSource } from '../../models';
import Noco from '../../Noco'; import Noco from '../../Noco';
import { syncService, userService } from '../../services'; import { syncService, userService } from '../../services';
import type { Server } from 'socket.io';
import type { Request, Router } from 'express';
import type { AirtableSyncConfig } from '../../services/sync/helpers/job'; import type { AirtableSyncConfig } from '../../services/sync/helpers/job';
const AIRTABLE_IMPORT_JOB = 'AIRTABLE_IMPORT_JOB'; const AIRTABLE_IMPORT_JOB = 'AIRTABLE_IMPORT_JOB';

2
packages/nocodb/src/lib/controllers/sync/sync.ctl.ts

@ -1,7 +1,7 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { syncService } from '../../services'; import { syncService } from '../../services';
import type { Request, Response } from 'express';
export async function syncSourceList(req: Request, res: Response) { export async function syncSourceList(req: Request, res: Response) {
res.json( res.json(

4
packages/nocodb/src/lib/controllers/table.ctl.ts

@ -1,10 +1,10 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { TableListType, TableReqType, TableType } from 'nocodb-sdk';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { tableService } from '../services'; import { tableService } from '../services';
import type { TableListType, TableReqType, TableType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function tableList(req: Request, res: Response<TableListType>) { export async function tableList(req: Request, res: Response<TableListType>) {
res.json( res.json(

2
packages/nocodb/src/lib/controllers/test.ctl.ts

@ -1,6 +1,6 @@
import type { Request } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { TestResetService } from '../services/test/TestResetService'; import { TestResetService } from '../services/test/TestResetService';
import type { Request } from 'express';
export async function reset(req: Request<any, any>, res) { export async function reset(req: Request<any, any>, res) {
const service = new TestResetService({ const service = new TestResetService({

4
packages/nocodb/src/lib/controllers/user/initStrategies.ts

@ -1,12 +1,11 @@
import { OrgUserRoles } from 'nocodb-sdk';
import { promisify } from 'util'; import { promisify } from 'util';
import { OrgUserRoles } from 'nocodb-sdk';
import { Strategy as CustomStrategy } from 'passport-custom'; import { Strategy as CustomStrategy } from 'passport-custom';
import passport from 'passport'; import passport from 'passport';
import passportJWT from 'passport-jwt'; import passportJWT from 'passport-jwt';
import { Strategy as AuthTokenStrategy } from 'passport-auth-token'; import { Strategy as AuthTokenStrategy } from 'passport-auth-token';
import { Strategy as GoogleStrategy } from 'passport-google-oauth20'; import { Strategy as GoogleStrategy } from 'passport-google-oauth20';
const PassportLocalStrategy = require('passport-local').Strategy;
const ExtractJwt = passportJWT.ExtractJwt; const ExtractJwt = passportJWT.ExtractJwt;
const JwtStrategy = passportJWT.Strategy; const JwtStrategy = passportJWT.Strategy;
@ -20,6 +19,7 @@ import { ApiToken, Plugin, Project, ProjectUser, User } from '../../models';
import Noco from '../../Noco'; import Noco from '../../Noco';
import { CacheGetType, CacheScope } from '../../utils/globals'; import { CacheGetType, CacheScope } from '../../utils/globals';
import { userService } from '../../services'; import { userService } from '../../services';
const PassportLocalStrategy = require('passport-local').Strategy;
export function initStrategies(router): void { export function initStrategies(router): void {
passport.use( passport.use(

4
packages/nocodb/src/lib/controllers/user/user.ctl.ts

@ -1,6 +1,5 @@
import type { Request } from 'express';
import * as ejs from 'ejs';
import { promisify } from 'util'; import { promisify } from 'util';
import * as ejs from 'ejs';
import passport from 'passport'; import passport from 'passport';
import catchError, { NcError } from '../../meta/helpers/catchError'; import catchError, { NcError } from '../../meta/helpers/catchError';
@ -10,6 +9,7 @@ import { Audit, User } from '../../models';
import Noco from '../../Noco'; import Noco from '../../Noco';
import { userService } from '../../services'; import { userService } from '../../services';
import { setTokenCookie } from '../../services/user/helpers'; import { setTokenCookie } from '../../services/user/helpers';
import type { Request } from 'express';
export async function signup(req: Request<any, any>, res): Promise<any> { export async function signup(req: Request<any, any>, res): Promise<any> {
res.json( res.json(

2
packages/nocodb/src/lib/controllers/util.ctl.ts

@ -1,8 +1,8 @@
// // Project CRUD // // Project CRUD
import type { Request, Response } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import catchError from '../meta/helpers/catchError'; import catchError from '../meta/helpers/catchError';
import { utilService } from '../services'; import { utilService } from '../services';
import type { Request, Response } from 'express';
export async function testConnection(req: Request, res: Response) { export async function testConnection(req: Request, res: Response) {
res.json(await utilService.testConnection({ body: req.body })); res.json(await utilService.testConnection({ body: req.body }));

4
packages/nocodb/src/lib/controllers/view.ctl.ts

@ -1,10 +1,10 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { View } from '../models';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { viewService } from '../services'; import { viewService } from '../services';
import type { View } from '../models';
import type { Request, Response } from 'express';
// @ts-ignore // @ts-ignore
export async function viewGet(req: Request, res: Response) {} export async function viewGet(req: Request, res: Response) {}

2
packages/nocodb/src/lib/controllers/viewColumn.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { viewColumnService } from '../services'; import { viewColumnService } from '../services';
import type { Request, Response } from 'express';
export async function columnList(req: Request, res: Response) { export async function columnList(req: Request, res: Response) {
res.json(await viewColumnService.columnList({ viewId: req.params.viewId })); res.json(await viewColumnService.columnList({ viewId: req.params.viewId }));

4
packages/nocodb/src/lib/controllers/views/formView.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { FormType } from 'nocodb-sdk';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { formViewService } from '../../services'; import { formViewService } from '../../services';
import type { FormType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function formViewGet(req: Request, res: Response<FormType>) { export async function formViewGet(req: Request, res: Response<FormType>) {
const formViewData = await formViewService.formViewGet({ const formViewData = await formViewService.formViewGet({

2
packages/nocodb/src/lib/controllers/views/formViewColumn.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { formViewColumnService } from '../../services'; import { formViewColumnService } from '../../services';
import type { Request, Response } from 'express';
export async function columnUpdate(req: Request, res: Response) { export async function columnUpdate(req: Request, res: Response) {
res.json( res.json(

4
packages/nocodb/src/lib/controllers/views/galleryView.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { GalleryType } from 'nocodb-sdk';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { galleryViewService } from '../../services'; import { galleryViewService } from '../../services';
import type { GalleryType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function galleryViewGet(req: Request, res: Response<GalleryType>) { export async function galleryViewGet(req: Request, res: Response<GalleryType>) {
res.json( res.json(

2
packages/nocodb/src/lib/controllers/views/gridView.ctl.ts

@ -1,8 +1,8 @@
import type { Request } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { gridViewService } from '../../services'; import { gridViewService } from '../../services';
import type { Request } from 'express';
export async function gridViewCreate(req: Request<any>, res) { export async function gridViewCreate(req: Request<any>, res) {
const view = await gridViewService.gridViewCreate({ const view = await gridViewService.gridViewCreate({

2
packages/nocodb/src/lib/controllers/views/gridViewColumn.ctl.ts

@ -1,8 +1,8 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { gridViewColumnService } from '../../services'; import { gridViewColumnService } from '../../services';
import type { Request, Response } from 'express';
export async function columnList(req: Request, res: Response) { export async function columnList(req: Request, res: Response) {
res.json( res.json(

6
packages/nocodb/src/lib/controllers/views/kanbanView.ctl.ts

@ -1,12 +1,12 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { KanbanType } from 'nocodb-sdk';
import { ViewTypes } from 'nocodb-sdk'; import { ViewTypes } from 'nocodb-sdk';
import { T } from 'nc-help';
import View from '../../models/View'; import View from '../../models/View';
import KanbanView from '../../models/KanbanView'; import KanbanView from '../../models/KanbanView';
import { T } from 'nc-help';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import type { KanbanType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// todo: map to service // todo: map to service

4
packages/nocodb/src/lib/controllers/views/mapView.ctl.ts

@ -1,9 +1,9 @@
import type { Request, Response } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import type { MapType } from 'nocodb-sdk';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics'; import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { mapViewService } from '../../services'; import { mapViewService } from '../../services';
import type { MapType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function mapViewGet(req: Request, res: Response<MapType>) { export async function mapViewGet(req: Request, res: Response<MapType>) {
res.json( res.json(

14
packages/nocodb/src/lib/db/sql-client/lib/KnexClient.ts

@ -1,20 +1,20 @@
/* eslint-disable no-constant-condition */ /* eslint-disable no-constant-condition */
import type { Knex } from 'knex'; import fs from 'fs';
import { promisify } from 'util';
import path from 'path';
import { knex } from 'knex'; import { knex } from 'knex';
import { T } from 'nc-help'; import { T } from 'nc-help';
import Debug from '../../util/Debug';
import Emit from '../../util/emit';
import Result from '../../util/Result';
import findIndex from 'lodash/findIndex'; import findIndex from 'lodash/findIndex';
import find from 'lodash/find'; import find from 'lodash/find';
import fs from 'fs';
import { promisify } from 'util';
import jsonfile from 'jsonfile'; import jsonfile from 'jsonfile';
import path from 'path';
import mkdirp from 'mkdirp'; import mkdirp from 'mkdirp';
import Result from '../../util/Result';
import Emit from '../../util/emit';
import Debug from '../../util/Debug';
import * as dataHelp from './data.helper'; import * as dataHelp from './data.helper';
import SqlClient from './SqlClient'; import SqlClient from './SqlClient';
import type { Knex } from 'knex';
const evt = new Emit(); const evt = new Emit();
const log = new Debug('KnexClient'); const log = new Debug('KnexClient');

5
packages/nocodb/src/lib/db/sql-client/lib/SqlClientFactory.ts

@ -1,3 +1,5 @@
import fs from 'fs';
import { promisify } from 'util';
import Noco from '../../../Noco'; import Noco from '../../../Noco';
import SqlClientFactoryEE from './ee/SqlClientFactoryEE'; import SqlClientFactoryEE from './ee/SqlClientFactoryEE';
import MySqlClient from './mysql/MysqlClient'; import MySqlClient from './mysql/MysqlClient';
@ -9,9 +11,6 @@ import YugabyteClient from './pg/YugabyteClient';
import TidbClient from './mysql/TidbClient'; import TidbClient from './mysql/TidbClient';
import VitessClient from './mysql/VitessClient'; import VitessClient from './mysql/VitessClient';
import fs from 'fs';
import { promisify } from 'util';
export class SqlClientFactory { export class SqlClientFactory {
static create(connectionConfig) { static create(connectionConfig) {
connectionConfig.meta = connectionConfig.meta || {}; connectionConfig.meta = connectionConfig.meta || {};

2
packages/nocodb/src/lib/db/sql-client/lib/ee/SqlClientFactoryEE.ts

@ -1,6 +1,6 @@
import { SnowflakeClient } from 'nc-help';
import { SqlClientFactory } from '../SqlClientFactory'; import { SqlClientFactory } from '../SqlClientFactory';
import SfClient from '../snowflake/SnowflakeClient'; import SfClient from '../snowflake/SnowflakeClient';
import { SnowflakeClient } from 'nc-help';
class SqlClientFactoryEE { class SqlClientFactoryEE {
static create(connectionConfig) { static create(connectionConfig) {

5
packages/nocodb/src/lib/db/sql-client/lib/mssql/MssqlClient.ts

@ -1,10 +1,9 @@
import type { ColumnType } from 'nocodb-sdk';
import knex from 'knex'; import knex from 'knex';
import find from 'lodash/find';
import KnexClient from '../KnexClient'; import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug'; import Debug from '../../../util/Debug';
import Result from '../../../util/Result'; import Result from '../../../util/Result';
import find from 'lodash/find'; import type { ColumnType } from 'nocodb-sdk';
const log = new Debug('MssqlClient'); const log = new Debug('MssqlClient');

15
packages/nocodb/src/lib/db/sql-client/lib/mysql/MysqlClient.ts

@ -1,24 +1,23 @@
import path from 'path';
import { promisify } from 'util';
import knex from 'knex'; import knex from 'knex';
import isEmpty from 'lodash/isEmpty'; import isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys'; import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find'; import find from 'lodash/find';
import jsonfile from 'jsonfile';
import mkdirp from 'mkdirp';
import { nanoid } from 'nanoid';
import levenshtein from 'fast-levenshtein';
import Debug from '../../../util/Debug'; import Debug from '../../../util/Debug';
import Emit from '../../../util/emit'; import Emit from '../../../util/emit';
import Result from '../../../util/Result'; import Result from '../../../util/Result';
import queries from './mysql.queries';
import KnexClient from '../KnexClient'; import KnexClient from '../KnexClient';
import jsonfile from 'jsonfile'; import queries from './mysql.queries';
import path from 'path';
import mkdirp from 'mkdirp';
import { promisify } from 'util';
import { nanoid } from 'nanoid';
import fakerFunctionList from './fakerFunctionList'; import fakerFunctionList from './fakerFunctionList';
import * as findDataType from './findDataTypeMapping'; import * as findDataType from './findDataTypeMapping';
import levenshtein from 'fast-levenshtein';
const log = new Debug('MysqlClient'); const log = new Debug('MysqlClient');
const evt = new Emit(); const evt = new Emit();

4
packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts

@ -1,9 +1,9 @@
import knex from 'knex'; import knex from 'knex';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
import KnexClient from '../KnexClient'; import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug'; import Debug from '../../../util/Debug';
import Result from '../../../util/Result'; import Result from '../../../util/Result';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
const log = new Debug('OracleClient'); const log = new Debug('OracleClient');

6
packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts

@ -1,13 +1,13 @@
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import knex from 'knex'; import knex from 'knex';
import isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
import KnexClient from '../KnexClient'; import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug'; import Debug from '../../../util/Debug';
import Result from '../../../util/Result'; import Result from '../../../util/Result';
import queries from './pg.queries'; import queries from './pg.queries';
import isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
const log = new Debug('PGClient'); const log = new Debug('PGClient');
class PGClient extends KnexClient { class PGClient extends KnexClient {

2
packages/nocodb/src/lib/db/sql-client/lib/pg/YugabyteClient.ts

@ -1,6 +1,6 @@
import PGClient from './PgClient';
import Debug from '../../../util/Debug'; import Debug from '../../../util/Debug';
import Result from '../../../util/Result'; import Result from '../../../util/Result';
import PGClient from './PgClient';
const log = new Debug('YBClient'); const log = new Debug('YBClient');

2
packages/nocodb/src/lib/db/sql-client/lib/snowflake/SnowflakeClient.ts

@ -1,11 +1,11 @@
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import _ from 'lodash'; import _ from 'lodash';
import lodash from 'lodash';
import KnexClient from '../KnexClient'; import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug'; import Debug from '../../../util/Debug';
import Result from '../../../util/Result'; import Result from '../../../util/Result';
import queries from './snowflake.queries'; import queries from './snowflake.queries';
import lodash from 'lodash';
const log = new Debug('SnowflakeClient'); const log = new Debug('SnowflakeClient');
const rowsToLower = (arr) => { const rowsToLower = (arr) => {

10
packages/nocodb/src/lib/db/sql-client/lib/sqlite/SqliteClient.ts

@ -1,14 +1,14 @@
import { promisify } from 'util'; import { promisify } from 'util';
import knex from 'knex';
import fs from 'fs'; import fs from 'fs';
import KnexClient from '../KnexClient'; import knex from 'knex';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
import queries from './sqlite.queries';
import isEmpty from 'lodash/isEmpty'; import isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys'; import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find'; import find from 'lodash/find';
import { customAlphabet } from 'nanoid'; import { customAlphabet } from 'nanoid';
import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
import queries from './sqlite.queries';
const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 6); const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 6);

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts

@ -2,11 +2,11 @@ import autoBind from 'auto-bind';
import _ from 'lodash'; import _ from 'lodash';
import Validator from 'validator'; import Validator from 'validator';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel'; import Papaparse from 'papaparse';
import BaseModel from '../BaseModel'; import BaseModel from '../BaseModel';
import formulaQueryBuilder from './formulaQueryBuilderFromString'; import formulaQueryBuilder from './formulaQueryBuilderFromString';
import genRollupSelect from './genRollupSelect'; import genRollupSelect from './genRollupSelect';
import Papaparse from 'papaparse'; import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
/** /**
* Base class for models * Base class for models

54
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -1,29 +1,7 @@
import autoBind from 'auto-bind'; import autoBind from 'auto-bind';
import _ from 'lodash'; import _ from 'lodash';
import Model from '../../../../models/Model';
import type SelectOption from '../../../../models/SelectOption';
import type { XKnex } from '../../index';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type RollupColumn from '../../../../models/RollupColumn';
import type LookupColumn from '../../../../models/LookupColumn';
import DataLoader from 'dataloader'; import DataLoader from 'dataloader';
import Column from '../../../../models/Column';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
import conditionV2 from './conditionV2';
import Filter, {
COMPARISON_OPS,
COMPARISON_SUB_OPS,
IS_WITHIN_COMPARISON_SUB_OPS,
} from '../../../../models/Filter';
import sortV2 from './sortV2';
import Sort from '../../../../models/Sort';
import type FormulaColumn from '../../../../models/FormulaColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import type { Knex } from 'knex';
import View from '../../../../models/View';
import type { SortType } from 'nocodb-sdk';
import { import {
AuditOperationSubTypes, AuditOperationSubTypes,
AuditOperationTypes, AuditOperationTypes,
@ -32,8 +10,20 @@ import {
UITypes, UITypes,
ViewTypes, ViewTypes,
} from 'nocodb-sdk'; } from 'nocodb-sdk';
import formSubmissionEmailTemplate from '../../../../utils/common/formSubmissionEmailTemplate';
import ejs from 'ejs'; import ejs from 'ejs';
import Validator from 'validator';
import { customAlphabet } from 'nanoid';
import DOMPurify from 'isomorphic-dompurify';
import Model from '../../../../models/Model';
import Column from '../../../../models/Column';
import Filter, {
COMPARISON_OPS,
COMPARISON_SUB_OPS,
IS_WITHIN_COMPARISON_SUB_OPS,
} from '../../../../models/Filter';
import Sort from '../../../../models/Sort';
import View from '../../../../models/View';
import formSubmissionEmailTemplate from '../../../../utils/common/formSubmissionEmailTemplate';
import Audit from '../../../../models/Audit'; import Audit from '../../../../models/Audit';
import FormView from '../../../../models/FormView'; import FormView from '../../../../models/FormView';
import Hook from '../../../../models/Hook'; import Hook from '../../../../models/Hook';
@ -42,12 +32,22 @@ import {
_transformSubmittedFormDataForEmail, _transformSubmittedFormDataForEmail,
invokeWebhook, invokeWebhook,
} from '../../../../meta/helpers/webhookHelpers'; } from '../../../../meta/helpers/webhookHelpers';
import Validator from 'validator';
import { customValidators } from './customValidators';
import { NcError } from '../../../../meta/helpers/catchError'; import { NcError } from '../../../../meta/helpers/catchError';
import { customAlphabet } from 'nanoid'; import { customValidators } from './customValidators';
import DOMPurify from 'isomorphic-dompurify'; import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import genRollupSelectv2 from './genRollupSelectv2';
import sortV2 from './sortV2';
import conditionV2 from './conditionV2';
import { sanitize, unsanitize } from './helpers/sanitize'; import { sanitize, unsanitize } from './helpers/sanitize';
import type { SortType } from 'nocodb-sdk';
import type { Knex } from 'knex';
import type FormulaColumn from '../../../../models/FormulaColumn';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
import type LookupColumn from '../../../../models/LookupColumn';
import type RollupColumn from '../../../../models/RollupColumn';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type { XKnex } from '../../index';
import type SelectOption from '../../../../models/SelectOption';
import type QrCodeColumn from '../../../../models/QrCodeColumn'; import type QrCodeColumn from '../../../../models/QrCodeColumn';
import type BarcodeColumn from '../../../../models/BarcodeColumn'; import type BarcodeColumn from '../../../../models/BarcodeColumn';

6
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts

@ -1,14 +1,14 @@
import { Knex, knex } from 'knex'; import { Knex, knex } from 'knex';
import { SnowflakeClient } from 'nc-help'; import { SnowflakeClient } from 'nc-help';
import Filter from '../../../../models/Filter';
import type { FilterType } from 'nocodb-sdk'; import type { FilterType } from 'nocodb-sdk';
import type { BaseModelSql } from './BaseModelSql';
const types = require('pg').types; const types = require('pg').types;
// override parsing date column to Date() // override parsing date column to Date()
types.setTypeParser(1082, (val) => val); types.setTypeParser(1082, (val) => val);
import type { BaseModelSql } from './BaseModelSql';
import Filter from '../../../../models/Filter';
const opMappingGen = { const opMappingGen = {
eq: '=', eq: '=',
lt: '<', lt: '<',

12
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

@ -1,17 +1,17 @@
import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk';
import dayjs, { extend } from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
import Filter from '../../../../models/Filter'; import Filter from '../../../../models/Filter';
import genRollupSelectv2 from './genRollupSelectv2';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import { sanitize } from './helpers/sanitize';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import type { XKnex } from '../../index'; import type { XKnex } from '../../index';
import type Column from '../../../../models/Column'; import type Column from '../../../../models/Column';
import type LookupColumn from '../../../../models/LookupColumn'; import type LookupColumn from '../../../../models/LookupColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import type RollupColumn from '../../../../models/RollupColumn'; import type RollupColumn from '../../../../models/RollupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import type FormulaColumn from '../../../../models/FormulaColumn'; import type FormulaColumn from '../../../../models/FormulaColumn';
import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk';
import { sanitize } from './helpers/sanitize';
import dayjs, { extend } from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
extend(customParseFormat); extend(customParseFormat);

12
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts

@ -1,17 +1,17 @@
import jsep from 'jsep'; import jsep from 'jsep';
import { jsepCurlyHook, UITypes } from 'nocodb-sdk';
import mapFunctionName from '../mapFunctionName'; import mapFunctionName from '../mapFunctionName';
import genRollupSelectv2 from '../genRollupSelectv2';
import FormulaColumn from '../../../../../models/FormulaColumn';
import { validateDateWithUnknownFormat } from '../helpers/formulaFnHelper';
import { CacheGetType, CacheScope } from '../../../../../utils/globals';
import NocoCache from '../../../../../cache/NocoCache';
import type Model from '../../../../../models/Model'; import type Model from '../../../../../models/Model';
import type Column from '../../../../../models/Column'; import type Column from '../../../../../models/Column';
import genRollupSelectv2 from '../genRollupSelectv2';
import type RollupColumn from '../../../../../models/RollupColumn'; import type RollupColumn from '../../../../../models/RollupColumn';
import FormulaColumn from '../../../../../models/FormulaColumn';
import type { XKnex } from '../../../index'; import type { XKnex } from '../../../index';
import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
import type LookupColumn from '../../../../../models/LookupColumn'; import type LookupColumn from '../../../../../models/LookupColumn';
import { jsepCurlyHook, UITypes } from 'nocodb-sdk';
import { validateDateWithUnknownFormat } from '../helpers/formulaFnHelper';
import { CacheGetType, CacheScope } from '../../../../../utils/globals';
import NocoCache from '../../../../../cache/NocoCache';
// todo: switch function based on database // todo: switch function based on database

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mssql.ts

@ -1,8 +1,8 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import type { MapFnArgs } from '../mapFunctionName';
import commonFns from './commonFns';
import { convertUnits } from '../helpers/convertUnits'; import { convertUnits } from '../helpers/convertUnits';
import { getWeekdayByText } from '../helpers/formulaFnHelper'; import { getWeekdayByText } from '../helpers/formulaFnHelper';
import commonFns from './commonFns';
import type { MapFnArgs } from '../mapFunctionName';
const mssql = { const mssql = {
...commonFns, ...commonFns,

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts

@ -1,8 +1,8 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import type { MapFnArgs } from '../mapFunctionName';
import commonFns from './commonFns';
import { convertUnits } from '../helpers/convertUnits'; import { convertUnits } from '../helpers/convertUnits';
import { getWeekdayByText } from '../helpers/formulaFnHelper'; import { getWeekdayByText } from '../helpers/formulaFnHelper';
import commonFns from './commonFns';
import type { MapFnArgs } from '../mapFunctionName';
const mysql2 = { const mysql2 = {
...commonFns, ...commonFns,

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts

@ -1,8 +1,8 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import type { MapFnArgs } from '../mapFunctionName';
import commonFns from './commonFns';
import { convertUnits } from '../helpers/convertUnits'; import { convertUnits } from '../helpers/convertUnits';
import { getWeekdayByText } from '../helpers/formulaFnHelper'; import { getWeekdayByText } from '../helpers/formulaFnHelper';
import commonFns from './commonFns';
import type { MapFnArgs } from '../mapFunctionName';
const pg = { const pg = {
...commonFns, ...commonFns,

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts

@ -1,12 +1,12 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import type { MapFnArgs } from '../mapFunctionName';
import commonFns from './commonFns';
import { convertUnits } from '../helpers/convertUnits'; import { convertUnits } from '../helpers/convertUnits';
import { getWeekdayByText } from '../helpers/formulaFnHelper'; import { getWeekdayByText } from '../helpers/formulaFnHelper';
import { import {
convertToTargetFormat, convertToTargetFormat,
getDateFormat, getDateFormat,
} from '../../../../../utils/dateTimeUtils'; } from '../../../../../utils/dateTimeUtils';
import commonFns from './commonFns';
import type { MapFnArgs } from '../mapFunctionName';
const sqlite3 = { const sqlite3 = {
...commonFns, ...commonFns,

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/genRollupSelect.ts

@ -1,5 +1,5 @@
import type { Knex } from 'knex';
import { RelationTypes } from 'nocodb-sdk'; import { RelationTypes } from 'nocodb-sdk';
import type { Knex } from 'knex';
export default function ({ export default function ({
knex, knex,

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/genRollupSelectv2.ts

@ -1,8 +1,8 @@
import { RelationTypes } from 'nocodb-sdk';
import type RollupColumn from '../../../../models/RollupColumn'; import type RollupColumn from '../../../../models/RollupColumn';
import type { XKnex } from '../../index'; import type { XKnex } from '../../index';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import { RelationTypes } from 'nocodb-sdk';
export default async function ({ export default async function ({
knex, knex,

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

@ -1,5 +1,5 @@
import View from '../../../../../models/View';
import { isSystemColumn, UITypes } from 'nocodb-sdk'; import { isSystemColumn, UITypes } from 'nocodb-sdk';
import View from '../../../../../models/View';
import type Model from '../../../../../models/Model'; import type Model from '../../../../../models/Model';
import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/mapFunctionName.ts

@ -1,8 +1,8 @@
import type { XKnex } from '../../index';
import mssql from './functionMappings/mssql'; import mssql from './functionMappings/mssql';
import mysql from './functionMappings/mysql'; import mysql from './functionMappings/mysql';
import pg from './functionMappings/pg'; import pg from './functionMappings/pg';
import sqlite from './functionMappings/sqlite'; import sqlite from './functionMappings/sqlite';
import type { XKnex } from '../../index';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
export interface MapFnArgs { export interface MapFnArgs {

10
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts

@ -1,14 +1,14 @@
import { RelationTypes, UITypes } from 'nocodb-sdk';
import Sort from '../../../../models/Sort';
import genRollupSelectv2 from './genRollupSelectv2';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import { sanitize } from './helpers/sanitize';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import type { XKnex } from '../../index'; import type { XKnex } from '../../index';
import Sort from '../../../../models/Sort';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import type RollupColumn from '../../../../models/RollupColumn'; import type RollupColumn from '../../../../models/RollupColumn';
import type LookupColumn from '../../../../models/LookupColumn'; import type LookupColumn from '../../../../models/LookupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import type FormulaColumn from '../../../../models/FormulaColumn'; import type FormulaColumn from '../../../../models/FormulaColumn';
import { RelationTypes, UITypes } from 'nocodb-sdk';
import { sanitize } from './helpers/sanitize';
export default async function sortV2( export default async function sortV2(
sortList: Sort[], sortList: Sort[],

2
packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts

@ -8,13 +8,13 @@ import importFresh from 'import-fresh';
import inflection from 'inflection'; import inflection from 'inflection';
import slash from 'slash'; import slash from 'slash';
import { T } from 'nc-help'; import { T } from 'nc-help';
import { customAlphabet } from 'nanoid';
import SqlClientFactory from '../sql-client/lib/SqlClientFactory'; import SqlClientFactory from '../sql-client/lib/SqlClientFactory';
// import debug from 'debug'; // import debug from 'debug';
import KnexMigrator from '../sql-migrator/lib/KnexMigrator'; import KnexMigrator from '../sql-migrator/lib/KnexMigrator';
// import {XKnex} from "../sql-data-mapper"; // import {XKnex} from "../sql-data-mapper";
import NcConnectionMgr from '../../utils/common/NcConnectionMgr'; import NcConnectionMgr from '../../utils/common/NcConnectionMgr';
import { customAlphabet } from 'nanoid';
import Debug from '../util/Debug'; import Debug from '../util/Debug';
import Result from '../util/Result'; import Result from '../util/Result';

2
packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts

@ -1,6 +1,6 @@
import { UITypes } from 'nocodb-sdk';
import BaseRender from '../../BaseRender'; import BaseRender from '../../BaseRender';
import mapDefaultDisplayValue from '../../../../../meta/helpers/mapDefaultDisplayValue'; import mapDefaultDisplayValue from '../../../../../meta/helpers/mapDefaultDisplayValue';
import { UITypes } from 'nocodb-sdk';
abstract class BaseModelXcMeta extends BaseRender { abstract class BaseModelXcMeta extends BaseRender {
protected abstract _getAbstractType(column: any): any; protected abstract _getAbstractType(column: any): any;

2
packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaFactory.ts

@ -1,10 +1,10 @@
import type BaseModelXcMeta from './BaseModelXcMeta';
import ModelXcMetaMssql from './ModelXcMetaMssql'; import ModelXcMetaMssql from './ModelXcMetaMssql';
import ModelXcMetaMysql from './ModelXcMetaMysql'; import ModelXcMetaMysql from './ModelXcMetaMysql';
import ModelXcMetaOracle from './ModelXcMetaOracle'; import ModelXcMetaOracle from './ModelXcMetaOracle';
import ModelXcMetaPg from './ModelXcMetaPg'; import ModelXcMetaPg from './ModelXcMetaPg';
import ModelXcMetaSqlite from './ModelXcMetaSqlite'; import ModelXcMetaSqlite from './ModelXcMetaSqlite';
import ModelXcMetaSnowflake from './ModelXcMetaSnowflake'; import ModelXcMetaSnowflake from './ModelXcMetaSnowflake';
import type BaseModelXcMeta from './BaseModelXcMeta';
class ModelXcMetaFactory { class ModelXcMetaFactory {
public static create(connectionConfig, args): BaseModelXcMeta { public static create(connectionConfig, args): BaseModelXcMeta {

2
packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts

@ -1,7 +1,7 @@
import lodash from 'lodash'; import lodash from 'lodash';
import type { Acl } from '../../../../../../interface/config';
import BaseRender from '../../BaseRender'; import BaseRender from '../../BaseRender';
import type { Acl } from '../../../../../../interface/config';
class ExpressXcMiddleware extends BaseRender { class ExpressXcMiddleware extends BaseRender {
/** /**

2
packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts

@ -4,8 +4,8 @@
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import SqlClientFactory from '../../sql-client/lib/SqlClientFactory'; import SqlClientFactory from '../../sql-client/lib/SqlClientFactory';
import KnexMigratorv2 from '../../sql-migrator/lib/KnexMigratorv2'; import KnexMigratorv2 from '../../sql-migrator/lib/KnexMigratorv2';
import type Base from '../../../models/Base';
import Debug from '../../util/Debug'; import Debug from '../../util/Debug';
import type Base from '../../../models/Base';
const log = new Debug('SqlMgr'); const log = new Debug('SqlMgr');

4
packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts

@ -1,10 +1,10 @@
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import KnexMigratorv2Tans from '../../sql-migrator/lib/KnexMigratorv2Tans';
import SqlMgrv2 from './SqlMgrv2'; import SqlMgrv2 from './SqlMgrv2';
import type Base from '../../../models/Base'; import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import type { XKnex } from '../../sql-data-mapper'; import type { XKnex } from '../../sql-data-mapper';
import type NcMetaIO from '../../../meta/NcMetaIO'; import type NcMetaIO from '../../../meta/NcMetaIO';
import KnexMigratorv2Tans from '../../sql-migrator/lib/KnexMigratorv2Tans';
export default class SqlMgrv2Trans extends SqlMgrv2 { export default class SqlMgrv2Trans extends SqlMgrv2 {
protected trx: Knex.Transaction; protected trx: Knex.Transaction;

2
packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts

@ -12,8 +12,8 @@ import Emit from '../../util/emit';
import Result from '../../util/Result'; import Result from '../../util/Result';
import * as fileHelp from '../../util/file.help'; import * as fileHelp from '../../util/file.help';
import SqlMigrator from './SqlMigrator';
import NcConfigFactory from '../../../utils/NcConfigFactory'; import NcConfigFactory from '../../../utils/NcConfigFactory';
import SqlMigrator from './SqlMigrator';
const evt = new Emit(); const evt = new Emit();
const log = new Debug('KnexMigrator'); const log = new Debug('KnexMigrator');

6
packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts

@ -1,7 +1,6 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { promisify } from 'util'; import { promisify } from 'util';
import type { Knex } from 'knex';
import glob from 'glob'; import glob from 'glob';
import SqlClientFactory from '../../sql-client/lib/SqlClientFactory'; import SqlClientFactory from '../../sql-client/lib/SqlClientFactory';
@ -14,11 +13,12 @@ import * as fileHelp from '../../util/file.help';
// import SqlMigrator from './SqlMigrator'; // import SqlMigrator from './SqlMigrator';
// import NcConfigFactory from '../../../utils/NcConfigFactory'; // import NcConfigFactory from '../../../utils/NcConfigFactory';
import Noco from '../../../Noco'; import Noco from '../../../Noco';
import type { XKnex } from '../../sql-data-mapper';
import Project from '../../../models/Project'; import Project from '../../../models/Project';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Result from '../../util/Result'; import Result from '../../util/Result';
import type Base from '../../../models/Base';
import type { XKnex } from '../../sql-data-mapper';
import type { Knex } from 'knex';
const evt = new Emit(); const evt = new Emit();
const log = new Debug('KnexMigrator'); const log = new Debug('KnexMigrator');

4
packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts

@ -4,10 +4,10 @@
* @class KnexMigrator * @class KnexMigrator
* @extends {SqlMigrator} * @extends {SqlMigrator}
*/ */
import KnexMigratorv2 from './KnexMigratorv2';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Noco from '../../../Noco'; import Noco from '../../../Noco';
import KnexMigratorv2 from './KnexMigratorv2';
import type Base from '../../../models/Base';
import type { XKnex } from '../../sql-data-mapper'; import type { XKnex } from '../../sql-data-mapper';
import type NcMetaIO from '../../../meta/NcMetaIO'; import type NcMetaIO from '../../../meta/NcMetaIO';

2
packages/nocodb/src/lib/jobs/EmitteryJobsMgr.ts

@ -1,5 +1,5 @@
import JobsMgr from './JobsMgr';
import Emittery from 'emittery'; import Emittery from 'emittery';
import JobsMgr from './JobsMgr';
export default class EmitteryJobsMgr extends JobsMgr { export default class EmitteryJobsMgr extends JobsMgr {
emitter: Emittery; emitter: Emittery;

2
packages/nocodb/src/lib/jobs/NocoJobs.ts

@ -1,6 +1,6 @@
import type JobsMgr from './JobsMgr';
import EmitteryJobsMgr from './EmitteryJobsMgr'; import EmitteryJobsMgr from './EmitteryJobsMgr';
import RedisJobsMgr from './RedisJobsMgr'; import RedisJobsMgr from './RedisJobsMgr';
import type JobsMgr from './JobsMgr';
export default class NocoJobs { export default class NocoJobs {
private static client: JobsMgr; private static client: JobsMgr;

8
packages/nocodb/src/lib/meta/NcMetaIOImpl.ts

@ -1,16 +1,16 @@
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
import { customAlphabet } from 'nanoid'; import { customAlphabet } from 'nanoid';
import type { NcConfig } from '../../interface/config';
import type { Knex } from '../db/sql-data-mapper';
import { XKnex } from '../db/sql-data-mapper'; import { XKnex } from '../db/sql-data-mapper';
import type Noco from '../Noco';
import XcMigrationSource from '../migrations/XcMigrationSource'; import XcMigrationSource from '../migrations/XcMigrationSource';
import NcMetaIO, { META_TABLES } from './NcMetaIO';
import NcConnectionMgr from '../utils/common/NcConnectionMgr'; import NcConnectionMgr from '../utils/common/NcConnectionMgr';
import { MetaTable } from '../utils/globals'; import { MetaTable } from '../utils/globals';
import XcMigrationSourcev2 from '../migrations/XcMigrationSourcev2'; import XcMigrationSourcev2 from '../migrations/XcMigrationSourcev2';
import NcMetaIO, { META_TABLES } from './NcMetaIO';
import type Noco from '../Noco';
import type { Knex } from '../db/sql-data-mapper';
import type { NcConfig } from '../../interface/config';
// import { nanoid } from 'nanoid'; // import { nanoid } from 'nanoid';
/*import { v4 as uuidv4 } from 'uuid';*/ /*import { v4 as uuidv4 } from 'uuid';*/

34
packages/nocodb/src/lib/meta/NcMetaMgr.ts

@ -1,13 +1,12 @@
import CryptoJS from 'crypto-js';
import fs from 'fs'; import fs from 'fs';
import mkdirp from 'mkdirp';
import path from 'path'; import path from 'path';
import { promisify } from 'util';
import CryptoJS from 'crypto-js';
import mkdirp from 'mkdirp';
import archiver from 'archiver'; import archiver from 'archiver';
import axios from 'axios'; import axios from 'axios';
import bodyParser from 'body-parser'; import bodyParser from 'body-parser';
import type { Handler } from 'express';
import type express from 'express';
import { Router } from 'express'; import { Router } from 'express';
import extract from 'extract-zip'; import extract from 'extract-zip';
import isDocker from 'is-docker'; import isDocker from 'is-docker';
@ -16,11 +15,10 @@ import { customAlphabet, nanoid } from 'nanoid';
import slash from 'slash'; import slash from 'slash';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { ncp } from 'ncp'; import { ncp } from 'ncp';
import { UITypes } from 'nocodb-sdk';
import type IEmailAdapter from '../../interface/IEmailAdapter'; import { T } from 'nc-help';
import type IStorageAdapter from '../../interface/IStorageAdapter';
import type { NcConfig } from '../../interface/config';
import { Result } from '../../interface/config'; import { Result } from '../../interface/config';
import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory'; import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory';
import { NcConfigFactory } from '../index'; import { NcConfigFactory } from '../index';
import ProjectMgr from '../db/sql-mgr/ProjectMgr'; import ProjectMgr from '../db/sql-mgr/ProjectMgr';
@ -31,21 +29,23 @@ import NcHelp from '../utils/NcHelp';
import mimetypes, { mimeIcons } from '../utils/mimeTypes'; import mimetypes, { mimeIcons } from '../utils/mimeTypes';
import { packageVersion } from '../utils/packageVersion'; import { packageVersion } from '../utils/packageVersion';
import projectAcl from '../utils/projectAcl'; import projectAcl from '../utils/projectAcl';
import type Noco from '../Noco';
import type { GqlApiBuilder } from '../v1-legacy/gql/GqlApiBuilder';
import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr'; import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr';
import XcCache from '../v1-legacy/plugins/adapters/cache/XcCache'; import XcCache from '../v1-legacy/plugins/adapters/cache/XcCache';
import type { RestApiBuilder } from '../v1-legacy/rest/RestApiBuilder';
import RestAuthCtrl from '../v1-legacy/rest/RestAuthCtrlEE'; import RestAuthCtrl from '../v1-legacy/rest/RestAuthCtrlEE';
import type NcMetaIO from './NcMetaIO';
import { META_TABLES } from './NcMetaIO';
import { promisify } from 'util';
import NcTemplateParser from '../v1-legacy/templates/NcTemplateParser'; import NcTemplateParser from '../v1-legacy/templates/NcTemplateParser';
import { defaultConnectionConfig } from '../utils/NcConfigFactory'; import { defaultConnectionConfig } from '../utils/NcConfigFactory';
import xcMetaDiff from './handlers/xcMetaDiff';
import { UITypes } from 'nocodb-sdk';
import { T } from 'nc-help';
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants'; import { NC_ATTACHMENT_FIELD_SIZE } from '../constants';
import xcMetaDiff from './handlers/xcMetaDiff';
import { META_TABLES } from './NcMetaIO';
import type NcMetaIO from './NcMetaIO';
import type { RestApiBuilder } from '../v1-legacy/rest/RestApiBuilder';
import type { GqlApiBuilder } from '../v1-legacy/gql/GqlApiBuilder';
import type Noco from '../Noco';
import type { NcConfig } from '../../interface/config';
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 randomID = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 10);
const XC_PLUGIN_DET = 'XC_PLUGIN_DET'; const XC_PLUGIN_DET = 'XC_PLUGIN_DET';

10
packages/nocodb/src/lib/meta/NcMetaMgrv2.ts

@ -1,18 +1,18 @@
import bodyParser from 'body-parser'; import bodyParser from 'body-parser';
import type { Handler } from 'express';
import { Router } from 'express'; import { Router } from 'express';
import multer from 'multer'; import multer from 'multer';
import type { NcConfig } from '../../interface/config';
import ProjectMgr from '../db/sql-mgr/ProjectMgr'; import ProjectMgr from '../db/sql-mgr/ProjectMgr';
import { packageVersion } from '../utils/packageVersion'; import { packageVersion } from '../utils/packageVersion';
import projectAcl from '../utils/projectAcl'; import projectAcl from '../utils/projectAcl';
import type Noco from '../Noco';
import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr'; import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr';
import type NcMetaIO from './NcMetaIO';
import { defaultConnectionConfig } from '../utils/NcConfigFactory'; import { defaultConnectionConfig } from '../utils/NcConfigFactory';
import ncCreateLookup from './handlersv2/ncCreateLookup';
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants'; import { NC_ATTACHMENT_FIELD_SIZE } from '../constants';
import ncCreateLookup from './handlersv2/ncCreateLookup';
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'; // import ncGetMeta from './handlersv2/ncGetMeta';
export default class NcMetaMgrv2 { export default class NcMetaMgrv2 {

4
packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts

@ -1,10 +1,10 @@
import type { NextFunction, Request, Response } from 'express';
import type { ErrorObject } from 'ajv';
import Ajv from 'ajv'; import Ajv from 'ajv';
import addFormats from 'ajv-formats'; import addFormats from 'ajv-formats';
// @ts-ignore // @ts-ignore
import swagger from '../../../../schema/swagger.json'; import swagger from '../../../../schema/swagger.json';
import { NcError } from '../../helpers/catchError'; import { NcError } from '../../helpers/catchError';
import type { ErrorObject } from 'ajv';
import type { NextFunction, Request, Response } from 'express';
export function parseHrtimeToSeconds(hrtime) { export function parseHrtimeToSeconds(hrtime) {
const seconds = (hrtime[0] + hrtime[1] / 1e6).toFixed(3); const seconds = (hrtime[0] + hrtime[1] / 1e6).toFixed(3);

8
packages/nocodb/src/lib/meta/api/helpers/columnHelpers.ts

@ -1,4 +1,8 @@
import { customAlphabet } from 'nanoid'; import { customAlphabet } from 'nanoid';
import { UITypes } from 'nocodb-sdk';
import Column from '../../../models/Column';
import { getUniqueColumnAliasName } from '../../helpers/getUniqueName';
import validateParams from '../../helpers/validateParams';
import type { import type {
BoolType, BoolType,
ColumnReqType, ColumnReqType,
@ -8,13 +12,9 @@ import type {
RollupColumnReqType, RollupColumnReqType,
TableType, TableType,
} from 'nocodb-sdk'; } from 'nocodb-sdk';
import { UITypes } from 'nocodb-sdk';
import Column from '../../../models/Column';
import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import type LookupColumn from '../../../models/LookupColumn'; import type LookupColumn from '../../../models/LookupColumn';
import type Model from '../../../models/Model'; import type Model from '../../../models/Model';
import { getUniqueColumnAliasName } from '../../helpers/getUniqueName';
import validateParams from '../../helpers/validateParams';
export const randomID = customAlphabet( export const randomID = customAlphabet(
'1234567890abcdefghijklmnopqrstuvwxyz_', '1234567890abcdefghijklmnopqrstuvwxyz_',

8
packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts

@ -1,19 +1,19 @@
import type Project from '../../../models/Project'; import { ModelTypes, UITypes, ViewTypes } from 'nocodb-sdk';
import Column from '../../../models/Column'; import Column from '../../../models/Column';
import Model from '../../../models/Model'; import Model from '../../../models/Model';
import NcHelp from '../../../utils/NcHelp'; import NcHelp from '../../../utils/NcHelp';
import type Base from '../../../models/Base';
import View from '../../../models/View'; import View from '../../../models/View';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import getTableNameAlias, { import getTableNameAlias, {
getColumnNameAlias, getColumnNameAlias,
} from '../../helpers/getTableName'; } from '../../helpers/getTableName';
import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import getColumnUiType from '../../helpers/getColumnUiType'; import getColumnUiType from '../../helpers/getColumnUiType';
import mapDefaultDisplayValue from '../../helpers/mapDefaultDisplayValue'; import mapDefaultDisplayValue from '../../helpers/mapDefaultDisplayValue';
import { extractAndGenerateManyToManyRelations } from '../../../services/metaDiff.svc'; import { extractAndGenerateManyToManyRelations } from '../../../services/metaDiff.svc';
import { ModelTypes, UITypes, ViewTypes } from 'nocodb-sdk';
import { IGNORE_TABLES } from '../../../utils/common/BaseApiBuilder'; import { IGNORE_TABLES } from '../../../utils/common/BaseApiBuilder';
import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import type Base from '../../../models/Base';
import type Project from '../../../models/Project';
export async function populateMeta(base: Base, project: Project): Promise<any> { export async function populateMeta(base: Base, project: Project): Promise<any> {
const info = { const info = {

10
packages/nocodb/src/lib/meta/api/index.ts

@ -1,4 +1,7 @@
import crypto from 'crypto';
import { T } from 'nc-help'; import { T } from 'nc-help';
import { Server } from 'socket.io';
import passport from 'passport';
import orgLicenseController from '../../controllers/orgLicense.ctl'; import orgLicenseController from '../../controllers/orgLicense.ctl';
import orgTokenController from '../../controllers/orgToken.ctl'; import orgTokenController from '../../controllers/orgToken.ctl';
import orgUserController from '../../controllers/orgUser.ctl'; import orgUserController from '../../controllers/orgUser.ctl';
@ -6,7 +9,6 @@ import projectController from '../../controllers/project.ctl';
import baseController from '../../controllers/base.ctl'; import baseController from '../../controllers/base.ctl';
import tableController from '../../controllers/table.ctl'; import tableController from '../../controllers/table.ctl';
import columnController from '../../controllers/column.ctl'; import columnController from '../../controllers/column.ctl';
import type { Router } from 'express';
import sortController from '../../controllers/sort.ctl'; import sortController from '../../controllers/sort.ctl';
import filterController from '../../controllers/filter.ctl'; import filterController from '../../controllers/filter.ctl';
import viewColumnController from '../../controllers/viewColumn.ctl'; import viewColumnController from '../../controllers/viewColumn.ctl';
@ -47,14 +49,12 @@ import {
publicDataExportController, publicDataExportController,
publicMetaController, publicMetaController,
} from '../../controllers/publicControllers'; } from '../../controllers/publicControllers';
import type { Socket } from 'socket.io';
import { Server } from 'socket.io';
import passport from 'passport';
import crypto from 'crypto';
import swaggerController from '../../controllers/apiDocs'; import swaggerController from '../../controllers/apiDocs';
import { importController, syncSourceController } from '../../controllers/sync'; import { importController, syncSourceController } from '../../controllers/sync';
import mapViewController from '../../controllers/views/mapView.ctl'; import mapViewController from '../../controllers/views/mapView.ctl';
import type { Socket } from 'socket.io';
import type { Router } from 'express';
const clients: { [id: string]: Socket } = {}; const clients: { [id: string]: Socket } = {};
const jobs: { [id: string]: { last_message: any } } = {}; const jobs: { [id: string]: { last_message: any } } = {};

4
packages/nocodb/src/lib/meta/handlersv2/ncCreateLookup.ts

@ -1,6 +1,6 @@
import type { NcContextV2 } from '../NcMetaMgrv2';
import Column from '../../models/Column';
import { UITypes } from 'nocodb-sdk'; import { UITypes } from 'nocodb-sdk';
import Column from '../../models/Column';
import type { NcContextV2 } from '../NcMetaMgrv2';
export default async function (this: NcContextV2, { args }: any) { export default async function (this: NcContextV2, { args }: any) {
if ( if (

2
packages/nocodb/src/lib/meta/handlersv2/ncGetMeta.ts

@ -1,5 +1,5 @@
import type { NcContextV2 } from '../NcMetaMgrv2';
import Model from '../../models/Model'; import Model from '../../models/Model';
import type { NcContextV2 } from '../NcMetaMgrv2';
export default async function (this: NcContextV2, { args }: any) { export default async function (this: NcContextV2, { args }: any) {
const meta = await Model.getByIdOrName({ const meta = await Model.getByIdOrName({

21
packages/nocodb/src/lib/meta/helpers/NcPluginMgrv2.ts

@ -1,13 +1,4 @@
import type { import { PluginCategory } from 'nocodb-sdk';
IEmailAdapter,
IStorageAdapterV2,
IWebhookNotificationAdapter,
// XcEmailPlugin,
// XcPlugin,
// XcStoragePlugin,
// XcWebhookNotificationPlugin
} from 'nc-plugin';
import BackblazePluginConfig from '../../plugins/backblaze'; import BackblazePluginConfig from '../../plugins/backblaze';
import DiscordPluginConfig from '../../plugins/discord'; import DiscordPluginConfig from '../../plugins/discord';
import GcsPluginConfig from '../../plugins/gcs'; import GcsPluginConfig from '../../plugins/gcs';
@ -30,9 +21,17 @@ import SESPluginConfig from '../../plugins/ses';
import Noco from '../../Noco'; import Noco from '../../Noco';
import Local from '../../v1-legacy/plugins/adapters/storage/Local'; import Local from '../../v1-legacy/plugins/adapters/storage/Local';
import { MetaTable } from '../../utils/globals'; import { MetaTable } from '../../utils/globals';
import { PluginCategory } from 'nocodb-sdk';
import Plugin from '../../models/Plugin'; import Plugin from '../../models/Plugin';
import { NcError } from './catchError'; import { NcError } from './catchError';
import type {
IEmailAdapter,
IStorageAdapterV2,
IWebhookNotificationAdapter,
// XcEmailPlugin,
// XcPlugin,
// XcStoragePlugin,
// XcWebhookNotificationPlugin
} from 'nc-plugin';
const defaultPlugins = [ const defaultPlugins = [
SlackPluginConfig, SlackPluginConfig,

2
packages/nocodb/src/lib/meta/helpers/addFormulaErrorIfMissingColumn.ts

@ -1,5 +1,5 @@
import type FormulaColumn from '../../models/FormulaColumn';
import jsep from 'jsep'; import jsep from 'jsep';
import type FormulaColumn from '../../models/FormulaColumn';
export default function addFormulaErrorIfMissingColumn({ export default function addFormulaErrorIfMissingColumn({
formula, formula,

2
packages/nocodb/src/lib/meta/helpers/apiMetrics.ts

@ -1,5 +1,5 @@
import type { Request } from 'express';
import { T } from 'nc-help'; import { T } from 'nc-help';
import type { Request } from 'express';
const countMap = {}; const countMap = {};

2
packages/nocodb/src/lib/meta/helpers/getColumnPropsFromUIDT.ts

@ -1,5 +1,5 @@
import type { ColumnReqType, NormalColumnRequestType } from 'nocodb-sdk';
import { SqlUiFactory, UITypes } from 'nocodb-sdk'; import { SqlUiFactory, UITypes } from 'nocodb-sdk';
import type { ColumnReqType, NormalColumnRequestType } from 'nocodb-sdk';
import type Base from '../../models/Base'; import type Base from '../../models/Base';
import type Column from '../../models/Column'; import type Column from '../../models/Column';

2
packages/nocodb/src/lib/meta/helpers/getColumnUiType.ts

@ -1,7 +1,7 @@
import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory';
import type Base from '../../models/Base'; import type Base from '../../models/Base';
import type Column from '../../models/Column'; import type Column from '../../models/Column';
import type { ColumnType } from 'nocodb-sdk'; import type { ColumnType } from 'nocodb-sdk';
import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory';
export default function getColumnUiType( export default function getColumnUiType(
base: Base, base: Base,

2
packages/nocodb/src/lib/meta/helpers/getHandler.ts

@ -1,5 +1,5 @@
import type express from 'express';
import Noco from '../../Noco'; import Noco from '../../Noco';
import type express from 'express';
export default function getHandler( export default function getHandler(
defaultHandler: express.Handler, defaultHandler: express.Handler,

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save