initial commit

main
saif 2024-10-10 11:14:38 +05:00
commit e55bc1e500
31 changed files with 24640 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
client/css/bootstrap-grid.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,330 @@
/*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent;
}
@-ms-viewport {
width: device-width;
}
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
[tabindex="-1"]:focus {
outline: 0 !important;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
border-bottom: 0;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: .5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
dfn {
font-style: italic;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -.25em;
}
sup {
top: -.5em;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
a:hover {
color: #0056b3;
text-decoration: underline;
}
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):focus {
outline: 0;
}
pre,
code,
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
-ms-overflow-style: scrollbar;
}
figure {
margin: 0 0 1rem;
}
img {
vertical-align: middle;
border-style: none;
}
svg:not(:root) {
overflow: hidden;
}
table {
border-collapse: collapse;
}
caption {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: #6c757d;
text-align: left;
caption-side: bottom;
}
th {
text-align: inherit;
}
label {
display: inline-block;
margin-bottom: .5rem;
}
button {
border-radius: 0;
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html [type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: listbox;
}
textarea {
overflow: auto;
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit;
white-space: normal;
}
progress {
vertical-align: baseline;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
outline-offset: -2px;
-webkit-appearance: none;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
summary {
display: list-item;
cursor: pointer;
}
template {
display: none;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

8
client/css/bootstrap-reboot.min.css vendored Normal file
View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

8975
client/css/bootstrap.css Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
client/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DAO & RowMapper Generator</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<style>
body {
min-height: 100vh;
}
[data-attribute-name] {
background: transparent;
padding: 0.25rem 0;
margin-bottom: 0.25rem;
transition: background 0.15s ease-in-out;
}
[data-attribute-name]:hover {
background: rgba(0, 0, 0, 0.1);
}
[data-scroll-bottom] {
font-size: 4em;
display: block;
width: 60px;
height: 60px;
transform: rotate(90deg);
color: #fff;
background: #333;
border-radius: 5px;
line-height: 45px;
text-align: center;
position: fixed;
bottom: 30px;
right: 30px;
}
[data-scroll-bottom]:hover {
color: #fff;
text-decoration: none;
background: #222;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm my-4">
<ul class="nav nav-pills">
<li class="nav-item"><a href="index.html" class="nav-link">Schema Info</a></li>
<li class="nav-item"><a href="generate-daos-row-mapper.html" class="nav-link active">DAO Generator</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-sm">
<h2 class="mb-4">DAO & RowMapper Generator</h2>
</div>
</div>
<form class="form mb-4" data-schema-form>
<h5>Step 1: Enter Schema Credentials & Classpath</h5>
<div class="form-row">
<div class="form-group col-sm">
<label>DB Name</label>
<input type="text" class="form-control" value="inventory" data-db-name required>
</div>
<div class="form-group col-sm">
<label>Username</label>
<input type="text" class="form-control" value="utopia" data-db-user required>
</div>
<div class="form-group col-sm">
<label>Password</label>
<input type="password" class="form-control" value="Utopia01" data-db-password required>
</div>
<div class="form-group col-sm">
<label>Host</label>
<input type="text" class="form-control" value="192.168.90.97" data-db-host required>
</div>
<div class="form-group col-sm">
<label>Port</label>
<input type="text" class="form-control" value="3306" data-db-port required>
</div>
</div>
<div class="form-row">
<div class="form-group col-sm">
<label>Classpath</label>
<input type="text" class="form-control" value="D:\Projects\UIND-git\utopia-industries-bare\target\classes\com\utopiaindustries\uind\model\inventory" data-class-path>
</div>
</div>
<div class="form-row">
<div class="form-group col-sm">
<label>Base Package</label>
<input type="text" class="form-control" value="com.utopiaindustries.uind" data-base-package>
</div>
</div>
<button class="btn btn-primary" type="submit">Map Tables to POJOs</button>
</form>
<form class="form mb-5" data-generate-dao-form style="display: none;">
<h5>Step 2: Select Table-POJO Mapping</h5>
<div class="form-row">
<div class="col-sm form-group">
<label>DataSource Type</label>
<input type="text" class="form-control" value="NamedParameterJdbcTemplate" data-source-type required>
</div>
<div class="col-sm form-group">
<label>DataSource Name</label>
<input type="text" class="form-control" value="namedParameterJdbcTemplate" data-source-name required>
</div>
</div>
<div data-mapping-area></div>
<button class="btn btn-primary" type="submit">Generate DAOs and RowMappers</button>
</form>
</div>
<a href="#" class="scroll-to-bottom" data-scroll-bottom>&#8250;</a>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> -->
<script src="./js/main.js"></script>
</body>
</html>

134
client/index.html Normal file
View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DAO & RowMapper Generator</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm my-4">
<ul class="nav nav-pills">
<li class="nav-item"><a href="index.html" class="nav-link active">Schema Info</a></li>
<li class="nav-item"><a href="generate-daos-row-mapper.html" class="nav-link">DAO Generator</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-sm">
<h2 class="mb-4">Schema Definition</h2>
</div>
</div>
<form class="form" data-schema-form>
<div class="form-row">
<div class="form-group col-sm">
<label>DB Name</label>
<input type="text" class="form-control" value="inventory" data-db-name>
</div>
<div class="form-group col-sm">
<label>Username</label>
<input type="text" class="form-control" value="root" data-db-user>
</div>
<div class="form-group col-sm">
<label>Password</label>
<input type="password" class="form-control" value="qwerty" data-db-password>
</div>
<div class="form-group col-sm">
<label>Host</label>
<input type="text" class="form-control" value="localhost" data-db-host>
</div>
</div>
<button class="btn btn-primary">Get Schema Info</button>
</form>
<div class="bg-light p-3 mt-5" data-results></div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
(async function( $ ) {
// caching dom elements
let $formDb = $( '[data-schema-form]' ),
$inputDbName = $( '[data-db-name]' ),
$inputDbUser = $( '[data-db-user]' ),
$inputDbPass = $( '[data-db-password]' ),
$inputDbHost = $( '[data-db-host]' ),
$inputClassPath = $( '[data-class-path]' ),
$containerResults = $( '[data-results]' );
// function to prepare html string
let showSchemaStr = function( schemaInfo ) {
let htmlStr = '<div>';
for ( table in schemaInfo ) {
htmlStr += '<div class="mb-3">';
htmlStr += `<h5>Table: ${table}</h5>`;
// console.log( schemaInfo[table] );
for ( column in schemaInfo[table] ) {
htmlStr += `<div><code>${column}: ${schemaInfo[table][column]}</code></div>`;
}
// query string
htmlStr += '<br />'
htmlStr += '<div><code>INSERT INTO %s (';
let columnCount = 0;
for ( column in schemaInfo[table] ) {
columnCount++;
htmlStr += `${column}`;
if ( columnCount < Object.keys( schemaInfo[table] ).length ) {
htmlStr += ', ';
}
}
htmlStr += ') VALUES (';
columnCount = 0;
for ( column in schemaInfo[table] ) {
columnCount++;
htmlStr += `:${column}`;
if ( columnCount < Object.keys( schemaInfo[table] ).length ) {
htmlStr += ', ';
}
}
htmlStr += ') ON DUPLICATE KEY UPDATE ';
columnCount = 0;
for ( column in schemaInfo[table] ) {
columnCount++;
if ( 'id' === column ) {
continue;
}
htmlStr += `${column} = :${column}`;
if ( columnCount < Object.keys( schemaInfo[table] ).length ) {
htmlStr += ', ';
}
}
htmlStr += '</code></div>';
htmlStr += '</div><hr />';
}
htmlStr += '</div>';
return htmlStr;
};
$formDb.on( 'submit', async function( e ) {
e.preventDefault();
let schemaInfo = await $.post( 'http://localhost:3001/get-schema-info', {
dbConfig: {
host: $inputDbHost.val(),
user: $inputDbUser.val(),
password: $inputDbPass.val(),
database: $inputDbName.val(),
insecureAuth: true
},
classpath: $inputClassPath.val()
} );
$containerResults.html( showSchemaStr( schemaInfo ) );
});
})( jQuery );
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
client/js/bootstrap.bundle.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3894
client/js/bootstrap.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
client/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

299
client/js/main.js Normal file
View File

@ -0,0 +1,299 @@
(async function( $ ) {
/**
* global variables
*/
let tablePojoInfo = {};
/**
* pascal case to underscore
*/
let pascalCaseToUnderscore = function( str ) {
return str.replace( /(?:^|\.?)([A-Z])/g, function ( x, y ){ return "_" + y.toLowerCase() }).replace( /^_/, "" );
};
/**
* caching dom elements
*/
let $body = $( 'body' ),
$formDb = $( '[data-schema-form]' ),
$inputDbName = $( '[data-db-name]' ),
$inputDbUser = $( '[data-db-user]' ),
$inputDbPass = $( '[data-db-password]' ),
$inputDbHost = $( '[data-db-host]' ),
$inputDbPort = $( '[data-db-port]' ),
$inputClassPath = $( '[data-class-path]' ),
$inputBasePackage = $( '[data-base-package]' ),
$inputDataSourceType = $( '[data-source-type]' ),
$inputDataSourceName = $( '[data-source-name]' ),
$formGenerateDAO = $( '[data-generate-dao-form]' ),
$btnScrollBottom = $( '[data-scroll-bottom]' );
/**
* populate table attribute options
*/
let populateTableAttributeOptions = function( table, modelProperty ) {
let str = '<option value="">PLEASE SELECT RESPECTIVE ATTRIBUTE</option>';
for ( attribute in tablePojoInfo.schemaInfo[table] ) {
let selected = ( attribute === pascalCaseToUnderscore( modelProperty ) ? "selected" : "" );
str += `<option value="${attribute}" data-attribute-type="${tablePojoInfo.schemaInfo[table][attribute]}" ${ selected }>${attribute}</option>`;
}
return str;
};
/**
* populate table attributes on table select
*/
$body.on( 'change', '[data-select-table]', function( e ) {
let $selectTable = $( this ),
$row = $selectTable.closest( '[data-pojo-table-mapping]' ),
$attributesContainer = $row.find( '[data-attributes]' ),
$attributeSelects = $attributesContainer.find( '[data-table-attribute]' ),
table = $selectTable.val();
$row.attr( 'data-pojo-table-mapping', `${$row.attr('data-pojo')}:${table}` );
if ( table === '' ) {
// $attributesContainer.hide();
return;
}
$attributeSelects.each(function() {
let $attributeSelect = $( this );
let modelProperty = $attributeSelect.closest( '[data-attribute-name]' ).attr( 'data-attribute-name' );
$attributeSelect.html( populateTableAttributeOptions( table, modelProperty ) );
});
// $attributesContainer.show();
});
/**
* show attributes if enabled
*/
$body.on( 'change', '[name="enabled"]', function( e ) {
let $checkboxEnabled = $( this ),
$containerAttributes = $checkboxEnabled.closest( '[data-pojo-table-mapping]' ).find( '[data-attributes]' );
if ( $checkboxEnabled.prop( 'checked' ) ) {
$containerAttributes.show();
} else {
$containerAttributes.hide();
}
});
/**
* create map-tables-pojos payload
*/
let createMapTablesPojosPayload = function() {
return {
dbConfig: {
host: $inputDbHost.val(),
port: parseInt( $inputDbPort.val() ),
user: $inputDbUser.val(),
password: $inputDbPass.val(),
database: $inputDbName.val(),
insecureAuth: true
},
classpath: $inputClassPath.val()
};
};
/**
* function to generate option for each pojo
*/
let createTableOptions = function( pojo ) {
let str = '<option value="">Select Table</option>';
for ( table in tablePojoInfo.schemaInfo ) {
str += `<option value="${table}" ${ table === pascalCaseToUnderscore( pojo ) ? "selected" : "" }>${table}</option>`;
}
return str;
};
/**
* function to create entries for attribute mapping
*/
let createAttributeMapping = function( pojo ) {
let str = '';
for ( attribute in tablePojoInfo.pojoInfo[pojo] ) {
str += `
<div class="form-row" data-attribute-name="${attribute}" data-attribute-type="${tablePojoInfo.pojoInfo[pojo][attribute]}">
<div class="col-sm-6">
<code>${attribute}</code>
</div>
<div class="col-sm-6">
<select class="form-control form-control-sm" data-table-attribute></select>
</div>
</div>
`;
}
return str;
};
/**
* function to create rows for each table
*/
let createPojoRow = function( pojo ) {
let str = `
<div class="bg-light p-3 my-3" data-pojo-table-mapping="${pojo}:" data-pojo="${pojo}">
<div class="form-row">
<div class="form-group col-sm-6">
<h4>
<input type="checkbox" name="enabled" id="${pojo}" value="1" />
<label for="${pojo}"><code>${pojo}</code></label>
</h4>
</div>
<div class="form-group col-sm-6">
<select class="form-control" data-select-table>${createTableOptions( pojo )}</select>
</div>
</div>
<div data-attributes style="display:none;">
${createAttributeMapping( pojo )}
</div>
</div>
`;
return str;
};
/**
* function to create html string for table-pojo mapping form
*/
let createTablePojoMappingHTMLStr = function( results ) {
let htmlStr = '';
// iterate over each table and get the string
for ( pojo in tablePojoInfo.pojoInfo ) {
htmlStr += createPojoRow( pojo );
}
return htmlStr;
};
/**
* map table-pojo form submit
*/
$formDb.on( 'submit', async function( e ) {
e.preventDefault();
// hide mapping form
$formGenerateDAO.hide();
// send the request
tablePojoInfo = await $.post( 'http://localhost:3001/map-tables-pojos', createMapTablesPojosPayload() );
// show mapping form
$formGenerateDAO.show();
// create html string for mapping form
$formGenerateDAO.find( '[data-mapping-area]' ).html( createTablePojoMappingHTMLStr( tablePojoInfo ) );
// trigger change on all table selects
$( '[data-select-table]' ).each(function( i ) {
$( this ).trigger( 'change' );
});
});
/**
* function to prepare model package
*/
let prepareModelPackage = function() {
return $inputClassPath.val().replace( /\\/g, '.' ).split( 'classes.' )[1];
};
/**
* function to prepare pojo-table mapping
*/
let preparePojoTableMapping = function() {
let pojoTableMappingPayload = {};
pojoTableMappingPayload['dataSourceName'] = $inputDataSourceName.val();
pojoTableMappingPayload['dataSourceType'] = $inputDataSourceType.val();
pojoTableMappingPayload['databaseName'] = $inputDbName.val();
pojoTableMappingPayload['modelPackage'] = prepareModelPackage();
pojoTableMappingPayload['basePackage'] = $inputBasePackage.val();
pojoTableMappingPayload['pojoTableMapping'] = [];
$( '[data-pojo-table-mapping]' ).each(function() {
let $row = $( this ),
$checkboxEnabled = $row.find( '[name="enabled"]' ),
pojo = $row.attr( 'data-pojo' ),
table = $row.attr( 'data-pojo-table-mapping' ).split( ':' )[1];
if ( '' === table ) {
return;
}
if( ! $checkboxEnabled.prop( 'checked' ) ) {
return;
}
let obj = {};
obj['pojoName'] = pojo;
obj['tableName'] = table;
obj['attributes'] = [];
$row.find( '[data-attributes] [data-attribute-name]' ).each(function() {
let attr = {};
let $attr = $( this );
attr['pojoAttribute'] = $attr.attr( 'data-attribute-name' );
attr['tableAttribute'] = $attr.find( '[data-table-attribute]' ).val();
attr['pojoAttributeType'] = $attr.attr( 'data-attribute-type' );
attr['tableAttributeType'] = $attr.find( '[data-table-attribute] option:selected' ).attr( 'data-attribute-type' );
if ( '' === attr['tableAttribute'] ) {
return;
}
obj['attributes'].push( attr );
});
pojoTableMappingPayload['pojoTableMapping'].push( obj );
});
return pojoTableMappingPayload;
};
/**
* generate dao-rowmapper form submit
*/
$formGenerateDAO.on( 'submit', async function( e ) {
e.preventDefault();
let payload = {
payload: preparePojoTableMapping()
};
let filesCreated = await $.post( 'http://localhost:3001/create-files', payload );
});
/**
* scroll to bottom
*/
$btnScrollBottom.on( 'click', function( e ) {
e.preventDefault();
$( 'html, body' ).animate({
scrollTop: $( document ).height()
}, 100 );
});
})( jQuery );

