Browse Source

Merge pull request #5773 from nocodb/refactor/lint

refactor: lint
pull/5774/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
73af8587ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      packages/nocodb/.eslintrc.js
  2. 2
      packages/nocodb/src/cache/RedisCacheMgr.ts
  3. 2
      packages/nocodb/src/cache/RedisMockCacheMgr.ts
  4. 1
      packages/nocodb/src/controllers/api-tokens.controller.ts
  5. 1
      packages/nocodb/src/controllers/attachments.controller.ts
  6. 1
      packages/nocodb/src/controllers/audits.controller.ts
  7. 1
      packages/nocodb/src/controllers/bases.controller.ts
  8. 1
      packages/nocodb/src/controllers/bulk-data-alias.controller.ts
  9. 1
      packages/nocodb/src/controllers/columns.controller.ts
  10. 1
      packages/nocodb/src/controllers/data-alias-export.controller.ts
  11. 3
      packages/nocodb/src/controllers/data-alias-nested.controller.ts
  12. 1
      packages/nocodb/src/controllers/data-alias.controller.ts
  13. 2
      packages/nocodb/src/controllers/filters.controller.ts
  14. 1
      packages/nocodb/src/controllers/form-columns.controller.ts
  15. 1
      packages/nocodb/src/controllers/galleries.controller.ts
  16. 1
      packages/nocodb/src/controllers/grid-columns.controller.ts
  17. 1
      packages/nocodb/src/controllers/grids.controller.ts
  18. 1
      packages/nocodb/src/controllers/maps.controller.ts
  19. 1
      packages/nocodb/src/controllers/meta-diffs.controller.ts
  20. 1
      packages/nocodb/src/controllers/model-visibilities.controller.ts
  21. 1
      packages/nocodb/src/controllers/old-datas/old-datas.controller.ts
  22. 1
      packages/nocodb/src/controllers/org-users.controller.ts
  23. 10
      packages/nocodb/src/controllers/plugins.controller.ts
  24. 1
      packages/nocodb/src/controllers/project-users.controller.ts
  25. 2
      packages/nocodb/src/controllers/projects.controller.ts
  26. 1
      packages/nocodb/src/controllers/shared-bases.controller.ts
  27. 1
      packages/nocodb/src/controllers/sorts.controller.ts
  28. 1
      packages/nocodb/src/controllers/tables.controller.ts
  29. 6
      packages/nocodb/src/controllers/users/users.controller.ts
  30. 3
      packages/nocodb/src/controllers/view-columns.controller.ts
  31. 6
      packages/nocodb/src/db/BaseModelSql.ts
  32. 19
      packages/nocodb/src/db/BaseModelSqlv2.ts
  33. 2
      packages/nocodb/src/db/CustomKnex.ts
  34. 2
      packages/nocodb/src/db/conditionV2.ts
  35. 2
      packages/nocodb/src/db/sql-client/lib/SqlClientFactory.ts
  36. 1
      packages/nocodb/src/interceptors/is-upload-allowed/is-upload-allowed.interceptor.ts
  37. 9
      packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts
  38. 2
      packages/nocodb/src/models/Model.ts
  39. 1
      packages/nocodb/src/modules/datas/helpers.ts
  40. 3
      packages/nocodb/src/modules/jobs/jobs/at-import/helpers/readAndProcessData.ts
  41. 5
      packages/nocodb/src/modules/users/users.module.ts
  42. 1
      packages/nocodb/src/run/docker.ts
  43. 1
      packages/nocodb/src/run/dockerRunPG_CyQuick.ts
  44. 5
      packages/nocodb/src/services/bulk-data-alias.service.ts
  45. 1
      packages/nocodb/src/services/public-metas.service.ts
  46. 1
      packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts
  47. 5
      packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts

10
packages/nocodb/.eslintrc.js

@ -63,12 +63,20 @@ module.exports = {
], ],
}, },
], ],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-this-alias': 'off', '@typescript-eslint/no-this-alias': 'off',
// todo: enable // todo: enable
'@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/no-var-requires': 'off',
'no-useless-catch': 'off', 'no-useless-catch': 'off',
'no-empty': 'off', 'no-empty': 'off',

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

