Browse Source

refactor: folder structure

pull/2250/head
Naveen MR 3 years ago
parent
commit
4b5bb7d58a
  1. 2
      .run/Clear metadb.run.xml
  2. 28
      packages/nocodb/package.json
  3. 2
      packages/nocodb/src/__tests__/TemplateParser.test.ts
  4. 4
      packages/nocodb/src/__tests__/formula.test.ts
  5. 18
      packages/nocodb/src/__tests__/graphql.test.ts
  6. 26
      packages/nocodb/src/lib/Noco.ts
  7. 0
      packages/nocodb/src/lib/db/sql-data-mapper/README.md
  8. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionClause.test.js
  9. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionGraph.test.js
  10. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.meta.js
  11. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.model.js
  12. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.meta.js
  13. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.model.js
  14. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.meta.js
  15. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.model.js
  16. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/index.js
  17. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/sql.test.js
  18. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/whereClause.test.js
  19. 0
      packages/nocodb/src/lib/db/sql-data-mapper/__tests__/xSelect.test.js
  20. 0
      packages/nocodb/src/lib/db/sql-data-mapper/index.ts
  21. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts
  22. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/DbFactory.ts
  23. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts
  24. 34
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  25. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/CustomKnex.ts
  26. 14
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts
  27. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/customValidators.ts
  28. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulaQueryBuilderFromString.ts
  29. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
  30. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/commonFns.ts
  31. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mssql.ts
  32. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts
  33. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts
  34. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts
  35. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/genRollupSelect.ts
  36. 6
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/genRollupSelectv2.ts
  37. 6
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts
  38. 0
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/mapFunctionName.ts
  39. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts
  40. 0
      packages/nocodb/src/lib/db/sql-mgr/ProjectMgr.ts
  41. 2
      packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts
  42. 0
      packages/nocodb/src/lib/db/sql-mgr/code/BaseRender.ts
  43. 2
      packages/nocodb/src/lib/db/sql-mgr/code/gql-policies/xc-ts/ExpressXcTsPolicyGql.ts
  44. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts
  45. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory.ts
  46. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaMssql.ts
  47. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaMysql.ts
  48. 2
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaOracle.ts
  49. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaPg.ts
  50. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaSqlite.ts
  51. 0
      packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/schemaHelp.ts
  52. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts
  53. 0
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaFactory.ts
  54. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMssql.ts
  55. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMysql.ts
  56. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts
  57. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaPg.ts
  58. 2
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSqlite.ts
  59. 4
      packages/nocodb/src/lib/db/sql-mgr/code/policies/xc/ExpressXcPolicy.ts
  60. 0
      packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerTypes.ts
  61. 2
      packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts
  62. 2
      packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXcBt.ts
  63. 2
      packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXcHm.ts
  64. 2
      packages/nocodb/src/lib/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes.ts
  65. 2
      packages/nocodb/src/lib/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesBt.ts
  66. 2
      packages/nocodb/src/lib/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesHm.ts
  67. 4
      packages/nocodb/src/lib/db/sql-mgr/v2/ProjectMgrv2.ts
  68. 4
      packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2.ts
  69. 6
      packages/nocodb/src/lib/db/sql-mgr/v2/SqlMgrv2Trans.ts
  70. 2
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigrator.ts
  71. 8
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts
  72. 8
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts
  73. 0
      packages/nocodb/src/lib/db/sql-migrator/lib/SqlMigrator.ts
  74. 0
      packages/nocodb/src/lib/db/sql-migrator/lib/SqlMigratorFactory.ts
  75. 0
      packages/nocodb/src/lib/db/sql-migrator/lib/templates/mssql.template.ts
  76. 0
      packages/nocodb/src/lib/db/sql-migrator/lib/templates/mysql.template.ts
  77. 0
      packages/nocodb/src/lib/db/sql-migrator/lib/templates/pg.template.ts
  78. 0
      packages/nocodb/src/lib/db/sql-migrator/lib/templates/sqlite.template.ts
  79. 0
      packages/nocodb/src/lib/db/sql-migrator/tests/sqlmigrator.test.ts
  80. 0
      packages/nocodb/src/lib/db/sql-migrator/util/Debug.ts
  81. 0
      packages/nocodb/src/lib/db/sql-migrator/util/DebugMgr.ts
  82. 0
      packages/nocodb/src/lib/db/sql-migrator/util/FileCollection.ts
  83. 0
      packages/nocodb/src/lib/db/sql-migrator/util/Result.ts
  84. 0
      packages/nocodb/src/lib/db/sql-migrator/util/emit.ts
  85. 0
      packages/nocodb/src/lib/db/sql-migrator/util/file.help.ts
  86. 4
      packages/nocodb/src/lib/index.ts
  87. 4
      packages/nocodb/src/lib/meta/MetaAPILogger.ts
  88. 4
      packages/nocodb/src/lib/meta/NcMetaIO.ts
  89. 12
      packages/nocodb/src/lib/meta/NcMetaIOImpl.ts
  90. 0
      packages/nocodb/src/lib/meta/NcMetaIOImplEE.ts
  91. 38
      packages/nocodb/src/lib/meta/NcMetaMgr.ts
  92. 0
      packages/nocodb/src/lib/meta/NcMetaMgrEE.ts
  93. 10
      packages/nocodb/src/lib/meta/NcMetaMgrv2.ts
  94. 2
      packages/nocodb/src/lib/meta/api/apiTokenApis.ts
  95. 2
      packages/nocodb/src/lib/meta/api/attachmentApis.ts
  96. 4
      packages/nocodb/src/lib/meta/api/auditApis.ts
  97. 2
      packages/nocodb/src/lib/meta/api/cacheApis.ts
  98. 20
      packages/nocodb/src/lib/meta/api/columnApis.ts
  99. 6
      packages/nocodb/src/lib/meta/api/dataApis/bulkDataAliasApis.ts
  100. 10
      packages/nocodb/src/lib/meta/api/dataApis/dataAliasApis.ts
  101. Some files were not shown because too many files have changed in this diff Show More

