DBGATE_TOOLS => DBGATE_PACKAGES
Some checks are pending
Run tests / test-runner (push) Waiting to run

This commit is contained in:
Jan Prochazka 2024-08-20 12:18:55 +02:00
parent 8a69e94d79
commit 968e69c7f2
32 changed files with 58 additions and 43 deletions

View File

@ -1,4 +1,8 @@
global.DBGATE_TOOLS = require('dbgate-tools');
global.DBGATE_PACKAGES = {
'dbgate-tools': require('dbgate-tools'),
'dbgate-sqltree': require('dbgate-sqltree'),
};
const requireEngineDriver = require('dbgate-api/src/utility/requireEngineDriver');
const crypto = require('crypto');
@ -44,16 +48,18 @@ async function connect(engine, database) {
}
}
const testWrapper = body => async (label, ...other) => {
const engine = other[other.length - 1];
const driver = requireEngineDriver(engine.connection);
const conn = await connect(engine, randomDbName());
try {
await body(conn, driver, ...other);
} finally {
await driver.close(conn);
}
};
const testWrapper =
body =>
async (label, ...other) => {
const engine = other[other.length - 1];
const driver = requireEngineDriver(engine.connection);
const conn = await connect(engine, randomDbName());
try {
await body(conn, driver, ...other);
} finally {
await driver.close(conn);
}
};
module.exports = {
randomDbName,

View File

@ -1,7 +1,10 @@
const requireEngineDriver = require('dbgate-api/src/utility/requireEngineDriver');
const engines = require('./engines');
const { extractConnection } = require('./tools');
global.DBGATE_TOOLS = require('dbgate-tools');
global.DBGATE_PACKAGES = {
'dbgate-tools': require('dbgate-tools'),
'dbgate-sqltree': require('dbgate-sqltree'),
};
async function connectEngine(engine) {
const connection = extractConnection(engine);

View File

@ -97,10 +97,12 @@ if (processArgs.listenApi) {
}
const shell = require('./shell/index');
const dbgateTools = require('dbgate-tools');
const currentVersion = require('./currentVersion');
global['DBGATE_TOOLS'] = dbgateTools;
global.DBGATE_PACKAGES = {
'dbgate-tools': require('dbgate-tools'),
'dbgate-sqltree': require('dbgate-sqltree'),
};
if (processArgs.startProcess) {
const proc = require('./proc');

View File

@ -1,6 +1,9 @@
<script lang="ts" context="module">
async function loadPlugins(pluginsDict, installedPlugins) {
window['DBGATE_TOOLS'] = dbgateTools;
window['DBGATE_PACKAGES'] = {
'dbgate-tools': dbgateTools,
'dbgate-sqltree': sqlTree,
};
const newPlugins = {};
for (const installed of installedPlugins || []) {
@ -55,6 +58,7 @@
import { buildFileFormats, buildQuickExports } from './fileformats';
import { buildThemes } from './themes';
import * as dbgateTools from 'dbgate-tools';
import * as sqlTree from 'dbgate-sqltree';
import { apiCall } from '../utility/api';
let pluginsDict = {};

View File

@ -2,7 +2,7 @@ const csv = require('csv');
const fs = require('fs');
const stream = require('stream');
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('csvWriter');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -1,5 +1,5 @@
const ObjectId = require('mongodb').ObjectId;
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('mongoBulkInsert');

View File

@ -1,4 +1,4 @@
const { SqlDumper } = global.DBGATE_TOOLS;
const { SqlDumper } = global.DBGATE_PACKAGES['dbgate-tools'];
class Dumper extends SqlDumper {}

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const { convertToMongoCondition } = require('./convertToMongoCondition');
const Dumper = require('./Dumper');
const { mongoSplitterOptions } = require('dbgate-query-splitter/lib/options');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -1,4 +1,4 @@
const { SqlDumper, testEqualColumns, arrayToHexString } = global.DBGATE_TOOLS;
const { SqlDumper, testEqualColumns, arrayToHexString } = global.DBGATE_PACKAGES['dbgate-tools'];
class MsSqlDumper extends SqlDumper {
constructor(driver, options) {

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const MsSqlDumper = require('./MsSqlDumper');
const { mssqlSplitterOptions } = require('dbgate-query-splitter/lib/options');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -5,7 +5,7 @@ const Analyser = require('./Analyser');
const mysql2 = require('mysql2');
const { createBulkInsertStreamBase, makeUniqueColumnNames } = require('dbgate-tools');
const { MySqlDumper } = require('antares-mysql-dumper');
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('mysqlDriver');

View File

@ -1,4 +1,4 @@
const { SqlDumper, arrayToHexString } = global.DBGATE_TOOLS;
const { SqlDumper, arrayToHexString } = global.DBGATE_PACKAGES['dbgate-tools'];
const _isArray = require('lodash/isArray');
class Dumper extends SqlDumper {

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const { mysqlSplitterOptions } = require('dbgate-query-splitter/lib/options');
const Dumper = require('./Dumper');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -1,4 +1,4 @@
const { SqlDumper, arrayToHexString, testEqualTypes } = global.DBGATE_TOOLS;
const { SqlDumper, arrayToHexString, testEqualTypes } = global.DBGATE_PACKAGES['dbgate-tools'];
class Dumper extends SqlDumper {
createDatabase(name) {

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const Dumper = require('./Dumper');
const { oracleSplitterOptions } = require('dbgate-query-splitter/lib/options');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -5,7 +5,7 @@ const driverBases = require('../frontend/drivers');
const Analyser = require('./Analyser');
const pg = require('pg');
const { createBulkInsertStreamBase, makeUniqueColumnNames } = require('dbgate-tools');
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('postreDriver');

View File

@ -1,4 +1,4 @@
const { SqlDumper, arrayToHexString, testEqualTypes } = global.DBGATE_TOOLS;
const { SqlDumper, arrayToHexString, testEqualTypes } = global.DBGATE_PACKAGES['dbgate-tools'];
class Dumper extends SqlDumper {
/** @param type {import('dbgate-types').TransformType} */

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const Dumper = require('./Dumper');
const { postgreSplitterOptions } = require('dbgate-query-splitter/lib/options');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const { redisSplitterOptions } = require('dbgate-query-splitter/lib/options');
const Dumper = require('./Dumper');

View File

@ -4,7 +4,7 @@ const driverBase = require('../frontend/driver');
const Analyser = require('./Analyser');
const { splitQuery, sqliteSplitterOptions } = require('dbgate-query-splitter');
const { createBulkInsertStreamBase, makeUniqueColumnNames } = require('dbgate-tools');
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('sqliteDriver');

View File

@ -1,4 +1,4 @@
const { SqlDumper, arrayToHexString } = global.DBGATE_TOOLS;
const { SqlDumper, arrayToHexString } = global.DBGATE_PACKAGES['dbgate-tools'];
class Dumper extends SqlDumper {
renameColumn(column, newcol) {

View File

@ -1,4 +1,4 @@
const { driverBase } = global.DBGATE_TOOLS;
const { driverBase } = global.DBGATE_PACKAGES['dbgate-tools'];
const Dumper = require('./Dumper');
const { sqliteSplitterOptions, noSplitSplitterOptions } = require('dbgate-query-splitter/lib/options');

View File

@ -17,7 +17,7 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
}),
],

View File

@ -1,7 +1,7 @@
const fs = require('fs');
const stream = require('stream');
const NodeXmlStream = require('node-xml-stream-parser');
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('xmlReader');

View File

@ -1,6 +1,6 @@
const fs = require('fs');
const stream = require('stream');
const { getLogger } = global.DBGATE_TOOLS;
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('xmlWriter');