dbgate-api 7.0.4 → 7.0.6
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.
- package/package.json +5 -5
- package/src/controllers/auth.js +2 -0
- package/src/controllers/connections.js +11 -11
- package/src/currentVersion.js +2 -2
- package/src/storageModel.js +78 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbgate-api",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.6",
|
|
5
5
|
"homepage": "https://dbgate.org/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"compare-versions": "^3.6.0",
|
|
31
31
|
"cors": "^2.8.5",
|
|
32
32
|
"cross-env": "^6.0.3",
|
|
33
|
-
"dbgate-datalib": "^7.0.
|
|
33
|
+
"dbgate-datalib": "^7.0.6",
|
|
34
34
|
"dbgate-query-splitter": "^4.11.9",
|
|
35
|
-
"dbgate-sqltree": "^7.0.
|
|
36
|
-
"dbgate-tools": "^7.0.
|
|
35
|
+
"dbgate-sqltree": "^7.0.6",
|
|
36
|
+
"dbgate-tools": "^7.0.6",
|
|
37
37
|
"debug": "^4.3.4",
|
|
38
38
|
"diff": "^5.0.0",
|
|
39
39
|
"diff2html": "^3.4.13",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@types/fs-extra": "^9.0.11",
|
|
89
89
|
"@types/lodash": "^4.14.149",
|
|
90
|
-
"dbgate-types": "^7.0.
|
|
90
|
+
"dbgate-types": "^7.0.6",
|
|
91
91
|
"env-cmd": "^10.1.0",
|
|
92
92
|
"jsdoc-to-markdown": "^9.0.5",
|
|
93
93
|
"node-loader": "^1.0.2",
|
package/src/controllers/auth.js
CHANGED
|
@@ -55,6 +55,8 @@ function authMiddleware(req, res, next) {
|
|
|
55
55
|
'/stream',
|
|
56
56
|
'/storage/get-connections-for-login-page',
|
|
57
57
|
'/storage/set-admin-password',
|
|
58
|
+
'/storage/request-password-reset',
|
|
59
|
+
'/storage/reset-password',
|
|
58
60
|
'/auth/get-providers',
|
|
59
61
|
'/connections/dblogin-web',
|
|
60
62
|
'/connections/dblogin-app',
|
|
@@ -205,7 +205,7 @@ module.exports = {
|
|
|
205
205
|
return storageConnections;
|
|
206
206
|
}
|
|
207
207
|
if (portalConnections) {
|
|
208
|
-
if (platformInfo.allowShellConnection) return portalConnections;
|
|
208
|
+
if (platformInfo.allowShellConnection) return portalConnections.map(x => encryptConnection(x));
|
|
209
209
|
return portalConnections.map(maskConnection).filter(x => connectionHasPermission(x, loadedPermissions));
|
|
210
210
|
}
|
|
211
211
|
return (await this.datastore.find()).filter(x => connectionHasPermission(x, loadedPermissions));
|
|
@@ -243,13 +243,13 @@ module.exports = {
|
|
|
243
243
|
subprocess.send({ ...connection, requestDbList });
|
|
244
244
|
return new Promise((resolve, reject) => {
|
|
245
245
|
let isWaitingForVolatile = false;
|
|
246
|
-
|
|
246
|
+
|
|
247
247
|
const cleanup = () => {
|
|
248
248
|
if (connection._id && pendingTestSubprocesses[connection._id]) {
|
|
249
249
|
delete pendingTestSubprocesses[connection._id];
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
|
|
252
|
+
|
|
253
253
|
subprocess.on('message', resp => {
|
|
254
254
|
if (handleProcessCommunication(resp, subprocess)) return;
|
|
255
255
|
// @ts-ignore
|
|
@@ -279,8 +279,8 @@ module.exports = {
|
|
|
279
279
|
reject(new MissingCredentialsError(missingCredentialsDetail));
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
|
-
|
|
283
|
-
subprocess.on('exit',
|
|
282
|
+
|
|
283
|
+
subprocess.on('exit', code => {
|
|
284
284
|
// If exit happens while waiting for volatile, that's expected
|
|
285
285
|
if (isWaitingForVolatile && code === 0) {
|
|
286
286
|
cleanup();
|
|
@@ -291,8 +291,8 @@ module.exports = {
|
|
|
291
291
|
reject(new Error(`Test subprocess exited with code ${code}`));
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
|
-
|
|
295
|
-
subprocess.on('error',
|
|
294
|
+
|
|
295
|
+
subprocess.on('error', err => {
|
|
296
296
|
cleanup();
|
|
297
297
|
reject(err);
|
|
298
298
|
});
|
|
@@ -327,7 +327,7 @@ module.exports = {
|
|
|
327
327
|
return testRes;
|
|
328
328
|
} else {
|
|
329
329
|
volatileConnections[res._id] = res;
|
|
330
|
-
|
|
330
|
+
|
|
331
331
|
// Check if there's a pending test subprocess waiting for this volatile connection
|
|
332
332
|
const pendingTest = pendingTestSubprocesses[conid];
|
|
333
333
|
if (pendingTest) {
|
|
@@ -335,7 +335,7 @@ module.exports = {
|
|
|
335
335
|
try {
|
|
336
336
|
// Send the volatile connection to the waiting subprocess
|
|
337
337
|
subprocess.send({ ...res, requestDbList, isVolatileResolved: true });
|
|
338
|
-
|
|
338
|
+
|
|
339
339
|
// Wait for the test result and emit it as an event
|
|
340
340
|
subprocess.once('message', resp => {
|
|
341
341
|
if (handleProcessCommunication(resp, subprocess)) return;
|
|
@@ -358,7 +358,7 @@ module.exports = {
|
|
|
358
358
|
delete pendingTestSubprocesses[conid];
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
|
|
361
|
+
|
|
362
362
|
return res;
|
|
363
363
|
}
|
|
364
364
|
},
|
|
@@ -489,7 +489,7 @@ module.exports = {
|
|
|
489
489
|
|
|
490
490
|
if (portalConnections) {
|
|
491
491
|
const res = portalConnections.find(x => x._id == conid) || null;
|
|
492
|
-
return mask && !platformInfo.allowShellConnection ? maskConnection(res) : res;
|
|
492
|
+
return mask && !platformInfo.allowShellConnection ? maskConnection(res) : encryptConnection(res);
|
|
493
493
|
}
|
|
494
494
|
const res = await this.datastore.get(conid);
|
|
495
495
|
return res || null;
|
package/src/currentVersion.js
CHANGED
package/src/storageModel.js
CHANGED
|
@@ -850,6 +850,84 @@ module.exports = {
|
|
|
850
850
|
}
|
|
851
851
|
]
|
|
852
852
|
},
|
|
853
|
+
{
|
|
854
|
+
"pureName": "password_reset_tokens",
|
|
855
|
+
"columns": [
|
|
856
|
+
{
|
|
857
|
+
"pureName": "password_reset_tokens",
|
|
858
|
+
"columnName": "id",
|
|
859
|
+
"dataType": "int",
|
|
860
|
+
"autoIncrement": true,
|
|
861
|
+
"notNull": true
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"pureName": "password_reset_tokens",
|
|
865
|
+
"columnName": "user_id",
|
|
866
|
+
"dataType": "int",
|
|
867
|
+
"notNull": true
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"pureName": "password_reset_tokens",
|
|
871
|
+
"columnName": "token",
|
|
872
|
+
"dataType": "varchar(500)",
|
|
873
|
+
"notNull": true
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"pureName": "password_reset_tokens",
|
|
877
|
+
"columnName": "created_at",
|
|
878
|
+
"dataType": "datetime",
|
|
879
|
+
"notNull": true
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"pureName": "password_reset_tokens",
|
|
883
|
+
"columnName": "expires_at",
|
|
884
|
+
"dataType": "datetime",
|
|
885
|
+
"notNull": true
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"pureName": "password_reset_tokens",
|
|
889
|
+
"columnName": "used_at",
|
|
890
|
+
"dataType": "datetime",
|
|
891
|
+
"notNull": false
|
|
892
|
+
}
|
|
893
|
+
],
|
|
894
|
+
"foreignKeys": [
|
|
895
|
+
{
|
|
896
|
+
"constraintType": "foreignKey",
|
|
897
|
+
"constraintName": "FK_password_reset_tokens_user_id",
|
|
898
|
+
"pureName": "password_reset_tokens",
|
|
899
|
+
"refTableName": "users",
|
|
900
|
+
"columns": [
|
|
901
|
+
{
|
|
902
|
+
"columnName": "user_id",
|
|
903
|
+
"refColumnName": "id"
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
],
|
|
908
|
+
"indexes": [
|
|
909
|
+
{
|
|
910
|
+
"constraintName": "idx_token",
|
|
911
|
+
"pureName": "password_reset_tokens",
|
|
912
|
+
"constraintType": "index",
|
|
913
|
+
"columns": [
|
|
914
|
+
{
|
|
915
|
+
"columnName": "token"
|
|
916
|
+
}
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
],
|
|
920
|
+
"primaryKey": {
|
|
921
|
+
"pureName": "password_reset_tokens",
|
|
922
|
+
"constraintType": "primaryKey",
|
|
923
|
+
"constraintName": "PK_password_reset_tokens",
|
|
924
|
+
"columns": [
|
|
925
|
+
{
|
|
926
|
+
"columnName": "id"
|
|
927
|
+
}
|
|
928
|
+
]
|
|
929
|
+
}
|
|
930
|
+
},
|
|
853
931
|
{
|
|
854
932
|
"pureName": "roles",
|
|
855
933
|
"columns": [
|