Browse Source

Merge pull request #5252 from nocodb/chore/eslint-import-type-rule

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

43
packages/nocodb/.eslintrc.json

@ -57,46 +57,7 @@
"no-useless-catch": "off",
"no-empty": "off",
"@typescript-eslint/no-empty-function": "off",
"import/order": "off"
// "@typescript-eslint/member-ordering": [
// "warn" ,
// {
// "default": {
// "memberTypes": [ "static-field",
// "public-field",
// "instance-field",
// "protected-field",
// "private-field",
// "abstract-field",
//
// "public-static-field",
// "protected-static-field",
// "private-static-field",
// "public-instance-field",
// "public-decorated-field",
// "public-abstract-field",
// "protected-instance-field",
// "protected-decorated-field",
// "protected-abstract-field",
// "private-instance-field",
// "private-decorated-field",
// "private-abstract-field",
//
//
//
// "constructor",
//
// "public-static-method",
// "protected-static-method",
// "private-static-method",
// "public-method",
// "protected-method",
// "private-method"
// ]
// }
// }
// ]
"import/order": "off",
"@typescript-eslint/consistent-type-imports": "warn"
}
}

6
packages/nocodb/src/interface/config.ts

@ -1,6 +1,6 @@
import { Handler } from 'express';
import * as e from 'express';
import { Knex } from 'knex';
import type { Handler } from 'express';
import type * as e from 'express';
import type { Knex } from 'knex';
export interface Route {
path: string;

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

@ -9,14 +9,14 @@ import clear from 'clear';
import cookieParser from 'cookie-parser';
import debug from 'debug';
import * as express from 'express';
import { Router } 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 { NcConfig } from '../interface/config';
import type { NcConfig } from '../interface/config';
import { NC_LICENSE_KEY } from './constants';
import Migrator from './db/sql-migrator/lib/KnexMigrator';
import Store from './models/Store';
@ -25,24 +25,24 @@ import { T } from 'nc-help';
import NcProjectBuilderCE from './v1-legacy/NcProjectBuilder';
import NcProjectBuilderEE from './v1-legacy/NcProjectBuilderEE';
import { GqlApiBuilder } from './v1-legacy/gql/GqlApiBuilder';
import NcMetaIO from './meta/NcMetaIO';
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 NcMetaMgrCE from './meta/NcMetaMgr';
import NcMetaMgrEE from './meta/NcMetaMgrEE';
import { RestApiBuilder } from './v1-legacy/rest/RestApiBuilder';
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 NcMetaMgrv2 from './meta/NcMetaMgrv2';
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 * as http from 'http';
import type * as http from 'http';
import weAreHiring from './utils/weAreHiring';
import getInstance from './utils/getInstance';
import initAdminFromEnv from './services/user/initAdminFromEnv';

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

@ -1,4 +1,4 @@
import CacheMgr from './CacheMgr';
import type CacheMgr from './CacheMgr';
import RedisCacheMgr from './RedisCacheMgr';
import RedisMockCacheMgr from './RedisMockCacheMgr';
import { CacheGetType } from '../utils/globals';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import multer from 'multer';
import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk';
import path from 'path';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,7 +1,7 @@
import { Request, Response } from 'express';
import { BaseListType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
import type { BaseListType } from 'nocodb-sdk';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import Base from '../models/Base';
import type Base from '../models/Base';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';

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

@ -1,5 +1,6 @@
import { Request, Response, Router } from 'express';
import { ColumnReqType, TableType, UITypes } from 'nocodb-sdk';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import * as XLSX from 'xlsx';
import apiMetrics from '../../meta/helpers/apiMetrics';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -2,15 +2,15 @@ import { NcError } from '../../meta/helpers/catchError';
import Project from '../../models/Project';
import Model from '../../models/Model';
import View from '../../models/View';
import { Request } from 'express';
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 LookupColumn from '../../models/LookupColumn';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import type LookupColumn from '../../models/LookupColumn';
import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import papaparse from 'papaparse';
import { dataService } from '../../services';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import Model from '../../models/Model';
import { nocoExecute } from 'nc-help';
import Base from '../../models/Base';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,5 +1,6 @@
import { Request, Response, Router } from 'express';
import { FilterReqType } from 'nocodb-sdk';
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';

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

@ -1,6 +1,7 @@
import catchError from '../meta/helpers/catchError';
import { Request, Response, Router } from 'express';
import { HookListType, HookType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
import { Router } from 'express';
import type { HookListType, HookType } from 'nocodb-sdk';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,6 +1,7 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { PluginType } from 'nocodb-sdk';
import type { PluginType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { pluginService } from '../services';

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

@ -1,7 +1,7 @@
import { Request, Response } from 'express';
import { ProjectType } from 'nocodb-sdk';
import type { Request, Response } from 'express';
import type { ProjectType } from 'nocodb-sdk';
import Project from '../models/Project';
import { ProjectListType } from 'nocodb-sdk';
import type { ProjectListType } from 'nocodb-sdk';
import { packageVersion } from '../utils/packageVersion';
import { T } from 'nc-help';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,18 +1,13 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import * as XLSX from 'xlsx';
import { nocoExecute } from 'nc-help';
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 {
Base,
Column,
LinkToAnotherRecordColumn,
LookupColumn,
Model,
View,
} from '../../models';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../../models';
import { Base, Column, Model, View } from '../../models';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
async function exportExcel(req: Request, res: Response) {

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import catchError from '../../meta/helpers/catchError';
import { publicMetaService } from '../../services';

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

@ -1,6 +1,7 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { SortListType, SortReqType } from 'nocodb-sdk';
import type { SortListType, SortReqType } from 'nocodb-sdk';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';

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

@ -1,13 +1,13 @@
import { Request, Router } from 'express';
import type { Request, Router } from 'express';
// import { Queue } from 'bullmq';
// import axios from 'axios';
import catchError, { NcError } from '../../meta/helpers/catchError';
import { Server } from 'socket.io';
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 { AirtableSyncConfig } from '../../services/sync/helpers/job';
import type { AirtableSyncConfig } from '../../services/sync/helpers/job';
const AIRTABLE_IMPORT_JOB = 'AIRTABLE_IMPORT_JOB';
const AIRTABLE_PROGRESS_JOB = 'AIRTABLE_PROGRESS_JOB';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { syncService } from '../../services';

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

@ -1,5 +1,6 @@
import { Request, Response, Router } from 'express';
import { TableListType, TableReqType, TableType } from 'nocodb-sdk';
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';

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

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

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

@ -1,4 +1,4 @@
import { Request } from 'express';
import type { Request } from 'express';
import * as ejs from 'ejs';
import { promisify } from 'util';

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

@ -1,5 +1,5 @@
// // Project CRUD
import { Request, Response } from 'express';
import type { Request, Response } from 'express';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import catchError from '../meta/helpers/catchError';
import { utilService } from '../services';

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

@ -1,6 +1,7 @@
import { Request, Response, Router } from 'express';
import type { Request, Response } from 'express';
import { Router } from 'express';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { View } from '../models';
import type { View } from '../models';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { viewService } from '../services';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,5 +1,6 @@
import { Request, Response, Router } from 'express';
import { FormType } from 'nocodb-sdk';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,5 +1,6 @@
import { Request, Response, Router } from 'express';
import { GalleryType } from 'nocodb-sdk';
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';

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

@ -1,4 +1,5 @@
import { Request, Router } from 'express';
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';

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

@ -1,4 +1,5 @@
import { Request, Response, Router } from 'express';
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';

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

@ -1,5 +1,7 @@
import { Request, Response, Router } from 'express';
import { KanbanType, ViewTypes } from 'nocodb-sdk';
import type { Request, Response } from 'express';
import { Router } from 'express';
import type { KanbanType } from 'nocodb-sdk';
import { ViewTypes } from 'nocodb-sdk';
import View from '../../models/View';
import KanbanView from '../../models/KanbanView';
import { T } from 'nc-help';

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

@ -1,5 +1,6 @@
import { Request, Response, Router } from 'express';
import { MapType } from 'nocodb-sdk';
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';

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

@ -1,5 +1,6 @@
/* eslint-disable no-constant-condition */
import { knex, Knex } from 'knex';
import type { Knex } from 'knex';
import { knex } from 'knex';
import { T } from 'nc-help';
import Debug from '../../util/Debug';
import Emit from '../../util/emit';

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

@ -1,4 +1,4 @@
import { ColumnType } from 'nocodb-sdk';
import type { ColumnType } from 'nocodb-sdk';
import knex from 'knex';
import KnexClient from '../KnexClient';

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

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/ban-types,prefer-const */
import { Knex } from 'knex';
import Filter from '../../../models/Filter';
import Sort from '../../../models/Sort';
import type { Knex } from 'knex';
import type Filter from '../../../models/Filter';
import type Sort from '../../../models/Sort';
const autoBind = require('auto-bind');
const _ = require('lodash');

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

@ -2,7 +2,8 @@ import autoBind from 'auto-bind';
import _ from 'lodash';
import Validator from 'validator';
import BaseModel, { XcFilter, XcFilterWithAlias } from '../BaseModel';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
import BaseModel from '../BaseModel';
import formulaQueryBuilder from './formulaQueryBuilderFromString';
import genRollupSelect from './genRollupSelect';
import Papaparse from 'papaparse';

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

@ -2,14 +2,14 @@ import autoBind from 'auto-bind';
import _ from 'lodash';
import Model from '../../../../models/Model';
import SelectOption from '../../../../models/SelectOption';
import { XKnex } from '../../index';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import RollupColumn from '../../../../models/RollupColumn';
import LookupColumn from '../../../../models/LookupColumn';
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 { XcFilter, XcFilterWithAlias } from '../BaseModel';
import type { XcFilter, XcFilterWithAlias } from '../BaseModel';
import conditionV2 from './conditionV2';
import Filter, {
COMPARISON_OPS,
@ -18,17 +18,17 @@ import Filter, {
} from '../../../../models/Filter';
import sortV2 from './sortV2';
import Sort from '../../../../models/Sort';
import FormulaColumn from '../../../../models/FormulaColumn';
import type FormulaColumn from '../../../../models/FormulaColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import { Knex } from 'knex';
import type { Knex } from 'knex';
import View from '../../../../models/View';
import type { SortType } from 'nocodb-sdk';
import {
AuditOperationSubTypes,
AuditOperationTypes,
isVirtualCol,
RelationTypes,
SortType,
UITypes,
ViewTypes,
} from 'nocodb-sdk';
@ -48,8 +48,8 @@ import { NcError } from '../../../../meta/helpers/catchError';
import { customAlphabet } from 'nanoid';
import DOMPurify from 'isomorphic-dompurify';
import { sanitize, unsanitize } from './helpers/sanitize';
import QrCodeColumn from '../../../../models/QrCodeColumn';
import BarcodeColumn from '../../../../models/BarcodeColumn';
import type QrCodeColumn from '../../../../models/QrCodeColumn';
import type BarcodeColumn from '../../../../models/BarcodeColumn';
const GROUP_COL = '__nc_group_id';

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

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

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

@ -1,13 +1,13 @@
import Filter from '../../../../models/Filter';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import { Knex } from 'knex';
import { XKnex } from '../../index';
import Column from '../../../../models/Column';
import LookupColumn from '../../../../models/LookupColumn';
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 RollupColumn from '../../../../models/RollupColumn';
import type RollupColumn from '../../../../models/RollupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import 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';
@ -576,53 +576,57 @@ const parseConditionV2 = async (
}
}
break;
case 'gt': {
const gt_op = customWhereClause ? '<' : '>';
qb = qb.where(field, gt_op, val);
if (column.uidt === UITypes.Rating) {
// unset rating is considered as NULL
if (gt_op === '<' && val > 0) {
qb = qb.orWhereNull(field);
case 'gt':
{
const gt_op = customWhereClause ? '<' : '>';
qb = qb.where(field, gt_op, val);
if (column.uidt === UITypes.Rating) {
// unset rating is considered as NULL
if (gt_op === '<' && val > 0) {
qb = qb.orWhereNull(field);
}
}
}
break;
}
case 'ge':
case 'gte': {
const ge_op = customWhereClause ? '<=' : '>=';
qb = qb.where(field, ge_op, val);
if (column.uidt === UITypes.Rating) {
// unset rating is considered as NULL
if (ge_op === '<=' || (ge_op === '>=' && val === 0)) {
qb = qb.orWhereNull(field);
case 'gte':
{
const ge_op = customWhereClause ? '<=' : '>=';
qb = qb.where(field, ge_op, val);
if (column.uidt === UITypes.Rating) {
// unset rating is considered as NULL
if (ge_op === '<=' || (ge_op === '>=' && val === 0)) {
qb = qb.orWhereNull(field);
}
}
}
break;
}
case 'lt': {
const lt_op = customWhereClause ? '>' : '<';
qb = qb.where(field, lt_op, val);
if (column.uidt === UITypes.Rating) {
// unset number is considered as NULL
if (lt_op === '<' && val > 0) {
qb = qb.orWhereNull(field);
case 'lt':
{
const lt_op = customWhereClause ? '>' : '<';
qb = qb.where(field, lt_op, val);
if (column.uidt === UITypes.Rating) {
// unset number is considered as NULL
if (lt_op === '<' && val > 0) {
qb = qb.orWhereNull(field);
}
}
}
break;
}
case 'le':
case 'lte': {
const le_op = customWhereClause ? '>=' : '<=';
qb = qb.where(field, le_op, val);
if (column.uidt === UITypes.Rating) {
// unset number is considered as NULL
if (le_op === '<=' || (le_op === '>=' && val === 0)) {
qb = qb.orWhereNull(field);
case 'lte':
{
const le_op = customWhereClause ? '>=' : '<=';
qb = qb.where(field, le_op, val);
if (column.uidt === UITypes.Rating) {
// unset number is considered as NULL
if (le_op === '<=' || (le_op === '>=' && val === 0)) {
qb = qb.orWhereNull(field);
}
}
}
break;
}
case 'in':
qb = qb.whereIn(
field,

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

@ -1,13 +1,13 @@
import jsep from 'jsep';
import mapFunctionName from '../mapFunctionName';
import Model from '../../../../../models/Model';
import Column from '../../../../../models/Column';
import type Model from '../../../../../models/Model';
import type Column from '../../../../../models/Column';
import genRollupSelectv2 from '../genRollupSelectv2';
import RollupColumn from '../../../../../models/RollupColumn';
import type RollupColumn from '../../../../../models/RollupColumn';
import FormulaColumn from '../../../../../models/FormulaColumn';
import { XKnex } from '../../../index';
import LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
import LookupColumn from '../../../../../models/LookupColumn';
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';

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

@ -1,4 +1,4 @@
import { MapFnArgs } from '../mapFunctionName';
import type { MapFnArgs } from '../mapFunctionName';
export default {
// todo: handle default case

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

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

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

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

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

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

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

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

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

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

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

@ -1,7 +1,7 @@
import RollupColumn from '../../../../models/RollupColumn';
import { XKnex } from '../../index';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import { Knex } from 'knex';
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 ({

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

@ -1,7 +1,7 @@
import View from '../../../../../models/View';
import { isSystemColumn, UITypes } from 'nocodb-sdk';
import Model from '../../../../../models/Model';
import LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
import type Model from '../../../../../models/Model';
import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
const getAst = async ({
query,

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

@ -1,9 +1,9 @@
import { XKnex } from '../../index';
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 { Knex } from 'knex';
import type { Knex } from 'knex';
export interface MapFnArgs {
pt: any;

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

@ -1,12 +1,12 @@
import { Knex } from 'knex';
import { XKnex } from '../../index';
import type { Knex } from 'knex';
import type { XKnex } from '../../index';
import Sort from '../../../../models/Sort';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import type LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import RollupColumn from '../../../../models/RollupColumn';
import LookupColumn from '../../../../models/LookupColumn';
import type RollupColumn from '../../../../models/RollupColumn';
import type LookupColumn from '../../../../models/LookupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import FormulaColumn from '../../../../models/FormulaColumn';
import type FormulaColumn from '../../../../models/FormulaColumn';
import { RelationTypes, UITypes } from 'nocodb-sdk';
import { sanitize } from './helpers/sanitize';

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

@ -1,4 +1,4 @@
import BaseModelXcMeta from './BaseModelXcMeta';
import type BaseModelXcMeta from './BaseModelXcMeta';
import ModelXcMetaMssql from './ModelXcMetaMssql';
import ModelXcMetaMysql from './ModelXcMetaMysql';
import ModelXcMetaOracle from './ModelXcMetaOracle';

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

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

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

@ -1,7 +1,7 @@
import SqlMgrv2 from './SqlMgrv2';
import SqlMgrv2Trans from './SqlMgrv2Trans';
import NcMetaIO from '../../../meta/NcMetaIO';
import Base from '../../../models/Base';
import type NcMetaIO from '../../../meta/NcMetaIO';
import type Base from '../../../models/Base';
export default class ProjectMgrv2 {
private static sqlMgrMap: {

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

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

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

@ -1,9 +1,9 @@
import SqlMgrv2 from './SqlMgrv2';
import Base from '../../../models/Base';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import { Knex } from 'knex';
import { XKnex } from '../../sql-data-mapper';
import NcMetaIO from '../../../meta/NcMetaIO';
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 {

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

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import { promisify } from 'util';
import { Knex } from 'knex';
import type { Knex } from 'knex';
import glob from 'glob';
import SqlClientFactory from '../../sql-client/lib/SqlClientFactory';
@ -14,9 +14,9 @@ import * as fileHelp from '../../util/file.help';
// import SqlMigrator from './SqlMigrator';
// import NcConfigFactory from '../../../utils/NcConfigFactory';
import Noco from '../../../Noco';
import { XKnex } from '../../sql-data-mapper';
import type { XKnex } from '../../sql-data-mapper';
import Project from '../../../models/Project';
import Base from '../../../models/Base';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Result from '../../util/Result';

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

@ -5,11 +5,11 @@
* @extends {SqlMigrator}
*/
import KnexMigratorv2 from './KnexMigratorv2';
import Base from '../../../models/Base';
import type Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Noco from '../../../Noco';
import { XKnex } from '../../sql-data-mapper';
import NcMetaIO from '../../../meta/NcMetaIO';
import type { XKnex } from '../../sql-data-mapper';
import type NcMetaIO from '../../../meta/NcMetaIO';
import type MssqlClient from '../../sql-client/lib/mssql/MssqlClient';
import type MysqlClient from '../../sql-client/lib/mysql/MysqlClient';

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

@ -1,4 +1,4 @@
import JobsMgr from './JobsMgr';
import type JobsMgr from './JobsMgr';
import EmitteryJobsMgr from './EmitteryJobsMgr';
import RedisJobsMgr from './RedisJobsMgr';

2
packages/nocodb/src/lib/meta/MetaAPILogger.ts

@ -1,5 +1,5 @@
import { XKnex } from '../db/sql-data-mapper';
import { Request } from 'express';
import type { Request } from 'express';
export default class MetaAPILogger {
static _instance: MetaAPILogger;

6
packages/nocodb/src/lib/meta/NcMetaIO.ts

@ -1,6 +1,6 @@
import { NcConfig } from '../../interface/config';
import Noco from '../Noco';
import { XKnex } from '../db/sql-data-mapper';
import type { NcConfig } from '../../interface/config';
import type Noco from '../Noco';
import type { XKnex } from '../db/sql-data-mapper';
const META_TABLES = {
graphql: [

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

@ -1,9 +1,10 @@
import CryptoJS from 'crypto-js';
import { customAlphabet } from 'nanoid';
import { NcConfig } from '../../interface/config';
import { Knex, XKnex } from '../db/sql-data-mapper';
import Noco from '../Noco';
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';

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

@ -6,7 +6,9 @@ import path from 'path';
import archiver from 'archiver';
import axios from 'axios';
import bodyParser from 'body-parser';
import express, { Handler, Router } from 'express';
import type { Handler } from 'express';
import type express from 'express';
import { Router } from 'express';
import extract from 'extract-zip';
import isDocker from 'is-docker';
import multer from 'multer';
@ -15,9 +17,10 @@ import slash from 'slash';
import { v4 as uuidv4 } from 'uuid';
import { ncp } from 'ncp';
import IEmailAdapter from '../../interface/IEmailAdapter';
import IStorageAdapter from '../../interface/IStorageAdapter';
import { NcConfig, Result } from '../../interface/config';
import type IEmailAdapter from '../../interface/IEmailAdapter';
import type IStorageAdapter from '../../interface/IStorageAdapter';
import type { NcConfig } from '../../interface/config';
import { Result } from '../../interface/config';
import SqlClientFactory from '../db/sql-client/lib/SqlClientFactory';
import { NcConfigFactory } from '../index';
import ProjectMgr from '../db/sql-mgr/ProjectMgr';
@ -28,13 +31,14 @@ import NcHelp from '../utils/NcHelp';
import mimetypes, { mimeIcons } from '../utils/mimeTypes';
import { packageVersion } from '../utils/packageVersion';
import projectAcl from '../utils/projectAcl';
import Noco from '../Noco';
import { GqlApiBuilder } from '../v1-legacy/gql/GqlApiBuilder';
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 { RestApiBuilder } from '../v1-legacy/rest/RestApiBuilder';
import type { RestApiBuilder } from '../v1-legacy/rest/RestApiBuilder';
import RestAuthCtrl from '../v1-legacy/rest/RestAuthCtrlEE';
import NcMetaIO, { META_TABLES } from './NcMetaIO';
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';

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

@ -1,14 +1,15 @@
import bodyParser from 'body-parser';
import { Handler, Router } from 'express';
import type { Handler } from 'express';
import { Router } from 'express';
import multer from 'multer';
import { NcConfig } from '../../interface/config';
import type { NcConfig } from '../../interface/config';
import ProjectMgr from '../db/sql-mgr/ProjectMgr';
import { packageVersion } from '../utils/packageVersion';
import projectAcl from '../utils/projectAcl';
import Noco from '../Noco';
import type Noco from '../Noco';
import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr';
import NcMetaIO from './NcMetaIO';
import type NcMetaIO from './NcMetaIO';
import { defaultConnectionConfig } from '../utils/NcConfigFactory';
import ncCreateLookup from './handlersv2/ncCreateLookup';
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants';

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

@ -1,5 +1,6 @@
import { NextFunction, Request, Response } from 'express';
import Ajv, { ErrorObject } from 'ajv';
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';

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

@ -1,5 +1,5 @@
import { customAlphabet } from 'nanoid';
import {
import type {
BoolType,
ColumnReqType,
LinkToAnotherRecordType,
@ -7,12 +7,12 @@ import {
RelationTypes,
RollupColumnReqType,
TableType,
UITypes,
} from 'nocodb-sdk';
import { UITypes } from 'nocodb-sdk';
import Column from '../../../models/Column';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import LookupColumn from '../../../models/LookupColumn';
import Model from '../../../models/Model';
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';

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

@ -1,14 +1,14 @@
import Project from '../../../models/Project';
import type Project from '../../../models/Project';
import Column from '../../../models/Column';
import Model from '../../../models/Model';
import NcHelp from '../../../utils/NcHelp';
import Base from '../../../models/Base';
import type Base from '../../../models/Base';
import View from '../../../models/View';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import getTableNameAlias, {
getColumnNameAlias,
} from '../../helpers/getTableName';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import type LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import getColumnUiType from '../../helpers/getColumnUiType';
import mapDefaultDisplayValue from '../../helpers/mapDefaultDisplayValue';
import { extractAndGenerateManyToManyRelations } from '../../../services/metaDiff.svc';

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

@ -6,7 +6,7 @@ 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 { Router } from 'express';
import type { Router } from 'express';
import sortController from '../../controllers/sort.ctl';
import filterController from '../../controllers/filter.ctl';
import viewColumnController from '../../controllers/viewColumn.ctl';
@ -47,7 +47,8 @@ import {
publicDataExportController,
publicMetaController,
} from '../../controllers/publicControllers';
import { Server, Socket } from 'socket.io';
import type { Socket } from 'socket.io';
import { Server } from 'socket.io';
import passport from 'passport';
import crypto from 'crypto';

2
packages/nocodb/src/lib/meta/handlers/xcMetaDiff.ts

@ -1,4 +1,4 @@
import NcMetaMgr from '../NcMetaMgr';
import type NcMetaMgr from '../NcMetaMgr';
enum XcMetaDiffType {
TABLE_NEW = 'TABLE_NEW',

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

@ -1,4 +1,4 @@
import { NcContextV2 } from '../NcMetaMgrv2';
import type { NcContextV2 } from '../NcMetaMgrv2';
import Column from '../../models/Column';
import { UITypes } from 'nocodb-sdk';

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

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

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

@ -1,4 +1,4 @@
import {
import type {
IEmailAdapter,
IStorageAdapterV2,
IWebhookNotificationAdapter,

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

@ -1,4 +1,4 @@
import { PaginatedType } from 'nocodb-sdk';
import type { PaginatedType } from 'nocodb-sdk';
const config: any = {
limitDefault: Math.max(+process.env.DB_QUERY_LIMIT_DEFAULT || 25, 1),

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

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

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

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

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

@ -1,4 +1,4 @@
import { ErrorObject } from 'ajv';
import type { ErrorObject } from 'ajv';
enum DBError {
TABLE_EXIST = 'TABLE_EXIST',

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

@ -1,11 +1,7 @@
import {
ColumnReqType,
NormalColumnRequestType,
SqlUiFactory,
UITypes,
} from 'nocodb-sdk';
import Base from '../../models/Base';
import Column from '../../models/Column';
import type { ColumnReqType, NormalColumnRequestType } from 'nocodb-sdk';
import { SqlUiFactory, UITypes } from 'nocodb-sdk';
import type Base from '../../models/Base';
import type Column from '../../models/Column';
export default async function getColumnPropsFromUIDT(
column: ColumnReqType & { altered?: number },

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

@ -1,6 +1,6 @@
import Base from '../../models/Base';
import Column from '../../models/Column';
import { ColumnType } from 'nocodb-sdk';
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(

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

@ -1,4 +1,4 @@
import express from 'express';
import type express from 'express';
import Noco from '../../Noco';
export default function getHandler(

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

@ -1,5 +1,5 @@
import inflection from 'inflection';
import Base from '../../models/Base';
import type Base from '../../models/Base';
export default function getTableNameAlias(
tableName: string,

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

@ -1,4 +1,4 @@
import Column from '../../models/Column';
import type Column from '../../models/Column';
export function getUniqueColumnName(columns: Column[], initialName = 'field') {
let c = 0;

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

@ -1,4 +1,4 @@
import { ColumnType } from 'nocodb-sdk';
import type { ColumnType } from 'nocodb-sdk';
export default function mapDefaultDisplayValue<T extends ColumnType>(
columnsArr: Array<T>

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

@ -1,6 +1,6 @@
import { OrgUserRoles } from 'nocodb-sdk';
import projectAcl from '../../utils/projectAcl';
import { NextFunction, Request, Response } from 'express';
import type { NextFunction, Request, Response } from 'express';
import catchError, { NcError } from './catchError';
import extractProjectIdAndAuthenticate from './extractProjectIdAndAuthenticate';

6
packages/nocodb/src/lib/meta/helpers/populateSamplePayload.ts

@ -2,9 +2,9 @@ import View from '../../models/View';
import Column from '../../models/Column';
import { RelationTypes, UITypes } from 'nocodb-sdk';
import Model from '../../models/Model';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import LookupColumn from '../../models/LookupColumn';
import SelectOption from '../../models/SelectOption';
import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import type LookupColumn from '../../models/LookupColumn';
import type SelectOption from '../../models/SelectOption';
export default async function populateSamplePayload(
viewOrModel: View | Model,

4
packages/nocodb/src/lib/meta/helpers/syncMigration.ts

@ -1,6 +1,6 @@
import Migrator from '../../db/sql-migrator/lib/KnexMigratorv2';
import Project from '../../models/Project';
import Base from '../../models/Base';
import type Project from '../../models/Project';
import type Base from '../../models/Base';
export default async function syncMigration(project: Project): Promise<void> {
for (const base of await project.getBases()) {

10
packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts

@ -1,12 +1,12 @@
import Handlebars from 'handlebars';
import Model from '../../models/Model';
import type Model from '../../models/Model';
import NcPluginMgrv2 from './NcPluginMgrv2';
import Column from '../../models/Column';
import Hook from '../../models/Hook';
import type Column from '../../models/Column';
import type Hook from '../../models/Hook';
import Filter from '../../models/Filter';
import HookLog from '../../models/HookLog';
import { HookLogType } from 'nocodb-sdk';
import FormView from '../../models/FormView';
import type { HookLogType } from 'nocodb-sdk';
import type FormView from '../../models/FormView';
export function parseBody(template: string, data: any): string {
if (!template) {

2
packages/nocodb/src/lib/migrations/v1/nc_002_add_m2m.ts

@ -1,4 +1,4 @@
import { Knex } from 'knex';
import type { Knex } from 'knex';
const up = async (knex: Knex) => {
await knex.schema.alterTable('nc_models', (table) => {

2
packages/nocodb/src/lib/migrations/v1/nc_003_add_fkn_column.ts

@ -1,4 +1,4 @@
import { Knex } from 'knex';
import type { Knex } from 'knex';
const up = async (knex: Knex) => {
await knex.schema.alterTable('nc_relations', (table) => {

2
packages/nocodb/src/lib/migrations/v1/nc_004_add_view_type_column.ts

@ -1,4 +1,4 @@
import { Knex } from 'knex';
import type { Knex } from 'knex';
const up = async (knex: Knex) => {
await knex.schema.alterTable('nc_shared_views', (table) => {

2
packages/nocodb/src/lib/migrations/v1/nc_005_add_view_name_column.ts

@ -1,4 +1,4 @@
import { Knex } from 'knex';
import type { Knex } from 'knex';
const up = async (knex: Knex) => {
await knex.schema.alterTable('nc_shared_views', (table) => {

2
packages/nocodb/src/lib/migrations/v1/nc_006_alter_nc_shared_views.ts

@ -1,4 +1,4 @@
import { Knex } from 'knex';
import type { Knex } from 'knex';
const up = async (knex: Knex) => {
await knex.schema.alterTable('nc_shared_views', (table) => {

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

Loading…
Cancel
Save