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

2
packages/nocodb/package-lock.json generated

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

2
packages/nocodb/package.json

@ -162,7 +162,7 @@
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^3.0.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"mocha": "^10.1.0",
"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 debug from 'debug';
import * as express from 'express';
import type { Router } from 'express';
import importFresh from 'import-fresh';
import morgan from 'morgan';
import NcToolGui from 'nc-lib-gui';
import requestIp from 'request-ip';
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 Migrator from './db/sql-migrator/lib/KnexMigrator';
import Store from './models/Store';
import NcConfigFactory from './utils/NcConfigFactory';
import { T } from 'nc-help';
import NcProjectBuilderCE from './v1-legacy/NcProjectBuilder';
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 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 RestAuthCtrlEE from './v1-legacy/rest/RestAuthCtrlEE';
import mkdirp from 'mkdirp';
import MetaAPILogger from './meta/MetaAPILogger';
import NcUpgrader from './version-upgrader/NcUpgrader';
import type NcMetaMgrv2 from './meta/NcMetaMgrv2';
import NocoCache from './cache/NocoCache';
import registerMetaApis from './meta/api';
import NcPluginMgrv2 from './meta/helpers/NcPluginMgrv2';
import User from './models/User';
import type * as http from 'http';
import weAreHiring from './utils/weAreHiring';
import getInstance from './utils/getInstance';
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');
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 RedisMockCacheMgr from './RedisMockCacheMgr';
import { CacheGetType } from '../utils/globals';
import type CacheMgr from './CacheMgr';
export default class NocoCache {
private static client: CacheMgr;

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

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

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

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

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

@ -1,8 +1,8 @@
import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { swaggerService } from '../../services';
import getSwaggerHtml from './swaggerHtml';
import getRedocHtml from './redocHtml';
import { swaggerService } from '../../services';
async function swaggerJson(req, res) {
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 ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { apiTokenService } from '../services';
import type { Request, Response } from 'express';
export async function apiTokenList(req: Request, res: Response) {
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 multer from 'multer';
import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk';
import path from 'path';
import Noco from '../Noco';
import { MetaTable } from '../utils/globals';
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 { getCacheMiddleware } from '../meta/api/helpers';
import { attachmentService } from '../services';
import type { Request, Response } from 'express';
const isUploadAllowedMw = async (req: Request, _res: Response, next: any) => {
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 Audit from '../models/Audit';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { auditService } from '../services';
import type { Request, Response } from 'express';
export async function commentRow(req: Request<any, any>, res) {
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 type Base from '../models/Base';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { baseService } from '../services';
import type Base from '../models/Base';
import type { BaseListType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
async function baseGet(req: Request<any>, res: Response<Base>) {
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 catchError from '../meta/helpers/catchError';
import { cacheService } from '../services';
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 type { ColumnReqType, TableType, UITypes } from 'nocodb-sdk';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
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) {
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 { bulkDataService } from '../../services';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics';
import type { Request, Response } from 'express';
async function bulkDataInsert(req: Request, res: Response) {
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 { dataService } from '../../services';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics';
import type { Request, Response } from 'express';
export async function dataList(req: Request, res: Response) {
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 { dataService } from '../../services';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics';
import { parseHrtimeToSeconds } from '../../meta/api/helpers';
import type { Request, Response } from 'express';
// todo: Handle the error case where view doesnt belong to model
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 * as XLSX from 'xlsx';
import apiMetrics from '../../meta/helpers/apiMetrics';
@ -6,6 +5,7 @@ import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { View } from '../../models';
import { extractCsvData, extractXlsxData } from '../../services/dbData/helpers';
import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import type { Request, Response } from 'express';
async function excelDataExport(req: Request, res: Response) {
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 ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import apiMetrics from '../../meta/helpers/apiMetrics';
import { dataAliasNestedService } from '../../services';
import type { Request, Response } from 'express';
// todo: handle case where the given column is not ltar
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 Project from '../../models/Project';
import Model from '../../models/Model';
import View from '../../models/View';
import type { Request } from 'express';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { isSystemColumn, UITypes } from 'nocodb-sdk';
import * as XLSX from 'xlsx';
import Column from '../../models/Column';
import { dataService } from '../../services';
import type LookupColumn from '../../models/LookupColumn';
import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import papaparse from 'papaparse';
import { dataService } from '../../services';
import type { Request } from 'express';
export async function getViewAndModelFromRequestByAliasOrId(
req:
| 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 Model from '../../models/Model';
import { nocoExecute } from 'nc-help';
import Model from '../../models/Model';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import View from '../../models/View';
@ -10,6 +9,7 @@ import Project from '../../models/Project';
import { NcError } from '../../meta/helpers/catchError';
import apiMetrics from '../../meta/helpers/apiMetrics';
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) {
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 View from '../models/View';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { extractCsvData } from './dbData/helpers';
import type { Request, Response } from 'express';
async function exportCsv(req: Request, res: Response) {
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 type { FilterReqType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { filterService } from '../services';
import type { FilterReqType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// @ts-ignore
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 type { HookListType, HookType } from 'nocodb-sdk';
import catchError from '../meta/helpers/catchError';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { hookService } from '../services';
import type { HookListType, HookType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function hookList(
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 { T } from 'nc-help';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { hookFilterService } from '../services';
import type { Request, Response } from 'express';
export async function filterGet(req: Request, res: Response) {
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 ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
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 { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getConditionalHandler } from '../meta/helpers/getHandler';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { orgTokenService, orgTokenServiceEE } from '../services';
import type { Request, Response } from 'express';
async function apiTokenList(req, res) {
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 { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { PluginType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { pluginService } from '../services';
import type { PluginType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
export async function pluginList(_req: Request, res: Response) {
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 isDocker from 'is-docker';
import { packageVersion } from '../utils/packageVersion';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import ProjectUser from '../models/ProjectUser';
import Noco from '../Noco';
import isDocker from 'is-docker';
import Project from '../models/Project';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import Filter from '../models/Filter';
import { projectService } from '../services';
import type { ProjectListType } from 'nocodb-sdk';
import type { ProjectType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// // 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 ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
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 multer from 'multer';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
import catchError from '../../meta/helpers/catchError';
import { publicDataService } from '../../services';
import type { Request, Response } from 'express';
export async function dataList(req: Request, res: Response) {
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 * as XLSX from 'xlsx';
import { nocoExecute } from 'nc-help';
@ -6,9 +5,10 @@ import papaparse from 'papaparse';
import { ErrorMessages, isSystemColumn, UITypes, ViewTypes } from 'nocodb-sdk';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
import catchError, { NcError } from '../../meta/helpers/catchError';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../../models';
import { Base, Column, Model, View } from '../../models';
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) {
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 catchError from '../../meta/helpers/catchError';
import { publicMetaService } from '../../services';
import type { Request, Response } from 'express';
export async function viewMetaGet(req: Request, res: Response) {
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 { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { SortListType, SortReqType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { sortService } from '../services';
import type { SortListType, SortReqType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// @ts-ignore
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 axios from 'axios';
import catchError, { NcError } from '../../meta/helpers/catchError';
import type { Server } from 'socket.io';
import NocoJobs from '../../jobs/NocoJobs';
import { SyncSource } from '../../models';
import Noco from '../../Noco';
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';
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 ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { syncService } from '../../services';
import type { Request, Response } from 'express';
export async function syncSourceList(req: Request, res: Response) {
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 type { TableListType, TableReqType, TableType } from 'nocodb-sdk';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
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>) {
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 { TestResetService } from '../services/test/TestResetService';
import type { Request } from 'express';
export async function reset(req: Request<any, any>, res) {
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 { OrgUserRoles } from 'nocodb-sdk';
import { Strategy as CustomStrategy } from 'passport-custom';
import passport from 'passport';
import passportJWT from 'passport-jwt';
import { Strategy as AuthTokenStrategy } from 'passport-auth-token';
import { Strategy as GoogleStrategy } from 'passport-google-oauth20';
const PassportLocalStrategy = require('passport-local').Strategy;
const ExtractJwt = passportJWT.ExtractJwt;
const JwtStrategy = passportJWT.Strategy;
@ -20,6 +19,7 @@ import { ApiToken, Plugin, Project, ProjectUser, User } from '../../models';
import Noco from '../../Noco';
import { CacheGetType, CacheScope } from '../../utils/globals';
import { userService } from '../../services';
const PassportLocalStrategy = require('passport-local').Strategy;
export function initStrategies(router): void {
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 * as ejs from 'ejs';
import passport from 'passport';
import catchError, { NcError } from '../../meta/helpers/catchError';
@ -10,6 +9,7 @@ import { Audit, User } from '../../models';
import Noco from '../../Noco';
import { userService } from '../../services';
import { setTokenCookie } from '../../services/user/helpers';
import type { Request } from 'express';
export async function signup(req: Request<any, any>, res): Promise<any> {
res.json(

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

@ -1,8 +1,8 @@
// // Project CRUD
import type { Request, Response } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import catchError from '../meta/helpers/catchError';
import { utilService } from '../services';
import type { Request, Response } from 'express';
export async function testConnection(req: Request, res: Response) {
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 { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { View } from '../models';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { viewService } from '../services';
import type { View } from '../models';
import type { Request, Response } from 'express';
// @ts-ignore
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 ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { viewColumnService } from '../services';
import type { Request, Response } from 'express';
export async function columnList(req: Request, res: Response) {
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 type { FormType } from 'nocodb-sdk';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
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>) {
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 ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { formViewColumnService } from '../../services';
import type { Request, Response } from 'express';
export async function columnUpdate(req: Request, res: Response) {
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 type { GalleryType } from 'nocodb-sdk';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
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>) {
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 ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { gridViewService } from '../../services';
import type { Request } from 'express';
export async function gridViewCreate(req: Request<any>, res) {
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 ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import { gridViewColumnService } from '../../services';
import type { Request, Response } from 'express';
export async function columnList(req: Request, res: Response) {
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 type { KanbanType } from 'nocodb-sdk';
import { ViewTypes } from 'nocodb-sdk';
import { T } from 'nc-help';
import View from '../../models/View';
import KanbanView from '../../models/KanbanView';
import { T } from 'nc-help';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
import type { KanbanType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
// 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 type { MapType } from 'nocodb-sdk';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../../meta/helpers/apiMetrics';
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>) {
res.json(

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

@ -1,20 +1,20 @@
/* 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 { 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 find from 'lodash/find';
import fs from 'fs';
import { promisify } from 'util';
import jsonfile from 'jsonfile';
import path from 'path';
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 SqlClient from './SqlClient';
import type { Knex } from 'knex';
const evt = new Emit();
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 SqlClientFactoryEE from './ee/SqlClientFactoryEE';
import MySqlClient from './mysql/MysqlClient';
@ -9,9 +11,6 @@ import YugabyteClient from './pg/YugabyteClient';
import TidbClient from './mysql/TidbClient';
import VitessClient from './mysql/VitessClient';
import fs from 'fs';
import { promisify } from 'util';
export class SqlClientFactory {
static create(connectionConfig) {
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 SfClient from '../snowflake/SnowflakeClient';
import { SnowflakeClient } from 'nc-help';
class SqlClientFactoryEE {
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 find from 'lodash/find';
import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
import find from 'lodash/find';
import type { ColumnType } from 'nocodb-sdk';
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 isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys';
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 Emit from '../../../util/emit';
import Result from '../../../util/Result';
import queries from './mysql.queries';
import KnexClient from '../KnexClient';
import jsonfile from 'jsonfile';
import path from 'path';
import mkdirp from 'mkdirp';
import { promisify } from 'util';
import { nanoid } from 'nanoid';
import queries from './mysql.queries';
import fakerFunctionList from './fakerFunctionList';
import * as findDataType from './findDataTypeMapping';
import levenshtein from 'fast-levenshtein';
const log = new Debug('MysqlClient');
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 mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
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 knex from 'knex';
import isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
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');
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 Result from '../../../util/Result';
import PGClient from './PgClient';
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 _ from 'lodash';
import lodash from 'lodash';
import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
import queries from './snowflake.queries';
import lodash from 'lodash';
const log = new Debug('SnowflakeClient');
const rowsToLower = (arr) => {

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

@ -1,14 +1,14 @@
import { promisify } from 'util';
import knex from 'knex';
import fs from 'fs';
import KnexClient from '../KnexClient';
import Debug from '../../../util/Debug';
import Result from '../../../util/Result';
import queries from './sqlite.queries';
import knex from 'knex';
import isEmpty from 'lodash/isEmpty';
import mapKeys from 'lodash/mapKeys';
import find from 'lodash/find';
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);

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 Validator from 'validator';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
import Papaparse from 'papaparse';
import BaseModel from '../BaseModel';
import formulaQueryBuilder from './formulaQueryBuilderFromString';
import genRollupSelect from './genRollupSelect';
import Papaparse from 'papaparse';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
/**
* 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 _ 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 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 {
AuditOperationSubTypes,
AuditOperationTypes,
@ -32,8 +10,20 @@ import {
UITypes,
ViewTypes,
} from 'nocodb-sdk';
import formSubmissionEmailTemplate from '../../../../utils/common/formSubmissionEmailTemplate';
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 FormView from '../../../../models/FormView';
import Hook from '../../../../models/Hook';
@ -42,12 +32,22 @@ import {
_transformSubmittedFormDataForEmail,
invokeWebhook,
} from '../../../../meta/helpers/webhookHelpers';
import Validator from 'validator';
import { customValidators } from './customValidators';
import { NcError } from '../../../../meta/helpers/catchError';
import { customAlphabet } from 'nanoid';
import DOMPurify from 'isomorphic-dompurify';
import { customValidators } from './customValidators';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import genRollupSelectv2 from './genRollupSelectv2';
import sortV2 from './sortV2';
import conditionV2 from './conditionV2';
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 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 { SnowflakeClient } from 'nc-help';
import Filter from '../../../../models/Filter';
import type { FilterType } from 'nocodb-sdk';
import type { BaseModelSql } from './BaseModelSql';
const types = require('pg').types;
// override parsing date column to Date()
types.setTypeParser(1082, (val) => val);
import type { BaseModelSql } from './BaseModelSql';
import Filter from '../../../../models/Filter';
const opMappingGen = {
eq: '=',
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 genRollupSelectv2 from './genRollupSelectv2';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import { sanitize } from './helpers/sanitize';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type { Knex } from 'knex';
import type { XKnex } from '../../index';
import type Column from '../../../../models/Column';
import type LookupColumn from '../../../../models/LookupColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import type RollupColumn from '../../../../models/RollupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
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);

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

@ -1,17 +1,17 @@
import jsep from 'jsep';
import { jsepCurlyHook, UITypes } from 'nocodb-sdk';
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 Column from '../../../../../models/Column';
import genRollupSelectv2 from '../genRollupSelectv2';
import type RollupColumn from '../../../../../models/RollupColumn';
import FormulaColumn from '../../../../../models/FormulaColumn';
import type { XKnex } from '../../../index';
import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
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

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

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

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

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

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

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

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

@ -1,12 +1,12 @@
import dayjs from 'dayjs';
import type { MapFnArgs } from '../mapFunctionName';
import commonFns from './commonFns';
import { convertUnits } from '../helpers/convertUnits';
import { getWeekdayByText } from '../helpers/formulaFnHelper';
import {
convertToTargetFormat,
getDateFormat,
} from '../../../../../utils/dateTimeUtils';
import commonFns from './commonFns';
import type { MapFnArgs } from '../mapFunctionName';
const sqlite3 = {
...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 type { Knex } from 'knex';
export default function ({
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 { XKnex } from '../../index';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type { Knex } from 'knex';
import { RelationTypes } from 'nocodb-sdk';
export default async function ({
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 View from '../../../../../models/View';
import type Model from '../../../../../models/Model';
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 mysql from './functionMappings/mysql';
import pg from './functionMappings/pg';
import sqlite from './functionMappings/sqlite';
import type { XKnex } from '../../index';
import type { Knex } from 'knex';
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 { XKnex } from '../../index';
import Sort from '../../../../models/Sort';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import type RollupColumn from '../../../../models/RollupColumn';
import type LookupColumn from '../../../../models/LookupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import type FormulaColumn from '../../../../models/FormulaColumn';
import { RelationTypes, UITypes } from 'nocodb-sdk';
import { sanitize } from './helpers/sanitize';
export default async function sortV2(
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 slash from 'slash';
import { T } from 'nc-help';
import { customAlphabet } from 'nanoid';
import SqlClientFactory from '../sql-client/lib/SqlClientFactory';
// import debug from 'debug';
import KnexMigrator from '../sql-migrator/lib/KnexMigrator';
// import {XKnex} from "../sql-data-mapper";
import NcConnectionMgr from '../../utils/common/NcConnectionMgr';
import { customAlphabet } from 'nanoid';
import Debug from '../util/Debug';
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 mapDefaultDisplayValue from '../../../../../meta/helpers/mapDefaultDisplayValue';
import { UITypes } from 'nocodb-sdk';
abstract class BaseModelXcMeta extends BaseRender {
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 ModelXcMetaMysql from './ModelXcMetaMysql';
import ModelXcMetaOracle from './ModelXcMetaOracle';
import ModelXcMetaPg from './ModelXcMetaPg';
import ModelXcMetaSqlite from './ModelXcMetaSqlite';
import ModelXcMetaSnowflake from './ModelXcMetaSnowflake';
import type BaseModelXcMeta from './BaseModelXcMeta';
class ModelXcMetaFactory {
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 type { Acl } from '../../../../../../interface/config';
import BaseRender from '../../BaseRender';
import type { Acl } from '../../../../../../interface/config';
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 SqlClientFactory from '../../sql-client/lib/SqlClientFactory';
import KnexMigratorv2 from '../../sql-migrator/lib/KnexMigratorv2';
import type Base from '../../../models/Base';
import Debug from '../../util/Debug';
import type Base from '../../../models/Base';
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 type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import type { Knex } from 'knex';
import type { XKnex } from '../../sql-data-mapper';
import type NcMetaIO from '../../../meta/NcMetaIO';
import KnexMigratorv2Tans from '../../sql-migrator/lib/KnexMigratorv2Tans';
export default class SqlMgrv2Trans extends SqlMgrv2 {
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 * as fileHelp from '../../util/file.help';
import SqlMigrator from './SqlMigrator';
import NcConfigFactory from '../../../utils/NcConfigFactory';
import SqlMigrator from './SqlMigrator';
const evt = new Emit();
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 path from 'path';
import { promisify } from 'util';
import type { Knex } from 'knex';
import glob from 'glob';
import SqlClientFactory from '../../sql-client/lib/SqlClientFactory';
@ -14,11 +13,12 @@ import * as fileHelp from '../../util/file.help';
// import SqlMigrator from './SqlMigrator';
// import NcConfigFactory from '../../../utils/NcConfigFactory';
import Noco from '../../../Noco';
import type { XKnex } from '../../sql-data-mapper';
import Project from '../../../models/Project';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
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 log = new Debug('KnexMigrator');

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

@ -4,10 +4,10 @@
* @class KnexMigrator
* @extends {SqlMigrator}
*/
import KnexMigratorv2 from './KnexMigratorv2';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Noco from '../../../Noco';
import KnexMigratorv2 from './KnexMigratorv2';
import type Base from '../../../models/Base';
import type { XKnex } from '../../sql-data-mapper';
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 JobsMgr from './JobsMgr';
export default class EmitteryJobsMgr extends JobsMgr {
emitter: Emittery;

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

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

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

@ -1,16 +1,16 @@
import CryptoJS from 'crypto-js';
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 type Noco from '../Noco';
import XcMigrationSource from '../migrations/XcMigrationSource';
import NcMetaIO, { META_TABLES } from './NcMetaIO';
import NcConnectionMgr from '../utils/common/NcConnectionMgr';
import { MetaTable } from '../utils/globals';
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 { 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 mkdirp from 'mkdirp';
import path from 'path';
import { promisify } from 'util';
import CryptoJS from 'crypto-js';
import mkdirp from 'mkdirp';
import archiver from 'archiver';
import axios from 'axios';
import bodyParser from 'body-parser';
import type { Handler } from 'express';
import type express from 'express';
import { Router } from 'express';
import extract from 'extract-zip';
import isDocker from 'is-docker';
@ -16,11 +15,10 @@ import { customAlphabet, nanoid } from 'nanoid';
import slash from 'slash';
import { v4 as uuidv4 } from 'uuid';
import { ncp } from 'ncp';
import type IEmailAdapter from '../../interface/IEmailAdapter';
import type IStorageAdapter from '../../interface/IStorageAdapter';
import type { NcConfig } from '../../interface/config';
import { UITypes } from 'nocodb-sdk';
import { T } from 'nc-help';
import { Result } from '../../interface/config';
import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory';
import { NcConfigFactory } from '../index';
import ProjectMgr from '../db/sql-mgr/ProjectMgr';
@ -31,21 +29,23 @@ import NcHelp from '../utils/NcHelp';
import mimetypes, { mimeIcons } from '../utils/mimeTypes';
import { packageVersion } from '../utils/packageVersion';
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 XcCache from '../v1-legacy/plugins/adapters/cache/XcCache';
import type { RestApiBuilder } from '../v1-legacy/rest/RestApiBuilder';
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 { 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 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 XC_PLUGIN_DET = 'XC_PLUGIN_DET';

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

@ -1,18 +1,18 @@
import bodyParser from 'body-parser';
import type { Handler } from 'express';
import { Router } from 'express';
import multer from 'multer';
import type { NcConfig } from '../../interface/config';
import ProjectMgr from '../db/sql-mgr/ProjectMgr';
import { packageVersion } from '../utils/packageVersion';
import projectAcl from '../utils/projectAcl';
import type Noco from '../Noco';
import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr';
import type NcMetaIO from './NcMetaIO';
import { defaultConnectionConfig } from '../utils/NcConfigFactory';
import ncCreateLookup from './handlersv2/ncCreateLookup';
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';
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 addFormats from 'ajv-formats';
// @ts-ignore
import swagger from '../../../../schema/swagger.json';
import { NcError } from '../../helpers/catchError';
import type { ErrorObject } from 'ajv';
import type { NextFunction, Request, Response } from 'express';
export function parseHrtimeToSeconds(hrtime) {
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 { UITypes } from 'nocodb-sdk';
import Column from '../../../models/Column';
import { getUniqueColumnAliasName } from '../../helpers/getUniqueName';
import validateParams from '../../helpers/validateParams';
import type {
BoolType,
ColumnReqType,
@ -8,13 +12,9 @@ import type {
RollupColumnReqType,
TableType,
} from 'nocodb-sdk';
import { UITypes } from 'nocodb-sdk';
import Column from '../../../models/Column';
import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import type LookupColumn from '../../../models/LookupColumn';
import type Model from '../../../models/Model';
import { getUniqueColumnAliasName } from '../../helpers/getUniqueName';
import validateParams from '../../helpers/validateParams';
export const randomID = customAlphabet(
'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 Model from '../../../models/Model';
import NcHelp from '../../../utils/NcHelp';
import type Base from '../../../models/Base';
import View from '../../../models/View';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import getTableNameAlias, {
getColumnNameAlias,
} from '../../helpers/getTableName';
import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import getColumnUiType from '../../helpers/getColumnUiType';
import mapDefaultDisplayValue from '../../helpers/mapDefaultDisplayValue';
import { extractAndGenerateManyToManyRelations } from '../../../services/metaDiff.svc';
import { ModelTypes, UITypes, ViewTypes } from 'nocodb-sdk';
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> {
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 { Server } from 'socket.io';
import passport from 'passport';
import orgLicenseController from '../../controllers/orgLicense.ctl';
import orgTokenController from '../../controllers/orgToken.ctl';
import orgUserController from '../../controllers/orgUser.ctl';
@ -6,7 +9,6 @@ import projectController from '../../controllers/project.ctl';
import baseController from '../../controllers/base.ctl';
import tableController from '../../controllers/table.ctl';
import columnController from '../../controllers/column.ctl';
import type { Router } from 'express';
import sortController from '../../controllers/sort.ctl';
import filterController from '../../controllers/filter.ctl';
import viewColumnController from '../../controllers/viewColumn.ctl';
@ -47,14 +49,12 @@ import {
publicDataExportController,
publicMetaController,
} 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 { importController, syncSourceController } from '../../controllers/sync';
import mapViewController from '../../controllers/views/mapView.ctl';
import type { Socket } from 'socket.io';
import type { Router } from 'express';
const clients: { [id: string]: Socket } = {};
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 Column from '../../models/Column';
import type { NcContextV2 } from '../NcMetaMgrv2';
export default async function (this: NcContextV2, { args }: any) {
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 type { NcContextV2 } from '../NcMetaMgrv2';
export default async function (this: NcContextV2, { args }: any) {
const meta = await Model.getByIdOrName({

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

@ -1,13 +1,4 @@
import type {
IEmailAdapter,
IStorageAdapterV2,
IWebhookNotificationAdapter,
// XcEmailPlugin,
// XcPlugin,
// XcStoragePlugin,
// XcWebhookNotificationPlugin
} from 'nc-plugin';
import { PluginCategory } from 'nocodb-sdk';
import BackblazePluginConfig from '../../plugins/backblaze';
import DiscordPluginConfig from '../../plugins/discord';
import GcsPluginConfig from '../../plugins/gcs';
@ -30,9 +21,17 @@ import SESPluginConfig from '../../plugins/ses';
import Noco from '../../Noco';
import Local from '../../v1-legacy/plugins/adapters/storage/Local';
import { MetaTable } from '../../utils/globals';
import { PluginCategory } from 'nocodb-sdk';
import Plugin from '../../models/Plugin';
import { NcError } from './catchError';
import type {
IEmailAdapter,
IStorageAdapterV2,
IWebhookNotificationAdapter,
// XcEmailPlugin,
// XcPlugin,
// XcStoragePlugin,
// XcWebhookNotificationPlugin
} from 'nc-plugin';
const defaultPlugins = [
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 type FormulaColumn from '../../models/FormulaColumn';
export default function addFormulaErrorIfMissingColumn({
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 type { Request } from 'express';
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 type { ColumnReqType, NormalColumnRequestType } from 'nocodb-sdk';
import type Base from '../../models/Base';
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 Column from '../../models/Column';
import type { ColumnType } from 'nocodb-sdk';
import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory';
export default function getColumnUiType(
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 type express from 'express';
export default function getHandler(
defaultHandler: express.Handler,

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

Loading…
Cancel
Save