leo-connector-common
Advanced tools
Comparing version 2.1.0-RC4 to 2.1.0
@@ -11,10 +11,11 @@ "use strict"; | ||
module.exports = function(ID, client, tableConfig, stream, callback) { | ||
module.exports = function(ID, source, client, tableConfig, stream, callback) { | ||
// adding backwards compatibility for ID | ||
// adding backwards compatibility for ID and source | ||
if (!callback) { | ||
callback = stream; | ||
stream = tableConfig; | ||
tableConfig = client; | ||
callback = tableConfig; | ||
stream = client; | ||
tableConfig = source; | ||
client = ID; | ||
source = 'queue:dw.load'; | ||
ID = 'system:dw-ingest'; | ||
@@ -83,3 +84,3 @@ } | ||
} else { | ||
invalid = handleFailedValidation(ID, obj, 'No events id’s in delete.'); | ||
invalid = handleFailedValidation(ID, source, obj, 'No events id’s in delete.'); | ||
} | ||
@@ -110,3 +111,3 @@ } else { | ||
if (!table) { | ||
return handleFailedValidation(ID, obj, `No table found for ${tableName}`); | ||
return handleFailedValidation(ID, source, obj, `No table found for ${tableName}`); | ||
} | ||
@@ -122,3 +123,3 @@ | ||
if (!validate.isValidString(value, type[3] && type[3] || 255, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid String on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid String on field ${field}`); | ||
} | ||
@@ -128,3 +129,3 @@ | ||
if (table.structure[field].sort && table.structure[field].sort.values && !validate.isValidEnum(value, table.structure[field].sort.values, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid enum on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid enum on field ${field}`); | ||
} | ||
@@ -135,3 +136,3 @@ break; | ||
if (!validate.isValidTimestamp(value, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid ${type[1]} on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid ${type[1]} on field ${field}`); | ||
} | ||
@@ -142,3 +143,3 @@ break; | ||
if (!validate.isValidDatetime(value, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid ${type[1]} on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid ${type[1]} on field ${field}`); | ||
} | ||
@@ -149,3 +150,3 @@ break; | ||
if (!validate.isValidInteger(value, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid ${type[1]} on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid ${type[1]} on field ${field}`); | ||
} | ||
@@ -156,3 +157,3 @@ break; | ||
if (!validate.isValidBigint(value, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid ${type[1]} on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid ${type[1]} on field ${field}`); | ||
} | ||
@@ -163,3 +164,3 @@ break; | ||
if (!validate.isValidFloat(value, fieldDefault)) { | ||
return handleFailedValidation(ID, obj, `Invalid ${type[1]} on field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid ${type[1]} on field ${field}`); | ||
} | ||
@@ -169,3 +170,3 @@ break; | ||
case undefined: | ||
return handleFailedValidation(ID, obj, `Invalid ${type[1]} in the table config for table: ${table.identifier} field ${field}`); | ||
return handleFailedValidation(ID, source, obj, `Invalid ${type[1]} in the table config for table: ${table.identifier} field ${field}`); | ||
break; | ||
@@ -324,6 +325,7 @@ } | ||
* @param ID {string} | ||
* @param source {string} | ||
* @param eventObj {Object} | ||
* @param error {string} | ||
*/ | ||
function handleFailedValidation(ID, eventObj, error) | ||
function handleFailedValidation(ID, source, eventObj, error) | ||
{ | ||
@@ -335,3 +337,3 @@ logger.debug('Adding failed event', eventObj); | ||
if (!errorStream) { | ||
errorStream = leo.load(ID, `${ID}_error`); | ||
errorStream = leo.load(ID, `${source}_error`); | ||
} | ||
@@ -338,0 +340,0 @@ errorStream.write(eventObj); |
{ | ||
"name": "leo-connector-common", | ||
"version": "2.1.0-RC4", | ||
"version": "2.1.0", | ||
"description": "Common package for all Leo Platform database connectors", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"leo-logger": "^1.0.1", | ||
"leo-sdk": "^2.2.4", | ||
"leo-sdk": "^2.3.1", | ||
"moment": "^2.24.0", | ||
@@ -32,0 +32,0 @@ "sqlstring": "^2.3.1" |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
108791
3887
0
Updatedleo-sdk@^2.3.1