Merge branch 'feature/npm-refactor-poc'

This commit is contained in:
SPRINX0\prochazka
2024-11-14 15:40:17 +01:00
61 changed files with 455 additions and 359 deletions

View File

@@ -47,9 +47,6 @@ jobs:
yarn printSecrets
env:
GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}}
- name: fillNativeModulesElectron
run: |
yarn fillNativeModulesElectron
- name: fillPackagedPlugins
run: |
yarn fillPackagedPlugins

View File

@@ -55,11 +55,11 @@ jobs:
cd ..
cd dbgate-merged
yarn adjustPackageJson
- name: adjustPackageJsonPremium
- name: adjustAppPackageJsonPremium
run: |
cd ..
cd dbgate-merged
node adjustPackageJsonPremium
node adjustAppPackageJsonPremium
- name: setUpdaterChannel premium-beta
run: |
cd ..
@@ -87,11 +87,6 @@ jobs:
yarn printSecrets
env:
GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}}
- name: fillNativeModulesElectron
run: |
cd ..
cd dbgate-merged
yarn fillNativeModulesElectron
- name: fillPackagedPlugins
run: |
cd ..

View File

@@ -56,11 +56,11 @@ jobs:
cd ..
cd dbgate-merged
yarn adjustPackageJson
- name: yarn adjustPackageJsonPremium
- name: adjustAppPackageJsonPremium
run: |
cd ..
cd dbgate-merged
node adjustPackageJsonPremium
node adjustAppPackageJsonPremium
- name: setUpdaterChannel premium
run: |
cd ..
@@ -88,11 +88,6 @@ jobs:
yarn printSecrets
env:
GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}}
- name: fillNativeModulesElectron
run: |
cd ..
cd dbgate-merged
yarn fillNativeModulesElectron
- name: fillPackagedPlugins
run: |
cd ..

View File

@@ -50,9 +50,6 @@ jobs:
yarn printSecrets
env:
GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}}
- name: fillNativeModulesElectron
run: |
yarn fillNativeModulesElectron
- name: fillPackagedPlugins
run: |
yarn fillPackagedPlugins

View File

@@ -54,6 +54,12 @@ jobs:
node sync.js --nowatch
cd ..
- name: yarn adjustPackageJson
run: |
cd ..
cd dbgate-merged
yarn adjustPackageJson
- name: yarn install
run: |
cd ..

View File

@@ -62,6 +62,12 @@ jobs:
node sync.js --nowatch
cd ..
- name: yarn adjustPackageJson
run: |
cd ..
cd dbgate-merged
yarn adjustPackageJson
- name: yarn install
run: |
cd ..

View File

@@ -56,6 +56,13 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: yarn adjustPackageJson
run: |
cd ..
cd dbgate-merged
yarn adjustPackageJson
- name: yarn install
run: |
# yarn --version

113
.github/workflows/build-npm-pro.yaml vendored Normal file
View File

