Browse Source

refactor: move api handlers to controllers folder

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5239/head
Pranav C 2 years ago
parent
commit
00c942f98c
  1. 2
      packages/nocodb/src/lib/Noco.ts
  2. 10
      packages/nocodb/src/lib/controllers/apiTokenApis.ts
  3. 18
      packages/nocodb/src/lib/controllers/attachmentApis.ts
  4. 10
      packages/nocodb/src/lib/controllers/auditApis.ts
  5. 14
      packages/nocodb/src/lib/controllers/baseApis.ts
  6. 4
      packages/nocodb/src/lib/controllers/cacheApis.ts
  7. 44
      packages/nocodb/src/lib/controllers/columnApis.ts
  8. 12
      packages/nocodb/src/lib/controllers/dataApis/bulkDataAliasApis.ts
  9. 20
      packages/nocodb/src/lib/controllers/dataApis/dataAliasApis.ts
  10. 6
      packages/nocodb/src/lib/controllers/dataApis/dataAliasExportApis.ts
  11. 14
      packages/nocodb/src/lib/controllers/dataApis/dataAliasNestedApis.ts
  12. 18
      packages/nocodb/src/lib/controllers/dataApis/dataApis.ts
  13. 20
      packages/nocodb/src/lib/controllers/dataApis/helpers.ts
  14. 0
      packages/nocodb/src/lib/controllers/dataApis/index.ts
  15. 18
      packages/nocodb/src/lib/controllers/dataApis/oldDataApis.ts
  16. 4
      packages/nocodb/src/lib/controllers/exportApis.ts
  17. 16
      packages/nocodb/src/lib/controllers/filterApis.ts
  18. 18
      packages/nocodb/src/lib/controllers/formViewApis.ts
  19. 8
      packages/nocodb/src/lib/controllers/formViewColumnApis.ts
  20. 10
      packages/nocodb/src/lib/controllers/galleryViewApis.ts
  21. 18
      packages/nocodb/src/lib/controllers/gridViewApis.ts
  22. 8
      packages/nocodb/src/lib/controllers/gridViewColumnApis.ts
  23. 18
      packages/nocodb/src/lib/controllers/hookApis.ts
  24. 16
      packages/nocodb/src/lib/controllers/hookFilterApis.ts
  25. 10
      packages/nocodb/src/lib/controllers/kanbanViewApis.ts
  26. 8
      packages/nocodb/src/lib/controllers/mapViewApis.ts
  27. 28
      packages/nocodb/src/lib/controllers/metaDiffApis.ts
  28. 10
      packages/nocodb/src/lib/controllers/modelVisibilityApis.ts
  29. 12
      packages/nocodb/src/lib/controllers/orgLicenseApis.ts
  30. 16
      packages/nocodb/src/lib/controllers/orgTokenApis.ts
  31. 30
      packages/nocodb/src/lib/controllers/orgUserApis.ts
  32. 12
      packages/nocodb/src/lib/controllers/pluginApis.ts
  33. 28
      packages/nocodb/src/lib/controllers/projectApis.ts
  34. 26
      packages/nocodb/src/lib/controllers/projectUserApis.ts
  35. 0
      packages/nocodb/src/lib/controllers/publicApis/index.ts
  36. 24
      packages/nocodb/src/lib/controllers/publicApis/publicDataApis.ts
  37. 18
      packages/nocodb/src/lib/controllers/publicApis/publicDataExportApis.ts
  38. 14
      packages/nocodb/src/lib/controllers/publicApis/publicMetaApis.ts
  39. 8
      packages/nocodb/src/lib/controllers/sharedBaseApis.ts
  40. 16
      packages/nocodb/src/lib/controllers/sortApis.ts
  41. 6
      packages/nocodb/src/lib/controllers/swagger/helpers/getPaths.ts
  42. 6
      packages/nocodb/src/lib/controllers/swagger/helpers/getSchemas.ts
  43. 10
      packages/nocodb/src/lib/controllers/swagger/helpers/getSwaggerColumnMetas.ts
  44. 14
      packages/nocodb/src/lib/controllers/swagger/helpers/getSwaggerJSON.ts
  45. 0
      packages/nocodb/src/lib/controllers/swagger/helpers/swagger-base.json
  46. 0
      packages/nocodb/src/lib/controllers/swagger/helpers/templates/headers.ts
  47. 2
      packages/nocodb/src/lib/controllers/swagger/helpers/templates/params.ts
  48. 0
      packages/nocodb/src/lib/controllers/swagger/helpers/templates/paths.ts
  49. 0
      packages/nocodb/src/lib/controllers/swagger/helpers/templates/schemas.ts
  50. 0
      packages/nocodb/src/lib/controllers/swagger/redocHtml.ts
  51. 8
      packages/nocodb/src/lib/controllers/swagger/swaggerApis.ts
  52. 0
      packages/nocodb/src/lib/controllers/swagger/swaggerHtml.ts
  53. 0
      packages/nocodb/src/lib/controllers/sync/helpers/EntityMap.ts
  54. 0
      packages/nocodb/src/lib/controllers/sync/helpers/NocoSyncDestAdapter.ts
  55. 0
      packages/nocodb/src/lib/controllers/sync/helpers/NocoSyncSourceAdapter.ts
  56. 0
      packages/nocodb/src/lib/controllers/sync/helpers/fetchAT.ts
  57. 0
      packages/nocodb/src/lib/controllers/sync/helpers/job.ts
  58. 0
      packages/nocodb/src/lib/controllers/sync/helpers/readAndProcessData.ts
  59. 0
      packages/nocodb/src/lib/controllers/sync/helpers/syncMap.ts
  60. 8
      packages/nocodb/src/lib/controllers/sync/importApis.ts
  61. 8
      packages/nocodb/src/lib/controllers/sync/syncSourceApis.ts
  62. 34
      packages/nocodb/src/lib/controllers/tableApis.ts
  63. 2
      packages/nocodb/src/lib/controllers/testApis.ts
  64. 4
      packages/nocodb/src/lib/controllers/userApi/helpers.ts
  65. 0
      packages/nocodb/src/lib/controllers/userApi/index.ts
  66. 10
      packages/nocodb/src/lib/controllers/userApi/initAdminFromEnv.ts
  67. 16
      packages/nocodb/src/lib/controllers/userApi/initStrategies.ts
  68. 0
      packages/nocodb/src/lib/controllers/userApi/ui/auth/emailVerify.ts
  69. 0
      packages/nocodb/src/lib/controllers/userApi/ui/auth/resetPassword.ts
  70. 0
      packages/nocodb/src/lib/controllers/userApi/ui/emailTemplates/forgotPassword.ts
  71. 0
      packages/nocodb/src/lib/controllers/userApi/ui/emailTemplates/invite.ts
  72. 0
      packages/nocodb/src/lib/controllers/userApi/ui/emailTemplates/verify.ts
  73. 24
      packages/nocodb/src/lib/controllers/userApi/userApis.ts
  74. 22
      packages/nocodb/src/lib/controllers/utilApis.ts
  75. 14
      packages/nocodb/src/lib/controllers/viewApis.ts
  76. 6
      packages/nocodb/src/lib/controllers/viewColumnApis.ts
  77. 2
      packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts
  78. 78
      packages/nocodb/src/lib/meta/api/index.ts

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

@ -45,7 +45,7 @@ import User from './models/User';
import * as http from 'http';
import weAreHiring from './utils/weAreHiring';
import getInstance from './utils/getInstance';
import initAdminFromEnv from './meta/api/userApi/initAdminFromEnv';
import initAdminFromEnv from './controllers/userApi/initAdminFromEnv';
const log = debug('nc:app');
require('dotenv').config();

