dbgate-api 5.5.4-alpha.1 → 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-alpha.1",
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.4-alpha.1",
29
+ "dbgate-datalib": "^5.5.4-alpha.2",
30
30
  "dbgate-query-splitter": "^4.10.5",
31
- "dbgate-sqltree": "^5.5.4-alpha.1",
32
- "dbgate-tools": "^5.5.4-alpha.1",
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.4-alpha.1",
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",
@@ -1,5 +1,5 @@
1
1
 
2
2
  module.exports = {
3
- version: '5.5.4-alpha.1',
4
- buildTime: '2024-10-01T07:21:08.626Z'
3
+ version: '5.5.4-alpha.2',
4
+ buildTime: '2024-10-01T08:41:09.234Z'
5
5
  };
@@ -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 pool = systemConnection || (await connectUtility(driver, connection, 'script'));
11
+ const dbhan = systemConnection || (await connectUtility(driver, connection, 'script'));
12
12
  logger.info(`Connected.`);
13
13
 
14
- await driver.script(pool, sql);
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 pool = systemConnection || (await connectUtility(driver, connection, 'read'));
24
+ const dbhan = systemConnection || (await connectUtility(driver, connection, 'read'));
25
25
  if (!analysedStructure) {
26
- analysedStructure = await driver.analyseFull(pool);
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, pool, driver);
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: (!processArgs.listenApiChild && !isNpmDist) || !!process.env.SHELL_CONNECTION || !!isElectron(),
43
- allowShellScripting: (!processArgs.listenApiChild && !isNpmDist) || !!process.env.SHELL_SCRIPTING || !!isElectron(),
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