mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
renamed dbgate packages, because of npmjs policy
This commit is contained in:
32
package.json
32
package.json
@@ -1,25 +1,25 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "@dbgate/all",
|
"name": "dbgate-all",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start:api": "yarn workspace @dbgate/api start",
|
"start:api": "yarn workspace dbgate-api start",
|
||||||
"start:api:portal": "yarn workspace @dbgate/api start:portal",
|
"start:api:portal": "yarn workspace dbgate-api start:portal",
|
||||||
"start:web": "yarn workspace @dbgate/web start",
|
"start:web": "yarn workspace dbgate-web start",
|
||||||
"start:sqltree": "yarn workspace @dbgate/sqltree start",
|
"start:sqltree": "yarn workspace dbgate-sqltree start",
|
||||||
"start:tools": "yarn workspace @dbgate/tools start",
|
"start:tools": "yarn workspace dbgate-tools start",
|
||||||
"start:datalib": "yarn workspace @dbgate/datalib start",
|
"start:datalib": "yarn workspace dbgate-datalib start",
|
||||||
"start:filterparser": "yarn workspace @dbgate/filterparser start",
|
"start:filterparser": "yarn workspace dbgate-filterparser start",
|
||||||
"build:sqltree": "yarn workspace @dbgate/sqltree build",
|
"build:sqltree": "yarn workspace dbgate-sqltree build",
|
||||||
"build:datalib": "yarn workspace @dbgate/datalib build",
|
"build:datalib": "yarn workspace dbgate-datalib build",
|
||||||
"build:filterparser": "yarn workspace @dbgate/filterparser build",
|
"build:filterparser": "yarn workspace dbgate-filterparser build",
|
||||||
"build:tools": "yarn workspace @dbgate/tools build",
|
"build:tools": "yarn workspace dbgate-tools build",
|
||||||
"build:lib": "yarn build:tools && yarn build:sqltree && yarn build:filterparser && yarn build:datalib",
|
"build:lib": "yarn build:tools && yarn build:sqltree && yarn build:filterparser && yarn build:datalib",
|
||||||
"build:app": "cd app && yarn install && yarn build",
|
"build:app": "cd app && yarn install && yarn build",
|
||||||
"build:api": "yarn workspace @dbgate/api build",
|
"build:api": "yarn workspace dbgate-api build",
|
||||||
"build:web:docker": "yarn workspace @dbgate/web build:docker",
|
"build:web:docker": "yarn workspace dbgate-web build:docker",
|
||||||
"build:app:local": "cd app && yarn build:local",
|
"build:app:local": "cd app && yarn build:local",
|
||||||
"start:app:local": "cd app && yarn start:local",
|
"start:app:local": "cd app && yarn start:local",
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
"prepare": "yarn build:lib",
|
"prepare": "yarn build:lib",
|
||||||
"start": "concurrently --kill-others-on-fail \"yarn start:api\" \"yarn start:web\"",
|
"start": "concurrently --kill-others-on-fail \"yarn start:api\" \"yarn start:web\"",
|
||||||
"lib": "concurrently --kill-others-on-fail \"yarn start:sqltree\" \"yarn start:filterparser\" \"yarn start:datalib\" \"yarn start:tools\"",
|
"lib": "concurrently --kill-others-on-fail \"yarn start:sqltree\" \"yarn start:filterparser\" \"yarn start:datalib\" \"yarn start:tools\"",
|
||||||
"ts:api": "yarn workspace @dbgate/api ts",
|
"ts:api": "yarn workspace dbgate-api ts",
|
||||||
"ts:web": "yarn workspace @dbgate/web ts",
|
"ts:web": "yarn workspace dbgate-web ts",
|
||||||
"ts": "yarn ts:api && yarn ts:web",
|
"ts": "yarn ts:api && yarn ts:web",
|
||||||
"postinstall": "patch-package"
|
"postinstall": "patch-package"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbgate/api",
|
"name": "dbgate-api",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dbgate/engines": "^1.0.0",
|
"dbgate-engines": "^1.0.0",
|
||||||
"@dbgate/sqltree": "^1.0.0",
|
"dbgate-sqltree": "^1.0.0",
|
||||||
"async-lock": "^1.2.4",
|
"async-lock": "^1.2.4",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"build": "webpack"
|
"build": "webpack"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/lodash": "^4.14.149",
|
"@types/lodash": "^4.14.149",
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"nodemon": "^2.0.2",
|
"nodemon": "^2.0.2",
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ const uuidv1 = require('uuid/v1');
|
|||||||
const connections = require('./connections');
|
const connections = require('./connections');
|
||||||
const socket = require('../utility/socket');
|
const socket = require('../utility/socket');
|
||||||
const { fork } = require('child_process');
|
const { fork } = require('child_process');
|
||||||
const DatabaseAnalyser = require('@dbgate/engines/default/DatabaseAnalyser');
|
const DatabaseAnalyser = require('dbgate-engines/default/DatabaseAnalyser');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
/** @type {import('@dbgate/types').OpenedDatabaseConnection[]} */
|
/** @type {import('dbgate-types').OpenedDatabaseConnection[]} */
|
||||||
opened: [],
|
opened: [],
|
||||||
closed: [],
|
closed: [],
|
||||||
requests: {},
|
requests: {},
|
||||||
@@ -67,7 +67,7 @@ module.exports = {
|
|||||||
return newOpened;
|
return newOpened;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @param {import('@dbgate/types').OpenedDatabaseConnection} conn */
|
/** @param {import('dbgate-types').OpenedDatabaseConnection} conn */
|
||||||
sendRequest(conn, message) {
|
sendRequest(conn, message) {
|
||||||
const msgid = uuidv1();
|
const msgid = uuidv1();
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise((resolve, reject) => {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const { fork } = require('child_process');
|
|||||||
const { rundir, uploadsdir } = require('../utility/directories');
|
const { rundir, uploadsdir } = require('../utility/directories');
|
||||||
|
|
||||||
const scriptTemplate = (script) => `
|
const scriptTemplate = (script) => `
|
||||||
const dbgateApi = require(process.env.DBGATE_API || "@dbgate/api");
|
const dbgateApi = require(process.env.DBGATE_API || "dbgate-api");
|
||||||
require=null;
|
require=null;
|
||||||
async function run() {
|
async function run() {
|
||||||
${script}
|
${script}
|
||||||
@@ -18,7 +18,7 @@ dbgateApi.runScript(run);
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const loaderScriptTemplate = (functionName, props, runid) => `
|
const loaderScriptTemplate = (functionName, props, runid) => `
|
||||||
const dbgateApi = require(process.env.DBGATE_API || "@dbgate/api");
|
const dbgateApi = require(process.env.DBGATE_API || "dbgate-api");
|
||||||
require=null;
|
require=null;
|
||||||
async function run() {
|
async function run() {
|
||||||
const reader=await dbgateApi.${functionName}(${JSON.stringify(props)});
|
const reader=await dbgateApi.${functionName}(${JSON.stringify(props)});
|
||||||
@@ -29,7 +29,7 @@ dbgateApi.runScript(run);
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
/** @type {import('@dbgate/types').OpenedRunner[]} */
|
/** @type {import('dbgate-types').OpenedRunner[]} */
|
||||||
opened: [],
|
opened: [],
|
||||||
requests: {},
|
requests: {},
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const { fork } = require('child_process');
|
|||||||
const jsldata = require('./jsldata');
|
const jsldata = require('./jsldata');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
/** @type {import('@dbgate/types').OpenedSession[]} */
|
/** @type {import('dbgate-types').OpenedSession[]} */
|
||||||
opened: [],
|
opened: [],
|
||||||
|
|
||||||
// handle_error(sesid, props) {
|
// handle_error(sesid, props) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
const driverConnect = require('../utility/driverConnect');
|
const driverConnect = require('../utility/driverConnect');
|
||||||
const childProcessChecker = require('../utility/childProcessChecker');
|
const childProcessChecker = require('../utility/childProcessChecker');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
const stableStringify = require('json-stable-stringify');
|
const stableStringify = require('json-stable-stringify');
|
||||||
const driverConnect = require('../utility/driverConnect');
|
const driverConnect = require('../utility/driverConnect');
|
||||||
const childProcessChecker = require('../utility/childProcessChecker');
|
const childProcessChecker = require('../utility/childProcessChecker');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
const stableStringify = require('json-stable-stringify');
|
const stableStringify = require('json-stable-stringify');
|
||||||
const driverConnect = require('../utility/driverConnect');
|
const driverConnect = require('../utility/driverConnect');
|
||||||
const childProcessChecker = require('../utility/childProcessChecker');
|
const childProcessChecker = require('../utility/childProcessChecker');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
const uuidv1 = require('uuid/v1');
|
const uuidv1 = require('uuid/v1');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const driverConnect = require('../utility/driverConnect');
|
const driverConnect = require('../utility/driverConnect');
|
||||||
|
|
||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
|
|
||||||
async function queryReader({ connection, sql }) {
|
async function queryReader({ connection, sql }) {
|
||||||
console.log(`Reading query ${sql}`);
|
console.log(`Reading query ${sql}`);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const { quoteFullName } = require('@dbgate/tools');
|
const { quoteFullName } = require('dbgate-tools');
|
||||||
const driverConnect = require('../utility/driverConnect');
|
const driverConnect = require('../utility/driverConnect');
|
||||||
|
|
||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
|
|
||||||
async function tableReader({ connection, pureName, schemaName }) {
|
async function tableReader({ connection, pureName, schemaName }) {
|
||||||
const driver = engines(connection);
|
const driver = engines(connection);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const driverConnect = require('../utility/driverConnect');
|
const driverConnect = require('../utility/driverConnect');
|
||||||
|
|
||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
|
|
||||||
async function tableWriter({ connection, schemaName, pureName, ...options }) {
|
async function tableWriter({ connection, schemaName, pureName, ...options }) {
|
||||||
console.log(`Write table ${schemaName}.${pureName}`);
|
console.log(`Write table ${schemaName}.${pureName}`);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"name": "@dbgate/datalib",
|
"name": "dbgate-datalib",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -12,11 +12,11 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dbgate/sqltree": "^1.0.0",
|
"dbgate-sqltree": "^1.0.0",
|
||||||
"@dbgate/filterparser": "^1.0.0"
|
"dbgate-filterparser": "^1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^13.7.0",
|
||||||
"typescript": "^3.7.5"
|
"typescript": "^3.7.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { Command, Insert, Update, Delete, UpdateField, Condition, AllowIdentityInsert } from '@dbgate/sqltree';
|
import { Command, Insert, Update, Delete, UpdateField, Condition, AllowIdentityInsert } from 'dbgate-sqltree';
|
||||||
import { NamedObjectInfo, DatabaseInfo } from '@dbgate/types';
|
import { NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
|
||||||
|
|
||||||
export interface ChangeSetItem {
|
export interface ChangeSetItem {
|
||||||
pureName: string;
|
pureName: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { EngineDriver, ViewInfo, ColumnInfo } from '@dbgate/types';
|
import { EngineDriver, ViewInfo, ColumnInfo } from 'dbgate-types';
|
||||||
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
||||||
import { GridConfig, GridCache } from './GridConfig';
|
import { GridConfig, GridCache } from './GridConfig';
|
||||||
import { FreeTableModel } from './FreeTableModel';
|
import { FreeTableModel } from './FreeTableModel';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TableInfo } from '@dbgate/types';
|
import { TableInfo } from 'dbgate-types';
|
||||||
|
|
||||||
export interface FreeTableModel {
|
export interface FreeTableModel {
|
||||||
structure: TableInfo;
|
structure: TableInfo;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DisplayColumn } from './GridDisplay';
|
import { DisplayColumn } from './GridDisplay';
|
||||||
import { TableInfo } from '@dbgate/types';
|
import { TableInfo } from 'dbgate-types';
|
||||||
|
|
||||||
export interface GridConfigColumns {
|
export interface GridConfigColumns {
|
||||||
hiddenColumns: string[];
|
hiddenColumns: string[];
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { GridConfig, GridCache, GridConfigColumns, createGridCache, GroupFunc } from './GridConfig';
|
import { GridConfig, GridCache, GridConfigColumns, createGridCache, GroupFunc } from './GridConfig';
|
||||||
import { ForeignKeyInfo, TableInfo, ColumnInfo, EngineDriver, NamedObjectInfo, DatabaseInfo } from '@dbgate/types';
|
import { ForeignKeyInfo, TableInfo, ColumnInfo, EngineDriver, NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
|
||||||
import { parseFilter, getFilterType } from '@dbgate/filterparser';
|
import { parseFilter, getFilterType } from 'dbgate-filterparser';
|
||||||
import { filterName } from './filterName';
|
import { filterName } from './filterName';
|
||||||
import { ChangeSetFieldDefinition, ChangeSetRowDefinition } from './ChangeSet';
|
import { ChangeSetFieldDefinition, ChangeSetRowDefinition } from './ChangeSet';
|
||||||
import { Expression, Select, treeToSql, dumpSqlSelect } from '@dbgate/sqltree';
|
import { Expression, Select, treeToSql, dumpSqlSelect } from 'dbgate-sqltree';
|
||||||
import { isTypeLogical } from '@dbgate/tools';
|
import { isTypeLogical } from 'dbgate-tools';
|
||||||
|
|
||||||
export interface DisplayColumn {
|
export interface DisplayColumn {
|
||||||
schemaName: string;
|
schemaName: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
||||||
import { QueryResultColumn } from '@dbgate/types';
|
import { QueryResultColumn } from 'dbgate-types';
|
||||||
import { GridConfig, GridCache } from './GridConfig';
|
import { GridConfig, GridCache } from './GridConfig';
|
||||||
|
|
||||||
export class JslGridDisplay extends GridDisplay {
|
export class JslGridDisplay extends GridDisplay {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { GridDisplay, ChangeCacheFunc, DisplayColumn, DisplayedColumnInfo, ChangeConfigFunc } from './GridDisplay';
|
import { GridDisplay, ChangeCacheFunc, DisplayColumn, DisplayedColumnInfo, ChangeConfigFunc } from './GridDisplay';
|
||||||
import { TableInfo, EngineDriver, ViewInfo, ColumnInfo, NamedObjectInfo, DatabaseInfo } from '@dbgate/types';
|
import { TableInfo, EngineDriver, ViewInfo, ColumnInfo, NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
|
||||||
import { GridConfig, GridCache, createGridCache } from './GridConfig';
|
import { GridConfig, GridCache, createGridCache } from './GridConfig';
|
||||||
import { Expression, Select, treeToSql, dumpSqlSelect } from '@dbgate/sqltree';
|
import { Expression, Select, treeToSql, dumpSqlSelect } from 'dbgate-sqltree';
|
||||||
import { filterName } from './filterName';
|
import { filterName } from './filterName';
|
||||||
|
|
||||||
export class TableGridDisplay extends GridDisplay {
|
export class TableGridDisplay extends GridDisplay {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
||||||
import { EngineDriver, ViewInfo, ColumnInfo } from '@dbgate/types';
|
import { EngineDriver, ViewInfo, ColumnInfo } from 'dbgate-types';
|
||||||
import { GridConfig, GridCache } from './GridConfig';
|
import { GridConfig, GridCache } from './GridConfig';
|
||||||
|
|
||||||
export class ViewGridDisplay extends GridDisplay {
|
export class ViewGridDisplay extends GridDisplay {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# @dbgate/engines
|
# dbgate-engines
|
||||||
|
|
||||||
JavaScript library implementing MySQL, MS SQL and PostgreSQL operations
|
JavaScript library implementing MySQL, MS SQL and PostgreSQL operations
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
yarn add @dbgate/engines
|
yarn add dbgate-engines
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ const fp = require('lodash/fp');
|
|||||||
class DatabaseAnalyser {
|
class DatabaseAnalyser {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('@dbgate/types').EngineDriver} driver
|
* @param {import('dbgate-types').EngineDriver} driver
|
||||||
*/
|
*/
|
||||||
constructor(pool, driver) {
|
constructor(pool, driver) {
|
||||||
this.pool = pool;
|
this.pool = pool;
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
// this.result = DatabaseAnalyser.createEmptyStructure();
|
// this.result = DatabaseAnalyser.createEmptyStructure();
|
||||||
/** @type {import('@dbgate/types').DatabaseInfo} */
|
/** @type {import('dbgate-types').DatabaseInfo} */
|
||||||
this.structure = null;
|
this.structure = null;
|
||||||
/** import('@dbgate/types').DatabaseModification[]) */
|
/** import('dbgate-types').DatabaseModification[]) */
|
||||||
this.modifications = null;
|
this.modifications = null;
|
||||||
this.singleObjectFilter = null;
|
this.singleObjectFilter = null;
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ class DatabaseAnalyser {
|
|||||||
return DatabaseAnalyser.createEmptyStructure();
|
return DatabaseAnalyser.createEmptyStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {Promise<import('@dbgate/types').DatabaseModification[]>} */
|
/** @returns {Promise<import('dbgate-types').DatabaseModification[]>} */
|
||||||
async getModifications() {
|
async getModifications() {
|
||||||
if (this.structure == null) throw new Error('DatabaseAnalyse.getModifications - structure must be filled');
|
if (this.structure == null) throw new Error('DatabaseAnalyse.getModifications - structure must be filled');
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class DatabaseAnalyser {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {import('@dbgate/types').DatabaseInfo} */
|
/** @returns {import('dbgate-types').DatabaseInfo} */
|
||||||
DatabaseAnalyser.createEmptyStructure = () => ({
|
DatabaseAnalyser.createEmptyStructure = () => ({
|
||||||
tables: [],
|
tables: [],
|
||||||
views: [],
|
views: [],
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const _ = require('lodash');
|
|||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
|
||||||
class SqlDumper {
|
class SqlDumper {
|
||||||
/** @param driver {import('@dbgate/types').EngineDriver} */
|
/** @param driver {import('dbgate-types').EngineDriver} */
|
||||||
constructor(driver) {
|
constructor(driver) {
|
||||||
this.s = '';
|
this.s = '';
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
@@ -150,7 +150,7 @@ class SqlDumper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param column {import('@dbgate/types').ColumnInfo}
|
* @param column {import('dbgate-types').ColumnInfo}
|
||||||
*/
|
*/
|
||||||
columnDefinition(column, { includeDefault = true, includeNullable = true, includeCollate = true } = {}) {
|
columnDefinition(column, { includeDefault = true, includeNullable = true, includeCollate = true } = {}) {
|
||||||
if (column.computedExpression) {
|
if (column.computedExpression) {
|
||||||
@@ -176,7 +176,7 @@ class SqlDumper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param column {import('@dbgate/types').ColumnInfo}
|
* @param column {import('dbgate-types').ColumnInfo}
|
||||||
*/
|
*/
|
||||||
columnDefault(column) {
|
columnDefault(column) {
|
||||||
if (column.defaultConstraint != null) {
|
if (column.defaultConstraint != null) {
|
||||||
@@ -202,7 +202,7 @@ class SqlDumper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param table {import('@dbgate/types').TableInfo} */
|
/** @param table {import('dbgate-types').TableInfo} */
|
||||||
createTable(table) {
|
createTable(table) {
|
||||||
this.put('^create ^table %f ( &>&n', table);
|
this.put('^create ^table %f ( &>&n', table);
|
||||||
this.putCollection(',&n', table.columns, (col) => {
|
this.putCollection(',&n', table.columns, (col) => {
|
||||||
@@ -245,7 +245,7 @@ class SqlDumper {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param fk {import('@dbgate/types').ForeignKeyInfo} */
|
/** @param fk {import('dbgate-types').ForeignKeyInfo} */
|
||||||
createForeignKeyFore(fk) {
|
createForeignKeyFore(fk) {
|
||||||
if (fk.constraintName != null) this.put('^constraint %i ', fk.constraintName);
|
if (fk.constraintName != null) this.put('^constraint %i ', fk.constraintName);
|
||||||
this.put(
|
this.put(
|
||||||
@@ -258,13 +258,13 @@ class SqlDumper {
|
|||||||
if (fk.updateAction) this.put(' ^on ^update %k', fk.updateAction);
|
if (fk.updateAction) this.put(' ^on ^update %k', fk.updateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param type {import('@dbgate/types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
transform(type, dumpExpr) {
|
transform(type, dumpExpr) {
|
||||||
dumpExpr();
|
dumpExpr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param table {import('@dbgate/types').NamedObjectInfo}
|
* @param table {import('dbgate-types').NamedObjectInfo}
|
||||||
* @param allow {boolean}
|
* @param allow {boolean}
|
||||||
*/
|
*/
|
||||||
allowIdentityInsert(table, allow) {}
|
allowIdentityInsert(table, allow) {}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
const { prepareTableForImport } = require('@dbgate/tools');
|
const { prepareTableForImport } = require('dbgate-tools');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('@dbgate/types').EngineDriver} driver
|
* @param {import('dbgate-types').EngineDriver} driver
|
||||||
*/
|
*/
|
||||||
function createBulkInsertStreamBase(driver, stream, pool, name, options) {
|
function createBulkInsertStreamBase(driver, stream, pool, name, options) {
|
||||||
const fullNameQuoted = name.schemaName
|
const fullNameQuoted = name.schemaName
|
||||||
|
|||||||
2
packages/engines/index.d.ts
vendored
2
packages/engines/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import types from "@dbgate/types";
|
import types from "dbgate-types";
|
||||||
|
|
||||||
declare function getDriver(
|
declare function getDriver(
|
||||||
connection: string | { engine: string }
|
connection: string | { engine: string }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const sql = require('./sql');
|
|||||||
|
|
||||||
const DatabaseAnalyser = require('../default/DatabaseAnalyser');
|
const DatabaseAnalyser = require('../default/DatabaseAnalyser');
|
||||||
const { filter } = require('lodash');
|
const { filter } = require('lodash');
|
||||||
const { isTypeString, isTypeNumeric } = require('@dbgate/tools');
|
const { isTypeString, isTypeNumeric } = require('dbgate-tools');
|
||||||
|
|
||||||
function objectTypeToField(type) {
|
function objectTypeToField(type) {
|
||||||
switch (type.trim()) {
|
switch (type.trim()) {
|
||||||
@@ -187,7 +187,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
|
|||||||
// object not modified
|
// object not modified
|
||||||
if (obj && Math.abs(new Date(modifyDate).getTime() - new Date(obj.modifyDate).getTime()) < 1000) return null;
|
if (obj && Math.abs(new Date(modifyDate).getTime() - new Date(obj.modifyDate).getTime()) < 1000) return null;
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').DatabaseModification} */
|
/** @type {import('dbgate-types').DatabaseModification} */
|
||||||
const action = obj
|
const action = obj
|
||||||
? {
|
? {
|
||||||
newName: { schemaName, pureName },
|
newName: { schemaName, pureName },
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class MsSqlDumper extends SqlDumper {
|
|||||||
this.putCmd('^set ^identity_insert %f %k;&n', table, allow ? 'on' : 'off');
|
this.putCmd('^set ^identity_insert %f %k;&n', table, allow ? 'on' : 'off');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param type {import('@dbgate/types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
transform(type, dumpExpr) {
|
transform(type, dumpExpr) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'GROUP:YEAR':
|
case 'GROUP:YEAR':
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const createBulkInsertStreamBase = require('../default/createBulkInsertStreamBas
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('@dbgate/types').EngineDriver} driver
|
* @param {import('dbgate-types').EngineDriver} driver
|
||||||
*/
|
*/
|
||||||
function createBulkInsertStream(driver, mssql, stream, pool, name, options) {
|
function createBulkInsertStream(driver, mssql, stream, pool, name, options) {
|
||||||
const writable = createBulkInsertStreamBase(driver, stream, pool, name, options);
|
const writable = createBulkInsertStreamBase(driver, stream, pool, name, options);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const MsSqlDumper = require('./MsSqlDumper');
|
|||||||
const createBulkInsertStream = require('./createBulkInsertStream');
|
const createBulkInsertStream = require('./createBulkInsertStream');
|
||||||
const driverBase = require('../default/driverBase');
|
const driverBase = require('../default/driverBase');
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
const dialect = {
|
const dialect = {
|
||||||
limitSelect: true,
|
limitSelect: true,
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
@@ -51,7 +51,7 @@ function extractColumns(columns) {
|
|||||||
return [res, mapper];
|
return [res, mapper];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').EngineDriver} */
|
/** @type {import('dbgate-types').EngineDriver} */
|
||||||
const driver = {
|
const driver = {
|
||||||
...driverBase,
|
...driverBase,
|
||||||
analyserClass: MsSqlAnalyser,
|
analyserClass: MsSqlAnalyser,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const _ = require('lodash');
|
|||||||
const sql = require('./sql');
|
const sql = require('./sql');
|
||||||
|
|
||||||
const DatabaseAnalayser = require('../default/DatabaseAnalyser');
|
const DatabaseAnalayser = require('../default/DatabaseAnalyser');
|
||||||
const { isTypeString, isTypeNumeric } = require('@dbgate/tools');
|
const { isTypeString, isTypeNumeric } = require('dbgate-tools');
|
||||||
const { rangeStep } = require('lodash/fp');
|
const { rangeStep } = require('lodash/fp');
|
||||||
|
|
||||||
function getColumnInfo({
|
function getColumnInfo({
|
||||||
@@ -191,7 +191,7 @@ class MySqlAnalyser extends DatabaseAnalayser {
|
|||||||
|
|
||||||
// console.log('MODIFICATION OF ', field, pureName, modifyDate, obj.modifyDate);
|
// console.log('MODIFICATION OF ', field, pureName, modifyDate, obj.modifyDate);
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').DatabaseModification} */
|
/** @type {import('dbgate-types').DatabaseModification} */
|
||||||
const action = obj
|
const action = obj
|
||||||
? {
|
? {
|
||||||
newName: { pureName },
|
newName: { pureName },
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const SqlDumper = require('../default/SqlDumper');
|
const SqlDumper = require('../default/SqlDumper');
|
||||||
|
|
||||||
class MySqlDumper extends SqlDumper {
|
class MySqlDumper extends SqlDumper {
|
||||||
/** @param type {import('@dbgate/types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
transform(type, dumpExpr) {
|
transform(type, dumpExpr) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'GROUP:YEAR':
|
case 'GROUP:YEAR':
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const driverBase = require('../default/driverBase');
|
|||||||
const MySqlAnalyser = require('./MySqlAnalyser');
|
const MySqlAnalyser = require('./MySqlAnalyser');
|
||||||
const MySqlDumper = require('./MySqlDumper');
|
const MySqlDumper = require('./MySqlDumper');
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
const dialect = {
|
const dialect = {
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
stringEscapeChar: '\\',
|
stringEscapeChar: '\\',
|
||||||
@@ -20,7 +20,7 @@ function extractColumns(fields) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').EngineDriver} */
|
/** @type {import('dbgate-types').EngineDriver} */
|
||||||
const driver = {
|
const driver = {
|
||||||
...driverBase,
|
...driverBase,
|
||||||
analyserClass: MySqlAnalyser,
|
analyserClass: MySqlAnalyser,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbgate/engines",
|
"name": "dbgate-engines",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"typings": "./index.d.ts",
|
"typings": "./index.d.ts",
|
||||||
@@ -14,13 +14,13 @@
|
|||||||
"license": "GPL",
|
"license": "GPL",
|
||||||
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/lodash": "^4.14.149",
|
"@types/lodash": "^4.14.149",
|
||||||
"nodemon": "^2.0.2",
|
"nodemon": "^2.0.2",
|
||||||
"typescript": "^3.7.5"
|
"typescript": "^3.7.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"@dbgate/tools": "^1.0.0"
|
"dbgate-tools": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const _ = require('lodash');
|
|||||||
const sql = require('./sql');
|
const sql = require('./sql');
|
||||||
|
|
||||||
const DatabaseAnalayser = require('../default/DatabaseAnalyser');
|
const DatabaseAnalayser = require('../default/DatabaseAnalyser');
|
||||||
const { isTypeString, isTypeNumeric } = require('@dbgate/tools');
|
const { isTypeString, isTypeNumeric } = require('dbgate-tools');
|
||||||
|
|
||||||
function normalizeTypeName(dataType) {
|
function normalizeTypeName(dataType) {
|
||||||
if (dataType == 'character varying') return 'varchar';
|
if (dataType == 'character varying') return 'varchar';
|
||||||
@@ -127,7 +127,7 @@ class PostgreAnalyser extends DatabaseAnalayser {
|
|||||||
|
|
||||||
// console.log('MODIFICATION OF ', objectTypeField, schemaName, pureName);
|
// console.log('MODIFICATION OF ', objectTypeField, schemaName, pureName);
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').DatabaseModification} */
|
/** @type {import('dbgate-types').DatabaseModification} */
|
||||||
const action = obj
|
const action = obj
|
||||||
? {
|
? {
|
||||||
newName: { schemaName, pureName },
|
newName: { schemaName, pureName },
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const SqlDumper = require('../default/SqlDumper');
|
const SqlDumper = require('../default/SqlDumper');
|
||||||
|
|
||||||
class PostgreDumper extends SqlDumper {
|
class PostgreDumper extends SqlDumper {
|
||||||
/** @param type {import('@dbgate/types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
transform(type, dumpExpr) {
|
transform(type, dumpExpr) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'GROUP:YEAR':
|
case 'GROUP:YEAR':
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const driverBase = require('../default/driverBase');
|
|||||||
const PostgreAnalyser = require('./PostgreAnalyser');
|
const PostgreAnalyser = require('./PostgreAnalyser');
|
||||||
const PostgreDumper = require('./PostgreDumper');
|
const PostgreDumper = require('./PostgreDumper');
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
const dialect = {
|
const dialect = {
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
// stringEscapeChar: '\\',
|
// stringEscapeChar: '\\',
|
||||||
@@ -14,7 +14,7 @@ const dialect = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @type {import('@dbgate/types').EngineDriver} */
|
/** @type {import('dbgate-types').EngineDriver} */
|
||||||
const driver = {
|
const driver = {
|
||||||
...driverBase,
|
...driverBase,
|
||||||
analyserClass: PostgreAnalyser,
|
analyserClass: PostgreAnalyser,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"name": "@dbgate/filterparser",
|
"name": "dbgate-filterparser",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/jest": "^25.1.4",
|
"@types/jest": "^25.1.4",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^13.7.0",
|
||||||
"jest": "^24.9.0",
|
"jest": "^24.9.0",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/parsimmon": "^1.10.1",
|
"@types/parsimmon": "^1.10.1",
|
||||||
"@dbgate/tools": "^1.0.0",
|
"dbgate-tools": "^1.0.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"parsimmon": "^1.13.0"
|
"parsimmon": "^1.13.0"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { parseFilter } from './parseFilter';
|
import { parseFilter } from './parseFilter';
|
||||||
import { FilterType } from './types';
|
import { FilterType } from './types';
|
||||||
import engines from '@dbgate/engines';
|
import engines from 'dbgate-engines';
|
||||||
import { dumpSqlCondition, treeToSql } from '@dbgate/sqltree';
|
import { dumpSqlCondition, treeToSql } from 'dbgate-sqltree';
|
||||||
|
|
||||||
const ast = parseFilter(process.argv[2], process.argv[3] as FilterType);
|
const ast = parseFilter(process.argv[2], process.argv[3] as FilterType);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { isTypeDateTime } from '@dbgate/tools';
|
import { isTypeDateTime } from 'dbgate-tools';
|
||||||
|
|
||||||
export type FilterMultipleValuesMode = 'is' | 'is_not' | 'contains' | 'begins' | 'ends';
|
export type FilterMultipleValuesMode = 'is' | 'is_not' | 'contains' | 'begins' | 'ends';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { isTypeNumber, isTypeString, isTypeLogical, isTypeDateTime } from '@dbgate/tools';
|
import { isTypeNumber, isTypeString, isTypeLogical, isTypeDateTime } from 'dbgate-tools';
|
||||||
import { FilterType } from './types';
|
import { FilterType } from './types';
|
||||||
|
|
||||||
export function getFilterType(dataType: string): FilterType {
|
export function getFilterType(dataType: string): FilterType {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import P from 'parsimmon';
|
import P from 'parsimmon';
|
||||||
import { FilterType } from './types';
|
import { FilterType } from './types';
|
||||||
import { Condition } from '@dbgate/sqltree';
|
import { Condition } from 'dbgate-sqltree';
|
||||||
import { TransformType } from '@dbgate/types';
|
import { TransformType } from 'dbgate-types';
|
||||||
|
|
||||||
const whitespace = P.regexp(/\s*/m);
|
const whitespace = P.regexp(/\s*/m);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// import types from '@dbgate/types';
|
// import types from 'dbgate-types';
|
||||||
|
|
||||||
export type FilterType = 'number' | 'string' | 'datetime' | 'logical';
|
export type FilterType = 'number' | 'string' | 'datetime' | 'logical';
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# @dbgate/sqltree
|
# dbgate-sqltree
|
||||||
|
|
||||||
JavaScript/TypeScript SQL query-builder library
|
JavaScript/TypeScript SQL query-builder library
|
||||||
|
|
||||||
@dbgate/sqltree hold query definition in RAW JSON objects.
|
dbgate-sqltree hold query definition in RAW JSON objects.
|
||||||
|
|
||||||
## Sample usage
|
## Sample usage
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const { treeToSql, dumpSqlSelect } = require('@dbgate/sqltree');
|
const { treeToSql, dumpSqlSelect } = require('dbgate-sqltree');
|
||||||
const engines = require('@dbgate/engines');
|
const engines = require('dbgate-engines');
|
||||||
|
|
||||||
const select = {
|
const select = {
|
||||||
commandType: 'select',
|
commandType: 'select',
|
||||||
@@ -36,4 +36,4 @@ console.log('Generated SQL', sqll);
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
yarn add @dbgate/sqltree
|
yarn add dbgate-sqltree
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"name": "@dbgate/sqltree",
|
"name": "dbgate-sqltree",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^13.7.0",
|
||||||
"typescript": "^3.7.5"
|
"typescript": "^3.7.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SqlDumper } from '@dbgate/types';
|
import { SqlDumper } from 'dbgate-types';
|
||||||
import { Command, Select, Update, Delete, Insert } from './types';
|
import { Command, Select, Update, Delete, Insert } from './types';
|
||||||
import { dumpSqlExpression } from './dumpSqlExpression';
|
import { dumpSqlExpression } from './dumpSqlExpression';
|
||||||
import { dumpSqlFromDefinition, dumpSqlSourceRef } from './dumpSqlSource';
|
import { dumpSqlFromDefinition, dumpSqlSourceRef } from './dumpSqlSource';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SqlDumper } from '@dbgate/types';
|
import { SqlDumper } from 'dbgate-types';
|
||||||
import { Condition, BinaryCondition } from './types';
|
import { Condition, BinaryCondition } from './types';
|
||||||
import { dumpSqlExpression } from './dumpSqlExpression';
|
import { dumpSqlExpression } from './dumpSqlExpression';
|
||||||
import { link } from 'fs';
|
import { link } from 'fs';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { SqlDumper } from '@dbgate/types';
|
import { SqlDumper } from 'dbgate-types';
|
||||||
import { Expression, ColumnRefExpression } from './types';
|
import { Expression, ColumnRefExpression } from './types';
|
||||||
import { dumpSqlSourceRef } from './dumpSqlSource';
|
import { dumpSqlSourceRef } from './dumpSqlSource';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Source, FromDefinition, Relation } from './types';
|
import { Source, FromDefinition, Relation } from './types';
|
||||||
import { SqlDumper } from '@dbgate/types';
|
import { SqlDumper } from 'dbgate-types';
|
||||||
import { dumpSqlSelect } from './dumpSqlCommand';
|
import { dumpSqlSelect } from './dumpSqlCommand';
|
||||||
import { dumpSqlCondition } from './dumpSqlCondition';
|
import { dumpSqlCondition } from './dumpSqlCondition';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { NamedObjectInfo, RangeDefinition, TransformType } from '@dbgate/types';
|
import { NamedObjectInfo, RangeDefinition, TransformType } from 'dbgate-types';
|
||||||
|
|
||||||
// export interface Command {
|
// export interface Command {
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EngineDriver, SqlDumper } from '@dbgate/types';
|
import { EngineDriver, SqlDumper } from 'dbgate-types';
|
||||||
import { Command } from './types';
|
import { Command } from './types';
|
||||||
import { dumpSqlCommand } from './dumpSqlCommand';
|
import { dumpSqlCommand } from './dumpSqlCommand';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"name": "@dbgate/tools",
|
"name": "dbgate-tools",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^13.7.0",
|
||||||
"jest": "^24.9.0",
|
"jest": "^24.9.0",
|
||||||
"ts-jest": "^25.2.1",
|
"ts-jest": "^25.2.1",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DatabaseInfo, DatabaseInfoObjects } from '@dbgate/types';
|
import { DatabaseInfo, DatabaseInfoObjects } from 'dbgate-types';
|
||||||
|
|
||||||
export function fullNameFromString(name) {
|
export function fullNameFromString(name) {
|
||||||
const m = name.match(/\[([^\]]+)\]\.\[([^\]]+)\]/);
|
const m = name.match(/\[([^\]]+)\]\.\[([^\]]+)\]/);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TableInfo } from '@dbgate/types';
|
import { TableInfo } from 'dbgate-types';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
export function prepareTableForImport(table: TableInfo): TableInfo {
|
export function prepareTableForImport(table: TableInfo): TableInfo {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# @dbgate/types
|
# dbgate-types
|
||||||
|
|
||||||
Typescript definitions for DbGate app
|
Typescript definitions for DbGate app
|
||||||
|
|
||||||
@@ -11,4 +11,4 @@ Typescript definitions for DbGate app
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
yarn add --dev @dbgate/types
|
yarn add --dev dbgate-types
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"name": "@dbgate/types",
|
"name": "dbgate-types",
|
||||||
|
|
||||||
"homepage": "https://dbgate.org/",
|
"homepage": "https://dbgate.org/",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbgate/web",
|
"name": "dbgate-web",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/colors": "^5.0.0",
|
"@ant-design/colors": "^5.0.0",
|
||||||
"@dbgate/datalib": "^1.0.0",
|
"dbgate-datalib": "^1.0.0",
|
||||||
"@dbgate/engines": "^1.0.0",
|
"dbgate-engines": "^1.0.0",
|
||||||
"@dbgate/sqltree": "^1.0.0",
|
"dbgate-sqltree": "^1.0.0",
|
||||||
"@mdi/font": "^5.8.55",
|
"@mdi/font": "^5.8.55",
|
||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.3.2",
|
"@testing-library/react": "^9.3.2",
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dbgate/types": "^1.0.0",
|
"dbgate-types": "^1.0.0",
|
||||||
"@types/react": "^16.9.17",
|
"@types/react": "^16.9.17",
|
||||||
"@types/styled-components": "^4.4.2",
|
"@types/styled-components": "^4.4.2",
|
||||||
"typescript": "^3.7.4"
|
"typescript": "^3.7.4"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
|
|
||||||
const macroAppObject = () => ({ name, type, title, group }, { setOpenedTabs }) => {
|
const macroAppObject = () => ({ name, type, title, group }, { setOpenedTabs }) => {
|
||||||
const key = name;
|
const key = name;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _ from 'lodash';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { DropDownMenuItem } from '../modals/DropDownMenu';
|
import { DropDownMenuItem } from '../modals/DropDownMenu';
|
||||||
import { openNewTab } from '../utility/common';
|
import { openNewTab } from '../utility/common';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
|
|
||||||
function openArchive(setOpenedTabs, fileName, folderName) {
|
function openArchive(setOpenedTabs, fileName, folderName) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _ from 'lodash';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { DropDownMenuItem } from '../modals/DropDownMenu';
|
import { DropDownMenuItem } from '../modals/DropDownMenu';
|
||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
|
|
||||||
function Menu({ data, setOpenedTabs }) {
|
function Menu({ data, setOpenedTabs }) {
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
/** @param columnProps {import('@dbgate/types').ColumnInfo} */
|
/** @param columnProps {import('dbgate-types').ColumnInfo} */
|
||||||
function getColumnIcon(columnProps) {
|
function getColumnIcon(columnProps) {
|
||||||
if (columnProps.autoIncrement) return 'img autoincrement';
|
if (columnProps.autoIncrement) return 'img autoincrement';
|
||||||
return 'img column';
|
return 'img column';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param columnProps {import('@dbgate/types').ColumnInfo} */
|
/** @param columnProps {import('dbgate-types').ColumnInfo} */
|
||||||
export default function columnAppObject(columnProps, { setOpenedTabs }) {
|
export default function columnAppObject(columnProps, { setOpenedTabs }) {
|
||||||
const title = columnProps.columnName;
|
const title = columnProps.columnName;
|
||||||
const key = title;
|
const key = title;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React from 'react';
|
|||||||
import { DropDownMenuItem } from '../modals/DropDownMenu';
|
import { DropDownMenuItem } from '../modals/DropDownMenu';
|
||||||
import ConnectionModal from '../modals/ConnectionModal';
|
import ConnectionModal from '../modals/ConnectionModal';
|
||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
import ConfirmModal from '../modals/ConfirmModal';
|
import ConfirmModal from '../modals/ConfirmModal';
|
||||||
import CreateDatabaseModal from '../modals/CreateDatabaseModal';
|
import CreateDatabaseModal from '../modals/CreateDatabaseModal';
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/** @param props {import('@dbgate/types').ConstraintInfo} */
|
/** @param props {import('dbgate-types').ConstraintInfo} */
|
||||||
function getConstraintIcon(props) {
|
function getConstraintIcon(props) {
|
||||||
if (props.constraintType == 'primaryKey') return 'img primary-key';
|
if (props.constraintType == 'primaryKey') return 'img primary-key';
|
||||||
if (props.constraintType == 'foreignKey') return 'img foreign-key';
|
if (props.constraintType == 'foreignKey') return 'img foreign-key';
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param props {import('@dbgate/types').ConstraintInfo} */
|
/** @param props {import('dbgate-types').ConstraintInfo} */
|
||||||
export default function constraintAppObject(props, { setOpenedTabs }) {
|
export default function constraintAppObject(props, { setOpenedTabs }) {
|
||||||
const title = props.constraintName;
|
const title = props.constraintName;
|
||||||
const key = title;
|
const key = title;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { DropDownMenuItem } from '../modals/DropDownMenu';
|
|||||||
import { openNewTab } from '../utility/common';
|
import { openNewTab } from '../utility/common';
|
||||||
import { getConnectionInfo } from '../utility/metadataLoaders';
|
import { getConnectionInfo } from '../utility/metadataLoaders';
|
||||||
import fullDisplayName from '../utility/fullDisplayName';
|
import fullDisplayName from '../utility/fullDisplayName';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
import ImportExportModal from '../modals/ImportExportModal';
|
import ImportExportModal from '../modals/ImportExportModal';
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
GridDisplay,
|
GridDisplay,
|
||||||
revertChangeSetRowChanges,
|
revertChangeSetRowChanges,
|
||||||
setChangeSetValue,
|
setChangeSetValue,
|
||||||
} from '@dbgate/datalib';
|
} from 'dbgate-datalib';
|
||||||
import Grider, { GriderRowStatus } from './Grider';
|
import Grider, { GriderRowStatus } from './Grider';
|
||||||
|
|
||||||
export default class ChangeSetGrider extends Grider {
|
export default class ChangeSetGrider extends Grider {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import ColumnLabel from './ColumnLabel';
|
|||||||
import DropDownButton from '../widgets/DropDownButton';
|
import DropDownButton from '../widgets/DropDownButton';
|
||||||
import { DropDownMenuItem, DropDownMenuDivider } from '../modals/DropDownMenu';
|
import { DropDownMenuItem, DropDownMenuDivider } from '../modals/DropDownMenu';
|
||||||
import { useSplitterDrag } from '../widgets/Splitter';
|
import { useSplitterDrag } from '../widgets/Splitter';
|
||||||
import { isTypeDateTime } from '@dbgate/tools';
|
import { isTypeDateTime } from 'dbgate-tools';
|
||||||
import { openDatabaseObjectDetail } from '../appobj/databaseObjectAppObject';
|
import { openDatabaseObjectDetail } from '../appobj/databaseObjectAppObject';
|
||||||
import { useSetOpenedTabs } from '../utility/globalState';
|
import { useSetOpenedTabs } from '../utility/globalState';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const Label = styled.span`
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
/** @param column {import('@dbgate/datalib').DisplayColumn|import('@dbgate/types').ColumnInfo} */
|
/** @param column {import('dbgate-datalib').DisplayColumn|import('dbgate-types').ColumnInfo} */
|
||||||
export default function ColumnLabel(column) {
|
export default function ColumnLabel(column) {
|
||||||
let icon = null;
|
let icon = null;
|
||||||
if (column.autoIncrement) icon = 'img autoincrement';
|
if (column.autoIncrement) icon = 'img autoincrement';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import ColumnLabel from './ColumnLabel';
|
import ColumnLabel from './ColumnLabel';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
import { ExpandIcon } from '../icons';
|
import { ExpandIcon } from '../icons';
|
||||||
import InlineButton from '../widgets/InlineButton';
|
import InlineButton from '../widgets/InlineButton';
|
||||||
import { ManagerInnerContainer } from './ManagerStyles';
|
import { ManagerInnerContainer } from './ManagerStyles';
|
||||||
@@ -34,8 +34,8 @@ const Button = styled.button`
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {object} props
|
* @param {object} props
|
||||||
* @param {import('@dbgate/datalib').GridDisplay} props.display
|
* @param {import('dbgate-datalib').GridDisplay} props.display
|
||||||
* @param {import('@dbgate/datalib').DisplayColumn} props.column
|
* @param {import('dbgate-datalib').DisplayColumn} props.column
|
||||||
*/
|
*/
|
||||||
function ColumnManagerRow(props) {
|
function ColumnManagerRow(props) {
|
||||||
const { display, column } = props;
|
const { display, column } = props;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React from 'react';
|
|||||||
import { DropDownMenuItem, DropDownMenuDivider, showMenu } from '../modals/DropDownMenu';
|
import { DropDownMenuItem, DropDownMenuDivider, showMenu } from '../modals/DropDownMenu';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
import { parseFilter, createMultiLineFilter } from '@dbgate/filterparser';
|
import { parseFilter, createMultiLineFilter } from 'dbgate-filterparser';
|
||||||
import InlineButton from '../widgets/InlineButton';
|
import InlineButton from '../widgets/InlineButton';
|
||||||
import useShowModal from '../modals/showModal';
|
import useShowModal from '../modals/showModal';
|
||||||
import FilterMultipleValuesModal from '../modals/FilterMultipleValuesModal';
|
import FilterMultipleValuesModal from '../modals/FilterMultipleValuesModal';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import ReferenceManager from './ReferenceManager';
|
|||||||
import { HorizontalSplitter } from '../widgets/Splitter';
|
import { HorizontalSplitter } from '../widgets/Splitter';
|
||||||
import WidgetColumnBar, { WidgetColumnBarItem } from '../widgets/WidgetColumnBar';
|
import WidgetColumnBar, { WidgetColumnBarItem } from '../widgets/WidgetColumnBar';
|
||||||
import CellDataView from '../celldata/CellDataView';
|
import CellDataView from '../celldata/CellDataView';
|
||||||
import { FreeTableGridDisplay } from '@dbgate/datalib';
|
import { FreeTableGridDisplay } from 'dbgate-datalib';
|
||||||
import useTheme from '../theme/useTheme';
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
const LeftContainer = styled.div`
|
const LeftContainer = styled.div`
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { HorizontalScrollBar, VerticalScrollBar } from './ScrollBars';
|
|||||||
import useDimensions from '../utility/useDimensions';
|
import useDimensions from '../utility/useDimensions';
|
||||||
import DataFilterControl from './DataFilterControl';
|
import DataFilterControl from './DataFilterControl';
|
||||||
import stableStringify from 'json-stable-stringify';
|
import stableStringify from 'json-stable-stringify';
|
||||||
import { getFilterType, getFilterValueExpression } from '@dbgate/filterparser';
|
import { getFilterType, getFilterValueExpression } from 'dbgate-filterparser';
|
||||||
import { cellFromEvent, getCellRange, topLeftCell, isRegularCell, nullCell, emptyCellArray } from './selection';
|
import { cellFromEvent, getCellRange, topLeftCell, isRegularCell, nullCell, emptyCellArray } from './selection';
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
import DataGridRow from './DataGridRow';
|
import DataGridRow from './DataGridRow';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import InplaceEditor from './InplaceEditor';
|
import InplaceEditor from './InplaceEditor';
|
||||||
import { cellIsSelected } from './gridutil';
|
import { cellIsSelected } from './gridutil';
|
||||||
import { isTypeLogical } from '@dbgate/tools';
|
import { isTypeLogical } from 'dbgate-tools';
|
||||||
import useTheme from '../theme/useTheme';
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
const TableBodyCell = styled.td`
|
const TableBodyCell = styled.td`
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { ManagerInnerContainer } from './ManagerStyles';
|
import { ManagerInnerContainer } from './ManagerStyles';
|
||||||
import SearchInput from '../widgets/SearchInput';
|
import SearchInput from '../widgets/SearchInput';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from 'dbgate-datalib';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
import useTheme from '../theme/useTheme';
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import DataGridCore from './DataGridCore';
|
|||||||
import useSocket from '../utility/SocketProvider';
|
import useSocket from '../utility/SocketProvider';
|
||||||
import useShowModal from '../modals/showModal';
|
import useShowModal from '../modals/showModal';
|
||||||
import ImportExportModal from '../modals/ImportExportModal';
|
import ImportExportModal from '../modals/ImportExportModal';
|
||||||
import { changeSetToSql, createChangeSet, getChangeSetInsertedRows } from '@dbgate/datalib';
|
import { changeSetToSql, createChangeSet, getChangeSetInsertedRows } from 'dbgate-datalib';
|
||||||
import { openNewTab } from '../utility/common';
|
import { openNewTab } from '../utility/common';
|
||||||
import LoadingDataGridCore from './LoadingDataGridCore';
|
import LoadingDataGridCore from './LoadingDataGridCore';
|
||||||
import ChangeSetGrider from './ChangeSetGrider';
|
import ChangeSetGrider from './ChangeSetGrider';
|
||||||
import { scriptToSql } from '@dbgate/sqltree';
|
import { scriptToSql } from 'dbgate-sqltree';
|
||||||
import useModalState from '../modals/useModalState';
|
import useModalState from '../modals/useModalState';
|
||||||
import ConfirmSqlModal from '../modals/ConfirmSqlModal';
|
import ConfirmSqlModal from '../modals/ConfirmSqlModal';
|
||||||
import ErrorMessageModal from '../modals/ErrorMessageModal';
|
import ErrorMessageModal from '../modals/ErrorMessageModal';
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import React from 'react';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import DataGrid from './DataGrid';
|
import DataGrid from './DataGrid';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { TableGridDisplay, createGridConfig, createGridCache } from '@dbgate/datalib';
|
import { TableGridDisplay, createGridConfig, createGridCache } from 'dbgate-datalib';
|
||||||
import { getFilterValueExpression } from '@dbgate/filterparser';
|
import { getFilterValueExpression } from 'dbgate-filterparser';
|
||||||
import { useConnectionInfo, getTableInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, getTableInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import engines from '@dbgate/engines';
|
import engines from 'dbgate-engines';
|
||||||
import useSocket from '../utility/SocketProvider';
|
import useSocket from '../utility/SocketProvider';
|
||||||
import { VerticalSplitter } from '../widgets/Splitter';
|
import { VerticalSplitter } from '../widgets/Splitter';
|
||||||
import stableStringify from 'json-stable-stringify';
|
import stableStringify from 'json-stable-stringify';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { SeriesSizes } from './SeriesSizes';
|
import { SeriesSizes } from './SeriesSizes';
|
||||||
import { CellAddress } from './selection';
|
import { CellAddress } from './selection';
|
||||||
import { GridDisplay } from '@dbgate/datalib';
|
import { GridDisplay } from 'dbgate-datalib';
|
||||||
import Grider from './Grider';
|
import Grider from './Grider';
|
||||||
|
|
||||||
export function countColumnSizes(grider: Grider, columns, containerWidth, display: GridDisplay) {
|
export function countColumnSizes(grider: Grider, columns, containerWidth, display: GridDisplay) {
|
||||||
@@ -89,7 +89,7 @@ export function countVisibleRealColumns(columnSizes, firstVisibleColumnScrollInd
|
|||||||
|
|
||||||
const visibleRealColumnIndexes = [];
|
const visibleRealColumnIndexes = [];
|
||||||
const modelIndexes = {};
|
const modelIndexes = {};
|
||||||
/** @type {(import('@dbgate/datalib').DisplayColumn & {widthPx: string; colIndex: number})[]} */
|
/** @type {(import('dbgate-datalib').DisplayColumn & {widthPx: string; colIndex: number})[]} */
|
||||||
const realColumns = [];
|
const realColumns = [];
|
||||||
|
|
||||||
// frozen columns
|
// frozen columns
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { GridDisplay, ChangeSet, GridReferenceDefinition } from '@dbgate/datalib';
|
import { GridDisplay, ChangeSet, GridReferenceDefinition } from 'dbgate-datalib';
|
||||||
import Grider from './Grider';
|
import Grider from './Grider';
|
||||||
|
|
||||||
export interface DataGridProps {
|
export interface DataGridProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { runMacro } from '@dbgate/datalib';
|
import { runMacro } from 'dbgate-datalib';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createGridCache, FreeTableGridDisplay } from '@dbgate/datalib';
|
import { createGridCache, FreeTableGridDisplay } from 'dbgate-datalib';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import DataGridCore from '../datagrid/DataGridCore';
|
import DataGridCore from '../datagrid/DataGridCore';
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FreeTableModel } from '@dbgate/datalib';
|
import { FreeTableModel } from 'dbgate-datalib';
|
||||||
import Grider, { GriderRowStatus } from '../datagrid/Grider';
|
import Grider, { GriderRowStatus } from '../datagrid/Grider';
|
||||||
|
|
||||||
export default class FreeTableGrider extends Grider {
|
export default class FreeTableGrider extends Grider {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FreeTableModel, MacroDefinition, MacroSelectedCell, runMacro } from '@dbgate/datalib';
|
import { FreeTableModel, MacroDefinition, MacroSelectedCell, runMacro } from 'dbgate-datalib';
|
||||||
import Grider, { GriderRowStatus } from '../datagrid/Grider';
|
import Grider, { GriderRowStatus } from '../datagrid/Grider';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ async function addFilesToSourceList(files, values, setFieldValue, preferedStorag
|
|||||||
if (isFileStorage(storage)) {
|
if (isFileStorage(storage)) {
|
||||||
if (storage == 'excel') {
|
if (storage == 'excel') {
|
||||||
const resp = await axios.get(`files/analyse-excel?filePath=${encodeURIComponent(file.full)}`);
|
const resp = await axios.get(`files/analyse-excel?filePath=${encodeURIComponent(file.full)}`);
|
||||||
/** @type {import('@dbgate/types').DatabaseInfo} */
|
/** @type {import('dbgate-types').DatabaseInfo} */
|
||||||
const structure = resp.data;
|
const structure = resp.data;
|
||||||
for (const table of structure.tables) {
|
for (const table of structure.tables) {
|
||||||
const sourceName = table.pureName;
|
const sourceName = table.pureName;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createGridCache, createGridConfig, FreeTableGridDisplay } from '@dbgate/datalib';
|
import { createGridCache, createGridConfig, FreeTableGridDisplay } from 'dbgate-datalib';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import DataGridCore from '../datagrid/DataGridCore';
|
import DataGridCore from '../datagrid/DataGridCore';
|
||||||
import RowsArrayGrider from '../datagrid/RowsArrayGrider';
|
import RowsArrayGrider from '../datagrid/RowsArrayGrider';
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import _ from 'lodash';
|
|||||||
import ScriptWriter from './ScriptWriter';
|
import ScriptWriter from './ScriptWriter';
|
||||||
import getAsArray from '../utility/getAsArray';
|
import getAsArray from '../utility/getAsArray';
|
||||||
import { getConnectionInfo } from '../utility/metadataLoaders';
|
import { getConnectionInfo } from '../utility/metadataLoaders';
|
||||||
import engines from '@dbgate/engines';
|
import engines from 'dbgate-engines';
|
||||||
import { findObjectLike } from '@dbgate/tools';
|
import { findObjectLike } from 'dbgate-tools';
|
||||||
|
|
||||||
export function getTargetName(source, values) {
|
export function getTargetName(source, values) {
|
||||||
const key = `targetName_${source}`;
|
const key = `targetName_${source}`;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export default function InsertJoinModal({ sql, modalState, engine, dbinfo, onIns
|
|||||||
const targets = React.useMemo(() => {
|
const targets = React.useMemo(() => {
|
||||||
const source = sources[sourceIndex];
|
const source = sources[sourceIndex];
|
||||||
if (!source) return [];
|
if (!source) return [];
|
||||||
/** @type {import('@dbgate/types').TableInfo} */
|
/** @type {import('dbgate-types').TableInfo} */
|
||||||
const table = dbinfo.tables.find((x) => x.pureName == sources[sourceIndex].name);
|
const table = dbinfo.tables.find((x) => x.pureName == sources[sourceIndex].name);
|
||||||
if (!table) return [];
|
if (!table) return [];
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import DataGrid from '../datagrid/DataGrid';
|
import DataGrid from '../datagrid/DataGrid';
|
||||||
import { JslGridDisplay, createGridConfig, createGridCache } from '@dbgate/datalib';
|
import { JslGridDisplay, createGridConfig, createGridCache } from 'dbgate-datalib';
|
||||||
import useFetch from '../utility/useFetch';
|
import useFetch from '../utility/useFetch';
|
||||||
import JslDataGridCore from '../datagrid/JslDataGridCore';
|
import JslDataGridCore from '../datagrid/JslDataGridCore';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { createGridCache, createChangeSet, createGridConfig, createFreeTableModel } from '@dbgate/datalib';
|
import { createGridCache, createChangeSet, createGridConfig, createFreeTableModel } from 'dbgate-datalib';
|
||||||
import useUndoReducer from '../utility/useUndoReducer';
|
import useUndoReducer from '../utility/useUndoReducer';
|
||||||
import usePropsCompare from '../utility/usePropsCompare';
|
import usePropsCompare from '../utility/usePropsCompare';
|
||||||
import { useSetOpenedTabs, useUpdateDatabaseForTab } from '../utility/globalState';
|
import { useSetOpenedTabs, useUpdateDatabaseForTab } from '../utility/globalState';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
import engines from '@dbgate/engines';
|
import engines from 'dbgate-engines';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useConnectionInfo,
|
useConnectionInfo,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
import engines from '@dbgate/engines';
|
import engines from 'dbgate-engines';
|
||||||
|
|
||||||
import { useConnectionInfo, getTableInfo, getConnectionInfo, getSqlObjectInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, getTableInfo, getConnectionInfo, getSqlObjectInfo } from '../utility/metadataLoaders';
|
||||||
import SqlEditor from '../sqleditor/SqlEditor';
|
import SqlEditor from '../sqleditor/SqlEditor';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { createGridCache, createChangeSet, createGridConfig } from '@dbgate/datalib';
|
import { createGridCache, createChangeSet, createGridConfig } from 'dbgate-datalib';
|
||||||
import useUndoReducer from '../utility/useUndoReducer';
|
import useUndoReducer from '../utility/useUndoReducer';
|
||||||
import usePropsCompare from '../utility/usePropsCompare';
|
import usePropsCompare from '../utility/usePropsCompare';
|
||||||
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import DataGrid from '../datagrid/DataGrid';
|
import DataGrid from '../datagrid/DataGrid';
|
||||||
import { ViewGridDisplay, createGridCache, createChangeSet } from '@dbgate/datalib';
|
import { ViewGridDisplay, createGridCache, createChangeSet } from 'dbgate-datalib';
|
||||||
import { useConnectionInfo, useViewInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, useViewInfo } from '../utility/metadataLoaders';
|
||||||
import engines from '@dbgate/engines';
|
import engines from 'dbgate-engines';
|
||||||
import useUndoReducer from '../utility/useUndoReducer';
|
import useUndoReducer from '../utility/useUndoReducer';
|
||||||
import usePropsCompare from '../utility/usePropsCompare';
|
import usePropsCompare from '../utility/usePropsCompare';
|
||||||
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
||||||
|
|||||||
@@ -124,12 +124,12 @@ function useCore(loader, args) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {Promise<import('@dbgate/types').DatabaseInfo>} */
|
/** @returns {Promise<import('dbgate-types').DatabaseInfo>} */
|
||||||
export function getDatabaseInfo(args) {
|
export function getDatabaseInfo(args) {
|
||||||
return getCore(databaseInfoLoader, args);
|
return getCore(databaseInfoLoader, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {import('@dbgate/types').DatabaseInfo} */
|
/** @returns {import('dbgate-types').DatabaseInfo} */
|
||||||
export function useDatabaseInfo(args) {
|
export function useDatabaseInfo(args) {
|
||||||
return useCore(databaseInfoLoader, args);
|
return useCore(databaseInfoLoader, args);
|
||||||
}
|
}
|
||||||
@@ -150,22 +150,22 @@ export function useDbCore(args, objectTypeField = undefined) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {Promise<import('@dbgate/types').TableInfo>} */
|
/** @returns {Promise<import('dbgate-types').TableInfo>} */
|
||||||
export function getTableInfo(args) {
|
export function getTableInfo(args) {
|
||||||
return getDbCore(args, 'tables');
|
return getDbCore(args, 'tables');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {import('@dbgate/types').TableInfo} */
|
/** @returns {import('dbgate-types').TableInfo} */
|
||||||
export function useTableInfo(args) {
|
export function useTableInfo(args) {
|
||||||
return useDbCore(args, 'tables');
|
return useDbCore(args, 'tables');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {Promise<import('@dbgate/types').ViewInfo>} */
|
/** @returns {Promise<import('dbgate-types').ViewInfo>} */
|
||||||
export function getViewInfo(args) {
|
export function getViewInfo(args) {
|
||||||
return getDbCore(args, 'views');
|
return getDbCore(args, 'views');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {import('@dbgate/types').ViewInfo} */
|
/** @returns {import('dbgate-types').ViewInfo} */
|
||||||
export function useViewInfo(args) {
|
export function useViewInfo(args) {
|
||||||
return useDbCore(args, 'views');
|
return useDbCore(args, 'views');
|
||||||
}
|
}
|
||||||
@@ -178,12 +178,12 @@ export function useSqlObjectInfo(args) {
|
|||||||
return useDbCore(args);
|
return useDbCore(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {Promise<import('@dbgate/types').StoredConnection>} */
|
/** @returns {Promise<import('dbgate-types').StoredConnection>} */
|
||||||
export function getConnectionInfo(args) {
|
export function getConnectionInfo(args) {
|
||||||
return getCore(connectionInfoLoader, args);
|
return getCore(connectionInfoLoader, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {import('@dbgate/types').StoredConnection} */
|
/** @returns {import('dbgate-types').StoredConnection} */
|
||||||
export function useConnectionInfo(args) {
|
export function useConnectionInfo(args) {
|
||||||
return useCore(connectionInfoLoader, args);
|
return useCore(connectionInfoLoader, args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createGridConfig } from '@dbgate/datalib';
|
import { createGridConfig } from 'dbgate-datalib';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const loadGridConfigFunc = (tabid) => () => {
|
const loadGridConfigFunc = (tabid) => () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const dbgateApi = require('@dbgate/api');
|
const dbgateApi = require('dbgate-api');
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
// const queryReader = await dbgateApi.queryReader({
|
// const queryReader = await dbgateApi.queryReader({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const dbgateApi = require('@dbgate/api');
|
const dbgateApi = require('dbgate-api');
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const csvReader = await dbgateApi.csvReader({
|
const csvReader = await dbgateApi.csvReader({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const dbgateApi = require('@dbgate/api');
|
const dbgateApi = require('dbgate-api');
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const var3 = await dbgateApi.excelSheetReader({
|
const var3 = await dbgateApi.excelSheetReader({
|
||||||
|
|||||||
Reference in New Issue
Block a user