879
package-lock.json generated Normal file
View File

@ -0,0 +1,879 @@
{
"name": "dao-rowmapper-generator",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "dao-rowmapper-generator",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"concurrently": "^5.2.0"
}
},
"node_modules/ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"engines": {
"node": ">=6"
}
},
"node_modules/ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dependencies": {
"color-convert": "^1.9.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"engines": {
"node": ">=6"
}
},
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/chalk/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/cliui": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
"dependencies": {
"string-width": "^3.1.0",
"strip-ansi": "^5.2.0",
"wrap-ansi": "^5.1.0"
}
},
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"node_modules/concurrently": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.2.0.tgz",
"integrity": "sha512-XxcDbQ4/43d6CxR7+iV8IZXhur4KbmEJk1CetVMUqCy34z9l0DkszbY+/9wvmSnToTej0SYomc2WSRH+L0zVJw==",
"dependencies": {
"chalk": "^2.4.2",
"date-fns": "^2.0.1",
"lodash": "^4.17.15",
"read-pkg": "^4.0.1",
"rxjs": "^6.5.2",
"spawn-command": "^0.0.2-1",
"supports-color": "^6.1.0",
"tree-kill": "^1.2.2",
"yargs": "^13.3.0"
},
"bin": {
"concurrently": "bin/concurrently.js"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/date-fns": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.14.0.tgz",
"integrity": "sha512-1zD+68jhFgDIM0rF05rcwYO8cExdNqxjq4xP1QKM60Q45mnO6zaMWB4tOzrIr4M4GSLntsKeE4c9Bdl2jhL/yw==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/date-fns"
}
},
"node_modules/decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
},
"node_modules/error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
"dependencies": {
"is-arrayish": "^0.2.1"
}
},
"node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"dependencies": {
"locate-path": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"engines": {
"node": ">=4"
}
},
"node_modules/hosted-git-info": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg=="
},
"node_modules/is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
},
"node_modules/is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"engines": {
"node": ">=4"
}
},
"node_modules/json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
},
"node_modules/locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"dependencies": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"node_modules/normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
"integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
"dependencies": {
"hosted-git-info": "^2.1.4",
"resolve": "^1.10.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
}
},
"node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"dependencies": {
"p-try": "^2.0.0"
},
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"dependencies": {
"p-limit": "^2.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"engines": {
"node": ">=6"
}
},
"node_modules/parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"dependencies": {
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1"
},
"engines": {
"node": ">=4"
}
},
"node_modules/path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"engines": {
"node": ">=4"
}
},
"node_modules/path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
},
"node_modules/pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"engines": {
"node": ">=4"
}
},
"node_modules/read-pkg": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz",
"integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=",
"dependencies": {
"normalize-package-data": "^2.3.2",
"parse-json": "^4.0.0",
"pify": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
},
"node_modules/resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"dependencies": {
"path-parse": "^1.0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/rxjs": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.0.tgz",
"integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==",
"dependencies": {
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"bin": {
"semver": "bin/semver"
}
},
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"node_modules/spawn-command": {
"version": "0.0.2-1",
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
"integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A="
},
"node_modules/spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
"integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
"dependencies": {
"spdx-expression-parse": "^3.0.0",
"spdx-license-ids": "^3.0.0"
}
},
"node_modules/spdx-exceptions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
"integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A=="
},
"node_modules/spdx-expression-parse": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
"integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
"dependencies": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"node_modules/spdx-license-ids": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
"integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q=="
},
"node_modules/string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"dependencies": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dependencies": {
"ansi-regex": "^4.1.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/supports-color": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
"integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/tree-kill": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
"bin": {
"tree-kill": "cli.js"
}
},
"node_modules/tslib": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q=="
},
"node_modules/validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
"dependencies": {
"spdx-correct": "^3.0.0",
"spdx-expression-parse": "^3.0.0"
}
},
"node_modules/which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
},
"node_modules/wrap-ansi": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
"dependencies": {
"ansi-styles": "^3.2.0",
"string-width": "^3.0.0",
"strip-ansi": "^5.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
},
"node_modules/yargs": {
"version": "13.3.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
"dependencies": {
"cliui": "^5.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.2"
}
},
"node_modules/yargs-parser": {
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
"dependencies": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"requires": {
"color-convert": "^1.9.0"
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"dependencies": {
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"cliui": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
"requires": {
"string-width": "^3.1.0",
"strip-ansi": "^5.2.0",
"wrap-ansi": "^5.1.0"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"concurrently": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.2.0.tgz",
"integrity": "sha512-XxcDbQ4/43d6CxR7+iV8IZXhur4KbmEJk1CetVMUqCy34z9l0DkszbY+/9wvmSnToTej0SYomc2WSRH+L0zVJw==",
"requires": {
"chalk": "^2.4.2",
"date-fns": "^2.0.1",
"lodash": "^4.17.15",
"read-pkg": "^4.0.1",
"rxjs": "^6.5.2",
"spawn-command": "^0.0.2-1",
"supports-color": "^6.1.0",
"tree-kill": "^1.2.2",
"yargs": "^13.3.0"
}
},
"date-fns": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.14.0.tgz",
"integrity": "sha512-1zD+68jhFgDIM0rF05rcwYO8cExdNqxjq4xP1QKM60Q45mnO6zaMWB4tOzrIr4M4GSLntsKeE4c9Bdl2jhL/yw=="
},
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
"requires": {
"is-arrayish": "^0.2.1"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"requires": {
"locate-path": "^3.0.0"
}
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
},
"hosted-git-info": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg=="
},
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
"integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
"requires": {
"hosted-git-info": "^2.1.4",
"resolve": "^1.10.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
}
},
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
},
"parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"requires": {
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1"
}
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
},
"read-pkg": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz",
"integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=",
"requires": {
"normalize-package-data": "^2.3.2",
"parse-json": "^4.0.0",
"pify": "^3.0.0"
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
},
"require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
},
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"requires": {
"path-parse": "^1.0.6"
}
},
"rxjs": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.0.tgz",
"integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==",
"requires": {
"tslib": "^1.9.0"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"spawn-command": {
"version": "0.0.2-1",
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
"integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A="
},
"spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
"integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
"requires": {
"spdx-expression-parse": "^3.0.0",
"spdx-license-ids": "^3.0.0"
}
},
"spdx-exceptions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
"integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A=="
},
"spdx-expression-parse": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
"integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
"requires": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"spdx-license-ids": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
"integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q=="
},
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"requires": {
"ansi-regex": "^4.1.0"
}
},
"supports-color": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
"integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
"requires": {
"has-flag": "^3.0.0"
}
},
"tree-kill": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="
},
"tslib": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q=="
},
"validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
"requires": {
"spdx-correct": "^3.0.0",
"spdx-expression-parse": "^3.0.0"
}
},
"which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
},
"wrap-ansi": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
"requires": {
"ansi-styles": "^3.2.0",
"string-width": "^3.0.0",
"strip-ansi": "^5.0.0"
}
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
},
"yargs": {
"version": "13.3.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
"requires": {
"cliui": "^5.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.2"
}
},
"yargs-parser": {
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
}

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "dao-rowmapper-generator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "concurrently \"nodemon ./server/index.js\" \"http-server ./client/ -p 8085 -c-1 -s\""
},
"author": "",
"license": "ISC",
"dependencies": {
"concurrently": "^5.2.0"
}
}

