diff --git a/.run/Clear metadb.run.xml b/.run/Clear metadb.run.xml
index 2fc4fdd987..b86ac7542d 100644
--- a/.run/Clear metadb.run.xml
+++ b/.run/Clear metadb.run.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json
index ba8853b406..452e11d057 100644
--- a/packages/nocodb/package.json
+++ b/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"
]
}
-}
\ No newline at end of file
+}
diff --git a/packages/nocodb/src/__tests__/TemplateParser.test.ts b/packages/nocodb/src/__tests__/TemplateParser.test.ts
index 8f932bcedb..6332f4cdee 100644
--- a/packages/nocodb/src/__tests__/TemplateParser.test.ts
+++ b/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', () => {
diff --git a/packages/nocodb/src/__tests__/formula.test.ts b/packages/nocodb/src/__tests__/formula.test.ts
index ba78bfd62c..41a677f9e4 100644
--- a/packages/nocodb/src/__tests__/formula.test.ts
+++ b/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';
diff --git a/packages/nocodb/src/__tests__/graphql.test.ts b/packages/nocodb/src/__tests__/graphql.test.ts
index 291ed5f43b..76a2833683 100644
--- a/packages/nocodb/src/__tests__/graphql.test.ts
+++ b/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")}`
// })
diff --git a/packages/nocodb/src/lib/noco/Noco.ts b/packages/nocodb/src/lib/Noco.ts
similarity index 95%
rename from packages/nocodb/src/lib/noco/Noco.ts
rename to packages/nocodb/src/lib/Noco.ts
index 241a97d732..7b3df6ef5b 100644
--- a/packages/nocodb/src/lib/noco/Noco.ts
+++ b/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();
diff --git a/packages/nocodb/src/lib/sql-data-mapper/README.md b/packages/nocodb/src/lib/db/sql-data-mapper/README.md
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/README.md
rename to packages/nocodb/src/lib/db/sql-data-mapper/README.md
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/conditionClause.test.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionClause.test.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/conditionClause.test.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionClause.test.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/conditionGraph.test.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionGraph.test.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/conditionGraph.test.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/conditionGraph.test.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/city.meta.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.meta.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/city.meta.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.meta.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/city.model.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.model.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/city.model.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/city.model.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/country.meta.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.meta.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/country.meta.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.meta.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/country.model.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.model.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/country.model.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/country.model.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/film.meta.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.meta.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/film.meta.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.meta.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/film.model.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.model.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/film.model.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/film.model.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/models/index.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/index.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/models/index.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/models/index.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/sql.test.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/sql.test.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/sql.test.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/sql.test.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/whereClause.test.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/whereClause.test.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/whereClause.test.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/whereClause.test.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/__tests__/xSelect.test.js b/packages/nocodb/src/lib/db/sql-data-mapper/__tests__/xSelect.test.js
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/__tests__/xSelect.test.js
rename to packages/nocodb/src/lib/db/sql-data-mapper/__tests__/xSelect.test.js
diff --git a/packages/nocodb/src/lib/sql-data-mapper/index.ts b/packages/nocodb/src/lib/db/sql-data-mapper/index.ts
similarity index 100%
rename from packages/nocodb/src/lib/sql-data-mapper/index.ts
rename to packages/nocodb/src/lib/db/sql-data-mapper/index.ts
diff --git a/packages/nocodb/src/lib/sql-data-mapper/lib/BaseModel.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts
similarity index 99%
rename from packages/nocodb/src/lib/sql-data-mapper/lib/BaseModel.ts
rename to packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts
index 047a4aeb82..dd9ac2c4a1 100644
--- a/packages/nocodb/src/lib/sql-data-mapper/lib/BaseModel.ts
+++ b/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