@@ -0,0 +1,113 @@
name: NPM packages PREMIUM
# on: [push]
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
# on:
# push:
# branches:
# - production
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- name: Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Checkout dbgate/dbgate-pro
uses: actions/checkout@v2
with:
repository: dbgate/dbgate-pro
token: ${{ secrets.GH_TOKEN }}
path: dbgate-pro
- name: Merge dbgate/dbgate-pro
run: |
mkdir ../dbgate-pro
mv dbgate-pro/* ../dbgate-pro/
cd ..
mkdir dbgate-merged
cd dbgate-pro
cd sync
yarn
node sync.js --nowatch
cd ..
- name: adjustNpmPackageJsonPremium
run: |
cd ..
cd dbgate-merged
node adjustNpmPackageJsonPremium
- name: Configure NPM token
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd ..
cd dbgate-merged
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- name: yarn install
run: |
cd ..
cd dbgate-merged
yarn install
- name: setCurrentVersion
run: |
cd ..
cd dbgate-merged
yarn setCurrentVersion
- name: printSecrets
run: |
cd ..
cd dbgate-merged
yarn printSecrets
env:
GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}}
- name: Publish dbgate-api-premium
run: |
cd ..
cd dbgate-merged/packages/api
npm publish
- name: Publish dbgate-web-premium
run: |
cd ..
cd dbgate-merged/packages/web
npm publish
- name: Publish dbgate-serve-premium
run: |
cd ..
cd dbgate-merged/packages/serve
npm publish
- name: Publish dbgate-plugin-cosmosdb
run: |
cd ..
cd dbgate-merged/plugins/dbgate-plugin-cosmosdb
npm publish

View File

@@ -90,11 +90,6 @@ jobs:
run: |
npm publish
- name: Publish dbgate (obsolete)
working-directory: packages/dbgate
run: |
npm publish
- name: Publish dbgate-serve
working-directory: packages/serve
run: |

2
.gitignore vendored
View File

@@ -28,8 +28,6 @@ docker/plugins
npm-debug.log*
yarn-debug.log*
yarn-error.log*
app/src/nativeModulesContent.js
packages/api/src/nativeModulesContent.js
packages/api/src/packagedPluginsContent.js
.VSCodeCounter

View File

@@ -1,10 +1,34 @@
const fs = require('fs');
const path = require('path');
function adjustFile(file) {
const json = JSON.parse(fs.readFileSync(file, { encoding: 'utf-8' }));
for (const packageName of fs.readdirSync('plugins')) {
if (!packageName.startsWith('dbgate-plugin-')) continue;
const pluginJson = JSON.parse(
fs.readFileSync(path.join('plugins', packageName, 'package.json'), { encoding: 'utf-8' })
);
for (const depkey of ['dependencies', 'optionalDependencies']) {
for (const dependency of Object.keys(pluginJson[depkey] || {})) {
if (!json[depkey]) {
json[depkey] = {};
}
if (json[depkey][dependency]) {
if (json[depkey][dependency] != pluginJson[depkey][dependency]) {
console.log(`Dependency ${dependency} in ${packageName} is different from ${file}`);
}
continue;
}
json[depkey][dependency] = pluginJson[depkey][dependency];
}
}
}
if (process.platform != 'win32') {
delete json.optionalDependencies.msnodesqlv8;
}
fs.writeFileSync(file, JSON.stringify(json, null, 2), 'utf-8');
}

View File

@@ -130,10 +130,5 @@
"electron": "30.0.2",
"electron-builder": "23.1.0",
"electron-builder-notarize": "^1.5.2"
},
"optionalDependencies": {
"better-sqlite3": "9.6.0",
"msnodesqlv8": "^4.2.1",
"oracledb": "^6.6.0"
}
}

View File

@@ -430,7 +430,6 @@ function createWindow() {
);
global.API_PACKAGE = apiPackage;
global.NATIVE_MODULES = path.join(__dirname, 'nativeModules');
// console.log('global.API_PACKAGE', global.API_PACKAGE);
const api = require(apiPackage);

View File

@@ -1,3 +0,0 @@
const content = require('./nativeModulesContent');
module.exports = content;

View File

@@ -1,24 +0,0 @@
const fs = require('fs');
let fillContent = '';
if (process.platform == 'win32') {
fillContent += `content.msnodesqlv8 = () => require('msnodesqlv8');\n`;
}
fillContent += `content['better-sqlite3'] = () => require('better-sqlite3');\n`;
fillContent += `content['oracledb'] = () => require('oracledb');\n`;
const getContent = empty => `
// this file is generated automatically by script fillNativeModules.js, do not edit it manually
const content = {};
${empty ? '' : fillContent}
module.exports = content;
`;
fs.writeFileSync(
'packages/api/src/nativeModulesContent.js',
getContent(process.argv.includes('--electron') ? true : false)
);
fs.writeFileSync('app/src/nativeModulesContent.js', getContent(false));

View File

@@ -1,6 +1,6 @@
{
"private": true,
"version": "5.5.7-alpha.29",
"version": "5.5.7-alpha.51",
"name": "dbgate-all",
"workspaces": [
"packages/*",
@@ -47,8 +47,6 @@
"printSecrets": "node printSecrets",
"generatePadFile": "node generatePadFile",
"adjustPackageJson": "node adjustPackageJson",
"fillNativeModules": "node fillNativeModules",
"fillNativeModulesElectron": "node fillNativeModules --electron",
"fillPackagedPlugins": "node fillPackagedPlugins",
"resetPackagedPlugins": "node resetPackagedPlugins",
"prettier": "prettier --write packages/api/src && prettier --write packages/datalib/src && prettier --write packages/filterparser/src && prettier --write packages/sqltree/src && prettier --write packages/tools/src && prettier --write packages/types && prettier --write packages/web/src && prettier --write app/src",
@@ -62,7 +60,7 @@
"ts:api": "yarn workspace dbgate-api ts",
"ts:web": "yarn workspace dbgate-web ts",
"ts": "yarn ts:api && yarn ts:web",
"postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend",
"postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn build:plugins:frontend",
"dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js"
},
"dependencies": {

View File

@@ -19,7 +19,7 @@
"dependencies": {
"@aws-sdk/rds-signer": "^3.665.0",
"activedirectory2": "^2.1.0",
"async-lock": "^1.2.4",
"async-lock": "^1.2.6",
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"bufferutil": "^4.0.1",
@@ -85,10 +85,5 @@
"typescript": "^4.4.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"optionalDependencies": {
"better-sqlite3": "9.6.0",
"msnodesqlv8": "^4.2.1",
"oracledb": "^6.6.0"
}
}

View File

@@ -94,7 +94,7 @@ module.exports = {
if (!manifest.keywords) {
continue;
}
if (!manifest.keywords.includes('dbgateplugin')) {
if (!manifest.keywords.includes('dbgateplugin') && !manifest.keywords.includes('dbgatebuiltin')) {
continue;
}
const readmeFile = path.join(isPackaged ? packagedPluginsDir() : pluginsdir(), packageName, 'README.md');

View File

@@ -36,6 +36,7 @@ const _ = require('lodash');
const { getLogger } = require('dbgate-tools');
const { getDefaultAuthProvider } = require('./auth/authProvider');
const startCloudUpgradeTimer = require('./utility/cloudUpgrade');
const { isProApp } = require('./utility/checkLicense');
const logger = getLogger('main');
@@ -77,7 +78,10 @@ function start() {
} else if (platformInfo.isAwsUbuntuLayout) {
app.use(getExpressPath('/'), express.static('/home/ubuntu/build/public'));
} else if (platformInfo.isNpmDist) {
app.use(getExpressPath('/'), express.static(path.join(__dirname, '../../dbgate-web/public')));
app.use(
getExpressPath('/'),
express.static(path.join(__dirname, isProApp() ? '../../dbgate-web-premium/public' : '../../dbgate-web/public'))
);
} else if (process.env.DEVWEB) {
// console.log('__dirname', __dirname);
// console.log(path.join(__dirname, '../../web/public/build'));

View File

@@ -1,13 +0,0 @@
const argIndex = process.argv.indexOf('--native-modules');
const redirectFile = global['NATIVE_MODULES'] || (argIndex > 0 ? process.argv[argIndex + 1] : null);
function requireDynamic(file) {
try {
// @ts-ignore
return __non_webpack_require__(redirectFile);
} catch (err) {
return require(redirectFile);
}
}
module.exports = redirectFile ? requireDynamic(redirectFile) : require('./nativeModulesContent');

View File

@@ -1,7 +1,6 @@
const path = require('path');
const fs = require('fs');
const { pluginsdir, packagedPluginsDir, getPluginBackendPath } = require('../utility/directories');
const nativeModules = require('../nativeModules');
const platformInfo = require('../utility/platformInfo');
const authProxy = require('../utility/authProxy');
const { getLogger } = require('dbgate-tools');
@@ -11,7 +10,6 @@ const loadedPlugins = {};
const dbgateEnv = {
dbgateApi: null,
nativeModules,
platformInfo,
authProxy,
};

View File

@@ -12,7 +12,12 @@ function checkLicenseKey(key) {
};
}
function isProApp() {
return false;
}
module.exports = {
checkLicense,
checkLicenseKey,
isProApp,
};

View File

@@ -17,9 +17,6 @@ const listenApiChild = process.argv.includes('--listen-api-child') || listenApi;
function getPassArgs() {
const res = [];
if (global['NATIVE_MODULES']) {
res.push('--native-modules', global['NATIVE_MODULES']);
}
if (global['PLUGINS_DIR']) {
res.push('--plugins-dir', global['PLUGINS_DIR']);
}

View File

@@ -1,2 +0,0 @@
# DbGate - database administration tool
This package is obsolete, please use [dbgate-serve](https://www.npmjs.com/package/dbgate-serve) package instead

View File

@@ -1,17 +0,0 @@
{
"name": "dbgate",
"version": "5.0.0-alpha.1",
"homepage": "https://dbgate.org/",
"repository": {
"type": "git",
"url": "https://github.com/dbgate/dbgate.git"
},
"description": "Opensource database administration tool - web interface",
"author": "Jan Prochazka",
"license": "GPL-3.0",
"keywords": [
"sql",
"dbgate",
"web"
]
}

View File

@@ -2,9 +2,55 @@
[![NPM version](https://img.shields.io/npm/v/dbgate.svg)](https://www.npmjs.com/package/dbgate)
# DbGate - database administration tool
DbGate is fast and easy to use database administration tool for MySQL, PostgreSQL, SQL Server.
DbGate is cross-platform database manager.
It's designed to be simple to use and effective, when working with more databases simultaneously.
But there are also many advanced features like schema compare, visual query designer, chart visualisation or batch export and import.
## Install using npm
## Supported databases
* MySQL
* PostgreSQL
* SQL Server
* Oracle
* MongoDB
* Redis
* SQLite
* Amazon Redshift (Premium)
* CockroachDB
* MariaDB
* CosmosDB (Premium)
* ClickHouse
## Community vs Premium
This package has 2 variants:
* [dbgate-serve](https://www.npmjs.com/package/dbgate-serve) - Community edition (free and open source)
* [dbgate-serve-premium](https://www.npmjs.com/package/dbgate-serve-premium) - Premium edition (commercial)
## Install using npm - premium edition
```sh
npm install -g dbgate-serve-premium
```
DbGate is configure via environment variables. In this package, you could use .env files with configuration of DbGate. .env file is loaded in working directory.
.env file could look like following:
```
STORAGE_SERVER=localhost
STORAGE_USER=root
STORAGE_PASSWORD=mypassword
STORAGE_DATABASE=dbname
STORAGE_ENGINE=mysql@dbgate-plugin-mysql
```
You could find more about environment variable configuration on [DbGate docs](https://dbgate.org/docs/env-variables.html) page.
After installing, you can run dbgate with command:
```sh
dbgate-serve-premium
```
Then open http://localhost:3000 in your browser
## Install using npm - community edition
```sh
npm install -g dbgate-serve
```
@@ -14,10 +60,21 @@ After installing, you can run dbgate with command:
dbgate-serve
```
.env file could be used in the same way as in Premium edition, without STORAGE_xxx variables, which are specific for Premium.
Then open http://localhost:3000 in your browser
## Download electron app
You can also download binary packages from https://dbgate.org . Or run from source code, as described on [github](https://github.com/dbgate/dbgate)
## Download desktop app
You can also download binary packages for desktop app from https://dbgate.org . Or run from source code, as described on [github](https://github.com/dbgate/dbgate)
## Use Oracle with Instant client (thick mode)
If you are Oracle database user and you would like to use Oracle instant client (thick mode) instead of thin mode (pure JS NPM package), please make the following:
* Download Oracle instant client - https://www.oracle.com/cz/database/technologies/instant-client/downloads.html
* Unpack it somewhere (og. /opt/oracle in Linux systems)
* Configure ORACLE_INSTANT_CLIENT variable - should contain directory name of unpacked Instant client
If you don't know, whether you will need Instance client, please use this [table](https://node-oracledb.readthedocs.io/en/latest/user_guide/appendix_a.html) of features,
which are supported only in thick mode (with instant client). Eg. thin mode works from Oracle 12, if you have older Oracle server, you will need to install Oracle Instant client.
## Other dbgate packages
You can use some functionality of dbgate from your JavaScript code. See [dbgate-api](https://npmjs.com/dbgate-api) package.

View File

@@ -19,12 +19,16 @@
],
"dependencies": {
"dbgate-api": "^5.0.0-alpha.1",
"dbgate-plugin-clickhouse": "^5.0.0-alpha.1",
"dbgate-plugin-csv": "^5.0.0-alpha.1",
"dbgate-plugin-excel": "^5.0.0-alpha.1",
"dbgate-plugin-mongo": "^5.0.0-alpha.1",
"dbgate-plugin-mssql": "^5.0.0-alpha.1",
"dbgate-plugin-mysql": "^5.0.0-alpha.1",
"dbgate-plugin-oracle": "^5.0.0-alpha.1",
"dbgate-plugin-postgres": "^5.0.0-alpha.1",
"dbgate-plugin-redis": "^5.0.0-alpha.1",
"dbgate-plugin-sqlite": "^5.0.0-alpha.1",
"dbgate-plugin-xml": "^5.0.0-alpha.1",
"dbgate-web": "^5.0.0-alpha.1",
"dotenv": "^16.0.0"

View File

@@ -1,105 +1,3 @@
*Looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)*
# dbgate-web
---
# svelte app
This is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template.
To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit):
```bash
npx degit sveltejs/template svelte-app
cd svelte-app
```
*Note that you will need to have [Node.js](https://nodejs.org) installed.*
## Get started
Install the dependencies...
```bash
cd svelte-app
npm install
```
...then start [Rollup](https://rollupjs.org):
```bash
npm run dev
```
Navigate to [localhost:5000](http://localhost:5000). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`.
If you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.
## Building and running in production mode
To create an optimised version of the app:
```bash
npm run build
```
You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com).
## Single-page app mode
By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.
If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `"start"` command in package.json:
```js
"start": "sirv public --single"
```
## Using TypeScript
This template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with:
```bash
node scripts/setupTypeScript.js
```
Or remove the script via:
```bash
rm scripts/setupTypeScript.js
```
## Deploying to the web
### With [Vercel](https://vercel.com)
Install `vercel` if you haven't already:
```bash
npm install -g vercel
```
Then, from within your project folder:
```bash
cd public
vercel deploy --name my-project
```
### With [surge](https://surge.sh/)
Install `surge` if you haven't already:
```bash
npm install -g surge
```
Then, from within your project folder:
```bash
npm run build
surge public my-project.surge.sh
```
This package is used internally by [DbGate](https://dbgate.org)

View File

@@ -7,8 +7,8 @@
"description": "Clickhouse connector for DbGate",
"keywords": [
"dbgate",
"dbgateplugin",
"clickhouse"
"clickhouse",
"dbgatebuiltin"
],
"files": [
"dist",
@@ -25,14 +25,14 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"byline": "^5.0.0",
"dbgate-plugin-tools": "^1.0.8",
"dbgate-tools": "^5.0.0-alpha.1",
"json-stable-stringify": "^1.0.1",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@clickhouse/client": "^1.5.0"
"@clickhouse/client": "^1.5.0",
"dbgate-tools": "^5.0.0-alpha.1",
"json-stable-stringify": "^1.0.1",
"lodash": "^4.17.21"
}
}

View File

@@ -18,6 +18,13 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'@clickhouse/client': 'commonjs @clickhouse/client',
'json-stable-stringify': 'commonjs json-stable-stringify',
'dbgate-tools': 'commonjs dbgate-tools',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -15,7 +15,7 @@
"import",
"export",
"dbgate",
"dbgateplugin"
"dbgatebuiltin"
],
"files": [
"dist",
@@ -32,11 +32,13 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"csv": "^6.3.10",
"dbgate-plugin-tools": "^1.0.7",
"line-reader": "^0.4.0",
"lodash": "^4.17.21",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"csv": "^6.3.10",
"line-reader": "^0.4.0",
"lodash": "^4.17.21"
}
}
}

View File

@@ -1,4 +1,4 @@
const zipObject = require('lodash/zipObject');
const _ = require('lodash');
const csv = require('csv');
const fs = require('fs');
const stream = require('stream');
@@ -37,7 +37,7 @@ class CsvPrepareStream extends stream.Transform {
_transform(chunk, encoding, done) {
if (this.structure) {
this.push(
zipObject(
_.zipObject(
this.structure.columns.map((x) => x.columnName),
chunk
)
@@ -57,7 +57,7 @@ class CsvPrepareStream extends stream.Transform {
};
this.push(this.structure);
this.push(
zipObject(
_.zipObject(
this.structure.columns.map((x) => x.columnName),
chunk
)

View File

@@ -18,6 +18,12 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
csv: 'commonjs csv',
'line-reader': 'commonjs line-reader',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -15,7 +15,7 @@
"import",
"export",
"dbgate",
"dbgateplugin"
"dbgatebuiltin"
],
"files": [
"dist",
@@ -32,10 +32,12 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"lodash": "^4.17.21",
"xlsx": "0.16.9",
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependecies": {
"lodash": "^4.17.21",
"xlsx": "0.16.9"
}
}

View File

@@ -18,6 +18,11 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
xlsx: 'commonjs xlsx',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -12,9 +12,9 @@
},
"keywords": [
"dbgate",
"dbgateplugin",
"mongo",
"mongodb"
"mongodb",
"dbgatebuiltin"
],
"files": [
"dist",
@@ -31,15 +31,19 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"bson": "^6.8.0",
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"bson": "^6.8.0",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"is-promise": "^4.0.0",
"lodash": "^4.17.21",
"mongodb": "^6.3.0",
"mongodb-client-encryption": "^6.0.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
"mongodb": "^6.3.0"
},
"optionalDependencies": {
"mongodb-client-encryption": "^6.0.0"
}
}

View File

@@ -18,6 +18,16 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
lodash: 'commonjs lodash',
mongodb: 'commonjs mongodb',
'mongodb-client-encryption': 'commonjs mongodb-client-encryption',
bson: 'commonjs bson',
'is-promise': 'commonjs is-promise',
},
};
module.exports = config;

View File

@@ -14,7 +14,7 @@
"sql",
"mssql",
"dbgate",
"dbgateplugin"
"dbgatebuiltin"
],
"files": [
"dist",
@@ -31,12 +31,18 @@
"plugout": "dbgate-plugout dbgate-plugin-mssql"
},
"devDependencies": {
"async-lock": "^1.2.6",
"dbgate-plugin-tools": "^1.0.7",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"tedious": "^18.2.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"async-lock": "^1.2.6",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"tedious": "^18.2.0"
},
"optionalDependencies": {
"msnodesqlv8": "^4.2.1"
}
}

View File

@@ -1,4 +1,3 @@
const fp = require('lodash/fp');
const _ = require('lodash');
const sql = require('./sql');

View File

@@ -5,15 +5,13 @@ const MsSqlAnalyser = require('./MsSqlAnalyser');
const createTediousBulkInsertStream = require('./createTediousBulkInsertStream');
const createNativeBulkInsertStream = require('./createNativeBulkInsertStream');
const AsyncLock = require('async-lock');
const nativeDriver = require('./nativeDriver');
const lock = new AsyncLock();
const { tediousConnect, tediousQueryCore, tediousReadQuery, tediousStream } = require('./tediousDriver');
const { nativeConnect, nativeQueryCore, nativeReadQuery, nativeStream } = nativeDriver;
const { nativeConnect, nativeQueryCore, nativeReadQuery, nativeStream } = require('./nativeDriver');
const { getLogger } = global.DBGATE_PACKAGES['dbgate-tools'];
const logger = getLogger('mssqlDriver');
let requireMsnodesqlv8;
let platformInfo;
let authProxy;
@@ -59,7 +57,7 @@ const driver = {
getAuthTypes() {
const res = [];
if (requireMsnodesqlv8) res.push(...windowsAuthTypes);
if (platformInfo?.isWindows) res.push(...windowsAuthTypes);
if (authProxy.isAuthProxySupported()) {
res.push(
@@ -82,7 +80,7 @@ const driver = {
async connect(conn) {
const { authType } = conn;
const connectionType = requireMsnodesqlv8 && (authType == 'sspi' || authType == 'sql') ? 'msnodesqlv8' : 'tedious';
const connectionType = platformInfo?.isWindows && (authType == 'sspi' || authType == 'sql') ? 'msnodesqlv8' : 'tedious';
const client = connectionType == 'msnodesqlv8' ? await nativeConnect(conn) : await tediousConnect(conn);
return {
@@ -172,12 +170,8 @@ const driver = {
};
driver.initialize = dbgateEnv => {
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules.msnodesqlv8) {
requireMsnodesqlv8 = dbgateEnv.nativeModules.msnodesqlv8;
}
platformInfo = dbgateEnv.platformInfo;
authProxy = dbgateEnv.authProxy;
nativeDriver.initialize(dbgateEnv);
};
module.exports = driver;

View File

@@ -1,7 +1,6 @@
const _ = require('lodash');
const stream = require('stream');
const makeUniqueColumnNames = require('./makeUniqueColumnNames');
let requireMsnodesqlv8;
const { extractDbNameFromComposite } = global.DBGATE_PACKAGES['dbgate-tools'];
// async function nativeQueryCore(pool, sql, options) {
@@ -24,7 +23,7 @@ const { extractDbNameFromComposite } = global.DBGATE_PACKAGES['dbgate-tools'];
let msnodesqlv8Value;
function getMsnodesqlv8() {
if (!msnodesqlv8Value) {
msnodesqlv8Value = requireMsnodesqlv8();
msnodesqlv8Value = require('msnodesqlv8');
}
return msnodesqlv8Value;
}
@@ -225,16 +224,9 @@ async function nativeStream(dbhan, sql, options) {
});
}
const initialize = dbgateEnv => {
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules.msnodesqlv8) {
requireMsnodesqlv8 = dbgateEnv.nativeModules.msnodesqlv8;
}
};
module.exports = {
nativeConnect,
nativeQueryCore,
nativeReadQuery,
nativeStream,
initialize,
};

View File

@@ -17,6 +17,15 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
msnodesqlv8: 'commonjs msnodesqlv8',
'async-lock': 'commonjs async-lock',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
'dbgate-tools': 'commonjs dbgate-tools',
lodash: 'commonjs lodash',
tedious: 'commonjs tedious',
},
};
module.exports = config;

View File

@@ -13,8 +13,8 @@
"keywords": [
"sql",
"dbgate",
"dbgateplugin",
"mysql"
"mysql",
"dbgatebuiltin"
],
"files": [
"dist",
@@ -31,12 +31,15 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"antares-mysql-dumper": "^0.0.1",
"dbgate-plugin-tools": "^1.0.7",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"mysql2": "^3.11.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"antares-mysql-dumper": "^0.0.1",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"mysql2": "^3.11.3"
}
}

View File

@@ -1,4 +1,3 @@
const fp = require('lodash/fp');
const _ = require('lodash');
const sql = require('./sql');
@@ -172,7 +171,7 @@ class Analyser extends DatabaseAnalyser {
})),
procedures: programmables.rows
.filter(x => x.objectType == 'PROCEDURE')
.map(fp.omit(['objectType']))
.map(x => _.omit(x, ['objectType']))
.map(x => ({
...x,
createSql: `DELIMITER //\n\nCREATE PROCEDURE \`${x.pureName}\`()\n${x.routineDefinition}\n\nDELIMITER ;\n`,
@@ -181,7 +180,7 @@ class Analyser extends DatabaseAnalyser {
})),
functions: programmables.rows
.filter(x => x.objectType == 'FUNCTION')
.map(fp.omit(['objectType']))
.map(x => _.omit(x, ['objectType']))
.map(x => ({
...x,
createSql: `CREATE FUNCTION \`${x.pureName}\`()\nRETURNS ${x.returnDataType} ${

View File

@@ -14,6 +14,14 @@ var config = {
libraryTarget: 'commonjs2',
},
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
'antares-mysql-dumper': 'commonjs antares-mysql-dumper',
lodash: 'commonjs lodash',
mysql2: 'commonjs mysql2',
},
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -12,8 +12,8 @@
"author": "Rinie Kervel",
"keywords": [
"dbgate",
"dbgateplugin",
"oracle"
"oracle",
"dbgatebuiltin"
],
"files": [
"dist",
@@ -31,10 +31,15 @@
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.8",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21"
},
"optionalDependencies": {
"oracledb": "^6.6.0"
}
}

View File

@@ -1,4 +1,3 @@
const fp = require('lodash/fp');
const _ = require('lodash');
const sql = require('./sql');

View File

@@ -6,13 +6,12 @@ const Analyser = require('./Analyser');
const { createBulkInsertStreamBase, makeUniqueColumnNames } = global.DBGATE_PACKAGES['dbgate-tools'];
const createOracleBulkInsertStream = require('./createOracleBulkInsertStream');
let requireOracledb;
let platformInfo;
let oracledbValue;
function getOracledb() {
if (!oracledbValue) {
oracledbValue = requireOracledb();
oracledbValue = require('oracledb');
}
return oracledbValue;
}
@@ -359,9 +358,6 @@ const driver = {
};
driver.initialize = dbgateEnv => {
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules['oracledb']) {
requireOracledb = dbgateEnv.nativeModules['oracledb'];
}
platformInfo = dbgateEnv.platformInfo;
};

View File

@@ -35,6 +35,13 @@ var config = {
},
}),
],
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
lodash: 'commonjs lodash',
oracledb: 'commonjs oracledb',
},
};
module.exports = config;

View File

@@ -12,8 +12,8 @@
"author": "Jan Prochazka",
"keywords": [
"dbgate",
"dbgateplugin",
"postgresql"
"postgresql",
"dbgatebuiltin"
],
"files": [
"dist",
@@ -31,14 +31,14 @@
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.7",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"pg": "^8.11.5",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"pg-copy-streams": "^6.0.6"
"pg-copy-streams": "^6.0.6",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"pg": "^8.11.5"
}
}

View File

@@ -1,4 +1,3 @@
const fp = require('lodash/fp');
const _ = require('lodash');
const sql = require('./sql');

View File

@@ -35,6 +35,14 @@ var config = {
},
}),
],
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
lodash: 'commonjs lodash',
pg: 'commonjs pg',
'pg-copy-streams': 'commonjs pg-copy-streams',
}
};
module.exports = config;

View File

@@ -12,8 +12,8 @@
"author": "Jan Prochazka",
"keywords": [
"dbgate",
"dbgateplugin",
"redis"
"redis",
"dbgatebuiltin"
],
"files": [
"dist"
@@ -30,11 +30,13 @@
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"async": "^3.2.3",
"ioredis": "^5.4.1",
"node-redis-dump2": "^0.5.0"

View File

@@ -18,6 +18,14 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'dbgate-tools': 'commmonjs dbgate-tools',
'dbgate-query-splitter': 'commmonjs dbgate-query-splitter',
lodash: 'commmonjs lodash',
async: 'commmonjs async',
ioredis: 'commmonjs ioredis',
'node-redis-dump2': 'commmonjs node-redis-dump2',
},
};
module.exports = config;

View File

@@ -1,41 +1,45 @@
{
"name": "dbgate-plugin-sqlite",
"main": "dist/backend.js",
"version": "5.0.0-alpha.1",
"homepage": "https://dbgate.org",
"description": "SQLite connect plugin for DbGate",
"repository": {
"type": "git",
"url": "https://github.com/dbgate/dbgate"
},
"author": "Jan Prochazka",
"license": "GPL-3.0",
"keywords": [
"dbgate",
"dbgateplugin",
"sqlite"
],
"files": [
"dist",
"icon.svg"
],
"scripts": {
"build:frontend": "webpack --config webpack-frontend.config",
"build:frontend:watch": "webpack --watch --config webpack-frontend.config",
"build:backend": "webpack --config webpack-backend.config.js",
"build": "yarn build:frontend && yarn build:backend",
"plugin": "yarn build && yarn pack && dbgate-plugin dbgate-plugin-sqlite",
"copydist": "yarn build && yarn pack && dbgate-copydist ../dist/dbgate-plugin-sqlite",
"plugout": "dbgate-plugout dbgate-plugin-sqlite",
"prepublishOnly": "yarn build"
},
"devDependencies": {
"dbgate-tools": "^5.0.0-alpha.1",
"dbgate-plugin-tools": "^1.0.4",
"dbgate-query-splitter": "^4.11.2",
"byline": "^5.0.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
}
"name": "dbgate-plugin-sqlite",
"main": "dist/backend.js",
"version": "5.0.0-alpha.1",
"homepage": "https://dbgate.org",
"description": "SQLite connect plugin for DbGate",
"repository": {
"type": "git",
"url": "https://github.com/dbgate/dbgate"
},
"author": "Jan Prochazka",
"license": "GPL-3.0",
"keywords": [
"dbgate",
"sqlite",
"dbgatebuiltin"
],
"files": [
"dist",
"icon.svg"
],
"scripts": {
"build:frontend": "webpack --config webpack-frontend.config",
"build:frontend:watch": "webpack --watch --config webpack-frontend.config",
"build:backend": "webpack --config webpack-backend.config.js",
"build": "yarn build:frontend && yarn build:backend",
"plugin": "yarn build && yarn pack && dbgate-plugin dbgate-plugin-sqlite",
"copydist": "yarn build && yarn pack && dbgate-copydist ../dist/dbgate-plugin-sqlite",
"plugout": "dbgate-plugout dbgate-plugin-sqlite",
"prepublishOnly": "yarn build"
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.4",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"dbgate-query-splitter": "^4.11.2"
},
"optionalDependencies": {
"better-sqlite3": "9.6.0"
}
}

View File

@@ -1,5 +1,5 @@
const _ = require('lodash');
const { DatabaseAnalyser } = global.DBGATE_PACKAGES['dbgate-tools'];;
const { DatabaseAnalyser } = global.DBGATE_PACKAGES['dbgate-tools'];
const indexcolsQuery = `
SELECT

View File

@@ -7,12 +7,10 @@ const { getLogger, createBulkInsertStreamBase, extractErrorLogData } = global.DB
const logger = getLogger('sqliteDriver');
let requireBetterSqlite;
let betterSqliteValue;
function getBetterSqlite() {
if (!betterSqliteValue) {
betterSqliteValue = requireBetterSqlite();
betterSqliteValue = require('better-sqlite3');
}
return betterSqliteValue;
}
@@ -188,10 +186,6 @@ const driver = {
},
};
driver.initialize = (dbgateEnv) => {
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules['better-sqlite3']) {
requireBetterSqlite = dbgateEnv.nativeModules['better-sqlite3'];
}
};
driver.initialize = (dbgateEnv) => {};
module.exports = driver;

View File

@@ -18,6 +18,12 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
'better-sqlite3': 'commonjs better-sqlite3',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -15,7 +15,7 @@
"import",
"export",
"dbgate",
"dbgateplugin"
"dbgatebuiltin"
],
"files": [
"dist"
@@ -31,9 +31,11 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"node-xml-stream-parser": "^1.0.12",
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"node-xml-stream-parser": "^1.0.12"
}
}

View File

@@ -18,6 +18,9 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'node-xml-stream-parser': 'commonjs node-xml-stream-parser',
},
};
module.exports = config;

View File

@@ -39,19 +39,12 @@ changePackageFile('packages/types', json.version);
changePackageFile('packages/tools', json.version);
changePackageFile('packages/web', json.version);
changePackageFile('packages/datalib', json.version);
changePackageFile('packages/dbgate', json.version);
changePackageFile('packages/serve', json.version);
changePackageFile('packages/filterparser', json.version);
changePackageFile('packages/dbmodel', json.version);
changePackageFile('plugins/dbgate-plugin-csv', json.version);
changePackageFile('plugins/dbgate-plugin-xml', json.version);
changePackageFile('plugins/dbgate-plugin-excel', json.version);
changePackageFile('plugins/dbgate-plugin-mssql', json.version);
changePackageFile('plugins/dbgate-plugin-mysql', json.version);
changePackageFile('plugins/dbgate-plugin-mongo', json.version);
changePackageFile('plugins/dbgate-plugin-postgres', json.version);
changePackageFile('plugins/dbgate-plugin-sqlite', json.version);
changePackageFile('plugins/dbgate-plugin-redis', json.version);
changePackageFile('plugins/dbgate-plugin-oracle', json.version);
changePackageFile('plugins/dbgate-plugin-clickhouse', json.version);
for (const package of fs.readdirSync('plugins')) {
if (!package.startsWith('dbgate-plugin-')) continue;
changePackageFile(`plugins/${package}`, json.version);
}