leo-connector-common
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -83,3 +83,3 @@ "use strict"; | ||
let ids = obj[table].splice(0, params.limit || MAX); | ||
objArray.push(tables[table].replace(/\?/g, ids.filter((id) => {return id;}).join())); | ||
objArray.push(tables[table].replace(/\?/g, ids.filter(id => {return id != undefined}).join())); | ||
done(); | ||
@@ -97,3 +97,3 @@ }, () => obj[table].length); | ||
function (ids, builder) { | ||
let idsList = ids.filter((id) => {return id;}).join(); | ||
let idsList = ids.filter(id => {return id != undefined}).join(); | ||
let builderSql = builder(params.pk, sqlQuery.replace(/\?/g, idsList)); | ||
@@ -104,7 +104,3 @@ | ||
let join = joins[name]; | ||
if (join.type === 'one_to_many') { | ||
builderSql.joinOneToMany(join.table, join.pk, join.query.replace(/\?/g, idsList), join.transform); | ||
} else if (join.type === 'one_to_one') { | ||
builderSql.join(join.table, join.pk, join.query.replace(/\?/g, idsList), join.transform); | ||
} | ||
builderSql.joinOneToMany(join.table, join.pk, join.query.replace(/\?/g, idsList), join.transform); | ||
}); | ||
@@ -111,0 +107,0 @@ |
@@ -8,2 +8,3 @@ "use strict"; | ||
module.exports = function(client, tableConfig, stream, callback) { | ||
let tableStatuses = {}; | ||
let tableSks = {}; | ||
@@ -56,5 +57,15 @@ let tableNks = {}; | ||
if (tableConfig[t].isDimension) { | ||
client.importDimension(obj[t].stream, t, sk, nk, scds, done); | ||
client.importDimension(obj[t].stream, t, sk, nk, scds, (err, tableInfo) => { | ||
if (!err && tableInfo && tableInfo.count === 0) { | ||
tableStatuses[t] = "First Load"; | ||
} | ||
done(err); | ||
}); | ||
} else { | ||
client.importFact(obj[t].stream, t, nk, done); | ||
client.importFact(obj[t].stream, t, nk, (err, tableInfo) => { | ||
if (!err && tableInfo && tableInfo.count === 0) { | ||
tableStatuses[t] = "First Load"; | ||
} | ||
done(err); | ||
}); | ||
} | ||
@@ -118,3 +129,3 @@ }); | ||
if (links.length) { | ||
tasks.push(done => client.linkDimensions(t, links, nk, done)); | ||
tasks.push(done => client.linkDimensions(t, links, nk, done, tableStatuses[t] || "Unmodified")); | ||
} | ||
@@ -121,0 +132,0 @@ }); |
{ | ||
"name": "leo-connector-common", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Common package for all Leo Platform database connectors", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Documentation | ||
Quick Start Guide: https://github.com/LeoPlatform/Leo | ||
Documentation for the connectors can be found here: https://github.com/LeoPlatform/connectors | ||
@@ -3,0 +5,0 @@ |
@@ -55,5 +55,7 @@ "use strict"; | ||
} | ||
ids = ids.concat(newIds.filter((e, i, self) => { | ||
return e !== null && ids.indexOf(e) === -1 && self.indexOf(e) === i; | ||
return e != undefined && ids.indexOf(e) === -1 && self.indexOf(e) === i; | ||
})); | ||
if (ids.length >= opts.limit) { | ||
@@ -60,0 +62,0 @@ submit(push, done); |
92398
3402
7