@ -45,7 +45,7 @@ export default class RedisCacheMgr extends CacheMgr {
} }
// @ts-ignore // @ts-ignore
async get(key: string, type: string, config?: any): Promise<any> { async get(key: string, type: string): Promise<any> {
log(`RedisCacheMgr::get: getting key ${key} with type ${type}`); log(`RedisCacheMgr::get: getting key ${key} with type ${type}`);
if (type === CacheGetType.TYPE_ARRAY) { if (type === CacheGetType.TYPE_ARRAY) {
return this.client.smembers(key); return this.client.smembers(key);

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

@ -40,7 +40,7 @@ export default class RedisMockCacheMgr extends CacheMgr {
} }
// @ts-ignore // @ts-ignore
async get(key: string, type: string, config?: any): Promise<any> { async get(key: string, type: string): Promise<any> {
log(`RedisMockCacheMgr::get: getting key ${key} with type ${type}`); log(`RedisMockCacheMgr::get: getting key ${key} with type ${type}`);
if (type === CacheGetType.TYPE_ARRAY) { if (type === CacheGetType.TYPE_ARRAY) {
return this.client.smembers(key); return this.client.smembers(key);

1
packages/nocodb/src/controllers/api-tokens.controller.ts

@ -9,7 +9,6 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';
import { import {

1
packages/nocodb/src/controllers/attachments.controller.ts

@ -30,7 +30,6 @@ export class AttachmentsController {
@UploadedFiles() files: Array<any>, @UploadedFiles() files: Array<any>,
@Body() body: any, @Body() body: any,
@Request() req: any, @Request() req: any,
@Query('path') path: string,
) { ) {
const attachments = await this.attachmentsService.upload({ const attachments = await this.attachmentsService.upload({
files: files, files: files,

1
packages/nocodb/src/controllers/audits.controller.ts

@ -10,7 +10,6 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';
import { import {

1
packages/nocodb/src/controllers/bases.controller.ts

@ -10,7 +10,6 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { BaseReqType } from 'nocodb-sdk'; import { BaseReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';
import { import {

1
packages/nocodb/src/controllers/bulk-data-alias.controller.ts

@ -10,7 +10,6 @@ import {
Response, Response,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/columns.controller.ts

@ -11,7 +11,6 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ColumnReqType } from 'nocodb-sdk'; import { ColumnReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/data-alias-export.controller.ts

@ -1,6 +1,5 @@
import { Controller, Get, Request, Response, UseGuards } from '@nestjs/common'; import { Controller, Get, Request, Response, UseGuards } from '@nestjs/common';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

3
packages/nocodb/src/controllers/data-alias-nested.controller.ts

@ -8,7 +8,6 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,
@ -131,7 +130,6 @@ export class DataAliasNestedController {
@Param('projectName') projectName: string, @Param('projectName') projectName: string,
@Param('tableName') tableName: string, @Param('tableName') tableName: string,
@Param('refRowId') refRowId: string, @Param('refRowId') refRowId: string,
@Param('relationType') relationType: string,
) { ) {
await this.dataAliasNestedService.relationDataRemove({ await this.dataAliasNestedService.relationDataRemove({
columnName: columnName, columnName: columnName,
@ -158,7 +156,6 @@ export class DataAliasNestedController {
@Param('projectName') projectName: string, @Param('projectName') projectName: string,
@Param('tableName') tableName: string, @Param('tableName') tableName: string,
@Param('refRowId') refRowId: string, @Param('refRowId') refRowId: string,
@Param('relationType') relationType: string,
) { ) {
await this.dataAliasNestedService.relationDataAdd({ await this.dataAliasNestedService.relationDataAdd({
columnName: columnName, columnName: columnName,

1
packages/nocodb/src/controllers/data-alias.controller.ts

@ -11,7 +11,6 @@ import {
Response, Response,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { parseHrtimeToSeconds } from '../helpers'; import { parseHrtimeToSeconds } from '../helpers';
import { import {

2
packages/nocodb/src/controllers/filters.controller.ts

@ -9,14 +9,12 @@ import {
Post, Post,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { FilterReqType } from 'nocodb-sdk'; import { FilterReqType } from 'nocodb-sdk';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';
import { import {
Acl, Acl,
ExtractProjectIdMiddleware, ExtractProjectIdMiddleware,
UseAclMiddleware,
} from '../middlewares/extract-project-id/extract-project-id.middleware'; } from '../middlewares/extract-project-id/extract-project-id.middleware';
import { FiltersService } from '../services/filters.service'; import { FiltersService } from '../services/filters.service';

1
packages/nocodb/src/controllers/form-columns.controller.ts

@ -1,5 +1,4 @@
import { Body, Controller, Param, Patch, UseGuards } from '@nestjs/common'; import { Body, Controller, Param, Patch, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/galleries.controller.ts

@ -9,7 +9,6 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { GalleryUpdateReqType, ViewCreateReqType } from 'nocodb-sdk'; import { GalleryUpdateReqType, ViewCreateReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/grid-columns.controller.ts

@ -1,6 +1,5 @@
import { Body, Controller, Get, Param, Patch, UseGuards } from '@nestjs/common'; import { Body, Controller, Get, Param, Patch, UseGuards } from '@nestjs/common';
import { GridColumnReqType } from 'nocodb-sdk'; import { GridColumnReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/grids.controller.ts

@ -8,7 +8,6 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ViewCreateReqType } from 'nocodb-sdk'; import { ViewCreateReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/maps.controller.ts

@ -9,7 +9,6 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { MapUpdateReqType, ViewCreateReqType } from 'nocodb-sdk'; import { MapUpdateReqType, ViewCreateReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/meta-diffs.controller.ts

@ -6,7 +6,6 @@ import {
Post, Post,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/model-visibilities.controller.ts

@ -8,7 +8,6 @@ import {
Query, Query,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/old-datas/old-datas.controller.ts

@ -11,7 +11,6 @@ import {
Response, Response,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../../guards/global/global.guard'; import { GlobalGuard } from '../../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/org-users.controller.ts

@ -10,7 +10,6 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { OrgUserRoles } from 'nocodb-sdk'; import { OrgUserRoles } from 'nocodb-sdk';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';

10
packages/nocodb/src/controllers/plugins.controller.ts

@ -14,11 +14,11 @@ import { Acl } from '../middlewares/extract-project-id/extract-project-id.middle
import { PluginsService } from '../services/plugins.service'; import { PluginsService } from '../services/plugins.service';
// todo: move to a interceptor // todo: move to a interceptor
const blockInCloudMw = (_req, res, next) => { // const blockInCloudMw = (_req, res, next) => {
if (process.env.NC_CLOUD === 'true') { // if (process.env.NC_CLOUD === 'true') {
res.status(403).send('Not allowed'); // res.status(403).send('Not allowed');
} else next(); // } else next();
}; // };
@Controller() @Controller()
@UseGuards(GlobalGuard) @UseGuards(GlobalGuard)

1
packages/nocodb/src/controllers/project-users.controller.ts

@ -11,7 +11,6 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ProjectUserReqType } from 'nocodb-sdk'; import { ProjectUserReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

2
packages/nocodb/src/controllers/projects.controller.ts

@ -16,8 +16,8 @@ import { ProjectReqType } from 'nocodb-sdk';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';
import { import {
ExtractProjectIdMiddleware,
Acl, Acl,
ExtractProjectIdMiddleware,
} from '../middlewares/extract-project-id/extract-project-id.middleware'; } from '../middlewares/extract-project-id/extract-project-id.middleware';
import Noco from '../Noco'; import Noco from '../Noco';
import { packageVersion } from '../utils/packageVersion'; import { packageVersion } from '../utils/packageVersion';

1
packages/nocodb/src/controllers/shared-bases.controller.ts

@ -10,7 +10,6 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { import {
Acl, Acl,

1
packages/nocodb/src/controllers/sorts.controller.ts

@ -9,7 +9,6 @@ import {
Post, Post,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { SortReqType } from 'nocodb-sdk'; import { SortReqType } from 'nocodb-sdk';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';

1
packages/nocodb/src/controllers/tables.controller.ts

@ -11,7 +11,6 @@ import {
Request, Request,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { TableReqType } from 'nocodb-sdk'; import { TableReqType } from 'nocodb-sdk';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import extractRolesObj from '../utils/extractRolesObj'; import extractRolesObj from '../utils/extractRolesObj';

6
packages/nocodb/src/controllers/users/users.controller.ts

@ -94,7 +94,7 @@ export class UsersController {
@Get('/auth/google') @Get('/auth/google')
@UseGuards(AuthGuard('google')) @UseGuards(AuthGuard('google'))
googleAuthenticate(@Request() req) { googleAuthenticate() {
// google strategy will take care the request // google strategy will take care the request
} }
@ -116,7 +116,7 @@ export class UsersController {
@UseGuards(GlobalGuard) @UseGuards(GlobalGuard)
@Acl('passwordChange') @Acl('passwordChange')
@HttpCode(200) @HttpCode(200)
async passwordChange(@Request() req: any, @Body() body: any): Promise<any> { async passwordChange(@Request() req: any): Promise<any> {
if (!(req as any).isAuthenticated()) { if (!(req as any).isAuthenticated()) {
NcError.forbidden('Not allowed'); NcError.forbidden('Not allowed');
} }
@ -136,7 +136,7 @@ export class UsersController {
'/api/v1/auth/password/forgot', '/api/v1/auth/password/forgot',
]) ])
@HttpCode(200) @HttpCode(200)
async passwordForgot(@Request() req: any, @Body() body: any): Promise<any> { async passwordForgot(@Request() req: any): Promise<any> {
await this.usersService.passwordForgot({ await this.usersService.passwordForgot({
siteUrl: (req as any).ncSiteUrl, siteUrl: (req as any).ncSiteUrl,
body: req.body, body: req.body,

3
packages/nocodb/src/controllers/view-columns.controller.ts

@ -8,8 +8,7 @@ import {
Post, Post,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ColumnReqType, ViewColumnReqType } from 'nocodb-sdk'; import { ViewColumnReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../guards/global/global.guard'; import { GlobalGuard } from '../guards/global/global.guard';
import { PagedResponseImpl } from '../helpers/PagedResponse'; import { PagedResponseImpl } from '../helpers/PagedResponse';
import { import {

6
packages/nocodb/src/db/BaseModelSql.ts

@ -1613,7 +1613,7 @@ class BaseModelSql extends BaseModel {
} }
} }
async nestedRead(id, { where, fields: fields1, f, ...rest }, trx = null) { async nestedRead(id, { fields: fields1, f, ...rest }, trx = null) {
rest = Object.assign({}, this.defaultNestedQueryParams, rest); rest = Object.assign({}, this.defaultNestedQueryParams, rest);
const { hm: childs = '', bt: parents = '', mm: many = '' } = rest; const { hm: childs = '', bt: parents = '', mm: many = '' } = rest;
@ -1852,7 +1852,7 @@ class BaseModelSql extends BaseModel {
return null; return null;
} }
// @ts-ignore // @ts-ignore
const { tn, cn, vtn, vcn, vrcn, rtn, rcn } = const { vtn, vcn, vrcn, rtn, rcn } =
this.manyToManyRelations.find(({ vtn }) => assoc === vtn) || {}; this.manyToManyRelations.find(({ vtn }) => assoc === vtn) || {};
const childModel = this.dbModels[rtn]; const childModel = this.dbModels[rtn];
@ -1894,7 +1894,7 @@ class BaseModelSql extends BaseModel {
return null; return null;
} }
// @ts-ignore // @ts-ignore
const { tn, cn, vtn, vcn, vrcn, rtn, rcn } = const { vtn, vcn, vrcn, rtn, rcn } =
this.manyToManyRelations.find(({ vtn }) => assoc === vtn) || {}; this.manyToManyRelations.find(({ vtn }) => assoc === vtn) || {};
const childModel = this.dbModels[rtn]; const childModel = this.dbModels[rtn];

19
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -19,16 +19,7 @@ import DOMPurify from 'isomorphic-dompurify';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { NcError } from '../helpers/catchError'; import { NcError } from '../helpers/catchError';
import getAst from '../helpers/getAst'; import getAst from '../helpers/getAst';
import { import { Audit, Column, Filter, Model, Project, Sort, View } from '../models';
Audit,
Base,
Column,
Filter,
Model,
Project,
Sort,
View,
} from '../models';
import { sanitize, unsanitize } from '../helpers/sqlSanitize'; import { sanitize, unsanitize } from '../helpers/sqlSanitize';
import { import {
COMPARISON_OPS, COMPARISON_OPS,
@ -57,7 +48,7 @@ import type {
SelectOption, SelectOption,
} from '../models'; } from '../models';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import type { BoolType, SortType } from 'nocodb-sdk'; import type { SortType } from 'nocodb-sdk';
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
@ -1361,12 +1352,6 @@ class BaseModelSqlv2 {
const columns = await this.model.getColumns(); const columns = await this.model.getColumns();
for (const column of columns) { for (const column of columns) {
switch (column.uidt) { switch (column.uidt) {
case UITypes.Rollup:
{
// @ts-ignore
const colOptions: RollupColumn = await column.getColOptions();
}
break;
case UITypes.Lookup: case UITypes.Lookup:
{ {
// @ts-ignore // @ts-ignore

2
packages/nocodb/src/db/CustomKnex.ts

@ -1,6 +1,6 @@
import { Knex, knex } from 'knex'; import { Knex, knex } from 'knex';
import { SnowflakeClient } from 'nc-help'; import { SnowflakeClient } from 'nc-help';
import pg, { types } from 'pg'; import { types } from 'pg';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import Filter from '../models/Filter'; import Filter from '../models/Filter';
import type { FilterType } from 'nocodb-sdk'; import type { FilterType } from 'nocodb-sdk';

2
packages/nocodb/src/db/conditionV2.ts

@ -1,5 +1,5 @@
import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk'; import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk';
import dayjs, { extend } from 'dayjs'; import dayjs from 'dayjs';
// import customParseFormat from 'dayjs/plugin/customParseFormat.js'; // import customParseFormat from 'dayjs/plugin/customParseFormat.js';
import Filter from '../models/Filter'; import Filter from '../models/Filter';
import { sanitize } from '../helpers/sqlSanitize'; import { sanitize } from '../helpers/sqlSanitize';

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

@ -1,7 +1,5 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import Noco from '../../../Noco';
import SqlClientFactoryEE from './ee/SqlClientFactoryEE';
import MySqlClient from './mysql/MysqlClient'; import MySqlClient from './mysql/MysqlClient';
import MssqlClient from './mssql/MssqlClient'; import MssqlClient from './mssql/MssqlClient';
import OracleClient from './oracle/OracleClient'; import OracleClient from './oracle/OracleClient';

1
packages/nocodb/src/interceptors/is-upload-allowed/is-upload-allowed.interceptor.ts

@ -1,6 +1,5 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk'; import { OrgUserRoles, ProjectRoles } from 'nocodb-sdk';
import { throwError } from 'rxjs';
import { NcError } from '../../helpers/catchError'; import { NcError } from '../../helpers/catchError';
import Noco from '../../Noco'; import Noco from '../../Noco';
import extractRolesObj from '../../utils/extractRolesObj'; import extractRolesObj from '../../utils/extractRolesObj';

9
packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts

@ -1,10 +1,7 @@
import { promisify } from 'util';
import { Injectable, SetMetadata, UseInterceptors } from '@nestjs/common'; import { Injectable, SetMetadata, UseInterceptors } from '@nestjs/common';
import { Reflector } from '@nestjs/core'; import { Reflector } from '@nestjs/core';
import { NextFunction, Request, Response } from 'express';
import { OrgUserRoles } from 'nocodb-sdk'; import { OrgUserRoles } from 'nocodb-sdk';
import passport from 'passport'; import { map } from 'rxjs';
import { map, throwError } from 'rxjs';
import { import {
Column, Column,
Filter, Filter,
@ -19,8 +16,7 @@ import {
} from '../../models'; } from '../../models';
import extractRolesObj from '../../utils/extractRolesObj'; import extractRolesObj from '../../utils/extractRolesObj';
import projectAcl from '../../utils/projectAcl'; import projectAcl from '../../utils/projectAcl';
import catchError, { NcError } from '../catchError'; import { NcError } from '../catchError';
import extractProjectIdAndAuthenticate from '../extractProjectIdAndAuthenticate';
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { import type {
CallHandler, CallHandler,
@ -216,7 +212,6 @@ export class AclMiddleware implements NestInterceptor {
); );
const req = context.switchToHttp().getRequest(); const req = context.switchToHttp().getRequest();
const res = context.switchToHttp().getResponse();
req.customProperty = 'This is a custom property'; req.customProperty = 'This is a custom property';
const roles: Record<string, boolean> = extractRolesObj(req.user?.roles); const roles: Record<string, boolean> = extractRolesObj(req.user?.roles);

2
packages/nocodb/src/models/Model.ts

@ -16,7 +16,6 @@ import { sanitize } from '../helpers/sqlSanitize';
import { extractProps } from '../helpers/extractProps'; import { extractProps } from '../helpers/extractProps';
import Audit from './Audit'; import Audit from './Audit';
import View from './View'; import View from './View';
import Base from './Base';
import Column from './Column'; import Column from './Column';
import type { BoolType, TableReqType, TableType } from 'nocodb-sdk'; import type { BoolType, TableReqType, TableType } from 'nocodb-sdk';
import type { XKnex } from '../db/CustomKnex'; import type { XKnex } from '../db/CustomKnex';
@ -471,7 +470,6 @@ export default class Model implements TableType {
knex, knex,
) { ) {
const insertObj = {}; const insertObj = {};
const base = await Base.get(this.base_id);
for (const col of await this.getColumns()) { for (const col of await this.getColumns()) {
if (isVirtualCol(col)) continue; if (isVirtualCol(col)) continue;
let val = let val =

1
packages/nocodb/src/modules/datas/helpers.ts

@ -12,7 +12,6 @@ import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import type { BaseModelSqlv2 } from '../../db/BaseModelSqlv2'; import type { BaseModelSqlv2 } from '../../db/BaseModelSqlv2';
import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import type LookupColumn from '../../models/LookupColumn'; import type LookupColumn from '../../models/LookupColumn';
import type { Request } from 'express';
export interface PathParams { export interface PathParams {
projectName: string; projectName: string;

3
packages/nocodb/src/modules/jobs/jobs/at-import/helpers/readAndProcessData.ts

@ -21,14 +21,12 @@ async function readAllData({
fields, fields,
base, base,
logBasic = (_str) => {}, logBasic = (_str) => {},
services,
}: { }: {
table: { title?: string }; table: { title?: string };
fields?; fields?;
base: AirtableBase; base: AirtableBase;
logBasic?: (string) => void; logBasic?: (string) => void;
logDetailed?: (string) => void; logDetailed?: (string) => void;
services: AirtableImportContext;
}): Promise<EntityMap> { }): Promise<EntityMap> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let data = null; let data = null;
@ -229,7 +227,6 @@ export async function importLTARData({
base, base,
logDetailed, logDetailed,
logBasic, logBasic,
services,
})); }));
const modelMeta: any = const modelMeta: any =

5
packages/nocodb/src/modules/users/users.module.ts

@ -1,9 +1,6 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport'; import { PassportModule } from '@nestjs/passport';
import { import { GoogleStrategyProvider } from '../../strategies/google.strategy/google.strategy';
GoogleStrategy,
GoogleStrategyProvider,
} from '../../strategies/google.strategy/google.strategy';
import { GlobalModule } from '../global/global.module'; import { GlobalModule } from '../global/global.module';
import { UsersService } from '../../services/users/users.service'; import { UsersService } from '../../services/users/users.service';
import { UsersController } from '../../controllers/users/users.controller'; import { UsersController } from '../../controllers/users/users.controller';

1
packages/nocodb/src/run/docker.ts

@ -1,4 +1,3 @@
import axios from 'axios';
import cors from 'cors'; import cors from 'cors';
import express from 'express'; import express from 'express';
import Noco from '../Noco'; import Noco from '../Noco';

1
packages/nocodb/src/run/dockerRunPG_CyQuick.ts

@ -1,7 +1,6 @@
import cors from 'cors'; import cors from 'cors';
import express from 'express'; import express from 'express';
import Noco from '../Noco'; import Noco from '../Noco';
import nocobuild from '../nocobuild';
const server = express(); const server = express();
server.enable('trust proxy'); server.enable('trust proxy');

5
packages/nocodb/src/services/bulk-data-alias.service.ts

@ -1,8 +1,5 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { isSystemColumn, UITypes } from 'nocodb-sdk'; import { Base, Model } from '../models';
import * as XLSX from 'xlsx';
import { NcError } from '../helpers/catchError';
import { Base, Column, Model, Project, View } from '../models';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import { getViewAndModelByAliasOrId } from '../modules/datas/helpers'; import { getViewAndModelByAliasOrId } from '../modules/datas/helpers';
import type { PathParams } from '../modules/datas/helpers'; import type { PathParams } from '../modules/datas/helpers';

1
packages/nocodb/src/services/public-metas.service.ts

@ -3,7 +3,6 @@ import { ErrorMessages, RelationTypes, UITypes } from 'nocodb-sdk';
import { NcError } from '../helpers/catchError'; import { NcError } from '../helpers/catchError';
import { Base, Column, Model, Project, View } from '../models'; import { Base, Column, Model, Project, View } from '../models';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../models'; import type { LinkToAnotherRecordColumn, LookupColumn } from '../models';
import type { LinkToAnotherRecordType } from 'nocodb-sdk';
@Injectable() @Injectable()
export class PublicMetasService { export class PublicMetasService {

1
packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts

@ -1,4 +1,3 @@
import debug from 'debug';
import { Router } from 'express'; import { Router } from 'express';
import GqlXcSchemaFactory from '../../../db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory'; import GqlXcSchemaFactory from '../../../db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory';
import BaseApiBuilder from '../BaseApiBuilder'; import BaseApiBuilder from '../BaseApiBuilder';

5
packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts

@ -1,17 +1,14 @@
import debug from 'debug';
import autoBind from 'auto-bind'; import autoBind from 'auto-bind';
import SwaggerXc from '../../../db/sql-mgr/code/routers/xc-ts/SwaggerXc'; import SwaggerXc from '../../../db/sql-mgr/code/routers/xc-ts/SwaggerXc';
import ExpressXcTsRoutes from '../../../db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes'; import ExpressXcTsRoutes from '../../../db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes';
import NcHelp from '../../../utils/NcHelp'; import NcHelp from '../../../utils/NcHelp';
import BaseApiBuilder, { XcTablesPopulateParams } from '../BaseApiBuilder'; import BaseApiBuilder from '../BaseApiBuilder';
import type { MetaService } from '../../../meta/meta.service'; import type { MetaService } from '../../../meta/meta.service';
import type Noco from '../../../Noco'; import type Noco from '../../../Noco';
import type { Router } from 'express'; import type { Router } from 'express';
import type { DbConfig, NcConfig } from '../../../interface/config'; import type { DbConfig, NcConfig } from '../../../interface/config';
import type NcProjectBuilder from '../NcProjectBuilder'; import type NcProjectBuilder from '../NcProjectBuilder';
const log = debug('nc:api:rest');
export class RestApiBuilder extends BaseApiBuilder<Noco> { export class RestApiBuilder extends BaseApiBuilder<Noco> {
public readonly type = 'rest'; public readonly type = 'rest';

Loading…
Cancel
Save