dbgate-api 5.5.3 → 5.5.4-alpha.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbgate-api",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "5.5.
|
|
4
|
+
"version": "5.5.4-alpha.2",
|
|
5
5
|
"homepage": "https://dbgate.org/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"compare-versions": "^3.6.0",
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"cross-env": "^6.0.3",
|
|
29
|
-
"dbgate-datalib": "^5.5.
|
|
29
|
+
"dbgate-datalib": "^5.5.4-alpha.2",
|
|
30
30
|
"dbgate-query-splitter": "^4.10.5",
|
|
31
|
-
"dbgate-sqltree": "^5.5.
|
|
32
|
-
"dbgate-tools": "^5.5.
|
|
31
|
+
"dbgate-sqltree": "^5.5.4-alpha.2",
|
|
32
|
+
"dbgate-tools": "^5.5.4-alpha.2",
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"diff": "^5.0.0",
|
|
35
35
|
"diff2html": "^3.4.13",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/fs-extra": "^9.0.11",
|
|
77
77
|
"@types/lodash": "^4.14.149",
|
|
78
|
-
"dbgate-types": "^5.5.
|
|
78
|
+
"dbgate-types": "^5.5.4-alpha.2",
|
|
79
79
|
"env-cmd": "^10.1.0",
|
|
80
80
|
"node-loader": "^1.0.2",
|
|
81
81
|
"nodemon": "^2.0.2",
|
package/src/auth/authProvider.js
CHANGED
|
@@ -198,6 +198,19 @@ class LoginsProvider extends AuthProviderBase {
|
|
|
198
198
|
amoid = 'logins';
|
|
199
199
|
|
|
200
200
|
async login(login, password, options = undefined) {
|
|
201
|
+
if (login && password && process.env['LOGIN'] == login && process.env['PASSWORD'] == password) {
|
|
202
|
+
return {
|
|
203
|
+
accessToken: jwt.sign(
|
|
204
|
+
{
|
|
205
|
+
amoid: this.amoid,
|
|
206
|
+
login,
|
|
207
|
+
},
|
|
208
|
+
getTokenSecret(),
|
|
209
|
+
{ expiresIn: getTokenLifetime() }
|
|
210
|
+
),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
201
214
|
if (password == process.env[`LOGIN_PASSWORD_${login}`]) {
|
|
202
215
|
return {
|
|
203
216
|
accessToken: jwt.sign(
|
|
@@ -210,6 +223,7 @@ class LoginsProvider extends AuthProviderBase {
|
|
|
210
223
|
),
|
|
211
224
|
};
|
|
212
225
|
}
|
|
226
|
+
|
|
213
227
|
return { error: 'Invalid credentials' };
|
|
214
228
|
}
|
|
215
229
|
|
package/src/currentVersion.js
CHANGED
|
@@ -8,10 +8,14 @@ async function executeQuery({ connection = undefined, systemConnection = undefin
|
|
|
8
8
|
logger.info({ sql }, `Execute query`);
|
|
9
9
|
|
|
10
10
|
if (!driver) driver = requireEngineDriver(connection);
|
|
11
|
-
const
|
|
11
|
+
const dbhan = systemConnection || (await connectUtility(driver, connection, 'script'));
|
|
12
12
|
logger.info(`Connected.`);
|
|
13
13
|
|
|
14
|
-
await driver.script(
|
|
14
|
+
await driver.script(dbhan, sql);
|
|
15
|
+
|
|
16
|
+
if (!systemConnection) {
|
|
17
|
+
await driver.close(dbhan);
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
module.exports = executeQuery;
|
|
@@ -21,9 +21,9 @@ async function generateDeploySql({
|
|
|
21
21
|
}) {
|
|
22
22
|
if (!driver) driver = requireEngineDriver(connection);
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const dbhan = systemConnection || (await connectUtility(driver, connection, 'read'));
|
|
25
25
|
if (!analysedStructure) {
|
|
26
|
-
analysedStructure = await driver.analyseFull(
|
|
26
|
+
analysedStructure = await driver.analyseFull(dbhan);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const deployedModel = generateDbPairingId(
|
|
@@ -41,7 +41,7 @@ async function generateDeploySql({
|
|
|
41
41
|
noRenameColumn: true,
|
|
42
42
|
};
|
|
43
43
|
const currentModelPaired = matchPairedObjects(deployedModel, currentModel, opts);
|
|
44
|
-
const currentModelPairedPreloaded = await enrichWithPreloadedRows(deployedModel, currentModelPaired,
|
|
44
|
+
const currentModelPairedPreloaded = await enrichWithPreloadedRows(deployedModel, currentModelPaired, dbhan, driver);
|
|
45
45
|
|
|
46
46
|
// console.log('currentModelPairedPreloaded', currentModelPairedPreloaded.tables[0]);
|
|
47
47
|
// console.log('deployedModel', deployedModel.tables[0]);
|
|
@@ -55,6 +55,10 @@ async function generateDeploySql({
|
|
|
55
55
|
deployedModel,
|
|
56
56
|
driver
|
|
57
57
|
);
|
|
58
|
+
|
|
59
|
+
if (!systemConnection) {
|
|
60
|
+
await driver.close(dbhan);
|
|
61
|
+
}
|
|
58
62
|
return res;
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -11,6 +11,7 @@ const isLinux = platform === 'linux';
|
|
|
11
11
|
const isDocker = fs.existsSync('/home/dbgate-docker/public');
|
|
12
12
|
const isDevMode = process.env.DEVMODE == '1';
|
|
13
13
|
const isNpmDist = !!global['IS_NPM_DIST'];
|
|
14
|
+
const isDbModel = !!global['IS_DB_MODEL'];
|
|
14
15
|
const isForkedApi = processArgs.isForkedApi;
|
|
15
16
|
|
|
16
17
|
// function moduleAvailable(name) {
|
|
@@ -39,8 +40,10 @@ const platformInfo = {
|
|
|
39
40
|
environment: process.env.NODE_ENV,
|
|
40
41
|
platform,
|
|
41
42
|
runningInWebpack: !!process.env.WEBPACK_DEV_SERVER_URL,
|
|
42
|
-
allowShellConnection:
|
|
43
|
-
|
|
43
|
+
allowShellConnection:
|
|
44
|
+
(!processArgs.listenApiChild && !isNpmDist) || !!process.env.SHELL_CONNECTION || !!isElectron() || !!isDbModel,
|
|
45
|
+
allowShellScripting:
|
|
46
|
+
(!processArgs.listenApiChild && !isNpmDist) || !!process.env.SHELL_SCRIPTING || !!isElectron() || !!isDbModel,
|
|
44
47
|
defaultKeyfile: path.join(os.homedir(), '.ssh/id_rsa'),
|
|
45
48
|
};
|
|
46
49
|
|