mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-16 03:30:55 +01:00
refactor: replace ssh2-promise with @fabio286/ssh2-promise
This commit is contained in:
parent
275344eb8b
commit
d30a978cd6
@ -146,7 +146,7 @@
|
||||
"source-map-support": "~0.5.20",
|
||||
"spectre.css": "~0.5.9",
|
||||
"sql-formatter": "~13.0.0",
|
||||
"ssh2-promise": "~1.0.2",
|
||||
"@fabio286/ssh2-promise": "~1.0.4-b",
|
||||
"v-mask": "~2.3.0",
|
||||
"vue": "~3.3.4",
|
||||
"vue-i18n": "~9.2.2",
|
||||
@ -208,10 +208,5 @@
|
||||
"webpack-cli": "~4.9.1",
|
||||
"webpack-dev-server": "~4.11.1",
|
||||
"xvfb-maybe": "~0.2.1"
|
||||
},
|
||||
"overrides": {
|
||||
"ssh2-promise": {
|
||||
"ssh2": "github:Fabio286/ssh2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||
import * as mysql from 'mysql2/promise';
|
||||
import * as pg from 'pg';
|
||||
import { FirebirdSQLClient } from 'src/main/libs/clients/FirebirdSQLClient';
|
||||
@ -5,7 +6,6 @@ import MysqlExporter from 'src/main/libs/exporters/sql/MysqlExporter';
|
||||
import PostgreSQLExporter from 'src/main/libs/exporters/sql/PostgreSQLExporter';
|
||||
import MySQLImporter from 'src/main/libs/importers/sql/MySQLlImporter';
|
||||
import PostgreSQLImporter from 'src/main/libs/importers/sql/PostgreSQLImporter';
|
||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||
|
||||
import { MySQLClient } from '../../main/libs/clients/MySQLClient';
|
||||
import { PostgreSQLClient } from '../../main/libs/clients/PostgreSQLClient';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import mysql from 'mysql2/promise';
|
||||
import * as pg from 'pg';
|
||||
import SSH2Promise from 'ssh2-promise';
|
||||
import SSH2Promise = require('@fabio286/ssh2-promise');
|
||||
|
||||
const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
|
||||
// Remove comments, newlines and multiple spaces
|
||||
@ -16,7 +16,7 @@ const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
|
||||
/**
|
||||
* As Simple As Possible Query Builder Core
|
||||
*/
|
||||
export abstract class AntaresCore {
|
||||
export abstract class BaseClient {
|
||||
_client: antares.ClientCode;
|
||||
protected _cUid: string
|
||||
protected _params: mysql.ConnectionOptions | pg.ClientConfig | { databasePath: string; readonly: boolean};
|
@ -4,9 +4,9 @@ import * as antares from 'common/interfaces/antares';
|
||||
import * as firebird from 'node-firebird';
|
||||
import * as path from 'path';
|
||||
|
||||
import { AntaresCore } from '../AntaresCore';
|
||||
import { BaseClient } from './BaseClient';
|
||||
|
||||
export class FirebirdSQLClient extends AntaresCore {
|
||||
export class FirebirdSQLClient extends BaseClient {
|
||||
private _schema?: string;
|
||||
private _runningConnections: Map<string, number>;
|
||||
private _connectionsToCommit: Map<string, firebird.Transaction>;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import SSH2Promise = require('@fabio286/ssh2-promise');
|
||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||
import dataTypes from 'common/data-types/mysql';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import * as mysql from 'mysql2/promise';
|
||||
|
||||
import { AntaresCore } from '../AntaresCore';
|
||||
import SSH2Promise = require('ssh2-promise');
|
||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||
import { BaseClient } from './BaseClient';
|
||||
|
||||
export class MySQLClient extends AntaresCore {
|
||||
export class MySQLClient extends BaseClient {
|
||||
private _schema?: string;
|
||||
private _runningConnections: Map<string, number>;
|
||||
private _connectionsToCommit: Map<string, mysql.Connection | mysql.PoolConnection>;
|
||||
|
@ -1,13 +1,13 @@
|
||||
import SSH2Promise = require('@fabio286/ssh2-promise');
|
||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||
import dataTypes from 'common/data-types/postgresql';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import * as pg from 'pg';
|
||||
import * as pgAst from 'pgsql-ast-parser';
|
||||
|
||||
import { AntaresCore } from '../AntaresCore';
|
||||
import SSH2Promise = require('ssh2-promise');
|
||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||
import { ConnectionOptions } from 'tls';
|
||||
|
||||
import { BaseClient } from './BaseClient';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function pgToString (value: any) {
|
||||
return value.toString();
|
||||
@ -81,7 +81,7 @@ type builtinsTypes =
|
||||
'JSONB' |
|
||||
'REGNAMESPACE' |
|
||||
'REGROLE';
|
||||
export class PostgreSQLClient extends AntaresCore {
|
||||
export class PostgreSQLClient extends BaseClient {
|
||||
private _schema?: string;
|
||||
private _runningConnections: Map<string, number>;
|
||||
private _connectionsToCommit: Map<string, pg.Client | pg.PoolClient>;
|
||||
|
@ -3,9 +3,9 @@ import dataTypes from 'common/data-types/sqlite';
|
||||
import { DATETIME, FLOAT, NUMBER, TIME } from 'common/fieldTypes';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
|
||||
import { AntaresCore } from '../AntaresCore';
|
||||
import { BaseClient } from './BaseClient';
|
||||
|
||||
export class SQLiteClient extends AntaresCore {
|
||||
export class SQLiteClient extends BaseClient {
|
||||
private _schema?: string;
|
||||
private _connectionsToCommit: Map<string, sqlite.Database>;
|
||||
protected _connection?: sqlite.Database;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { ImportOptions } from 'common/interfaces/importer';
|
||||
import * as mysql from 'mysql2';
|
||||
import * as pg from 'pg';
|
||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||
|
||||
import { MySQLClient } from '../libs/clients/MySQLClient';
|
||||
import { PostgreSQLClient } from '../libs/clients/PostgreSQLClient';
|
||||
|
Loading…
x
Reference in New Issue
Block a user