Comparing version 0.11.1 to 0.12.0
@@ -1,1 +0,1 @@ | ||
{"version":"0.11.1","commands":{"build":{"id":"build","description":"build docs","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","description":"project name","multiple":false},"public":{"name":"public","type":"boolean","description":"anyone with the URL can access","helpGroup":"sharing","allowNo":false,"exclusive":["private","password"]},"private":{"name":"private","type":"boolean","description":"only invited people can access","helpGroup":"sharing","allowNo":false,"exclusive":["public","password"]},"password":{"name":"password","type":"option","char":"p","description":"anyone with the URL + password can access","helpGroup":"sharing","multiple":false,"exclusive":["public","private"]}},"args":[{"name":"filepath","description":"dbml file path"}]},"db2dbml":{"id":"db2dbml","description":"Generate DBML directly from a database","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"outFile":{"name":"outFile","type":"option","char":"o","description":"output file path","helpValue":"/path-to-your-file","multiple":false}},"args":[{"name":"format","description":"your database format (postgres, mysql, mssql)","required":true},{"name":"connection-string","description":"your database connection string:\n - postgres: postgresql://user:password@localhost:5432/dbname\n - mysql: mysql://user:password@localhost:3306/dbname\n - mssql: 'Server=localhost,1433;Database=master;User Id=sa;Password=your_password;Encrypt=true;TrustServerCertificate=true;'","required":true}]},"login":{"id":"login","description":"login to dbdocs\nlogin with your dbdocs credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"logout":{"id":"logout","description":"logout\nclears local login credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"ls":{"id":"ls","description":"list projects","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"password":{"id":"password","description":"set password for your project or remove password","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"project name","helpValue":"project name","multiple":false},"set":{"name":"set","type":"option","char":"s","description":"password for your project","helpValue":"password","multiple":false},"remove":{"name":"remove","type":"boolean","char":"r","description":"remove password from your project","allowNo":false}},"args":[]},"remove":{"id":"remove","description":"remove project","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"project_name","description":"name of the project which you want to remove"}]},"rename":{"id":"rename","description":"change your username","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"token":{"id":"token","description":"generate or revoke your authentication token","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"generate":{"name":"generate","type":"boolean","char":"g","description":"generate authentication token","allowNo":false},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke authentication token","allowNo":false}},"args":[]},"validate":{"id":"validate","description":"validate docs content","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"filepath","description":"dbml file path"}]}}} | ||
{"version":"0.12.0","commands":{"build":{"id":"build","description":"build docs","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","description":"project name","multiple":false},"public":{"name":"public","type":"boolean","description":"anyone with the URL can access","helpGroup":"sharing","allowNo":false,"exclusive":["private","password"]},"private":{"name":"private","type":"boolean","description":"only invited people can access","helpGroup":"sharing","allowNo":false,"exclusive":["public","password"]},"password":{"name":"password","type":"option","char":"p","description":"anyone with the URL + password can access","helpGroup":"sharing","multiple":false,"exclusive":["public","private"]}},"args":[{"name":"filepath","description":"dbml file path"}]},"db2dbml":{"id":"db2dbml","description":"Generate DBML directly from a database","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"examples":"Postgres:\n $ db2dbml postgres 'postgresql://user:password@localhost:5432/dbname?schemas=schema1,schema2'\nMySQL:\n $ db2dbml mysql 'mysql://user:password@localhost:3306/dbname'\nMSSQL:\n $ db2dbml mssql 'Server=localhost,1433;Database=master;User Id=sa;Password=your_password;Encrypt=true;TrustServerCertificate=true;Schemas=schema1,schema2;'\nSnowflake:\n $ db2dbml snowflake 'SERVER=<account_identifier>.<region>;UID=<your_username>;PWD=<your_password>;DATABASE=<your_database>;WAREHOUSE=<your_warehouse>;ROLE=<your_role>;SCHEMAS=schema1,schema2;'\nBigQuery:\n $ db2dbml bigquery /path_to_json_credential.json\n \n Note: Your JSON credential file must contain:\n {\n \"project_id\": \"your-project-id\",\n \"client_email\": \"your-client-email\",\n \"private_key\": \"your-private-key\",\n \"datasets\": [\"dataset_1\", \"dataset_2\", ...]\n }\n If \"datasets\" key is not provided or is empty, it will fetch all datasets.","flags":{"outFile":{"name":"outFile","type":"option","char":"o","description":"output file path","helpValue":"/path-to-your-file","multiple":false}},"args":[{"name":"database-type","description":"your database type (postgres, mysql, mssql, snowflake, bigquery)","required":true},{"name":"connection-string","description":"your database connection string (See below examples for more details)","required":true}]},"login":{"id":"login","description":"login to dbdocs\nlogin with your dbdocs credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"logout":{"id":"logout","description":"logout\nclears local login credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"ls":{"id":"ls","description":"list projects","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"password":{"id":"password","description":"set password for your project or remove password","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"project name","helpValue":"project name","multiple":false},"set":{"name":"set","type":"option","char":"s","description":"password for your project","helpValue":"password","multiple":false},"remove":{"name":"remove","type":"boolean","char":"r","description":"remove password from your project","allowNo":false}},"args":[]},"remove":{"id":"remove","description":"remove project","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"project_name","description":"name of the project which you want to remove"}]},"rename":{"id":"rename","description":"change your username","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"token":{"id":"token","description":"generate or revoke your authentication token","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"generate":{"name":"generate","type":"boolean","char":"g","description":"generate authentication token","allowNo":false},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke authentication token","allowNo":false}},"args":[]},"validate":{"id":"validate","description":"validate docs content","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"filepath","description":"dbml file path"}]}}} |
{ | ||
"name": "dbdocs", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"author": "@holistics", | ||
@@ -12,4 +12,4 @@ "bin": { | ||
"dependencies": { | ||
"@dbml/connector": "^3.7.2", | ||
"@dbml/core": "3.7.3", | ||
"@dbml/connector": "3.8.0", | ||
"@dbml/core": "3.8.0", | ||
"@oclif/core": "1.12.1", | ||
@@ -16,0 +16,0 @@ "@oclif/plugin-help": "5.1.12", |
dbdocs | ||
====== | ||
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) | ||
@@ -15,2 +13,3 @@ [![Version](https://img.shields.io/npm/v/dbdocs.svg)](https://npmjs.org/package/dbdocs) | ||
<!-- tocstop --> | ||
# Usage | ||
@@ -33,3 +32,3 @@ <!-- usage --> | ||
* [`dbdocs build [FILEPATH]`](#dbdocs-build-filepath) | ||
* [`dbdocs db2dbml [FORMAT] [CONNECTION-STRING`](#dbdocs-db2dbml-format-connection-string) | ||
* [`dbdocs db2dbml [DATABASE-TYPE] [CONNECTION-STRING`](#dbdocs-db2dbml-database-type-connection-string) | ||
* [`dbdocs help [COMMAND]`](#dbdocs-help-command) | ||
@@ -49,3 +48,3 @@ * [`dbdocs login`](#dbdocs-login) | ||
``` | ||
```bash | ||
USAGE | ||
@@ -62,3 +61,3 @@ $ dbdocs build [FILEPATH] | ||
## `dbdocs db2dbml [FORMAT] [CONNECTION-STRING]` | ||
## `dbdocs db2dbml [DATABASE-TYPE] [CONNECTION-STRING]` | ||
@@ -69,10 +68,7 @@ Generate DBML directly from a database | ||
USAGE | ||
$ dbdocs db2dbml [FORMAT] [CONNECTION-STRING] [-o <value>] | ||
$ dbdocs db2dbml [DATABASE-TYPE] [CONNECTION-STRING] [-o <value>] | ||
ARGUMENTS | ||
FORMAT your database format (postgres, mysql, mssql) | ||
CONNECTION-STRING your database connection string: | ||
- postgres: postgresql://user:password@localhost:5432/dbname | ||
- mysql: mysql://user:password@localhost:3306/dbname | ||
- mssql: 'Server=localhost,1433;Database=master;User Id=sa;Password=your_password;Encrypt=true;TrustServerCertificate=true;' | ||
DATABASE-TYPE your database type (postgres, mysql, mssql, snowflake, bigquery) | ||
CONNECTION-STRING your database connection string (See below examples for more details) | ||
@@ -85,2 +81,26 @@ FLAGS | ||
EXAMPLES | ||
Postgres: | ||
$ db2dbml postgres 'postgresql://user:password@localhost:5432/dbname?schemas=schema1,schema2' | ||
MySQL: | ||
$ db2dbml mysql 'mysql://user:password@localhost:3306/dbname' | ||
MSSQL: | ||
$ db2dbml mssql 'Server=localhost,1433;Database=master;User Id=sa;Password=your_password;Encrypt=true;TrustServerCertificate=true;Schemas=schema1,schema2;' | ||
Snowflake: | ||
$ db2dbml snowflake 'SERVER=<account_identifier>.<region>;UID=<your_username>;PWD=<your_password>;DATABASE=<your_database>;WAREHOUSE=<your_warehouse>;ROLE=<your_role>;SCHEMAS=schema1,schema2;' | ||
BigQuery: | ||
$ db2dbml bigquery /path_to_json_credential.json | ||
Note: Your JSON credential file must contain: | ||
{ | ||
"project_id": "your-project-id", | ||
"client_email": "your-client-email", | ||
"private_key": "your-private-key", | ||
"datasets": ["dataset_1", "dataset_2", ...] | ||
} | ||
If "datasets" key is not provided or is empty, it will fetch all datasets. | ||
``` | ||
@@ -92,3 +112,3 @@ | ||
``` | ||
```bash | ||
USAGE | ||
@@ -108,3 +128,3 @@ $ dbdocs help [COMMAND] | ||
``` | ||
```bash | ||
USAGE | ||
@@ -121,3 +141,3 @@ $ dbdocs login | ||
``` | ||
```bash | ||
USAGE | ||
@@ -134,3 +154,3 @@ $ dbdocs logout | ||
``` | ||
```bash | ||
USAGE | ||
@@ -147,3 +167,3 @@ $ dbdocs ls | ||
``` | ||
```bash | ||
USAGE | ||
@@ -162,3 +182,3 @@ $ dbdocs password | ||
``` | ||
```bash | ||
USAGE | ||
@@ -175,3 +195,3 @@ $ dbdocs remove [PROJECT_NAME] | ||
``` | ||
```bash | ||
USAGE | ||
@@ -188,3 +208,3 @@ $ dbdocs rename | ||
``` | ||
```bash | ||
USAGE | ||
@@ -202,3 +222,3 @@ $ dbdocs token | ||
``` | ||
```bash | ||
USAGE | ||
@@ -205,0 +225,0 @@ $ dbdocs validate [FILEPATH] |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
/* eslint-disable max-len */ | ||
/* eslint-disable no-use-before-define */ | ||
@@ -8,3 +8,3 @@ /* eslint-disable no-param-reassign */ | ||
const ora = require('ora'); | ||
const { SUPPORTED_DATABASE_CONNECTORS } = require('../utils/constants'); | ||
const { SUPPORTED_DATABASE_CONNECTORS, WINDOW_FILE_PATH_REGEX, UNIX_FILE_PATH_REGEX } = require('../utils/constants'); | ||
const { writeToConsole, writeToFileAsync } = require('../utils/output-writer'); | ||
@@ -18,3 +18,3 @@ | ||
const { flags, argv } = await this.parse(Db2dbmlCommand); | ||
const { format, connection } = getConnectionOpt(argv); | ||
const { databaseType, connection } = getConnectionOpt(argv); | ||
@@ -24,3 +24,3 @@ spinner.text = 'Connecting to database...'; | ||
const schemaJson = await connector.fetchSchemaJson(connection, format); | ||
const schemaJson = await connector.fetchSchemaJson(connection, databaseType); | ||
spinner.succeed('Connecting to database... done.'); | ||
@@ -56,4 +56,4 @@ | ||
{ | ||
name: 'format', | ||
description: 'your database format (postgres, mysql, mssql)', | ||
name: 'database-type', | ||
description: 'your database type (postgres, mysql, mssql, snowflake, bigquery)', | ||
required: true, | ||
@@ -63,6 +63,3 @@ }, | ||
name: 'connection-string', | ||
description: `your database connection string: | ||
- postgres: postgresql://user:password@localhost:5432/dbname | ||
- mysql: mysql://user:password@localhost:3306/dbname | ||
- mssql: 'Server=localhost,1433;Database=master;User Id=sa;Password=your_password;Encrypt=true;TrustServerCertificate=true;'`, | ||
description: 'your database connection string (See below examples for more details)', | ||
required: true, | ||
@@ -80,2 +77,24 @@ }, | ||
Db2dbmlCommand.examples = [ | ||
'Postgres:', | ||
" $ db2dbml postgres 'postgresql://user:password@localhost:5432/dbname?schemas=schema1,schema2'", | ||
'MySQL:', | ||
" $ db2dbml mysql 'mysql://user:password@localhost:3306/dbname'", | ||
'MSSQL:', | ||
" $ db2dbml mssql 'Server=localhost,1433;Database=master;User Id=sa;Password=your_password;Encrypt=true;TrustServerCertificate=true;Schemas=schema1,schema2;'", | ||
'Snowflake:', | ||
" $ db2dbml snowflake 'SERVER=<account_identifier>.<region>;UID=<your_username>;PWD=<your_password>;DATABASE=<your_database>;WAREHOUSE=<your_warehouse>;ROLE=<your_role>;SCHEMAS=schema1,schema2;'", | ||
'BigQuery:', | ||
' $ db2dbml bigquery /path_to_json_credential.json', | ||
' ', | ||
' Note: Your JSON credential file must contain:', | ||
' {', | ||
' "project_id": "your-project-id",', | ||
' "client_email": "your-client-email",', | ||
' "private_key": "your-private-key",', | ||
' "datasets": ["dataset_1", "dataset_2", ...]', | ||
' }', | ||
' If "datasets" key is not provided or is empty, it will fetch all datasets.', | ||
].join('\n'); | ||
/** | ||
@@ -87,4 +106,4 @@ * @param {string[]} argv | ||
const defaultConnectionOpt = { | ||
format: 'unknown', | ||
connection: argv[1], | ||
connection: argv[0], | ||
databaseType: 'unknown', | ||
}; | ||
@@ -94,3 +113,3 @@ | ||
if (SUPPORTED_DATABASE_CONNECTORS.includes(arg)) { | ||
connectionOpt.format = arg; | ||
connectionOpt.databaseType = arg; | ||
} | ||
@@ -106,2 +125,7 @@ | ||
// check if the arg is a valid path to credential json file | ||
if (WINDOW_FILE_PATH_REGEX.test(arg) || UNIX_FILE_PATH_REGEX.test(arg)) { | ||
connectionOpt.connection = arg; | ||
} | ||
return connectionOpt; | ||
@@ -108,0 +132,0 @@ }, defaultConnectionOpt); |
@@ -22,4 +22,21 @@ const PROJECT_GENERAL_ACCESS_TYPE = { | ||
const SUPPORTED_DATABASE_CONNECTORS = ['postgres', 'mysql', 'mssql']; | ||
const SUPPORTED_DATABASE_CONNECTORS = ['postgres', 'mysql', 'mssql', 'snowflake', 'bigquery']; | ||
/** | ||
* Match window path | ||
* Eg: | ||
* - C:\Documents\code\credential.json | ||
* - C:/Documents/code/credential.json | ||
*/ | ||
const WINDOW_FILE_PATH_REGEX = /^[a-zA-Z]:[\\/](?:[^<>:"/\\|?*\n\r]+[\\/])*[^<>:"/\\|?*\n\r]*$/; | ||
/** | ||
* Match unix system path | ||
* Eg: | ||
* - /Users/dev/code/credential.json | ||
* - ~/code/credential.json | ||
* - ./code/credential.json | ||
*/ | ||
const UNIX_FILE_PATH_REGEX = /^[a-zA-Z]:[\\/](?:[^<>:"/\\|?*\n\r]+[\\/])*[^<>:"/\\|?*\n\r]*$/; | ||
module.exports = { | ||
@@ -31,2 +48,4 @@ PROJECT_GENERAL_ACCESS_TYPE, | ||
SUPPORTED_DATABASE_CONNECTORS, | ||
WINDOW_FILE_PATH_REGEX, | ||
UNIX_FILE_PATH_REGEX, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51427
1178
216
+ Added@dbml/connector@3.8.0(transitive)
+ Added@dbml/core@3.8.0(transitive)
- Removed@dbml/connector@3.9.5(transitive)
- Removed@dbml/core@3.7.3(transitive)
Updated@dbml/connector@3.8.0
Updated@dbml/core@3.8.0