Comparing version 0.1.8 to 0.1.9
{ | ||
"name": "meadow", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "A data access library.", | ||
@@ -5,0 +5,0 @@ "main": "source/Meadow.js", |
@@ -236,3 +236,3 @@ /** | ||
pQuery.query.records[0] = libUnderscore.extend(_Schema.defaultObject, pQuery.query.records[0]); | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider create code complexity | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider create code | ||
_Provider.Create(pQuery, function(){ fStageComplete(pQuery.result.error, pQuery); }); | ||
@@ -243,12 +243,7 @@ }, | ||
{ | ||
if ( | ||
// The query wasn't run yet | ||
(pQuery.parameters.result.executed == false) || | ||
// The value is not set (it should be set to the value for our DefaultIdentifier) | ||
(pQuery.parameters.result.value === false) | ||
) | ||
if (pQuery.parameters.result.value === false) | ||
{ | ||
// The value is not set (it should be set to the value for our DefaultIdentifier) | ||
return fStageComplete('Creation failed', pQuery, false); | ||
} | ||
var tmpIDRecord = pQuery.result.value; | ||
@@ -267,9 +262,5 @@ fStageComplete(pQuery.result.error, pQuery, tmpIDRecord); | ||
{ | ||
if ( | ||
// The value is not an array | ||
(!Array.isArray(pQueryRead.parameters.result.value)) || | ||
// There is not at least one record returned | ||
(pQueryRead.parameters.result.value.length < 1) | ||
) | ||
if (pQueryRead.parameters.result.value.length < 1) | ||
{ | ||
// There is not at least one record returned | ||
return fStageComplete('No record found after create.', pQuery, pQueryRead, false); | ||
@@ -307,3 +298,3 @@ } | ||
{ | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code complexity | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code | ||
_Provider.Read(pQuery, function(){ fStageComplete(pQuery.result.error, pQuery); }); | ||
@@ -314,7 +305,5 @@ }, | ||
{ | ||
if ( | ||
// The value is not an array | ||
(pQuery.parameters.result.value.length < 1) | ||
) | ||
if (pQuery.parameters.result.value.length < 1) | ||
{ | ||
// The value is not an array | ||
return fStageComplete(false, pQuery, false); | ||
@@ -324,3 +313,2 @@ } | ||
var tmpRecord = marshalRecordFromSourceToObject(pQuery.result.value[0]); | ||
// TODO: Add error handling for marshaling | ||
fStageComplete(pQuery.result.error, pQuery, tmpRecord); | ||
@@ -354,3 +342,3 @@ } | ||
{ | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code complexity | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code | ||
_Provider.Read(pQuery, function(){ fStageComplete(pQuery.result.error, pQuery); }); | ||
@@ -429,3 +417,2 @@ }, | ||
pQuery.addFilter(_DefaultIdentifier, pQuery.query.records[0][_DefaultIdentifier]); | ||
// Sanity check on update | ||
@@ -436,3 +423,3 @@ if ((pQuery.parameters.filter === false) || (pQuery.parameters.filter.length < 1)) | ||
} | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code complexity | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code | ||
_Provider.Update(pQuery, function(){ fStageComplete(pQuery.result.error, pQuery); }); | ||
@@ -443,9 +430,5 @@ }, | ||
{ | ||
if ( | ||
// The query wasn't run yet | ||
(pQuery.parameters.result.executed == false) || | ||
// The value is not an object | ||
(typeof(pQuery.parameters.result.value) !== 'object') | ||
) | ||
if (typeof(pQuery.parameters.result.value) !== 'object') | ||
{ | ||
// The value is not an object | ||
return fStageComplete('No record updated.', pQuery, false); | ||
@@ -461,3 +444,3 @@ } | ||
var tmpQueryRead = pQuery.clone(); | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code complexity | ||
// This odd lambda is to use the async waterfall without spilling logic into the provider read code | ||
_Provider.Read(tmpQueryRead, function(){ fStageComplete(tmpQueryRead.result.error, pQuery, tmpQueryRead); }); | ||
@@ -468,17 +451,2 @@ }, | ||
{ | ||
// This is a theoretical error ... it is pretty much impossible to simulate because | ||
// the waterfall error handling in step 3 catches problems in the underlying update. | ||
// Therefore we'll leave the guard commented out for now. But here for moral support. | ||
/* | ||
if ( | ||
// The value is not an array | ||
(!Array.isArray(pQueryRead.parameters.result.value)) || | ||
// There is not at least one record returned | ||
(pQueryRead.parameters.result.value.length < 1) | ||
) | ||
{ | ||
return fStageComplete('There was an issue loading a record after save.', pQuery, pQueryRead, false); | ||
} | ||
*/ | ||
var tmpRecord = marshalRecordFromSourceToObject(pQueryRead.result.value[0]); | ||
@@ -545,7 +513,5 @@ // TODO: Add error handling for marshaling | ||
{ | ||
if ( | ||
// The value is not a number | ||
(typeof(pQuery.parameters.result.value) !== 'number') | ||
) | ||
if (typeof(pQuery.parameters.result.value) !== 'number') | ||
{ | ||
// The value is not a number | ||
return fStageComplete('Count did not return valid results.', pQuery, false); | ||
@@ -552,0 +518,0 @@ } |
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
63040
2238