Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uniqorm

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniqorm - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

70

bin/cli.js

@@ -30,5 +30,6 @@ #!/usr/bin/env node

* @param {string} connectString
* @param {String} output
* @param {Object} options
*/
function exp(connectString, options) {
function exp(connectString, output, options) {
try {

@@ -52,8 +53,8 @@ console.log('Exporting metadata from ' + chalk.yellow(connectString));

const cfg = {};
const m = connectString.match(/^(\w+)((:\w+)(:\w+)?)?@(.+)$/);
assert(m, 'connectString does not match required format');
const m = connectString.match(/^(\w+)(?::?(\w+):?(\w+)?)?@(.+)$/);
assert(m, 'connect string "' + connectString + '" is not valid');
cfg.dialect = m[1];
cfg.user = m[3].substring(1);
cfg.password = m[4].substring(1);
cfg.connectString = m[5];
cfg.user = m[2];
cfg.password = m[3];
cfg.connectString = m[4];

@@ -70,3 +71,3 @@ require('sqb-connect-' + cfg.dialect);

case 'connect':
console.log('Database: ' + v2);
console.log(v2);
break;

@@ -79,6 +80,6 @@ case 'tables':

case 'query':
console.log('Process ' + v + '..');
console.log('Processing ' + v + '..');
break;
case 'done':
console.log('Process ' + v + ': ' + chalk.cyan(v3) + ' ' +
console.log('Processing ' + v + ': ' + chalk.cyan(v3) + ' ' +
chalk.yellow(v) + ' listed');

@@ -92,23 +93,21 @@ break;

exporter.execute((err, result) => {
if (err)
logError('Failed', err);
else {
const str = JSON.stringify(result, null, '\t');
const ms = ((new Date).getTime() - startTime);
const sec = Math.round(ms / 10) / 10;
exporter.execute().then(result => {
const str = JSON.stringify(result, null, '\t');
const ms = ((new Date).getTime() - startTime);
const sec = Math.round(ms / 10) / 10;
if (options.write) {
fs.writeFile(options.write, str, 'utf8', (err) => {
if (err)
logError('Write file failed', err);
else {
console.log(chalk.green('Completed in ' + sec + ' sec'));
}
});
} else {
console.log(str);
console.log(chalk.green('Completed in ' + sec + ' sec'));
}
if (output) {
fs.writeFile(output, str, 'utf8', (err) => {
if (err)
logError('Write file failed', err);
else {
console.log(chalk.green('Completed in ' + sec + ' sec'));
}
});
} else {
console.log(str);
console.log(chalk.green('Completed in ' + sec + ' sec'));
}
}).catch(err => {
logError('Failed', err);
});

@@ -125,5 +124,7 @@

console.log(chalk.black.bold('*** Uniqorm CLI ' + pkg.version + ' ***'));
program
.version(pkg.version)
.command('extract <connectString>')
.command('extract <connectString> <output>')
.description('Extracts meta-data from database\n\n' +

@@ -134,3 +135,6 @@ chalk.black(' connectString:') +

chalk.black(' schema:') +
chalk.yellow(' Name of the database schema')
chalk.yellow(' Name of the database schema'),
chalk.black(' output:') +
chalk.yellow(' Output filename')
)

@@ -147,9 +151,3 @@ .option('-s, --schema [schema]', 'Comma seperated schema names to be included in export list. All schemas will be exported if not specified')

console.log(chalk.yellow(' ******************************'));
console.log(chalk.yellow(' UNIQORM Command Line Interface'));
console.log(chalk.yellow(' v' + pkg.version));
console.log(chalk.yellow(' ******************************'));
console.log('');
program.parse(process.argv);

@@ -114,2 +114,7 @@ /* UNIQORM

});
Object.defineProperty(ctor.prototype, 'name', {
value: name || 'Model',
writable: false,
configurable: false
});
Object.defineProperty(ctor.prototype, 'meta', {

@@ -116,0 +121,0 @@ value: meta,

@@ -117,3 +117,3 @@ /* UNIQORM

const f = model.getFieldInfo(item);
assert(f, `Field (${item}) is not defined in model (${model.name})`);
assert(f, `Field "${item}" not found in (${model.name})`);
if (f.owner === model || f.owner.type === '1:1') {

@@ -134,3 +134,3 @@ columns.push(f.tableAlias + '.' + f.fieldName +

} else
assert(f, `Can not link field (${item}) directly. 1:1 relation is required for this operation`);
assert(f, `Can not link field "${item}" directly. 1:1 relation is required for this operation`);
}

@@ -190,5 +190,2 @@ query.columns(...columns);

query.params(self._params);
/*console.log('--------');
console.log(database.serializer.build(query).sql);
console.log('--------');*/
return query;

@@ -195,0 +192,0 @@ }

{
"name": "uniqorm",
"description": "Easy to use, multi-dialect ORM framework for JavaScript",
"version": "0.0.7",
"version": "0.0.8",
"author": "Panates Ltd.",

@@ -24,4 +24,4 @@ "contributors": [

"chalk": "^1.1.3",
"commander": "^2.9.0",
"putil-promisify": "^1.0.3",
"commander": "^2.11.0",
"putil-promisify": "^1.0.4",
"putil-waterfall": "^1.0.8"

@@ -31,3 +31,3 @@ },

"babel-eslint": "^7.2.3",
"eslint": "^4.0.0",
"eslint": "^4.1.1",
"eslint-config-google": "^0.8.0",

@@ -34,0 +34,0 @@ "istanbul": "^0.4.5",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc