dbgate-api-premium 6.5.6 → 6.6.0

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-premium",
3
3
  "main": "src/index.js",
4
- "version": "6.5.6",
4
+ "version": "6.6.0",
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": "^6.5.6",
33
+ "dbgate-datalib": "^6.6.0",
34
34
  "dbgate-query-splitter": "^4.11.5",
35
- "dbgate-sqltree": "^6.5.6",
36
- "dbgate-tools": "^6.5.6",
35
+ "dbgate-sqltree": "^6.6.0",
36
+ "dbgate-tools": "^6.6.0",
37
37
  "debug": "^4.3.4",
38
38
  "diff": "^5.0.0",
39
39
  "diff2html": "^3.4.13",
@@ -68,6 +68,7 @@
68
68
  },
69
69
  "scripts": {
70
70
  "start": "env-cmd -f .env node src/index.js --listen-api",
71
+ "start:debug": "env-cmd -f .env node --inspect src/index.js --listen-api",
71
72
  "start:portal": "env-cmd -f env/portal/.env node src/index.js --listen-api",
72
73
  "start:singledb": "env-cmd -f env/singledb/.env node src/index.js --listen-api",
73
74
  "start:auth": "env-cmd -f env/auth/.env node src/index.js --listen-api",
@@ -85,7 +86,7 @@
85
86
  "devDependencies": {
86
87
  "@types/fs-extra": "^9.0.11",
87
88
  "@types/lodash": "^4.14.149",
88
- "dbgate-types": "^6.5.6",
89
+ "dbgate-types": "^6.6.0",
89
90
  "env-cmd": "^10.1.0",
90
91
  "jsdoc-to-markdown": "^9.0.5",
91
92
  "node-loader": "^1.0.2",
@@ -16,6 +16,7 @@ const { getConnectionLabel, getLogger, extractErrorLogData } = require('dbgate-t
16
16
  const logger = getLogger('cloud');
17
17
  const _ = require('lodash');
18
18
  const fs = require('fs-extra');
19
+ const { getAiGatewayServer } = require('../utility/authProxy');
19
20
 
20
21
  module.exports = {
21
22
  publicFiles_meta: true,
@@ -276,4 +277,17 @@ module.exports = {
276
277
  const resp = await callCloudApiPost(`content-folders/remove-user/${folid}`, { email });
277
278
  return resp;
278
279
  },
280
+
281
+ getAiGateway_meta: true,
282
+ async getAiGateway() {
283
+ return getAiGatewayServer();
284
+ },
285
+
286
+ // chatStream_meta: {
287
+ // raw: true,
288
+ // method: 'post',
289
+ // },
290
+ // chatStream(req, res) {
291
+ // callChatStream(req.body, res);
292
+ // },
279
293
  };
@@ -1,5 +1,5 @@
1
1
 
2
2
  module.exports = {
3
- version: '6.5.6',
4
- buildTime: '2025-07-17T07:05:49.044Z'
3
+ version: '6.6.0',
4
+ buildTime: '2025-07-25T07:23:41.045Z'
5
5
  };
@@ -674,6 +674,12 @@ module.exports = {
674
674
  "columnName": "awsRegion",
675
675
  "dataType": "varchar(250)",
676
676
  "notNull": false
677
+ },
678
+ {
679
+ "pureName": "connections",
680
+ "columnName": "connectionDefinition",
681
+ "dataType": "text",
682
+ "notNull": false
677
683
  }
678
684
  ],
679
685
  "foreignKeys": [],
@@ -310,6 +310,32 @@ async function callRefactorSqlQueryApi(query, task, structure, dialect) {
310
310
  return resp.data;
311
311
  }
312
312
 
313
+ // async function callChatStream({ input, tools }, res) {
314
+ // const resp = await axios.default.post(
315
+ // `${AI_GATEWAY_URL}/chat-stream`,
316
+ // {
317
+ // input,
318
+ // tools,
319
+ // },
320
+ // getAxiosParamsWithLicense()
321
+ // );
322
+
323
+ // res.set(resp.headers);
324
+ // res.status(resp.status);
325
+ // resp.data.pipe(res);
326
+ // }
327
+
328
+ function getAiGatewayServer() {
329
+ return {
330
+ url: AI_GATEWAY_URL,
331
+ headers: {
332
+ Authorization:
333
+ licenseKey ?? process.env.DBGATE_LICENSE ? `Bearer ${licenseKey ?? process.env.DBGATE_LICENSE}` : undefined,
334
+ ...getE2ETestHeaders(),
335
+ },
336
+ };
337
+ }
338
+
313
339
  module.exports = {
314
340
  isAuthProxySupported,
315
341
  authProxyGetRedirectUrl,
@@ -325,4 +351,6 @@ module.exports = {
325
351
  callRefactorSqlQueryApi,
326
352
  getLicenseHttpHeaders,
327
353
  tryToGetRefreshedLicense,
354
+ getAiGatewayServer,
355
+ // callChatStream,
328
356
  };
@@ -101,24 +101,26 @@ function decryptObjectPasswordField(obj, field, encryptor = null) {
101
101
  return obj;
102
102
  }
103
103
 
104
+ const fieldsToEncrypt = ['password', 'sshPassword', 'sshKeyfilePassword', 'connectionDefinition'];
105
+
104
106
  function encryptConnection(connection, encryptor = null) {
105
107
  if (connection.passwordMode != 'saveRaw') {
106
- connection = encryptObjectPasswordField(connection, 'password', encryptor);
107
- connection = encryptObjectPasswordField(connection, 'sshPassword', encryptor);
108
- connection = encryptObjectPasswordField(connection, 'sshKeyfilePassword', encryptor);
108
+ for (const field of fieldsToEncrypt) {
109
+ connection = encryptObjectPasswordField(connection, field, encryptor);
110
+ }
109
111
  }
110
112
  return connection;
111
113
  }
112
114
 
113
115
  function maskConnection(connection) {
114
116
  if (!connection) return connection;
115
- return _.omit(connection, ['password', 'sshPassword', 'sshKeyfilePassword']);
117
+ return _.omit(connection, fieldsToEncrypt);
116
118
  }
117
119
 
118
- function decryptConnection(connection, encryptor = null) {
119
- connection = decryptObjectPasswordField(connection, 'password', encryptor);
120
- connection = decryptObjectPasswordField(connection, 'sshPassword', encryptor);
121
- connection = decryptObjectPasswordField(connection, 'sshKeyfilePassword', encryptor);
120
+ function decryptConnection(connection) {
121
+ for (const field of fieldsToEncrypt) {
122
+ connection = decryptObjectPasswordField(connection, field);
123
+ }
122
124
  return connection;
123
125
  }
124
126
 
@@ -188,9 +190,9 @@ function recryptObjectPasswordFieldInPlace(obj, field, decryptEncryptor, encrypt
188
190
  }
189
191
 
190
192
  function recryptConnection(connection, decryptEncryptor, encryptEncryptor) {
191
- connection = recryptObjectPasswordField(connection, 'password', decryptEncryptor, encryptEncryptor);
192
- connection = recryptObjectPasswordField(connection, 'sshPassword', decryptEncryptor, encryptEncryptor);
193
- connection = recryptObjectPasswordField(connection, 'sshKeyfilePassword', decryptEncryptor, encryptEncryptor);
193
+ for (const field of fieldsToEncrypt) {
194
+ connection = recryptObjectPasswordField(connection, field, decryptEncryptor, encryptEncryptor);
195
+ }
194
196
  return connection;
195
197
  }
196
198