10
packages/nocodb/src/lib/meta/api/apiTokenApis.ts → packages/nocodb/src/lib/controllers/apiTokenApis.ts

@ -1,11 +1,11 @@
import { Request, Response, Router } from 'express';
import { OrgUserRoles } from 'nocodb-sdk';
import { Tele } from 'nc-help';
import { NcError } from '../helpers/catchError';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import ApiToken from '../../models/ApiToken';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import { NcError } from '../meta/helpers/catchError';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import ApiToken from '../models/ApiToken';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function apiTokenList(req: Request, res: Response) {
res.json(await ApiToken.list(req['user'].id));

18
packages/nocodb/src/lib/meta/api/attachmentApis.ts → packages/nocodb/src/lib/controllers/attachmentApis.ts

@ -5,16 +5,16 @@ import { nanoid } from 'nanoid';
import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk';
import path from 'path';
import slash from 'slash';
import Noco from '../../Noco';
import { MetaTable } from '../../utils/globals';
import mimetypes, { mimeIcons } from '../../utils/mimeTypes';
import Noco from '../Noco';
import { MetaTable } from '../utils/globals';
import mimetypes, { mimeIcons } from '../utils/mimeTypes';
import { Tele } from 'nc-help';
import extractProjectIdAndAuthenticate from '../helpers/extractProjectIdAndAuthenticate';
import catchError, { NcError } from '../helpers/catchError';
import NcPluginMgrv2 from '../helpers/NcPluginMgrv2';
import Local from '../../v1-legacy/plugins/adapters/storage/Local';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
import { getCacheMiddleware } from './helpers';
import extractProjectIdAndAuthenticate from '../meta/helpers/extractProjectIdAndAuthenticate';
import catchError, { NcError } from '../meta/helpers/catchError';
import NcPluginMgrv2 from '../meta/helpers/NcPluginMgrv2';
import Local from '../v1-legacy/plugins/adapters/storage/Local';
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants';
import { getCacheMiddleware } from '../meta/api/helpers';
const isUploadAllowed = async (req: Request, _res: Response, next: any) => {
if (!req['user']?.id) {

10
packages/nocodb/src/lib/meta/api/auditApis.ts → packages/nocodb/src/lib/controllers/auditApis.ts

@ -1,12 +1,12 @@
import { Request, Response, Router } from 'express';
import Audit from '../../models/Audit';
import Audit from '../models/Audit';
import { AuditOperationSubTypes, AuditOperationTypes } from 'nocodb-sdk';
import Model from '../../models/Model';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import Model from '../models/Model';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import DOMPurify from 'isomorphic-dompurify';
import { getAjvValidatorMw } from './helpers';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function commentRow(req: Request<any, any>, res) {
res.json(

14
packages/nocodb/src/lib/meta/api/baseApis.ts → packages/nocodb/src/lib/controllers/baseApis.ts

@ -1,13 +1,13 @@
import { Request, Response } from 'express';
import Project from '../../models/Project';
import Project from '../models/Project';
import { BaseListType } from 'nocodb-sdk';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { syncBaseMigration } from '../helpers/syncMigration';
import Base from '../../models/Base';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { syncBaseMigration } from '../meta/helpers/syncMigration';
import Base from '../models/Base';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { Tele } from 'nc-help';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw, populateMeta } from './helpers';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw, populateMeta } from '../meta/api/helpers';
export async function baseGet(
req: Request<any, any, any>,

4
packages/nocodb/src/lib/meta/api/cacheApis.ts → packages/nocodb/src/lib/controllers/cacheApis.ts

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

44
packages/nocodb/src/lib/meta/api/columnApis.ts → packages/nocodb/src/lib/controllers/columnApis.ts

@ -1,16 +1,16 @@
import { Request, Response, Router } from 'express';
import Model from '../../models/Model';
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import Base from '../../models/Base';
import Column from '../../models/Column';
import Model from '../models/Model';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
import Base from '../models/Base';
import Column from '../models/Column';
import { Tele } from 'nc-help';
import validateParams from '../helpers/validateParams';
import validateParams from '../meta/helpers/validateParams';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import LinkToAnotherRecordColumn from '../models/LinkToAnotherRecordColumn';
import {
getUniqueColumnAliasName,
getUniqueColumnName,
} from '../helpers/getUniqueName';
} from '../meta/helpers/getUniqueName';
import {
AuditOperationSubTypes,
AuditOperationTypes,
@ -24,20 +24,20 @@ import {
TableType,
UITypes,
} from 'nocodb-sdk';
import Audit from '../../models/Audit';
import SqlMgrv2 from '../../db/sql-mgr/v2/SqlMgrv2';
import Noco from '../../Noco';
import NcMetaIO from '../NcMetaIO';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { NcError } from '../helpers/catchError';
import getColumnPropsFromUIDT from '../helpers/getColumnPropsFromUIDT';
import mapDefaultDisplayValue from '../helpers/mapDefaultDisplayValue';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { metaApiMetrics } from '../helpers/apiMetrics';
import FormulaColumn from '../../models/FormulaColumn';
import KanbanView from '../../models/KanbanView';
import { MetaTable } from '../../utils/globals';
import formulaQueryBuilderv2 from '../../db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2';
import Audit from '../models/Audit';
import SqlMgrv2 from '../db/sql-mgr/v2/SqlMgrv2';
import Noco from '../Noco';
import NcMetaIO from '../meta/NcMetaIO';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { NcError } from '../meta/helpers/catchError';
import getColumnPropsFromUIDT from '../meta/helpers/getColumnPropsFromUIDT';
import mapDefaultDisplayValue from '../meta/helpers/mapDefaultDisplayValue';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import FormulaColumn from '../models/FormulaColumn';
import KanbanView from '../models/KanbanView';
import { MetaTable } from '../utils/globals';
import formulaQueryBuilderv2 from '../db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2';
import {
createHmAndBtColumn,
generateFkName,
@ -46,7 +46,7 @@ import {
validateLookupPayload,
validateRequiredField,
validateRollupPayload,
} from './helpers';
} from '../meta/api/helpers';
export enum Altered {
NEW_COLUMN = 1,

12
packages/nocodb/src/lib/meta/api/dataApis/bulkDataAliasApis.ts → packages/nocodb/src/lib/controllers/dataApis/bulkDataAliasApis.ts

@ -1,11 +1,11 @@
import { Request, Response, Router } from 'express';
import { BaseModelSqlv2 } from '../../../db/sql-data-mapper/lib/sql/BaseModelSqlv2';
import Model from '../../../models/Model';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import { BaseModelSqlv2 } from '../../db/sql-data-mapper/lib/sql/BaseModelSqlv2';
import Model from '../../models/Model';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import apiMetrics from '../../helpers/apiMetrics';
import apiMetrics from '../../meta/helpers/apiMetrics';
type BulkOperation =
| 'bulkInsert'

20
packages/nocodb/src/lib/meta/api/dataApis/dataAliasApis.ts → packages/nocodb/src/lib/controllers/dataApis/dataAliasApis.ts

@ -1,16 +1,16 @@
import { Request, Response, Router } from 'express';
import Model from '../../../models/Model';
import Model from '../../models/Model';
import { nocoExecute } from 'nc-help';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import { NcError } from '../../helpers/catchError';
import { PagedResponseImpl } from '../../helpers/PagedResponse';
import View from '../../../models/View';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { NcError } from '../../meta/helpers/catchError';
import { PagedResponseImpl } from '../../meta/helpers/PagedResponse';
import View from '../../models/View';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import apiMetrics from '../../helpers/apiMetrics';
import getAst from '../../../db/sql-data-mapper/lib/sql/helpers/getAst';
import { parseHrtimeToSeconds } from '../helpers';
import apiMetrics from '../../meta/helpers/apiMetrics';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
import { parseHrtimeToSeconds } from '../../meta/api/helpers';
// todo: Handle the error case where view doesnt belong to model
async function dataList(req: Request, res: Response) {

6
packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts → packages/nocodb/src/lib/controllers/dataApis/dataAliasExportApis.ts

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

14
packages/nocodb/src/lib/meta/api/dataApis/dataAliasNestedApis.ts → packages/nocodb/src/lib/controllers/dataApis/dataAliasNestedApis.ts

@ -1,15 +1,15 @@
import { Request, Response, Router } from 'express';
import Model from '../../../models/Model';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../helpers/PagedResponse';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import Model from '../../models/Model';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../meta/helpers/PagedResponse';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import {
getColumnByIdOrName,
getViewAndModelFromRequestByAliasOrId,
} from './helpers';
import { NcError } from '../../helpers/catchError';
import apiMetrics from '../../helpers/apiMetrics';
import { NcError } from '../../meta/helpers/catchError';
import apiMetrics from '../../meta/helpers/apiMetrics';
// todo: handle case where the given column is not ltar
export async function mmList(req: Request, res: Response, next) {

18
packages/nocodb/src/lib/meta/api/dataApis/dataApis.ts → packages/nocodb/src/lib/controllers/dataApis/dataApis.ts

@ -1,14 +1,14 @@
import { Request, Response, Router } from 'express';
import Model from '../../../models/Model';
import Model from '../../models/Model';
import { nocoExecute } from 'nc-help';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../helpers/PagedResponse';
import View from '../../../models/View';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import { NcError } from '../../helpers/catchError';
import apiMetrics from '../../helpers/apiMetrics';
import getAst from '../../../db/sql-data-mapper/lib/sql/helpers/getAst';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../meta/helpers/PagedResponse';
import View from '../../models/View';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { NcError } from '../../meta/helpers/catchError';
import apiMetrics from '../../meta/helpers/apiMetrics';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
export async function dataList(req: Request, res: Response, next) {
const view = await View.get(req.params.viewId);

20
packages/nocodb/src/lib/meta/api/dataApis/helpers.ts → packages/nocodb/src/lib/controllers/dataApis/helpers.ts

@ -1,20 +1,20 @@
import Project from '../../../models/Project';
import Model from '../../../models/Model';
import View from '../../../models/View';
import { NcError } from '../../helpers/catchError';
import Project from '../../models/Project';
import Model from '../../models/Model';
import View from '../../models/View';
import { NcError } from '../../meta/helpers/catchError';
import { Request } from 'express';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { isSystemColumn, UITypes } from 'nocodb-sdk';
import { nocoExecute } from 'nc-help';
import * as XLSX from 'xlsx';
import Column from '../../../models/Column';
import LookupColumn from '../../../models/LookupColumn';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import Column from '../../models/Column';
import LookupColumn from '../../models/LookupColumn';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import papaparse from 'papaparse';
import getAst from '../../../db/sql-data-mapper/lib/sql/helpers/getAst';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
export async function getViewAndModelFromRequestByAliasOrId(
req:
| Request<{ projectName: string; tableName: string; viewName?: string }>

0
packages/nocodb/src/lib/meta/api/dataApis/index.ts → packages/nocodb/src/lib/controllers/dataApis/index.ts

18
packages/nocodb/src/lib/meta/api/dataApis/oldDataApis.ts → packages/nocodb/src/lib/controllers/dataApis/oldDataApis.ts

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

4
packages/nocodb/src/lib/meta/api/exportApis.ts → packages/nocodb/src/lib/controllers/exportApis.ts

@ -1,6 +1,6 @@
import { Request, Response, Router } from 'express';
import View from '../../models/View';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import View from '../models/View';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { extractCsvData } from './dataApis/helpers';
async function exportCsv(req: Request, res: Response) {

16
packages/nocodb/src/lib/meta/api/filterApis.ts → packages/nocodb/src/lib/controllers/filterApis.ts

@ -1,19 +1,19 @@
import { Request, Response, Router } from 'express';
// @ts-ignore
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
// @ts-ignore
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
// @ts-ignore
import { Table, TableList, TableListParams, TableReq } from 'nocodb-sdk';
// @ts-ignore
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
// @ts-ignore
import Project from '../../models/Project';
import Filter from '../../models/Filter';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import Project from '../models/Project';
import Filter from '../models/Filter';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
// @ts-ignore
export async function filterGet(req: Request, res: Response, next) {

18
packages/nocodb/src/lib/meta/api/formViewApis.ts → packages/nocodb/src/lib/controllers/formViewApis.ts

@ -1,19 +1,19 @@
import { Request, Response, Router } from 'express';
// @ts-ignore
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
// @ts-ignore
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { FormType, ViewTypes } from 'nocodb-sdk';
// @ts-ignore
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
// @ts-ignore
import Project from '../../models/Project';
import View from '../../models/View';
import FormView from '../../models/FormView';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import Project from '../models/Project';
import View from '../models/View';
import FormView from '../models/FormView';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
// @ts-ignore
export async function formViewGet(req: Request, res: Response<FormType>) {

8
packages/nocodb/src/lib/meta/api/formViewColumnApis.ts → packages/nocodb/src/lib/controllers/formViewColumnApis.ts

@ -1,9 +1,9 @@
import { Request, Response, Router } from 'express';
import FormViewColumn from '../../models/FormViewColumn';
import FormViewColumn from '../models/FormViewColumn';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function columnUpdate(req: Request, res: Response) {
Tele.emit('evt', { evt_type: 'formViewColumn:updated' });

10
packages/nocodb/src/lib/meta/api/galleryViewApis.ts → packages/nocodb/src/lib/controllers/galleryViewApis.ts

@ -1,11 +1,11 @@
import { Request, Response, Router } from 'express';
import { GalleryType, ViewTypes } from 'nocodb-sdk';
import View from '../../models/View';
import GalleryView from '../../models/GalleryView';
import View from '../models/View';
import GalleryView from '../models/GalleryView';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function galleryViewGet(req: Request, res: Response<GalleryType>) {
res.json(await GalleryView.get(req.params.galleryViewId));
}

18
packages/nocodb/src/lib/meta/api/gridViewApis.ts → packages/nocodb/src/lib/controllers/gridViewApis.ts

@ -1,19 +1,19 @@
import { Request, Router } from 'express';
// @ts-ignore
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
// @ts-ignore
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { ViewTypes } from 'nocodb-sdk';
// @ts-ignore
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
// @ts-ignore
import Project from '../../models/Project';
import View from '../../models/View';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import GridView from '../../models/GridView';
import { getAjvValidatorMw } from './helpers';
import Project from '../models/Project';
import View from '../models/View';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import GridView from '../models/GridView';
import { getAjvValidatorMw } from '../meta/api/helpers';
// @ts-ignore
export async function gridViewCreate(req: Request<any, any>, res) {

8
packages/nocodb/src/lib/meta/api/gridViewColumnApis.ts → packages/nocodb/src/lib/controllers/gridViewColumnApis.ts

@ -1,9 +1,9 @@
import { Request, Response, Router } from 'express';
import GridViewColumn from '../../models/GridViewColumn';
import GridViewColumn from '../models/GridViewColumn';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function columnList(req: Request, res: Response) {
res.json(await GridViewColumn.list(req.params.gridViewId));

18
packages/nocodb/src/lib/meta/api/hookApis.ts → packages/nocodb/src/lib/controllers/hookApis.ts

@ -1,15 +1,15 @@
import { Tele } from 'nc-help';
import catchError from '../helpers/catchError';
import catchError from '../meta/helpers/catchError';
import { Request, Response, Router } from 'express';
import Hook from '../../models/Hook';
import Hook from '../models/Hook';
import { HookListType, HookType } from 'nocodb-sdk';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { invokeWebhook } from '../helpers/webhookHelpers';
import Model from '../../models/Model';
import populateSamplePayload from '../helpers/populateSamplePayload';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { invokeWebhook } from '../meta/helpers/webhookHelpers';
import Model from '../models/Model';
import populateSamplePayload from '../meta/helpers/populateSamplePayload';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function hookList(
req: Request<any, any, any>,

16
packages/nocodb/src/lib/meta/api/hookFilterApis.ts → packages/nocodb/src/lib/controllers/hookFilterApis.ts

@ -1,19 +1,19 @@
import { Request, Response, Router } from 'express';
// @ts-ignore
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
// @ts-ignore
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
// @ts-ignore
import { Table, TableList, TableListParams, TableReq } from 'nocodb-sdk';
// @ts-ignore
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
// @ts-ignore
import Project from '../../models/Project';
import Filter from '../../models/Filter';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import Project from '../models/Project';
import Filter from '../models/Filter';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
// @ts-ignore
export async function filterGet(req: Request, res: Response, next) {

10
packages/nocodb/src/lib/meta/api/kanbanViewApis.ts → packages/nocodb/src/lib/controllers/kanbanViewApis.ts

@ -1,11 +1,11 @@
import { Request, Response, Router } from 'express';
import { KanbanType, ViewTypes } from 'nocodb-sdk';
import View from '../../models/View';
import KanbanView from '../../models/KanbanView';
import View from '../models/View';
import KanbanView from '../models/KanbanView';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function kanbanViewGet(req: Request, res: Response<KanbanType>) {
res.json(await KanbanView.get(req.params.kanbanViewId));

8
packages/nocodb/src/lib/meta/api/mapViewApis.ts → packages/nocodb/src/lib/controllers/mapViewApis.ts

@ -1,10 +1,10 @@
import { Request, Response, Router } from 'express';
import { MapType, ViewTypes } from 'nocodb-sdk';
import View from '../../models/View';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import View from '../models/View';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { Tele } from 'nc-help';
import { metaApiMetrics } from '../helpers/apiMetrics';
import MapView from '../../models/MapView';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import MapView from '../models/MapView';
export async function mapViewGet(req: Request, res: Response<MapType>) {
res.json(await MapView.get(req.params.mapViewId));

28
packages/nocodb/src/lib/meta/api/metaDiffApis.ts → packages/nocodb/src/lib/controllers/metaDiffApis.ts

@ -1,22 +1,22 @@
// // Project CRUD
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import Model from '../../models/Model';
import Project from '../../models/Project';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import Model from '../models/Model';
import Project from '../models/Project';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import { isVirtualCol, ModelTypes, RelationTypes, UITypes } from 'nocodb-sdk';
import { Router } from 'express';
import Base from '../../models/Base';
import ModelXcMetaFactory from '../../db/sql-mgr/code/models/xc/ModelXcMetaFactory';
import Column from '../../models/Column';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import { getUniqueColumnAliasName } from '../helpers/getUniqueName';
import NcHelp from '../../utils/NcHelp';
import getTableNameAlias, { getColumnNameAlias } from '../helpers/getTableName';
import mapDefaultDisplayValue from '../helpers/mapDefaultDisplayValue';
import getColumnUiType from '../helpers/getColumnUiType';
import { metaApiMetrics } from '../helpers/apiMetrics';
import Base from '../models/Base';
import ModelXcMetaFactory from '../db/sql-mgr/code/models/xc/ModelXcMetaFactory';
import Column from '../models/Column';
import LinkToAnotherRecordColumn from '../models/LinkToAnotherRecordColumn';
import { getUniqueColumnAliasName } from '../meta/helpers/getUniqueName';
import NcHelp from '../utils/NcHelp';
import getTableNameAlias, { getColumnNameAlias } from '../meta/helpers/getTableName';
import mapDefaultDisplayValue from '../meta/helpers/mapDefaultDisplayValue';
import getColumnUiType from '../meta/helpers/getColumnUiType';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
export enum MetaDiffType {
TABLE_NEW = 'TABLE_NEW',

10
packages/nocodb/src/lib/meta/api/modelVisibilityApis.ts → packages/nocodb/src/lib/controllers/modelVisibilityApis.ts

@ -1,10 +1,10 @@
import Model from '../../models/Model';
import ModelRoleVisibility from '../../models/ModelRoleVisibility';
import Model from '../models/Model';
import ModelRoleVisibility from '../models/ModelRoleVisibility';
import { Router } from 'express';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
async function xcVisibilityMetaSetAll(req, res) {
Tele.emit('evt', { evt_type: 'uiAcl:updated' });
for (const d of req.body) {

12
packages/nocodb/src/lib/meta/api/orgLicenseApis.ts → packages/nocodb/src/lib/controllers/orgLicenseApis.ts

@ -1,11 +1,11 @@
import { Router } from 'express';
import { OrgUserRoles } from 'nocodb-sdk';
import { NC_LICENSE_KEY } from '../../constants';
import Store from '../../models/Store';
import Noco from '../../Noco';
import { metaApiMetrics } from '../helpers/apiMetrics';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { getAjvValidatorMw } from './helpers';
import { NC_LICENSE_KEY } from '../constants';
import Store from '../models/Store';
import Noco from '../Noco';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { getAjvValidatorMw } from '../meta/api/helpers';
async function licenseGet(_req, res) {
const license = await Store.get(NC_LICENSE_KEY);

16
packages/nocodb/src/lib/meta/api/orgTokenApis.ts → packages/nocodb/src/lib/controllers/orgTokenApis.ts

@ -1,14 +1,14 @@
import { Request, Response, Router } from 'express';
import { OrgUserRoles } from 'nocodb-sdk';
import ApiToken from '../../models/ApiToken';
import ApiToken from '../models/ApiToken';
import { Tele } from 'nc-help';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { NcError } from '../helpers/catchError';
import getHandler from '../helpers/getHandler';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { apiTokenListEE } from './ee/orgTokenApis';
import { getAjvValidatorMw } from './helpers';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { NcError } from '../meta/helpers/catchError';
import getHandler from '../meta/helpers/getHandler';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { apiTokenListEE } from '../meta/api/ee/orgTokenApis';
import { getAjvValidatorMw } from '../meta/api/helpers';
async function apiTokenList(req, res) {
const fk_user_id = req.user.id;

30
packages/nocodb/src/lib/meta/api/orgUserApis.ts → packages/nocodb/src/lib/controllers/orgUserApis.ts

@ -7,22 +7,22 @@ import {
import { v4 as uuidv4 } from 'uuid';
import validator from 'validator';
import { OrgUserRoles } from 'nocodb-sdk';
import { NC_APP_SETTINGS } from '../../constants';
import Audit from '../../models/Audit';
import ProjectUser from '../../models/ProjectUser';
import Store from '../../models/Store';
import SyncSource from '../../models/SyncSource';
import User from '../../models/User';
import Noco from '../../Noco';
import { MetaTable } from '../../utils/globals';
import { NC_APP_SETTINGS } from '../constants';
import Audit from '../models/Audit';
import ProjectUser from '../models/ProjectUser';
import Store from '../models/Store';
import SyncSource from '../models/SyncSource';
import User from '../models/User';
import Noco from '../Noco';
import { MetaTable } from '../utils/globals';
import { Tele } from 'nc-help';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { NcError } from '../helpers/catchError';
import { extractProps } from '../helpers/extractProps';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { randomTokenString } from '../helpers/stringHelpers';
import { getAjvValidatorMw } from './helpers';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { NcError } from '../meta/helpers/catchError';
import { extractProps } from '../meta/helpers/extractProps';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { randomTokenString } from '../meta/helpers/stringHelpers';
import { getAjvValidatorMw } from '../meta/api/helpers';
import { sendInviteEmail } from './projectUserApis';
async function userList(req, res) {

12
packages/nocodb/src/lib/meta/api/pluginApis.ts → packages/nocodb/src/lib/controllers/pluginApis.ts

@ -1,12 +1,12 @@
import { Request, Response, Router } from 'express';
import { Tele } from 'nc-help';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import Plugin from '../../models/Plugin';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import Plugin from '../models/Plugin';
import { PluginType } from 'nocodb-sdk';
import NcPluginMgrv2 from '../helpers/NcPluginMgrv2';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import NcPluginMgrv2 from '../meta/helpers/NcPluginMgrv2';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
export async function pluginList(_req: Request, res: Response) {
res.json(new PagedResponseImpl(await Plugin.list()));

28
packages/nocodb/src/lib/meta/api/projectApis.ts → packages/nocodb/src/lib/controllers/projectApis.ts

@ -1,25 +1,25 @@
import { Request, Response } from 'express';
import { OrgUserRoles, ProjectType } from 'nocodb-sdk';
import Project from '../../models/Project';
import Project from '../models/Project';
import { ProjectListType } from 'nocodb-sdk';
import DOMPurify from 'isomorphic-dompurify';
import { packageVersion } from '../../utils/packageVersion';
import { packageVersion } from '../utils/packageVersion';
import { Tele } from 'nc-help';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import syncMigration from '../helpers/syncMigration';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import ProjectUser from '../../models/ProjectUser';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import syncMigration from '../meta/helpers/syncMigration';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import ProjectUser from '../models/ProjectUser';
import { customAlphabet } from 'nanoid';
import Noco from '../../Noco';
import Noco from '../Noco';
import isDocker from 'is-docker';
import { NcError } from '../helpers/catchError';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { extractPropsAndSanitize } from '../helpers/extractProps';
import NcConfigFactory from '../../utils/NcConfigFactory';
import { NcError } from '../meta/helpers/catchError';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { extractPropsAndSanitize } from '../meta/helpers/extractProps';
import NcConfigFactory from '../utils/NcConfigFactory';
import { promisify } from 'util';
import { getAjvValidatorMw, populateMeta } from './helpers';
import Filter from '../../models/Filter';
import { getAjvValidatorMw, populateMeta } from '../meta/api/helpers';
import Filter from '../models/Filter';
const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 4);

26
packages/nocodb/src/lib/meta/api/projectUserApis.ts → packages/nocodb/src/lib/controllers/projectUserApis.ts

@ -1,23 +1,23 @@
import { OrgUserRoles } from 'nocodb-sdk';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { Router } from 'express';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import ProjectUser from '../../models/ProjectUser';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import ProjectUser from '../models/ProjectUser';
import validator from 'validator';
import { NcError } from '../helpers/catchError';
import { NcError } from '../meta/helpers/catchError';
import { v4 as uuidv4 } from 'uuid';
import User from '../../models/User';
import Audit from '../../models/Audit';
import NocoCache from '../../cache/NocoCache';
import { CacheGetType, CacheScope, MetaTable } from '../../utils/globals';
import User from '../models/User';
import Audit from '../models/Audit';
import NocoCache from '../cache/NocoCache';
import { CacheGetType, CacheScope, MetaTable } from '../utils/globals';
import * as ejs from 'ejs';
import NcPluginMgrv2 from '../helpers/NcPluginMgrv2';
import Noco from '../../Noco';
import NcPluginMgrv2 from '../meta/helpers/NcPluginMgrv2';
import Noco from '../Noco';
import { PluginCategory } from 'nocodb-sdk';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { randomTokenString } from '../helpers/stringHelpers';
import { getAjvValidatorMw } from './helpers';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { randomTokenString } from '../meta/helpers/stringHelpers';
import { getAjvValidatorMw } from '../meta/api/helpers';
async function userList(req, res) {
res.json({

0
packages/nocodb/src/lib/meta/api/publicApis/index.ts → packages/nocodb/src/lib/controllers/publicApis/index.ts

24
packages/nocodb/src/lib/meta/api/publicApis/publicDataApis.ts → packages/nocodb/src/lib/controllers/publicApis/publicDataApis.ts

@ -1,24 +1,24 @@
import { Request, Response, Router } from 'express';
import Model from '../../../models/Model';
import Model from '../../models/Model';
import { nocoExecute } from 'nc-help';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../helpers/PagedResponse';
import View from '../../../models/View';
import catchError, { NcError } from '../../helpers/catchError';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../meta/helpers/PagedResponse';
import View from '../../models/View';
import catchError, { NcError } from '../../meta/helpers/catchError';
import multer from 'multer';
import { ErrorMessages, UITypes, ViewTypes } from 'nocodb-sdk';
import Column from '../../../models/Column';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import NcPluginMgrv2 from '../../helpers/NcPluginMgrv2';
import Column from '../../models/Column';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import NcPluginMgrv2 from '../../meta/helpers/NcPluginMgrv2';
import path from 'path';
import { nanoid } from 'nanoid';
import { mimeIcons } from '../../../utils/mimeTypes';
import { mimeIcons } from '../../utils/mimeTypes';
import slash from 'slash';
import { sanitizeUrlPath } from '../attachmentApis';
import getAst from '../../../db/sql-data-mapper/lib/sql/helpers/getAst';
import getAst from '../../db/sql-data-mapper/lib/sql/helpers/getAst';
import { getColumnByIdOrName } from '../dataApis/helpers';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../../constants';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
export async function dataList(req: Request, res: Response) {
try {

18
packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts → packages/nocodb/src/lib/controllers/publicApis/publicDataExportApis.ts

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

14
packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts → packages/nocodb/src/lib/controllers/publicApis/publicMetaApis.ts

@ -1,17 +1,17 @@
import { Request, Response, Router } from 'express';
import catchError, { NcError } from '../../helpers/catchError';
import View from '../../../models/View';
import Model from '../../../models/Model';
import catchError, { NcError } from '../../meta/helpers/catchError';
import View from '../../models/View';
import Model from '../../models/Model';
import {
ErrorMessages,
LinkToAnotherRecordType,
RelationTypes,
UITypes,
} from 'nocodb-sdk';
import Column from '../../../models/Column';
import Base from '../../../models/Base';
import Project from '../../../models/Project';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import Column from '../../models/Column';
import Base from '../../models/Base';
import Project from '../../models/Project';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
export async function viewMetaGet(req: Request, res: Response) {
const view: View & {

8
packages/nocodb/src/lib/meta/api/sharedBaseApis.ts → packages/nocodb/src/lib/controllers/sharedBaseApis.ts

@ -1,10 +1,10 @@
import { Router } from 'express';
import { Tele } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { v4 as uuidv4 } from 'uuid';
import Project from '../../models/Project';
import { NcError } from '../helpers/catchError';
import { getAjvValidatorMw } from './helpers';
import Project from '../models/Project';
import { NcError } from '../meta/helpers/catchError';
import { getAjvValidatorMw } from '../meta/api/helpers';
// todo: load from config
const config = {
dashboardPath: '/nc',

16
packages/nocodb/src/lib/meta/api/sortApis.ts → packages/nocodb/src/lib/controllers/sortApis.ts

@ -1,18 +1,18 @@
import { Request, Response, Router } from 'express';
// @ts-ignore
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
// @ts-ignore
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import { SortListType, SortType, TableType } from 'nocodb-sdk';
// @ts-ignore
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
// @ts-ignore
import Project from '../../models/Project';
import Sort from '../../models/Sort';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { getAjvValidatorMw } from './helpers';
import Project from '../models/Project';
import Sort from '../models/Sort';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { getAjvValidatorMw } from '../meta/api/helpers';
// @ts-ignore
export async function sortGet(req: Request, res: Response<TableType>) {}

6
packages/nocodb/src/lib/meta/api/swagger/helpers/getPaths.ts → packages/nocodb/src/lib/controllers/swagger/helpers/getPaths.ts

@ -1,6 +1,6 @@
import Noco from '../../../../Noco';
import Model from '../../../../models/Model';
import Project from '../../../../models/Project';
import Noco from '../../../Noco';
import Model from '../../../models/Model';
import Project from '../../../models/Project';
import { getModelPaths, getViewPaths } from './templates/paths';
import { SwaggerColumn } from './getSwaggerColumnMetas';
import { SwaggerView } from './getSwaggerJSON';

6
packages/nocodb/src/lib/meta/api/swagger/helpers/getSchemas.ts → packages/nocodb/src/lib/controllers/swagger/helpers/getSchemas.ts

@ -1,6 +1,6 @@
import Noco from '../../../../Noco';
import Model from '../../../../models/Model';
import Project from '../../../../models/Project';
import Noco from '../../../Noco';
import Model from '../../../models/Model';
import Project from '../../../models/Project';
import { getModelSchemas, getViewSchemas } from './templates/schemas';
import { SwaggerColumn } from './getSwaggerColumnMetas';
import { SwaggerView } from './getSwaggerJSON';

10
packages/nocodb/src/lib/meta/api/swagger/helpers/getSwaggerColumnMetas.ts → packages/nocodb/src/lib/controllers/swagger/helpers/getSwaggerColumnMetas.ts

@ -1,9 +1,9 @@
import { UITypes } from 'nocodb-sdk';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import SwaggerTypes from '../../../../db/sql-mgr/code/routers/xc-ts/SwaggerTypes';
import Column from '../../../../models/Column';
import Noco from '../../../../Noco';
import Project from '../../../../models/Project';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import SwaggerTypes from '../../../db/sql-mgr/code/routers/xc-ts/SwaggerTypes';
import Column from '../../../models/Column';
import Noco from '../../../Noco';
import Project from '../../../models/Project';
export default async (
columns: Column[],

14
packages/nocodb/src/lib/meta/api/swagger/helpers/getSwaggerJSON.ts → packages/nocodb/src/lib/controllers/swagger/helpers/getSwaggerJSON.ts

@ -1,15 +1,15 @@
import FormViewColumn from '../../../../models/FormViewColumn';
import GalleryViewColumn from '../../../../models/GalleryViewColumn';
import Noco from '../../../../Noco';
import Model from '../../../../models/Model';
import FormViewColumn from '../../../models/FormViewColumn';
import GalleryViewColumn from '../../../models/GalleryViewColumn';
import Noco from '../../../Noco';
import Model from '../../../models/Model';
import swaggerBase from './swagger-base.json';
import getPaths from './getPaths';
import getSchemas from './getSchemas';
import Project from '../../../../models/Project';
import Project from '../../../models/Project';
import getSwaggerColumnMetas from './getSwaggerColumnMetas';
import { ViewTypes } from 'nocodb-sdk';
import GridViewColumn from '../../../../models/GridViewColumn';
import View from '../../../../models/View';
import GridViewColumn from '../../../models/GridViewColumn';
import View from '../../../models/View';
export default async function getSwaggerJSON(
project: Project,

0
packages/nocodb/src/lib/meta/api/swagger/helpers/swagger-base.json → packages/nocodb/src/lib/controllers/swagger/helpers/swagger-base.json

0
packages/nocodb/src/lib/meta/api/swagger/helpers/templates/headers.ts → packages/nocodb/src/lib/controllers/swagger/helpers/templates/headers.ts

2
packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts → packages/nocodb/src/lib/controllers/swagger/helpers/templates/params.ts

@ -1,6 +1,6 @@
import { SwaggerColumn } from '../getSwaggerColumnMetas';
import { RelationTypes, UITypes } from 'nocodb-sdk';
import LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
export const rowIdParam = {
schema: {

0
packages/nocodb/src/lib/meta/api/swagger/helpers/templates/paths.ts → packages/nocodb/src/lib/controllers/swagger/helpers/templates/paths.ts

0
packages/nocodb/src/lib/meta/api/swagger/helpers/templates/schemas.ts → packages/nocodb/src/lib/controllers/swagger/helpers/templates/schemas.ts

0
packages/nocodb/src/lib/meta/api/swagger/redocHtml.ts → packages/nocodb/src/lib/controllers/swagger/redocHtml.ts

8
packages/nocodb/src/lib/meta/api/swagger/swaggerApis.ts → packages/nocodb/src/lib/controllers/swagger/swaggerApis.ts

@ -1,10 +1,10 @@
// @ts-ignore
import catchError, { NcError } from '../../helpers/catchError';
import catchError, { NcError } from '../../meta/helpers/catchError';
import { Router } from 'express';
import Model from '../../../models/Model';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import Model from '../../models/Model';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import getSwaggerJSON from './helpers/getSwaggerJSON';
import Project from '../../../models/Project';
import Project from '../../models/Project';
import getSwaggerHtml from './swaggerHtml';
import getRedocHtml from './redocHtml';

0
packages/nocodb/src/lib/meta/api/swagger/swaggerHtml.ts → packages/nocodb/src/lib/controllers/swagger/swaggerHtml.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/EntityMap.ts → packages/nocodb/src/lib/controllers/sync/helpers/EntityMap.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/NocoSyncDestAdapter.ts → packages/nocodb/src/lib/controllers/sync/helpers/NocoSyncDestAdapter.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/NocoSyncSourceAdapter.ts → packages/nocodb/src/lib/controllers/sync/helpers/NocoSyncSourceAdapter.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/fetchAT.ts → packages/nocodb/src/lib/controllers/sync/helpers/fetchAT.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/job.ts → packages/nocodb/src/lib/controllers/sync/helpers/job.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/readAndProcessData.ts → packages/nocodb/src/lib/controllers/sync/helpers/readAndProcessData.ts

0
packages/nocodb/src/lib/meta/api/sync/helpers/syncMap.ts → packages/nocodb/src/lib/controllers/sync/helpers/syncMap.ts

8
packages/nocodb/src/lib/meta/api/sync/importApis.ts → packages/nocodb/src/lib/controllers/sync/importApis.ts

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

8
packages/nocodb/src/lib/meta/api/sync/syncSourceApis.ts → packages/nocodb/src/lib/controllers/sync/syncSourceApis.ts

@ -1,10 +1,10 @@
import { Request, Response, Router } from 'express';
import SyncSource from '../../../models/SyncSource';
import SyncSource from '../../models/SyncSource';
import { Tele } from 'nc-help';
import { PagedResponseImpl } from '../../helpers/PagedResponse';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import Project from '../../../models/Project';
import { PagedResponseImpl } from '../../meta/helpers/PagedResponse';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import Project from '../../models/Project';
export async function syncSourceList(req: Request, res: Response) {
// todo: pagination

34
packages/nocodb/src/lib/meta/api/tableApis.ts → packages/nocodb/src/lib/controllers/tableApis.ts

@ -1,7 +1,7 @@
import { Request, Response, Router } from 'express';
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import DOMPurify from 'isomorphic-dompurify';
import {
AuditOperationSubTypes,
@ -14,22 +14,22 @@ import {
TableType,
UITypes,
} from 'nocodb-sdk';
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import Project from '../../models/Project';
import Audit from '../../models/Audit';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { getAjvValidatorMw } from './helpers';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
import Project from '../models/Project';
import Audit from '../models/Audit';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { getAjvValidatorMw } from '../meta/api/helpers';
import { xcVisibilityMetaGet } from './modelVisibilityApis';
import View from '../../models/View';
import getColumnPropsFromUIDT from '../helpers/getColumnPropsFromUIDT';
import mapDefaultDisplayValue from '../helpers/mapDefaultDisplayValue';
import { NcError } from '../helpers/catchError';
import getTableNameAlias, { getColumnNameAlias } from '../helpers/getTableName';
import Column from '../../models/Column';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import getColumnUiType from '../helpers/getColumnUiType';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import { metaApiMetrics } from '../helpers/apiMetrics';
import View from '../models/View';
import getColumnPropsFromUIDT from '../meta/helpers/getColumnPropsFromUIDT';
import mapDefaultDisplayValue from '../meta/helpers/mapDefaultDisplayValue';
import { NcError } from '../meta/helpers/catchError';
import getTableNameAlias, { getColumnNameAlias } from '../meta/helpers/getTableName';
import Column from '../models/Column';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import getColumnUiType from '../meta/helpers/getColumnUiType';
import LinkToAnotherRecordColumn from '../models/LinkToAnotherRecordColumn';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
export async function tableGet(req: Request, res: Response<TableType>) {
const table = await Model.getWithInfo({

2
packages/nocodb/src/lib/meta/api/testApis.ts → packages/nocodb/src/lib/controllers/testApis.ts

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

4
packages/nocodb/src/lib/meta/api/userApi/helpers.ts → packages/nocodb/src/lib/controllers/userApi/helpers.ts

@ -1,7 +1,7 @@
import * as jwt from 'jsonwebtoken';
import crypto from 'crypto';
import User from '../../../models/User';
import { NcConfig } from '../../../../interface/config';
import User from '../../models/User';
import { NcConfig } from '../../../interface/config';
export function genJwt(user: User, config: NcConfig) {
return jwt.sign(

0
packages/nocodb/src/lib/meta/api/userApi/index.ts → packages/nocodb/src/lib/controllers/userApi/index.ts

10
packages/nocodb/src/lib/meta/api/userApi/initAdminFromEnv.ts → packages/nocodb/src/lib/controllers/userApi/initAdminFromEnv.ts

@ -1,14 +1,14 @@
import User from '../../../models/User';
import User from '../../models/User';
import { v4 as uuidv4 } from 'uuid';
import { promisify } from 'util';
import bcrypt from 'bcryptjs';
import Noco from '../../../Noco';
import { CacheScope, MetaTable } from '../../../utils/globals';
import ProjectUser from '../../../models/ProjectUser';
import Noco from '../../Noco';
import { CacheScope, MetaTable } from '../../utils/globals';
import ProjectUser from '../../models/ProjectUser';
import { validatePassword } from 'nocodb-sdk';
import boxen from 'boxen';
import NocoCache from '../../../cache/NocoCache';
import NocoCache from '../../cache/NocoCache';
import { Tele } from 'nc-help';
const { isEmail } = require('validator');

16
packages/nocodb/src/lib/meta/api/userApi/initStrategies.ts → packages/nocodb/src/lib/controllers/userApi/initStrategies.ts

@ -1,6 +1,6 @@
import { OrgUserRoles } from 'nocodb-sdk';
import User from '../../../models/User';
import ProjectUser from '../../../models/ProjectUser';
import User from '../../models/User';
import ProjectUser from '../../models/ProjectUser';
import { promisify } from 'util';
import { Strategy as CustomStrategy } from 'passport-custom';
import passport from 'passport';
@ -17,12 +17,12 @@ const jwtOptions = {
};
import bcrypt from 'bcryptjs';
import Project from '../../../models/Project';
import NocoCache from '../../../cache/NocoCache';
import { CacheGetType, CacheScope } from '../../../utils/globals';
import ApiToken from '../../../models/ApiToken';
import Noco from '../../../Noco';
import Plugin from '../../../models/Plugin';
import Project from '../../models/Project';
import NocoCache from '../../cache/NocoCache';
import { CacheGetType, CacheScope } from '../../utils/globals';
import ApiToken from '../../models/ApiToken';
import Noco from '../../Noco';
import Plugin from '../../models/Plugin';
import { registerNewUserIfAllowed } from './userApis';
export function initStrategies(router): void {

0
packages/nocodb/src/lib/meta/api/userApi/ui/auth/emailVerify.ts → packages/nocodb/src/lib/controllers/userApi/ui/auth/emailVerify.ts

0
packages/nocodb/src/lib/meta/api/userApi/ui/auth/resetPassword.ts → packages/nocodb/src/lib/controllers/userApi/ui/auth/resetPassword.ts

0
packages/nocodb/src/lib/meta/api/userApi/ui/emailTemplates/forgotPassword.ts → packages/nocodb/src/lib/controllers/userApi/ui/emailTemplates/forgotPassword.ts

0
packages/nocodb/src/lib/meta/api/userApi/ui/emailTemplates/invite.ts → packages/nocodb/src/lib/controllers/userApi/ui/emailTemplates/invite.ts

0
packages/nocodb/src/lib/meta/api/userApi/ui/emailTemplates/verify.ts → packages/nocodb/src/lib/controllers/userApi/ui/emailTemplates/verify.ts

24
packages/nocodb/src/lib/meta/api/userApi/userApis.ts → packages/nocodb/src/lib/controllers/userApi/userApis.ts

@ -1,30 +1,30 @@
import { Request, Response } from 'express';
import { TableType, validatePassword } from 'nocodb-sdk';
import { OrgUserRoles } from 'nocodb-sdk';
import { NC_APP_SETTINGS } from '../../../constants';
import Store from '../../../models/Store';
import { NC_APP_SETTINGS } from '../../constants';
import Store from '../../models/Store';
import { Tele } from 'nc-help';
import catchError, { NcError } from '../../helpers/catchError';
import catchError, { NcError } from '../../meta/helpers/catchError';
const { isEmail } = require('validator');
import * as ejs from 'ejs';
import bcrypt from 'bcryptjs';
import { promisify } from 'util';
import User from '../../../models/User';
import User from '../../models/User';
const { v4: uuidv4 } = require('uuid');
import Audit from '../../../models/Audit';
import NcPluginMgrv2 from '../../helpers/NcPluginMgrv2';
import Audit from '../../models/Audit';
import NcPluginMgrv2 from '../../meta/helpers/NcPluginMgrv2';
import passport from 'passport';
import extractProjectIdAndAuthenticate from '../../helpers/extractProjectIdAndAuthenticate';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import { MetaTable } from '../../../utils/globals';
import Noco from '../../../Noco';
import { getAjvValidatorMw } from '../helpers';
import extractProjectIdAndAuthenticate from '../../meta/helpers/extractProjectIdAndAuthenticate';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { MetaTable } from '../../utils/globals';
import Noco from '../../Noco';
import { getAjvValidatorMw } from '../../meta/api/helpers';
import { genJwt } from './helpers';
import { randomTokenString } from '../../helpers/stringHelpers';
import { randomTokenString } from '../../meta/helpers/stringHelpers';
export async function registerNewUserIfAllowed({
firstname,

22
packages/nocodb/src/lib/meta/api/utilApis.ts → packages/nocodb/src/lib/controllers/utilApis.ts

@ -3,20 +3,20 @@ import { Request, Response } from 'express';
import { compareVersions, validate } from 'compare-versions';
import { ViewTypes } from 'nocodb-sdk';
import Project from '../../models/Project';
import Noco from '../../Noco';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { MetaTable } from '../../utils/globals';
import { packageVersion } from '../../utils/packageVersion';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import SqlMgrv2 from '../../db/sql-mgr/v2/SqlMgrv2';
import Project from '../models/Project';
import Noco from '../Noco';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import { MetaTable } from '../utils/globals';
import { packageVersion } from '../utils/packageVersion';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import SqlMgrv2 from '../db/sql-mgr/v2/SqlMgrv2';
import NcConfigFactory, {
defaultConnectionConfig,
} from '../../utils/NcConfigFactory';
import User from '../../models/User';
import catchError from '../helpers/catchError';
} from '../utils/NcConfigFactory';
import User from '../models/User';
import catchError from '../meta/helpers/catchError';
import axios from 'axios';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants';
const versionCache = {
releaseVersion: null,

14
packages/nocodb/src/lib/meta/api/viewApis.ts → packages/nocodb/src/lib/controllers/viewApis.ts

@ -1,19 +1,19 @@
import { Request, Response, Router } from 'express';
// @ts-ignore
import Model from '../../models/Model';
import Model from '../models/Model';
import { Tele } from 'nc-help';
// @ts-ignore
import { PagedResponseImpl } from '../helpers/PagedResponse';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
// @ts-ignore
import { Table, TableReq, ViewList } from 'nocodb-sdk';
// @ts-ignore
import ProjectMgrv2 from '../../db/sql-mgr/v2/ProjectMgrv2';
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2';
// @ts-ignore
import Project from '../../models/Project';
import View from '../../models/View';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import Project from '../models/Project';
import View from '../models/View';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { xcVisibilityMetaGet } from './modelVisibilityApis';
import { metaApiMetrics } from '../helpers/apiMetrics';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
// @ts-ignore
export async function viewGet(req: Request, res: Response<Table>) {}

6
packages/nocodb/src/lib/meta/api/viewColumnApis.ts → packages/nocodb/src/lib/controllers/viewColumnApis.ts

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

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

@ -11,7 +11,7 @@ import getTableNameAlias, {
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import getColumnUiType from '../../helpers/getColumnUiType';
import mapDefaultDisplayValue from '../../helpers/mapDefaultDisplayValue';
import { extractAndGenerateManyToManyRelations } from '../metaDiffApis';
import { extractAndGenerateManyToManyRelations } from '../../../controllers/metaDiffApis';
import { ModelTypes, UITypes, ViewTypes } from 'nocodb-sdk';
import { IGNORE_TABLES } from '../../../utils/common/BaseApiBuilder';

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

@ -1,39 +1,39 @@
import { Tele } from 'nc-help';
import orgLicenseApis from './orgLicenseApis';
import orgTokenApis from './orgTokenApis';
import orgUserApis from './orgUserApis';
import projectApis from './projectApis';
import baseApis from './baseApis';
import tableApis from './tableApis';
import columnApis from './columnApis';
import orgLicenseApis from '../../controllers/orgLicenseApis';
import orgTokenApis from '../../controllers/orgTokenApis';
import orgUserApis from '../../controllers/orgUserApis';
import projectApis from '../../controllers/projectApis';
import baseApis from '../../controllers/baseApis';
import tableApis from '../../controllers/tableApis';
import columnApis from '../../controllers/columnApis';
import { Router } from 'express';
import sortApis from './sortApis';
import filterApis from './filterApis';
import viewColumnApis from './viewColumnApis';
import gridViewApis from './gridViewApis';
import viewApis from './viewApis';
import galleryViewApis from './galleryViewApis';
import formViewApis from './formViewApis';
import formViewColumnApis from './formViewColumnApis';
import attachmentApis from './attachmentApis';
import exportApis from './exportApis';
import auditApis from './auditApis';
import hookApis from './hookApis';
import pluginApis from './pluginApis';
import gridViewColumnApis from './gridViewColumnApis';
import kanbanViewApis from './kanbanViewApis';
import { userApis } from './userApi';
import sortApis from '../../controllers/sortApis';
import filterApis from '../../controllers/filterApis';
import viewColumnApis from '../../controllers/viewColumnApis';
import gridViewApis from '../../controllers/gridViewApis';
import viewApis from '../../controllers/viewApis';
import galleryViewApis from '../../controllers/galleryViewApis';
import formViewApis from '../../controllers/formViewApis';
import formViewColumnApis from '../../controllers/formViewColumnApis';
import attachmentApis from '../../controllers/attachmentApis';
import exportApis from '../../controllers/exportApis';
import auditApis from '../../controllers/auditApis';
import hookApis from '../../controllers/hookApis';
import pluginApis from '../../controllers/pluginApis';
import gridViewColumnApis from '../../controllers/gridViewColumnApis';
import kanbanViewApis from '../../controllers/kanbanViewApis';
import { userApis } from '../../controllers/userApi';
// import extractProjectIdAndAuthenticate from './helpers/extractProjectIdAndAuthenticate';
import utilApis from './utilApis';
import projectUserApis from './projectUserApis';
import sharedBaseApis from './sharedBaseApis';
import { initStrategies } from './userApi/initStrategies';
import modelVisibilityApis from './modelVisibilityApis';
import metaDiffApis from './metaDiffApis';
import cacheApis from './cacheApis';
import apiTokenApis from './apiTokenApis';
import hookFilterApis from './hookFilterApis';
import testApis from './testApis';
import utilApis from '../../controllers/utilApis';
import projectUserApis from '../../controllers/projectUserApis';
import sharedBaseApis from '../../controllers/sharedBaseApis';
import { initStrategies } from '../../controllers/userApi/initStrategies';
import modelVisibilityApis from '../../controllers/modelVisibilityApis';
import metaDiffApis from '../../controllers/metaDiffApis';
import cacheApis from '../../controllers/cacheApis';
import apiTokenApis from '../../controllers/apiTokenApis';
import hookFilterApis from '../../controllers/hookFilterApis';
import testApis from '../../controllers/testApis';
import {
bulkDataAliasApis,
dataAliasApis,
@ -41,20 +41,20 @@ import {
dataAliasNestedApis,
dataApis,
oldDataApis,
} from './dataApis';
} from '../../controllers/dataApis';
import {
publicDataApis,
publicDataExportApis,
publicMetaApis,
} from './publicApis';
} from '../../controllers/publicApis';
import { Server, Socket } from 'socket.io';
import passport from 'passport';
import crypto from 'crypto';
import swaggerApis from './swagger/swaggerApis';
import importApis from './sync/importApis';
import syncSourceApis from './sync/syncSourceApis';
import mapViewApis from './mapViewApis';
import swaggerApis from '../../controllers/swagger/swaggerApis';
import importApis from '../../controllers/sync/importApis';
import syncSourceApis from '../../controllers/sync/syncSourceApis';
import mapViewApis from '../../controllers/mapViewApis';
const clients: { [id: string]: Socket } = {};
const jobs: { [id: string]: { last_message: any } } = {};

Loading…
Cancel
Save