Skip to content

Commit 7722462

Browse files
authored
Merge pull request #1466 from rocket-admin/backend_agent_refactoring
Backend agent refactoring
2 parents c2bdb32 + 350a9c5 commit 7722462

File tree

16 files changed

+1249
-690
lines changed

16 files changed

+1249
-690
lines changed

Dockerfile.rocketadmin-agent

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ COPY rocketadmin-agent /app/rocketadmin-agent
1111
COPY .yarn /app/.yarn
1212
RUN yarn install --network-timeout 1000000
1313
RUN cd shared-code && ../node_modules/.bin/tsc
14-
RUN cd rocketadmin-agent && yarn run nest build
14+
RUN cd rocketadmin-agent && yarn run build
1515

1616
RUN chown -R appuser:appuser /app
1717

backend/src/shared/config/config.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ConfigService {
9999
migrationsRun: false,
100100
logging: false,
101101
extra: {
102-
max: 2,
102+
max: 10,
103103
},
104104
logger: 'advanced-console',
105105
driver: pgLiteDriver ? pgLiteDriver : undefined,

backend/test/ava-tests/saas-tests/connection-e2e.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ test(`${currentTest} should return a found connection`, async (t) => {
320320
.set('Cookie', token)
321321
.set('Accept', 'application/json');
322322

323+
const foundOneRo = JSON.parse(findOneResponce.text);
324+
console.log('🚀 ~ foundOneRo:', foundOneRo);
323325
t.is(findOneResponce.status, 200);
324326
const result = findOneResponce.body.connection;
325327

@@ -1271,6 +1273,7 @@ test(`${currentTest} throw an exception when group name is not unique`, async (t
12711273
.set('Accept', 'application/json');
12721274

12731275
const createConnectionRO = JSON.parse(createConnectionResponse.text);
1276+
t.is(createConnectionResponse.status, 201);
12741277
newGroup1.title = 'Admin';
12751278
const createGroupResponse = await request(app.getHttpServer())
12761279
.post(`/connection/group/${createConnectionRO.id}`)

backend/test/utils/register-user-and-return-user-info.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export async function registerUserAndReturnUserInfo(app: INestApplication): Prom
1919
email: string;
2020
password: string;
2121
}> {
22+
if (isSaaS()) {
23+
return await registerUserOnSaasAndReturnUserInfo();
24+
}
2225
const dataSource = app.get<DataSource>(BaseType.DATA_SOURCE);
2326
const userRepository = dataSource.getRepository(UserEntity);
2427
const companyRepository = dataSource.getRepository(CompanyInfoEntity);

rocketadmin-agent/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ COPY ./rocketadmin-agent/.clickhouse_test_agent_config.txt /app/rocketadmin-agen
2323
COPY shared-code /app/shared-code
2424
COPY ./rocketadmin-agent/ssl-cert.txt /app/rocketadmin-agent/
2525
RUN cd shared-code && ../node_modules/.bin/tsc
26-
RUN cd rocketadmin-agent && yarn run nest build
26+
RUN cd rocketadmin-agent && yarn run build
2727
COPY ./rocketadmin-agent/wait-for-db2.js /app/
28-
CMD [ "./node_modules/.bin/nest", "start"]
28+
CMD [ "node", "rocketadmin-agent/dist/main.js"]

rocketadmin-agent/package.json

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "rocketadmin-agent",
33
"version": "0.0.1",
4-
"description": "",
5-
"author": "",
4+
"description": "RocketAdmin Agent - Connect your database to RocketAdmin through a secure agent",
5+
"author": "RocketAdmin",
66
"private": true,
77
"license": "UNLICENSED",
88
"type": "module",
9+
"bin": "./dist/main.js",
910
"packageExtensions": {
1011
"ibm_db": {
1112
"dependencies": {
@@ -15,12 +16,12 @@
1516
},
1617
"scripts": {
1718
"prebuild": "rimraf dist",
18-
"build": "nest build",
19+
"build": "tsc -p tsconfig.build.json",
1920
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
20-
"start": "nest start",
21-
"start:dev": "nest start --watch",
22-
"start:debug": "nest start --debug --watch",
23-
"start:prod": "node dist/main",
21+
"start": "node dist/main.js",
22+
"start:dev": "tsc -p tsconfig.build.json && node dist/main.js",
23+
"start:debug": "node --inspect dist/main.js",
24+
"start:prod": "node dist/main.js",
2425
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
2526
"test": "jest --runInBand",
2627
"test:watch": "jest --watch",
@@ -30,44 +31,38 @@
3031
},
3132
"dependencies": {
3233
"@azure/core-tracing": "^1.3.1",
33-
"@nestjs/common": "^11.1.8",
34-
"@nestjs/config": "^4.0.2",
35-
"@nestjs/core": "^11.1.8",
36-
"@nestjs/platform-express": "^11.1.8",
37-
"@nestjs/platform-ws": "^11.1.8",
38-
"@nestjs/testing": "^11.1.8",
3934
"@rocketadmin/shared-code": "workspace:*",
4035
"@types/pg": "^8.15.6",
4136
"argon2": "^0.44.0",
37+
"chalk": "^5.6.2",
38+
"commander": "^14.0.2",
4239
"crypto-js": "^4.2.0",
40+
"dotenv": "^17.2.3",
4341
"get-port": "^7.1.0",
42+
"inquirer": "^13.0.2",
4443
"knex": "3.1.0",
4544
"mongodb": "^6.20.0",
4645
"mysql2": "^3.15.3",
46+
"ora": "^9.0.0",
4747
"oracledb": "^6.10.0",
4848
"pg": "^8.16.3",
49-
"readline-sync": "^1.4.10",
50-
"reflect-metadata": "^0.2.2",
5149
"rimraf": "^6.0.1",
52-
"rxjs": "^7.8.2",
5350
"ssh2": "^1.17.0",
5451
"tedious": "^18.6.1",
5552
"wait-on": "^9.0.1",
5653
"winston": "^3.18.3",
54+
"ws": "^8.18.3",
5755
"yarn": "^1.22.22"
5856
},
5957
"optionalDependencies": {
6058
"ibm_db": "3.3.0"
6159
},
6260
"devDependencies": {
63-
"@nestjs/cli": "^11.0.10",
64-
"@nestjs/schematics": "^11.0.9",
65-
"@nestjs/testing": "^11.1.8",
66-
"@types/express": "^5.0.5",
61+
"@types/inquirer": "^9.0.9",
6762
"@types/jest": "^30.0.0",
6863
"@types/node": "^24.9.1",
69-
"@types/readline-sync": "^1.4.8",
7064
"@types/supertest": "^6.0.3",
65+
"@types/ws": "^8.18.1",
7166
"@typescript-eslint/eslint-plugin": "^8.46.2",
7267
"@typescript-eslint/parser": "^8.46.2",
7368
"eslint": "^9.38.0",

rocketadmin-agent/src/app.controller.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

rocketadmin-agent/src/app.controller.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

rocketadmin-agent/src/app.module.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

rocketadmin-agent/src/app.service.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)