Skip to content

Commit

Permalink
Forward-engineering of CURL script
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesmarets committed Dec 4, 2018
1 parent 09d5417 commit ed2eec6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion forward_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const schemaHelper = require('../helper/schemaHelper.js');

module.exports = {
generateScript(data, logger, cb) {
const { jsonSchema, modelData, containerData, entityData, isUpdateScript } = data;
const { jsonSchema, modelData, entityData, isUpdateScript } = data;
const containerData = data.containerData || {};
let result = "";
let fieldsSchema = this.getFieldsSchema({
jsonSchema: JSON.parse(jsonSchema),
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Elasticsearch",
"version": "0.1.12",
"versionDate": "2018-10-26",
"version": "0.1.13",
"versionDate": "2018-12-04",
"author": "hackolade",
"engines": {
"hackolade": "1.12.7",
Expand Down
10 changes: 7 additions & 3 deletions reverse_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ module.exports = {
logger.log('info', { modelInfo }, 'Model info');

getMapping(null, client, modelInfo)
}).catch(() => getMapping(null, client));
}, () => getMapping(null, client));
},

(client, modelInfo, getData) => {
Expand All @@ -195,12 +195,16 @@ module.exports = {
}, (err) => {
logger.log('error', err, 'Error of getting schema');
getData(null, client, modelInfo, null);
}).catch(err => {
logger.log('error', err);
this.disconnect(data, logger, () => {});
cb(err);
});
},

(client, modelInfo, jsonSchemas, next) => {
async.map(indices, (indexName, nextIndex) => {
let bucketInfo = Object.assign(getBucketData(jsonSchemas[indexName]), defaultBucketInfo);
let bucketInfo = Object.assign(getBucketData(jsonSchemas[indexName] || {}), defaultBucketInfo);
if (!types[indexName]) {
if (includeEmptyCollection) {
nextIndex(null, [{
Expand Down Expand Up @@ -315,7 +319,7 @@ module.exports = {
], (err, items, modelInfo) => {
if (err) {
logger.log('error', err);
this.disconnect(connectionInfo, logger, () => {});
this.disconnect(data, logger, () => {});
}

cb(err, items, modelInfo);
Expand Down

0 comments on commit ed2eec6

Please sign in to comment.