131
server/dao.js Normal file
View File

@ -0,0 +1,131 @@
function capitalizeFirstLetter( string ) {
return string.charAt( 0 ).toUpperCase() + string.slice( 1 );
}
function lowerFirstLetter( string ) {
return string.charAt( 0 ).toLowerCase() + string.slice( 1 );
}
function prepareInsertQuery( attributes ) {
let columnCount = 0;
let str = 'INSERT INTO %s (';
for ( attribute of attributes ) {
columnCount++;
str += `${attribute.tableAttribute}`;
if ( columnCount < attributes.length ) {
str += ', ';
}
}
str += ') VALUES (';
columnCount = 0;
for ( attribute of attributes ) {
columnCount++;
str += `:${attribute.tableAttribute}`;
if ( columnCount < attributes.length ) {
str += ', ';
}
}
str += ') ON DUPLICATE KEY UPDATE ';
columnCount = 0;
for ( attribute of attributes ) {
columnCount++;
if ( 'id' === attribute.tableAttribute ) {
continue;
}
str += `${attribute.tableAttribute} = VALUES(${attribute.tableAttribute})`;
if ( columnCount < attributes.length ) {
str += ', ';
}
}
return str;
}
function addParamValue( attributes, pojoName ) {
let str = '';
let i = 0;
let attrCount = Object.keys( attributes ).length;
for ( attribute of attributes ) {
i++
str += `.addValue( "${attribute.tableAttribute}", ${lowerFirstLetter(mapping.pojoName)}.get${capitalizeFirstLetter(attribute.pojoAttribute)}() )`;
if ( i < attrCount ) {
str += `\n\t\t\t`;
}
}
return str;
}
exports.createFileContent = function( mapping, payload ) {
return `import ${payload.modelPackage}.${mapping.pojoName};
import ${payload.basePackage}.util.KeyHolderFunctions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class ${mapping.pojoName}DAO {
@Autowired
private ${payload.dataSourceType} ${payload.dataSourceName};
private final String TABLE_NAME = "${payload.databaseName}.${mapping.tableName}";
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
private final String INSERT_QUERY = String.format( "${prepareInsertQuery(mapping.attributes)}", TABLE_NAME );
// prepare query params
private MapSqlParameterSource prepareInsertQueryParams( ${mapping.pojoName} ${lowerFirstLetter(mapping.pojoName)} ) {
MapSqlParameterSource params = new MapSqlParameterSource();
params${addParamValue( mapping.attributes, mapping.pojoName )};
return params;
}
// find
public ${mapping.pojoName} find( long id ) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue( "id", id );
List<${mapping.pojoName}> ${lowerFirstLetter(mapping.pojoName)}s = ${payload.dataSourceName}.query( SELECT_QUERY, params, new ${mapping.pojoName}RowMapper() );
if ( ${lowerFirstLetter(mapping.pojoName)}s.size() > 0 ) {
return ${lowerFirstLetter(mapping.pojoName)}s.get( 0 );
} else {
return new ${mapping.pojoName}();
}
}
// find all
public List<${mapping.pojoName}> findAll() {
return ${payload.dataSourceName}.query( SELECT_ALL_QUERY, new ${mapping.pojoName}RowMapper() );
}
// save
public long save( ${mapping.pojoName} ${lowerFirstLetter(mapping.pojoName)} ) {
KeyHolder keyHolder = new GeneratedKeyHolder();
MapSqlParameterSource params = prepareInsertQueryParams( ${lowerFirstLetter(mapping.pojoName)} );
${payload.dataSourceName}.update( INSERT_QUERY, params, keyHolder );
return KeyHolderFunctions.getKey( ${lowerFirstLetter(mapping.pojoName)}.getId(), keyHolder );
}
// save all
public int[] saveAll( List<${mapping.pojoName}> ${lowerFirstLetter(mapping.pojoName)}s ) {
List<MapSqlParameterSource> batchArgs = new ArrayList<>();
for ( ${mapping.pojoName} ${lowerFirstLetter(mapping.pojoName)}: ${lowerFirstLetter(mapping.pojoName)}s ) {
MapSqlParameterSource params = prepareInsertQueryParams( ${lowerFirstLetter(mapping.pojoName)} );
batchArgs.add( params );
}
return ${payload.dataSourceName}.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[${lowerFirstLetter(mapping.pojoName)}s.size()]) );
}
// delete
public boolean delete( long id ) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue( "id", id );
return ${payload.dataSourceName}.update( DELETE_QUERY, params ) > 0;
}
}`;
};