2
.run/Clear metadb.run.xml

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Drop metadb" type="NodeJSConfigurationType" path-to-js-file="deleteMetaDb.js" working-dir="$PROJECT_DIR$/packages/nocodb/src/example">
<configuration default="false" name="Drop metadb" type="NodeJSConfigurationType" path-to-js-file="$PROJECT_DIR$/packages/nocodb/src/run/deleteMetaDb.js" working-dir="$PROJECT_DIR$/packages/nocodb/src/run">
<method v="2" />
</configuration>
</component>

28
packages/nocodb/package.json

@ -38,11 +38,11 @@
"reset": "git clean -dfx && git reset --hard && npm i",
"clean": "trash build src/test",
"prepare-release": "run-s reset src/test cov:check doc:html version doc:publish",
"start-graphql": "ts-node src/example/index.gql.ts",
"start-rest": "ts-node src/example/index.rest.ts",
"start-grpc": "ts-node src/example/index.grpc.ts",
"start-api": "ts-node src/example/index.ts",
"start-xc-tool-api": "ts-node src/example/xc-tool-apis.ts",
"start-graphql": "ts-node src/run/index.gql.ts",
"start-rest": "ts-node src/run/index.rest.ts",
"start-grpc": "ts-node src/run/index.grpc.ts",
"start-api": "ts-node src/run/index.ts",
"start-xc-tool-api": "ts-node src/run/xc-tool-apis.ts",
"docker-test": "node docker/index.js",
"test:dev:travis": "cross-env NODE_ENV=dev npm run test:rest && NODE_ENV=dev npm run test:graphql && NODE_ENV=dev npm run test:grpc",
"test:travis": "cross-env NODE_ENV=test npm run test:rest && NODE_ENV=test npm run test:graphql && NODE_ENV=test npm run test:grpc",
@ -63,17 +63,17 @@
"docker:s3:build:publish:image": "npm run build && npm run docker:build && npm run docker:s3:image:build && npm run docker:s3:image:deploy",
"docker:oracle:image:build": "docker build . -t xc-instant-oracle -f Dockerfile-ORACLE --no-cache",
"help:a": "node docker/test",
"help:seed": "ts-node ./src/example/seedts.ts",
"help:seed": "ts-node src/run/seedts.ts",
"help:c": "ts-node ./help/a",
"watch:build": "nodemon -e ts,js -w ./src -x npm run build",
"watch:serve": "nodemon -e ts -w ./build -x npm run debug-local ",
"watch:run": "cross-env NC_DISABLE_TELE1=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/docker --log-error --project tsconfig.json\"",
"watch:run:cypress": "cross-env EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/dockerRunMysql --log-error --project tsconfig.json\"",
"watch:run:pg": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/dockerRunPG --log-error --project tsconfig.json\"",
"run": "ts-node src/example/docker",
"watch:try": "nodemon -e ts,js -w ./src -x \"ts-node src/example/try --log-error --project tsconfig.json\"",
"example:docker": "ts-node ./src/example/docker.ts"
"watch:run": "cross-env NC_DISABLE_TELE1=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:cypress": "cross-env EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunMysql --log-error --project tsconfig.json\"",
"watch:run:pg": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG --log-error --project tsconfig.json\"",
"run": "ts-node src/run/docker",
"watch:try": "nodemon -e ts,js -w ./src -x \"ts-node src/run/try --log-error --project tsconfig.json\"",
"example:docker": "ts-node src/run/docker.ts"
},
"scripts-info": {
"info": "Display information about the package scripts",
@ -256,4 +256,4 @@
"**/*.spec.js"
]
}
}
}

2
packages/nocodb/src/__tests__/TemplateParser.test.ts

