dbgate-api 6.6.12 → 6.7.1

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": "6.6.12",
4
+ "version": "6.7.1",
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.6.12",
34
- "dbgate-query-splitter": "^4.11.7",
35
- "dbgate-sqltree": "^6.6.12",
36
- "dbgate-tools": "^6.6.12",
33
+ "dbgate-datalib": "^6.7.1",
34
+ "dbgate-query-splitter": "^4.11.9",
35
+ "dbgate-sqltree": "^6.7.1",
36
+ "dbgate-tools": "^6.7.1",
37
37
  "debug": "^4.3.4",
38
38
  "diff": "^5.0.0",
39
39
  "diff2html": "^3.4.13",
@@ -86,7 +86,7 @@
86
86
  "devDependencies": {
87
87
  "@types/fs-extra": "^9.0.11",
88
88
  "@types/lodash": "^4.14.149",
89
- "dbgate-types": "^6.6.12",
89
+ "dbgate-types": "^6.7.1",
90
90
  "env-cmd": "^10.1.0",
91
91
  "jsdoc-to-markdown": "^9.0.5",
92
92
  "node-loader": "^1.0.2",
@@ -35,8 +35,8 @@ module.exports = {
35
35
  },
36
36
 
37
37
  refreshPublicFiles_meta: true,
38
- async refreshPublicFiles({ isRefresh }) {
39
- await refreshPublicFiles(isRefresh);
38
+ async refreshPublicFiles({ isRefresh }, req) {
39
+ await refreshPublicFiles(isRefresh, req?.headers?.['x-ui-language']);
40
40
  return {
41
41
  status: 'ok',
42
42
  };
@@ -71,6 +71,7 @@ module.exports = {
71
71
  const isLicenseValid = checkedLicense?.status == 'ok';
72
72
  const logoutUrl = storageConnectionError ? null : await authProvider.getLogoutUrl();
73
73
  const adminConfig = storageConnectionError ? null : await storage.readConfig({ group: 'admin' });
74
+ const settingsConfig = storageConnectionError ? null : await storage.readConfig({ group: 'settings' });
74
75
 
75
76
  storage.startRefreshLicense();
76
77
 
@@ -121,6 +122,7 @@ module.exports = {
121
122
  allowPrivateCloud: platformInfo.isElectron || !!process.env.ALLOW_DBGATE_PRIVATE_CLOUD,
122
123
  ...currentVersion,
123
124
  redirectToDbGateCloudLogin: !!process.env.REDIRECT_TO_DBGATE_CLOUD_LOGIN,
125
+ preferrendLanguage: settingsConfig?.['storage.language'] || process.env.LANGUAGE || null,
124
126
  };
125
127
 
126
128
  return configResult;
@@ -14,7 +14,11 @@ const JsonLinesDatabase = require('../utility/JsonLinesDatabase');
14
14
  const processArgs = require('../utility/processArgs');
15
15
  const { safeJsonParse, getLogger, extractErrorLogData } = require('dbgate-tools');
16
16
  const platformInfo = require('../utility/platformInfo');
17
- const { connectionHasPermission, testConnectionPermission, loadPermissionsFromRequest } = require('../utility/hasPermission');
17
+ const {
18
+ connectionHasPermission,
19
+ testConnectionPermission,
20
+ loadPermissionsFromRequest,
21
+ } = require('../utility/hasPermission');
18
22
  const pipeForkLogs = require('../utility/pipeForkLogs');
19
23
  const requireEngineDriver = require('../utility/requireEngineDriver');
20
24
  const { getAuthProviderById } = require('../auth/authProvider');
@@ -116,7 +120,10 @@ function getPortalCollections() {
116
120
  }
117
121
  }
118
122
 
119
- logger.info({ connections: connections.map(pickSafeConnectionInfo) }, 'DBGM-00005 Using connections from ENV variables');
123
+ logger.info(
124
+ { connections: connections.map(pickSafeConnectionInfo) },
125
+ 'DBGM-00005 Using connections from ENV variables'
126
+ );
120
127
  const noengine = connections.filter(x => !x.engine);
121
128
  if (noengine.length > 0) {
122
129
  logger.warn(
@@ -502,7 +509,11 @@ module.exports = {
502
509
  state,
503
510
  client: 'web',
504
511
  });
505
- res.redirect(authResp.url);
512
+ if (authResp?.url) {
513
+ res.redirect(authResp.url);
514
+ return;
515
+ }
516
+ res.json({ error: 'No URL returned from auth provider' });
506
517
  },
507
518
 
508
519
  dbloginApp_meta: true,
@@ -1,5 +1,5 @@
1
1
 
2
2
  module.exports = {
3
- version: '6.6.12',
4
- buildTime: '2025-11-17T07:32:31.210Z'
3
+ version: '6.7.1',
4
+ buildTime: '2025-11-25T14:00:20.577Z'
5
5
  };
@@ -1533,6 +1533,12 @@ module.exports = {
1533
1533
  "columnName": "name",
1534
1534
  "dataType": "varchar(250)",
1535
1535
  "notNull": true
1536
+ },
1537
+ {
1538
+ "pureName": "team_file_types",
1539
+ "columnName": "format",
1540
+ "dataType": "varchar(50)",
1541
+ "notNull": false
1536
1542
  }
1537
1543
  ],
1538
1544
  "foreignKeys": [],
@@ -1549,7 +1555,38 @@ module.exports = {
1549
1555
  "preloadedRows": [
1550
1556
  {
1551
1557
  "id": -1,
1552
- "name": "sql"
1558
+ "name": "sql",
1559
+ "format": "text"
1560
+ },
1561
+ {
1562
+ "id": -2,
1563
+ "name": "diagrams",
1564
+ "format": "json"
1565
+ },
1566
+ {
1567
+ "id": -3,
1568
+ "name": "query",
1569
+ "format": "json"
1570
+ },
1571
+ {
1572
+ "id": -4,
1573
+ "name": "perspectives",
1574
+ "format": "json"
1575
+ },
1576
+ {
1577
+ "id": -5,
1578
+ "name": "impexp",
1579
+ "format": "json"
1580
+ },
1581
+ {
1582
+ "id": -6,
1583
+ "name": "shell",
1584
+ "format": "text"
1585
+ },
1586
+ {
1587
+ "id": -7,
1588
+ "name": "dbcompare",
1589
+ "format": "json"
1553
1590
  }
1554
1591
  ]
1555
1592
  },
@@ -193,7 +193,7 @@ async function getCloudSigninHeaders(holder = null) {
193
193
  return null;
194
194
  }
195
195
 
196
- async function updateCloudFiles(isRefresh) {
196
+ async function updateCloudFiles(isRefresh, language) {
197
197
  let lastCloudFilesTags;
198
198
  try {
199
199
  lastCloudFilesTags = await fs.readFile(path.join(datadir(), 'cloud-files-tags.txt'), 'utf-8');
@@ -218,6 +218,7 @@ async function updateCloudFiles(isRefresh) {
218
218
  ...getLicenseHttpHeaders(),
219
219
  ...(await getCloudInstanceHeaders()),
220
220
  'x-app-version': currentVersion.version,
221
+ 'x-app-language': language || 'en',
221
222
  },
222
223
  }
223
224
  );
@@ -274,7 +275,7 @@ async function ensurePromoWidgetDataLoaded() {
274
275
  promoWidgetDataLoaded = true;
275
276
  }
276
277
 
277
- async function updatePremiumPromoWidget() {
278
+ async function updatePremiumPromoWidget(language) {
278
279
  await ensurePromoWidgetDataLoaded();
279
280
 
280
281
  const tags = (await collectCloudFilesSearchTags()).join(',');
@@ -283,8 +284,10 @@ async function updatePremiumPromoWidget() {
283
284
  `${DBGATE_CLOUD_URL}/premium-promo-widget?identifier=${promoWidgetData?.identifier ?? 'empty'}&tags=${tags}`,
284
285
  {
285
286
  headers: {
287
+ ...getLicenseHttpHeaders(),
286
288
  ...(await getCloudInstanceHeaders()),
287
289
  'x-app-version': currentVersion.version,
290
+ 'x-app-language': language || 'en',
288
291
  },
289
292
  }
290
293
  );
@@ -299,17 +302,21 @@ async function updatePremiumPromoWidget() {
299
302
  socket.emitChanged(`promo-widget-changed`);
300
303
  }
301
304
 
302
- async function refreshPublicFiles(isRefresh) {
305
+ async function refreshPublicFiles(isRefresh, uiLanguage) {
306
+ const language = platformInfo.isElectron
307
+ ? (await config.getCachedSettings())?.['localization.language'] || 'en'
308
+ : uiLanguage;
303
309
  if (!cloudFiles) {
304
310
  await loadCloudFiles();
305
311
  }
306
312
  try {
307
- await updateCloudFiles(isRefresh);
313
+ await updateCloudFiles(isRefresh, language);
308
314
  } catch (err) {
309
315
  logger.error(extractErrorLogData(err), 'DBGM-00166 Error updating cloud files');
310
316
  }
311
- if (!isProApp()) {
312
- await updatePremiumPromoWidget();
317
+ const configSettings = await config.get();
318
+ if (!isProApp() || configSettings?.trialDaysLeft != null) {
319
+ await updatePremiumPromoWidget(language);
313
320
  }
314
321
  }
315
322
 
@@ -17,7 +17,7 @@ class QueryStreamTableWriter {
17
17
  this.started = new Date().getTime();
18
18
  }
19
19
 
20
- initializeFromQuery(structure, resultIndex, chartDefinition, autoDetectCharts = false) {
20
+ initializeFromQuery(structure, resultIndex, chartDefinition, autoDetectCharts = false, options = {}) {
21
21
  this.jslid = crypto.randomUUID();
22
22
  this.currentFile = path.join(jsldir(), `${this.jslid}.jsonl`);
23
23
  fs.writeFileSync(
@@ -25,6 +25,7 @@ class QueryStreamTableWriter {
25
25
  JSON.stringify({
26
26
  ...structure,
27
27
  __isStreamHeader: true,
28
+ ...options
28
29
  }) + '\n'
29
30
  );
30
31
  this.currentStream = fs.createWriteStream(this.currentFile, { flags: 'a' });
@@ -179,7 +180,7 @@ class StreamHandler {
179
180
  process.send({ msgtype: 'changedCurrentDatabase', database, sesid: this.sesid });
180
181
  }
181
182
 
182
- recordset(columns) {
183
+ recordset(columns, options) {
183
184
  if (this.rowsLimitOverflow) {
184
185
  return;
185
186
  }
@@ -189,7 +190,8 @@ class StreamHandler {
189
190
  Array.isArray(columns) ? { columns } : columns,
190
191
  this.queryStreamInfoHolder.resultIndex,
191
192
  this.frontMatter?.[`chart-${this.queryStreamInfoHolder.resultIndex + 1}`],
192
- this.autoDetectCharts
193
+ this.autoDetectCharts,
194
+ options
193
195
  );
194
196
  this.queryStreamInfoHolder.resultIndex += 1;
195
197
  this.rowCounter = 0;