235
server/index.js Normal file
View File

@ -0,0 +1,235 @@
/**
* require necessary packages
*/
const express = require( 'express' );
const app = express();
const cors = require( 'cors' );
const bodyParser = require( 'body-parser' );
const db = require( 'mysql-promise' )();
const { promisify } = require( 'util' );
const readdir = promisify( require('fs').readdir );
const writeFile = promisify( require( 'fs' ).writeFile );
const { JavaClassFileReader } = require('java-class-tools');
const dao = require( './dao' );
const rowMapper = require( './rowMapper' );
const port = '3001';
/**
* enable all cors and use body parser
*/
app.use( cors() );
app.use( bodyParser.json( {
limit: '50mb'
} ) );
app.use( bodyParser.urlencoded( {
extended: true,
limit: '50mb',
parameterLimit: 1000000
} ) );
/**
* datatypes
*/
let dataTypes = {
'Ljava/lang/String;': 'String',
'Ljava/lang/Long;': 'Long',
'Ljava/lang/Integer;': 'Integer',
'Ljava/math/BigInteger;': 'BigInteger',
'Ljava/math/BigDecimal;': 'BigDecimal',
'Ljava/lang/Double;': 'Double',
'Ljava/lang/Float;': 'Float',
'Ljava/lang/Boolean;': 'Boolean',
'Ljava/time/LocalDate;': 'LocalDate',
'Ljava/time/LocalDateTime;': 'LocalDateTime',
'Ljava/time/LocalTime;': 'LocalTime',
'J': 'long',
'I':'int',
'D':'double',
'F':'float',
'Z':'boolean',
'C':'char'
};
/**
* write file path
*/
const writeFileDir = `${__dirname}/files`;
/**
* reader
*/
const reader = new JavaClassFileReader();
/**
* utility functions
*/
// camel case to underscore
let camelCaseToUnderscore = function( str ) {
return str.replace( /(?:^|\.?)([A-Z])/g, function ( x, y ){ return "_" + y.toLowerCase() }).replace( /^_/, "" );
};
// query db for tables
let queryDbForTables = async function( req, db, dbName ) {
let tables = [];
// query for tables
let tableResults = await db.query( 'SHOW TABLES' );
for ( tableRow of tableResults[0] ) {
tables.push( tableRow[`Tables_in_${dbName}`] )
}
return tables;
};
// query a table for columns
let queryTableForColumns = async function( req, table, db, dbName ) {
let tableColumns = {};
let columnResults = await db.query( `DESCRIBE \`${dbName}\`.\`${table}\`` );
// iterate over columns
for ( column of columnResults[0] ) {
let columnType = '';
if ( column['Type'].indexOf( '(' ) > -1 ) {
columnType = column['Type'].split( '(' )[0].toUpperCase();
} else {
columnType = column['Type'].toUpperCase();
}
tableColumns[column['Field']] = columnType;
}
return tableColumns;
};
// get attributes of pojo
let getPOJOAttributes = async function( classpath, db ) {
// pojo info
let pojoInfo = {};
let files = await readdir( classpath );
files.forEach(async function( file ) {
try {
const javaFile = reader.read( classpath + '\\' + file );
let pojoName = file.replace( '.class', '' );
pojoInfo[pojoName] = {};
javaFile.fields.forEach(function ( entry ) {
// Get method name & descriptor from constant_pool
let nameCpEntry = javaFile.constant_pool[entry.name_index];
let descriptorCpEntry = javaFile.constant_pool[entry.descriptor_index];
// Convert to string
let name = String.fromCharCode.apply( null, nameCpEntry.bytes );
let descriptor = String.fromCharCode.apply( null, descriptorCpEntry.bytes );
pojoInfo[pojoName][name] = dataTypes[descriptor];
});
} catch ( e ) {
console.log( e );
}
});
return pojoInfo;
};
/**
* get schema info
*/
app.post( '/get-schema-info', async function( req, res ) {
// schema info
let schemaInfo = {};
// connection properties
let connectionProperties = req.body.dbConfig;
let dbName = connectionProperties.database;
// create connection
db.configure( connectionProperties );
// query for tables
let tables = await queryDbForTables( req, db, dbName );
// query for table columns
for ( table of tables ) {
schemaInfo[table] = await queryTableForColumns( req, table, db, dbName );
}
res.json( schemaInfo );
});
/**
* map table and pojos
*/
app.post( '/map-tables-pojos', async function( req, res ) {
try {
// let table-pojo map
let tablePojoInfo = {};
// schema info
tablePojoInfo['schemaInfo'] = {};
// pojo info
tablePojoInfo['pojoInfo'] = {};
// connection properties
let connectionProperties = req.body.dbConfig;
let dbName = connectionProperties.database;
// create connection
db.configure( connectionProperties );
// query for tables
let tables = await queryDbForTables( req, db, dbName );
// query for table columns
for ( table of tables ) {
tablePojoInfo['schemaInfo'][table] = await queryTableForColumns( req, table, db, dbName );
}
// get class attributes
tablePojoInfo['pojoInfo'] = await getPOJOAttributes( req.body.classpath, db );
res.json( tablePojoInfo );
} catch ( e ) {
console.log( e );
}
});
/**
* create files
*/
app.post( '/create-files', async function( req, res ) {
let payload = req.body.payload;
for ( mapping of payload.pojoTableMapping ) {
await writeFile( `${writeFileDir}/${mapping.pojoName}DAO.java`, dao.createFileContent( mapping, payload ) );
await writeFile( `${writeFileDir}/${mapping.pojoName}RowMapper.java`, rowMapper.createFileContent( mapping, payload ) );
}
res.status( 200 ).send( true );
});
/**
* start the app
*/
app.listen( port, function() {
console.log( `Listening on port: ${port}` );
});