@ -1,6 +1,6 @@
import { expect } from 'chai';
import 'mocha';
import NcTemplateParser from '../lib/template-parser/NcTemplateParser';
import NcTemplateParser from '../lib/v1-legacy/templates/NcTemplateParser';
import template from './template';
describe('Template parser', () => {

4
packages/nocodb/src/__tests__/formula.test.ts

@ -1,7 +1,7 @@
import { expect } from 'chai';
import 'mocha';
import knex from '../lib/sql-data-mapper/lib/sql/CustomKnex';
import formulaQueryBuilderFromString from '../lib/sql-data-mapper/lib/sql/formulaQueryBuilderFromString';
import knex from '../lib/db/sql-data-mapper/lib/sql/CustomKnex';
import formulaQueryBuilderFromString from '../lib/db/sql-data-mapper/lib/sql/formulaQueryBuilderFromString';
process.env.TEST = 'test';

18
packages/nocodb/src/__tests__/graphql.test.ts

@ -84,7 +84,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Signup with valid email', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ SignUp(data : { email: "${EMAIL_ID}", password: "${VALID_PASSWORD}"}){ token }}`
// })
@ -104,7 +104,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Signup with invalid email', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ SignUp(data : { email: "test", password: "${VALID_PASSWORD}"}){ token }}`
// })
@ -120,7 +120,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Signin with valid email', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ SignIn(data : { email: "${EMAIL_ID}", password: "${VALID_PASSWORD}"}){ token }}`
// })
@ -140,7 +140,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('me', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .set({'xc-auth': token})
// .send({
// query: `{ Me{ email id }}`
@ -159,7 +159,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Signin with invalid email', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ SignIn(data : { email: "abc@abcc.com", password: "randomPassord"}){ token }}`
// })
@ -175,7 +175,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Forgot password with a non-existing email id', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ PasswordForgot(email: "abc@abcc.com")}`
// })
@ -190,7 +190,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Forgot password with an existing email id', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ PasswordForgot(email: "${EMAIL_ID}")}`
// })
@ -204,7 +204,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Email validate with an invalid token', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ EmailValidate(tokenId: "invalid-token-id")}`
// })
@ -218,7 +218,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
//
// it('Reset Password with an invalid token', function (done) {
// request(app)
// .post('/v1/graphql')
// .post('/v1-legacy/graphql')
// .send({
// query: `mutation{ PasswordReset(password:"somePassword",tokenId: "invalid-token-id")}`
// })

26
packages/nocodb/src/lib/noco/Noco.ts → packages/nocodb/src/lib/Noco.ts

@ -15,32 +15,32 @@ import NcToolGui from 'nc-lib-gui';
import requestIp from 'request-ip';
import { v4 as uuidv4 } from 'uuid';
import { NcConfig } from '../../interface/config';
import Migrator from '../sql-migrator/lib/KnexMigrator';
import NcConfigFactory from '../utils/NcConfigFactory';
import { NcConfig } from '../interface/config';
import Migrator from './db/sql-migrator/lib/KnexMigrator';
import NcConfigFactory from './utils/NcConfigFactory';
import NcProjectBuilderCE from './NcProjectBuilder';
import NcProjectBuilderEE from './NcProjectBuilderEE';
import { GqlApiBuilder } from './gql/GqlApiBuilder';
import NcProjectBuilderCE from './v1-legacy/NcProjectBuilder';
import NcProjectBuilderEE from './v1-legacy/NcProjectBuilderEE';
import { GqlApiBuilder } from './v1-legacy/gql/GqlApiBuilder';
import NcMetaIO from './meta/NcMetaIO';
import NcMetaImplCE from './meta/NcMetaIOImpl';
import NcMetaImplEE from './meta/NcMetaIOImplEE';
import NcMetaMgrCE from './meta/NcMetaMgr';
import NcMetaMgrEE from './meta/NcMetaMgrEE';
import { RestApiBuilder } from './rest/RestApiBuilder';
import RestAuthCtrlCE from './rest/RestAuthCtrl';
import RestAuthCtrlEE from './rest/RestAuthCtrlEE';
import { RestApiBuilder } from './v1-legacy/rest/RestApiBuilder';
import RestAuthCtrlCE from './v1-legacy/rest/RestAuthCtrl';
import RestAuthCtrlEE from './v1-legacy/rest/RestAuthCtrlEE';
import mkdirp from 'mkdirp';
import MetaAPILogger from './meta/MetaAPILogger';
import NcUpgrader from './upgrader/NcUpgrader';
import NcUpgrader from './version-upgrader/NcUpgrader';
import NcMetaMgrv2 from './meta/NcMetaMgrv2';
import NocoCache from '../cache/NocoCache';
import NocoCache from './cache/NocoCache';
import registerMetaApis from './meta/api';
import NcPluginMgrv2 from './meta/helpers/NcPluginMgrv2';
import User from '../models/User';
import User from './models/User';
import { Tele } from 'nc-help';
import * as http from 'http';
import weAreHiring from '../utils/weAreHiring';
import weAreHiring from './utils/weAreHiring';
const log = debug('nc:app');
require('dotenv').config();

0
packages/nocodb/src/lib/sql-data-mapper/README.md → packages/nocodb/src/lib/db/sql-data-mapper/README.md

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/conditionClause.test.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionClause.test.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/conditionGraph.test.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionGraph.test.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/city.meta.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.meta.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/city.model.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.model.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/country.meta.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.meta.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/country.model.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.model.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/film.meta.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.meta.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/film.model.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.model.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/models/index.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/index.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/sql.test.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/sql.test.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/whereClause.test.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/whereClause.test.js

0
packages/nocodb/src/lib/sql-data-mapper/__tests__/xSelect.test.js → packages/nocodb/src/lib/db/sql-data-mapper/__tests__/xSelect.test.js

0
packages/nocodb/src/lib/sql-data-mapper/index.ts → packages/nocodb/src/lib/db/sql-data-mapper/index.ts

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

@ -838,13 +838,13 @@ abstract class BaseModel {
* @param {String} [args.max] - maximum value
* @param {String} [args.step] - step value
* @returns {Promise<object[]>} Distributions of column values in table
* @example
* @run
* table.distribution({
* cn : 'price',
* steps: '0,100,200,300,400',
* func: 'sum,avg'
* })
* @example
* @run
* table.distribution({
* cn : 'price',
* min: '0',

0
packages/nocodb/src/lib/sql-data-mapper/lib/DbFactory.ts → packages/nocodb/src/lib/db/sql-data-mapper/lib/DbFactory.ts

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

@ -1118,13 +1118,13 @@ class BaseModelSql extends BaseModel {
* @param {String} [args.max] - maximum value
* @param {String} [args.step] - step value
* @returns {Promise<Object[]>} Distributions of column values in table
* @example
* @run
* table.distribution({
* cn : 'price',
* steps: '0,100,200,300,400',
* func: 'sum,avg'
* })
* @example
* @run
* table.distribution({
* cn : 'price',
* min: '0',

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

@ -1,23 +1,23 @@
import autoBind from 'auto-bind';
import _ from 'lodash';
import Model from '../../../models/Model';
import { XKnex } from '../..';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import RollupColumn from '../../../models/RollupColumn';
import LookupColumn from '../../../models/LookupColumn';
import Model from '../../../../models/Model';
import { XKnex } from '../../index';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import RollupColumn from '../../../../models/RollupColumn';
import LookupColumn from '../../../../models/LookupColumn';
import DataLoader from 'dataloader';
import Column from '../../../models/Column';
import Column from '../../../../models/Column';
import { XcFilter, XcFilterWithAlias } from '../BaseModel';
import conditionV2 from './conditionV2';
import Filter from '../../../models/Filter';
import Filter from '../../../../models/Filter';
import sortV2 from './sortV2';
import Sort from '../../../models/Sort';
import FormulaColumn from '../../../models/FormulaColumn';
import Sort from '../../../../models/Sort';
import FormulaColumn from '../../../../models/FormulaColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import { QueryBuilder } from 'knex';
import View from '../../../models/View';
import View from '../../../../models/View';
import {
AuditOperationSubTypes,
AuditOperationTypes,
@ -26,20 +26,20 @@ import {
UITypes,
ViewTypes
} from 'nocodb-sdk';
import formSubmissionEmailTemplate from '../../../noco/common/formSubmissionEmailTemplate';
import formSubmissionEmailTemplate from '../../../../utils/common/formSubmissionEmailTemplate';
import ejs from 'ejs';
import Audit from '../../../models/Audit';
import FormView from '../../../models/FormView';
import Hook from '../../../models/Hook';
import NcPluginMgrv2 from '../../../noco/meta/helpers/NcPluginMgrv2';
import Audit from '../../../../models/Audit';
import FormView from '../../../../models/FormView';
import Hook from '../../../../models/Hook';
import NcPluginMgrv2 from '../../../../meta/helpers/NcPluginMgrv2';
import {
_transformSubmittedFormDataForEmail,
invokeWebhook,
parseBody
} from '../../../noco/meta/helpers/webhookHelpers';
} from '../../../../meta/helpers/webhookHelpers';
import Validator from 'validator';
import { customValidators } from './customValidators';
import { NcError } from '../../../noco/meta/helpers/catchError';
import { NcError } from '../../../../meta/helpers/catchError';
import { customAlphabet } from 'nanoid';
const GROUP_COL = '__nc_group_id';

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

@ -5,7 +5,7 @@ const types = require('pg').types;
types.setTypeParser(1082, val => val);
import { BaseModelSql } from './BaseModelSql';
import Filter from '../../../models/Filter';
import Filter from '../../../../models/Filter';
const opMappingGen = {
eq: '=',

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

@ -1,13 +1,13 @@
import Filter from '../../../models/Filter';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import Filter from '../../../../models/Filter';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import { QueryBuilder } from 'knex';
import { XKnex } from '../..';
import Column from '../../../models/Column';
import LookupColumn from '../../../models/LookupColumn';
import { XKnex } from '../../index';
import Column from '../../../../models/Column';
import LookupColumn from '../../../../models/LookupColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import RollupColumn from '../../../models/RollupColumn';
import RollupColumn from '../../../../models/RollupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import FormulaColumn from '../../../models/FormulaColumn';
import FormulaColumn from '../../../../models/FormulaColumn';
import { RelationTypes, UITypes } from 'nocodb-sdk';
// import LookupColumn from '../../../models/LookupColumn';

0
packages/nocodb/src/lib/sql-data-mapper/lib/sql/customValidators.ts → packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/customValidators.ts

0
packages/nocodb/src/lib/sql-data-mapper/lib/sql/formulaQueryBuilderFromString.ts → packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulaQueryBuilderFromString.ts

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

@ -1,12 +1,12 @@
import jsep from 'jsep';
import mapFunctionName from '../mapFunctionName';
import Model from '../../../../models/Model';
import Model from '../../../../../models/Model';
import genRollupSelectv2 from '../genRollupSelectv2';
import RollupColumn from '../../../../models/RollupColumn';
import FormulaColumn from '../../../../models/FormulaColumn';
import { XKnex } from '../../..';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import LookupColumn from '../../../../models/LookupColumn';
import RollupColumn from '../../../../../models/RollupColumn';
import FormulaColumn from '../../../../../models/FormulaColumn';
import { XKnex } from '../../../index';
import LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
import LookupColumn from '../../../../../models/LookupColumn';
import { jsepCurlyHook, UITypes } from 'nocodb-sdk';
// todo: switch function based on database

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

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

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

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

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

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

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

@ -1,6 +1,6 @@
import RollupColumn from '../../../models/RollupColumn';
import { XKnex } from '../..';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import RollupColumn from '../../../../models/RollupColumn';
import { XKnex } from '../../index';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import { QueryBuilder } from 'knex';
import { RelationTypes } from 'nocodb-sdk';

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

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

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

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

@ -1,12 +1,12 @@
import { QueryBuilder } from 'knex';
import { XKnex } from '../..';
import Sort from '../../../models/Sort';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import { XKnex } from '../../index';
import Sort from '../../../../models/Sort';
import LinkToAnotherRecordColumn from '../../../../models/LinkToAnotherRecordColumn';
import genRollupSelectv2 from './genRollupSelectv2';
import RollupColumn from '../../../models/RollupColumn';
import LookupColumn from '../../../models/LookupColumn';
import RollupColumn from '../../../../models/RollupColumn';
import LookupColumn from '../../../../models/LookupColumn';
import formulaQueryBuilderv2 from './formulav2/formulaQueryBuilderv2';
import FormulaColumn from '../../../models/FormulaColumn';
import FormulaColumn from '../../../../models/FormulaColumn';
import { RelationTypes, UITypes } from 'nocodb-sdk';
export default async function sortV2(

0
packages/nocodb/src/lib/sql-mgr/ProjectMgr.ts → packages/nocodb/src/lib/db/sql-mgr/ProjectMgr.ts

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

@ -13,7 +13,7 @@ import slash from 'slash';
const log = new Debug('SqlMgr');
import KnexMigrator from '../sql-migrator/lib/KnexMigrator';
// import {XKnex} from "../sql-data-mapper";
import NcConnectionMgr from '../noco/common/NcConnectionMgr';
import NcConnectionMgr from '../../utils/common/NcConnectionMgr';
import { customAlphabet } from 'nanoid';
const randomID = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 20);

0
packages/nocodb/src/lib/sql-mgr/code/BaseRender.ts → packages/nocodb/src/lib/db/sql-mgr/code/BaseRender.ts

2
packages/nocodb/src/lib/sql-mgr/code/gql-policies/xc-ts/ExpressXcTsPolicyGql.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-policies/xc-ts/ExpressXcTsPolicyGql.ts

@ -20,7 +20,7 @@ class ExpressXcPolicyGql extends BaseRender {
prepare(): any {
let data = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
return data;

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/BaseGqlXcTsSchema.ts

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory.ts

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaMssql.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaMssql.ts

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaMysql.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaMysql.ts

2
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaOracle.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaOracle.ts

@ -21,7 +21,7 @@ class GqlXcSchemaOracle extends BaseGqlXcTsSchema {
const data:any = {};
/!* example of simple variable *!/
/!* run of simple variable *!/
data.tn = this.ctx.tn_camelize;
data.columns = {

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaPg.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaPg.ts

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaSqlite.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/GqlXcTsSchemaSqlite.ts

0
packages/nocodb/src/lib/sql-mgr/code/gql-schema/xc-ts/schemaHelp.ts → packages/nocodb/src/lib/db/sql-mgr/code/gql-schema/xc-ts/schemaHelp.ts

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

@ -1,5 +1,5 @@
import BaseRender from '../../BaseRender';
import mapDefaultPrimaryValue from '../../../../noco/meta/helpers/mapDefaultPrimaryValue';
import mapDefaultPrimaryValue from '../../../../../meta/helpers/mapDefaultPrimaryValue';
import { UITypes } from 'nocodb-sdk';
abstract class BaseModelXcMeta extends BaseRender {

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

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

@ -19,7 +19,7 @@ class ModelXcMetaMssql extends BaseModelXcMeta {
prepare() {
const data: any = {};
/* example of simple variable */
/* run of simple variable */
data.tn = this.ctx.tn;
data.dbType = this.ctx.dbType;

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

@ -19,7 +19,7 @@ class ModelXcMetaMysql extends BaseModelXcMeta {
prepare() {
const data: any = {};
/* example of simple variable */
/* run of simple variable */
data.tn = this.ctx.tn;
data.dbType = this.ctx.dbType;

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

@ -19,7 +19,7 @@ class ModelXcMetaOracle extends BaseModelXcMeta {
prepare() {
const data: any = {};
/* example of simple variable */
/* run of simple variable */
data.tn = this.ctx.tn;
data.dbType = this.ctx.dbType;

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

@ -19,7 +19,7 @@ class ModelXcMetaPg extends BaseModelXcMeta {
prepare() {
const data: any = {};
/* example of simple variable */
/* run of simple variable */
data.tn = this.ctx.tn;
data.dbType = this.ctx.dbType;

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

@ -19,7 +19,7 @@ class ModelXcMetaSqlite extends BaseModelXcMeta {
prepare() {
const data: any = {};
/* example of simple variable */
/* run of simple variable */
data.tn = this.ctx.tn;
data.dbType = this.ctx.dbType;

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

@ -1,6 +1,6 @@
import lodash from 'lodash';
import { Acl } from '../../../../../interface/config';
import { Acl } from '../../../../../../interface/config';
import BaseRender from '../../BaseRender';
class ExpressXcMiddleware extends BaseRender {
@ -23,7 +23,7 @@ class ExpressXcMiddleware extends BaseRender {
prepare() {
let data: any = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
/* for complex code provide a func and args - do derivation within the func cbk */

0
packages/nocodb/src/lib/sql-mgr/code/routers/xc-ts/SwaggerTypes.ts → packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerTypes.ts

2
packages/nocodb/src/lib/sql-mgr/code/routers/xc-ts/SwaggerXc.ts → packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXc.ts

@ -22,7 +22,7 @@ class SwaggerXc extends BaseRender {
prepare() {
let data: any = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
data.paths = {};

2
packages/nocodb/src/lib/sql-mgr/code/routers/xc-ts/SwaggerXcBt.ts → packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXcBt.ts

@ -20,7 +20,7 @@ class SwaggerXcBt extends BaseRender {
prepare() {
let data: any = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
data.definitions = {

2
packages/nocodb/src/lib/sql-mgr/code/routers/xc-ts/SwaggerXcHm.ts → packages/nocodb/src/lib/db/sql-mgr/code/routers/xc-ts/SwaggerXcHm.ts

@ -20,7 +20,7 @@ class SwaggerXcHm extends BaseRender {
prepare() {
let data: any = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
data.definitions = {

2
packages/nocodb/src/lib/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes.ts → packages/nocodb/src/lib/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes.ts

@ -20,7 +20,7 @@ class ExpressXcTsRoutes extends BaseRender {
prepare() {
let data: any = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
return data;

2
packages/nocodb/src/lib/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesBt.ts → packages/nocodb/src/lib/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesBt.ts

@ -20,7 +20,7 @@ class ExpressXcTsRoutesBt extends BaseRender {
prepare() {
let data: any = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
return data;

2
packages/nocodb/src/lib/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesHm.ts → packages/nocodb/src/lib/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesHm.ts

@ -20,7 +20,7 @@ class ExpressXcTsRoutesHm extends BaseRender {
public prepare(): any {
let data = {};
/* example of simple variable */
/* run of simple variable */
data = this.ctx;
return data;

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

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

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

@ -4,9 +4,9 @@ import { Debug, SqlClientFactory } from 'nc-help';
const log = new Debug('SqlMgr');
// import {XKnex} from "../sql-data-mapper";
import NcConnectionMgrv2 from '../../noco/common/NcConnectionMgrv2';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import KnexMigratorv2 from '../../sql-migrator/lib/KnexMigratorv2';
import Base from '../../models/Base';
import Base from '../../../models/Base';
export default class SqlMgrv2 {
protected _migrator: KnexMigratorv2;

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

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

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

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

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

@ -13,11 +13,11 @@ import * as fileHelp from '../util/file.help';
// import SqlMigrator from './SqlMigrator';
// import NcConfigFactory from '../../../utils/NcConfigFactory';
import Noco from '../../noco/Noco';
import Noco from '../../../Noco';
import { XKnex } from '../../sql-data-mapper';
import Project from '../../models/Project';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../noco/common/NcConnectionMgrv2';
import Project from '../../../models/Project';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
const evt = new Emit();
const log = new Debug('KnexMigrator');

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

@ -5,11 +5,11 @@
* @extends {SqlMigrator}
*/
import KnexMigratorv2 from './KnexMigratorv2';
import Base from '../../models/Base';
import NcConnectionMgrv2 from '../../noco/common/NcConnectionMgrv2';
import Noco from '../../noco/Noco';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import Noco from '../../../Noco';
import { XKnex } from '../../sql-data-mapper';
import NcMetaIO from '../../noco/meta/NcMetaIO';
import NcMetaIO from '../../../meta/NcMetaIO';
export default class KnexMigratorv2Tans extends KnexMigratorv2 {
protected sqlClient: any;

0
packages/nocodb/src/lib/sql-migrator/lib/SqlMigrator.ts → packages/nocodb/src/lib/db/sql-migrator/lib/SqlMigrator.ts

0
packages/nocodb/src/lib/sql-migrator/lib/SqlMigratorFactory.ts → packages/nocodb/src/lib/db/sql-migrator/lib/SqlMigratorFactory.ts

0
packages/nocodb/src/lib/sql-migrator/lib/templates/mssql.template.ts → packages/nocodb/src/lib/db/sql-migrator/lib/templates/mssql.template.ts

0
packages/nocodb/src/lib/sql-migrator/lib/templates/mysql.template.ts → packages/nocodb/src/lib/db/sql-migrator/lib/templates/mysql.template.ts

0
packages/nocodb/src/lib/sql-migrator/lib/templates/pg.template.ts → packages/nocodb/src/lib/db/sql-migrator/lib/templates/pg.template.ts

0
packages/nocodb/src/lib/sql-migrator/lib/templates/sqlite.template.ts → packages/nocodb/src/lib/db/sql-migrator/lib/templates/sqlite.template.ts

0
packages/nocodb/src/lib/sql-migrator/tests/sqlmigrator.test.ts → packages/nocodb/src/lib/db/sql-migrator/tests/sqlmigrator.test.ts

0
packages/nocodb/src/lib/sql-migrator/util/Debug.ts → packages/nocodb/src/lib/db/sql-migrator/util/Debug.ts

0
packages/nocodb/src/lib/sql-migrator/util/DebugMgr.ts → packages/nocodb/src/lib/db/sql-migrator/util/DebugMgr.ts

0
packages/nocodb/src/lib/sql-migrator/util/FileCollection.ts → packages/nocodb/src/lib/db/sql-migrator/util/FileCollection.ts

0
packages/nocodb/src/lib/sql-migrator/util/Result.ts → packages/nocodb/src/lib/db/sql-migrator/util/Result.ts

0
packages/nocodb/src/lib/sql-migrator/util/emit.ts → packages/nocodb/src/lib/db/sql-migrator/util/emit.ts

0
packages/nocodb/src/lib/sql-migrator/util/file.help.ts → packages/nocodb/src/lib/db/sql-migrator/util/file.help.ts

4
packages/nocodb/src/lib/index.ts

@ -1,5 +1,5 @@
import Noco from './noco/Noco';
import XcTry from './noco/nc.try';
import Noco from './Noco';
import XcTry from './v1-legacy/nc.try';
import NcConfigFactory from './utils/NcConfigFactory';
export default Noco;

4
packages/nocodb/src/lib/noco/meta/MetaAPILogger.ts → packages/nocodb/src/lib/meta/MetaAPILogger.ts

@ -1,4 +1,4 @@
import { XKnex } from '../../sql-data-mapper';
import { XKnex } from '../db/sql-data-mapper';
import { Request } from 'express';
export default class MetaAPILogger {
@ -74,7 +74,7 @@ class XcLoggerMigrationSource {
// Migrations can be whatever you want, they will be passed as
// arguments to getMigrationName and getMigration
public getMigrations(): Promise<any> {
// In this example we are just returning migration names
// In this run we are just returning migration names
return Promise.resolve(['logger']);
}

4
packages/nocodb/src/lib/noco/meta/NcMetaIO.ts → packages/nocodb/src/lib/meta/NcMetaIO.ts

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

12
packages/nocodb/src/lib/noco/meta/NcMetaIOImpl.ts → packages/nocodb/src/lib/meta/NcMetaIOImpl.ts

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

0
packages/nocodb/src/lib/noco/meta/NcMetaIOImplEE.ts → packages/nocodb/src/lib/meta/NcMetaIOImplEE.ts

38
packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts → packages/nocodb/src/lib/meta/NcMetaMgr.ts

@ -16,28 +16,28 @@ import slash from 'slash';
import { v4 as uuidv4 } from 'uuid';
import { ncp } from 'ncp';
import IEmailAdapter from '../../../interface/IEmailAdapter';
import IStorageAdapter from '../../../interface/IStorageAdapter';
import { NcConfig, Result } from '../../../interface/config';
import { NcConfigFactory } from '../../index';
import ProjectMgr from '../../sql-mgr/ProjectMgr';
import ExpressXcTsRoutes from '../../sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes';
import ExpressXcTsRoutesBt from '../../sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesBt';
import ExpressXcTsRoutesHm from '../../sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesHm';
import NcHelp from '../../utils/NcHelp';
import mimetypes, { mimeIcons } from '../../utils/mimeTypes';
import projectAcl from '../../utils/projectAcl';
import IEmailAdapter from '../../interface/IEmailAdapter';
import IStorageAdapter from '../../interface/IStorageAdapter';
import { NcConfig, Result } from '../../interface/config';
import { NcConfigFactory } from '../index';
import ProjectMgr from '../db/sql-mgr/ProjectMgr';
import ExpressXcTsRoutes from '../db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes';
import ExpressXcTsRoutesBt from '../db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesBt';
import ExpressXcTsRoutesHm from '../db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutesHm';
import NcHelp from '../utils/NcHelp';
import mimetypes, { mimeIcons } from '../utils/mimeTypes';
import projectAcl from '../utils/projectAcl';
import Noco from '../Noco';
import { GqlApiBuilder } from '../gql/GqlApiBuilder';
import NcPluginMgr from '../plugins/NcPluginMgr';
import XcCache from '../plugins/adapters/cache/XcCache';
import { RestApiBuilder } from '../rest/RestApiBuilder';
import RestAuthCtrl from '../rest/RestAuthCtrlEE';
import { GqlApiBuilder } from '../v1-legacy/gql/GqlApiBuilder';
import NcPluginMgr from '../v1-legacy/plugins/NcPluginMgr';
import XcCache from '../v1-legacy/plugins/adapters/cache/XcCache';
import { RestApiBuilder } from '../v1-legacy/rest/RestApiBuilder';
import RestAuthCtrl from '../v1-legacy/rest/RestAuthCtrlEE';
import { packageVersion } from 'nc-help';
import NcMetaIO, { META_TABLES } from './NcMetaIO';
import { promisify } from 'util';
import NcTemplateParser from '../../template-parser/NcTemplateParser';
import { defaultConnectionConfig } from '../../utils/NcConfigFactory';
import NcTemplateParser from '../v1-legacy/templates/NcTemplateParser';
import { defaultConnectionConfig } from '../utils/NcConfigFactory';
import xcMetaDiff from './handlers/xcMetaDiff';
import { UITypes } from 'nocodb-sdk';
const randomID = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 10);
@ -5067,7 +5067,7 @@ export default class NcMetaMgr {
// @ts-ignore
protected xcVersionLetters(args) {
// const _vesions ={db:'v1'};
// const _vesions ={db:'v1-legacy'};
// for(const {meta: {_dbAlias}} of this.projectConfigs[args.project_id].envs[args.env].db) {
//
// }

0
packages/nocodb/src/lib/noco/meta/NcMetaMgrEE.ts → packages/nocodb/src/lib/meta/NcMetaMgrEE.ts

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

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

2
packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts → packages/nocodb/src/lib/meta/api/apiTokenApis.ts

@ -1,6 +1,6 @@
import { Request, Response, Router } from 'express';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import ApiToken from '../../../models/ApiToken';
import ApiToken from '../../models/ApiToken';
import { Tele } from 'nc-help';
import { metaApiMetrics } from '../helpers/apiMetrics';

2
packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts → packages/nocodb/src/lib/meta/api/attachmentApis.ts

@ -5,7 +5,7 @@ import { nanoid } from 'nanoid';
import { Tele } from 'nc-help';
import path from 'path';
import slash from 'slash';
import mimetypes, { mimeIcons } from '../../../utils/mimeTypes';
import mimetypes, { mimeIcons } from '../../utils/mimeTypes';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import catchError from '../helpers/catchError';
import NcPluginMgrv2 from '../helpers/NcPluginMgrv2';

4
packages/nocodb/src/lib/noco/meta/api/auditApis.ts → packages/nocodb/src/lib/meta/api/auditApis.ts

@ -1,7 +1,7 @@
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 Model from '../../models/Model';
import { PagedResponseImpl } from '../helpers/PagedResponse';
import ncMetaAclMw from '../helpers/ncMetaAclMw';

2
packages/nocodb/src/lib/noco/meta/api/cacheApis.ts → packages/nocodb/src/lib/meta/api/cacheApis.ts

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

20
packages/nocodb/src/lib/noco/meta/api/columnApis.ts → packages/nocodb/src/lib/meta/api/columnApis.ts

@ -1,13 +1,13 @@
import { Request, Response, Router } from 'express';
import Model from '../../../models/Model';
import ProjectMgrv2 from '../../../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 validateParams from '../helpers/validateParams';
import { Tele } from 'nc-help';
import { customAlphabet } from 'nanoid';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import {
getUniqueColumnAliasName,
getUniqueColumnName
@ -23,18 +23,18 @@ import {
TableType,
UITypes
} from 'nocodb-sdk';
import Audit from '../../../models/Audit';
import SqlMgrv2 from '../../../sql-mgr/v2/SqlMgrv2';
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 mapDefaultPrimaryValue from '../helpers/mapDefaultPrimaryValue';
import NcConnectionMgrv2 from '../../common/NcConnectionMgrv2';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { metaApiMetrics } from '../helpers/apiMetrics';
import FormulaColumn from '../../../models/FormulaColumn';
import { MetaTable } from '../../../utils/globals';
import FormulaColumn from '../../models/FormulaColumn';
import { MetaTable } from '../../utils/globals';
const randomID = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz_', 10);

6
packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts → packages/nocodb/src/lib/meta/api/dataApis/bulkDataAliasApis.ts

@ -1,7 +1,7 @@
import { Request, Response, Router } from 'express';
import Model from '../../../../models/Model';
import Base from '../../../../models/Base';
import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2';
import Model from '../../../models/Model';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import apiMetrics from '../../helpers/apiMetrics';

10
packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts → packages/nocodb/src/lib/meta/api/dataApis/dataAliasApis.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 '../../../common/NcConnectionMgrv2';
import Base from '../../../models/Base';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../helpers/PagedResponse';
import View from '../../../../models/View';
import View from '../../../models/View';
import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import apiMetrics from '../../helpers/apiMetrics';
import getAst from '../../../../sql-data-mapper/lib/sql/helpers/getAst';
import getAst from '../../../db/sql-data-mapper/lib/sql/helpers/getAst';
async function dataList(req: Request, res: Response) {
const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);

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

Loading…
Cancel
Save