mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 04:00:59 +00:00
DBGATE_TOOLS => DBGATE_PACKAGES
Some checks are pending
Run tests / test-runner (push) Waiting to run
Some checks are pending
Run tests / test-runner (push) Waiting to run
This commit is contained in:
parent
8a69e94d79
commit
968e69c7f2
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -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 = {};
|
||||
|
@ -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');
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||
const { SqlDumper } = global.DBGATE_PACKAGES['dbgate-tools'];
|
||||
|
||||
class Dumper extends SqlDumper {}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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');
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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} */
|
||||
|
@ -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');
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
||||
|
@ -17,7 +17,7 @@ var config = {
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||
'global.DBGATE_PACKAGES': 'window.DBGATE_PACKAGES',
|
||||
}),
|
||||
],
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user