1123
server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

20
server/package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "dao-rowmapper-generator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"async": "^3.1.1",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"java-class-tools": "^1.3.2",
"mysql": "^2.18.1",
"mysql-promise": "^5.0.0"
}
}

61
server/rowMapper.js Normal file
View File

@ -0,0 +1,61 @@
const additionalTypeMapping = {
'LocalDate': 'Date',
'LocalTime': 'Time',
'LocalDateTime': 'Timestamp',
'BigDecimal': 'BigDecimal',
'BigInteger': 'BigInteger'
};
function capitalizeFirstLetter( string ) {
return string.charAt( 0 ).toUpperCase() + string.slice( 1 );
}
function lowerFirstLetter( string ) {
return string.charAt( 0 ).toLowerCase() + string.slice( 1 );
}
function isDateTimeAttribute( attributeType ) {
return ['LocalDate', 'LocalTime', 'LocalDateTime'].includes( attributeType );
}
function preparePojoSetters( mapping ) {
let str = '';
let i = 0;
let attrCount = Object.keys( mapping.attributes ).length;
for ( const attr of mapping.attributes ) {
i++
if ( Object.keys( additionalTypeMapping ).includes( attr.pojoAttributeType ) ) {
// null condition for date/time/datetime
if ( isDateTimeAttribute( attr.pojoAttributeType ) ) {
str += `if ( rs.get${additionalTypeMapping[attr.pojoAttributeType]}( "${attr.tableAttribute}" ) != null ) {\n\t\t`;
}
str += `${lowerFirstLetter( mapping.pojoName )}.set${capitalizeFirstLetter(attr.pojoAttribute)}( rs.get${additionalTypeMapping[attr.pojoAttributeType]}( "${attr.tableAttribute}" ).to${attr.pojoAttributeType}() );`;
// null condition for date/time/datetime
if ( isDateTimeAttribute( attr.pojoAttributeType ) ) {
str += `\n\t}`;
}
} else {
str += `${lowerFirstLetter( mapping.pojoName )}.set${capitalizeFirstLetter(attr.pojoAttribute)}( rs.get${capitalizeFirstLetter(attr.pojoAttributeType)}( "${attr.tableAttribute}" ) );`;
}
if ( i < attrCount ) {
str += `\n\t`;
}
}
return str;
}
exports.createFileContent = function( mapping, payload ) {
return `import ${payload.modelPackage}.${mapping.pojoName};
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ${mapping.pojoName}RowMapper implements RowMapper {
public ${mapping.pojoName} mapRow( ResultSet rs, int rowNum ) throws SQLException {
${mapping.pojoName} ${lowerFirstLetter( mapping.pojoName )} = new ${mapping.pojoName}();
${preparePojoSetters( mapping )}
return ${lowerFirstLetter( mapping.pojoName )};
}
}`;
};