@nocobase/test 0.16.0-alpha.4 → 0.16.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -86,14 +86,13 @@ const _MySQLClient = class _MySQLClient extends BaseClient {
|
|
|
86
86
|
await this._client.query(`CREATE DATABASE IF NOT EXISTS ${name}`);
|
|
87
87
|
}
|
|
88
88
|
async _createConnection() {
|
|
89
|
-
|
|
89
|
+
return import_promise.default.createConnection({
|
|
90
90
|
host: process.env["DB_HOST"],
|
|
91
91
|
port: Number(process.env["DB_PORT"]),
|
|
92
92
|
user: process.env["DB_USER"],
|
|
93
93
|
password: process.env["DB_PASSWORD"],
|
|
94
94
|
database: process.env["DB_DATABASE"]
|
|
95
95
|
});
|
|
96
|
-
return connection;
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
__name(_MySQLClient, "MySQLClient");
|
|
@@ -106,14 +105,13 @@ const _MariaDBClient = class _MariaDBClient extends BaseClient {
|
|
|
106
105
|
await this._client.query(`CREATE DATABASE IF NOT EXISTS ${name}`);
|
|
107
106
|
}
|
|
108
107
|
async _createConnection() {
|
|
109
|
-
|
|
108
|
+
return await import_mariadb.default.createConnection({
|
|
110
109
|
host: process.env["DB_HOST"],
|
|
111
110
|
port: Number(process.env["DB_PORT"]),
|
|
112
111
|
user: process.env["DB_USER"],
|
|
113
112
|
password: process.env["DB_PASSWORD"],
|
|
114
113
|
database: process.env["DB_DATABASE"]
|
|
115
114
|
});
|
|
116
|
-
return connection;
|
|
117
115
|
}
|
|
118
116
|
};
|
|
119
117
|
__name(_MariaDBClient, "MariaDBClient");
|
|
@@ -139,13 +137,11 @@ const server = import_http.default.createServer((req, res) => {
|
|
|
139
137
|
const path2 = parsedUrl.pathname;
|
|
140
138
|
const trimmedPath = path2.replace(/^\/+|\/+$/g, "");
|
|
141
139
|
if (trimmedPath === "acquire") {
|
|
142
|
-
const via = parsedUrl.query.via;
|
|
143
140
|
const name = parsedUrl.query.name;
|
|
144
141
|
dbClient.createDB(name).then(() => {
|
|
145
142
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
146
143
|
res.end();
|
|
147
144
|
}).catch((error) => {
|
|
148
|
-
console.error(error);
|
|
149
145
|
res.writeHead(500, { "Content-Type": "application/json" });
|
|
150
146
|
res.end(JSON.stringify({ error }));
|
|
151
147
|
});
|
|
@@ -154,7 +150,6 @@ const server = import_http.default.createServer((req, res) => {
|
|
|
154
150
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
155
151
|
res.end();
|
|
156
152
|
}).catch((error) => {
|
|
157
|
-
console.error(error);
|
|
158
153
|
res.writeHead(500, { "Content-Type": "application/json" });
|
|
159
154
|
res.end(JSON.stringify({ error }));
|
|
160
155
|
});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "0.16.0-alpha.
|
|
3
|
+
"version": "0.16.0-alpha.5",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@nocobase/server": "0.16.0-alpha.
|
|
8
|
+
"@nocobase/server": "0.16.0-alpha.5",
|
|
9
9
|
"@types/supertest": "^2.0.11",
|
|
10
10
|
"mariadb": "^2.5.6",
|
|
11
11
|
"mockjs": "^1.1.0",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"supertest": "^6.1.6",
|
|
17
17
|
"ws": "^8.13.0"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "3badd2569e4658023897fa381ac4dd30e64d5bce"
|
|
20
20
|
}
|