nodee-model
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -236,3 +236,3 @@ 'use strict'; | ||
query.fields({ id:1 }).one(function(err, data){ // no need to return whole document, just "id" field | ||
if(err) cb(new Error('Model DataSource exists: checking if exists failed').cause(err)); | ||
if(err) cb(new Error((ModelCnst._name||'DataSource') + '.exists: checking if exists failed').cause(err)); | ||
else cb(null, !!data); | ||
@@ -334,3 +334,3 @@ }); | ||
if(!model.isValid()) { | ||
callback(new Error('DataSource.prototype.create: INVALID').details({ | ||
callback(new Error((model.constructor._name||'DataSource') + '.prototype.create: INVALID').details({ | ||
code:'INVALID', | ||
@@ -358,11 +358,11 @@ validErrs: model.validErrs() | ||
if(!model.isValid()) { | ||
callback(new Error('DataSource.prototype.update: INVALID').details({ | ||
callback(new Error((model.constructor._name||'DataSource')+'.prototype.update: INVALID').details({ | ||
code:'INVALID', validErrs: model.validErrs() })); | ||
} | ||
else if(!model.id) { | ||
callback(new Error('DataSource.prototype.update: INVALID - missing "id"').details({ | ||
callback(new Error((model.constructor._name||'DataSource')+'.prototype.update: INVALID - missing "id"').details({ | ||
code:'INVALID', validErrs:{ id:[ 'required' ] } })); | ||
} | ||
else if(optimisticLock && !model.modifiedDT){ | ||
callback(new Error('DataSource.prototype.update: INVALID - missing "modifiedDT"').details({ | ||
callback(new Error((model.constructor._name||'DataSource')+'.prototype.update: INVALID - missing "modifiedDT"').details({ | ||
code:'INVALID', validErrs:{ modifiedDT:[ 'required' ] } })); | ||
@@ -381,3 +381,3 @@ } | ||
} | ||
else callback(new Error('DataSource.prototype.update: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else callback(new Error((model.constructor._name||'DataSource')+'.prototype.update: NOTFOUND').details({ code:'NOTFOUND' })); | ||
}); | ||
@@ -401,3 +401,3 @@ } | ||
if(!model.isValid()) { | ||
callback(new Error('DataSource.prototype.remove: INVALID').details({ | ||
callback(new Error((model.constructor._name||'DataSource')+'.prototype.remove: INVALID').details({ | ||
code:'INVALID', | ||
@@ -408,7 +408,7 @@ validErrs: model.validErrs() | ||
else if(!model.id) { | ||
callback(new Error('DataSource.prototype.remove: INVALID - missing "id"').details({ | ||
callback(new Error((model.constructor._name||'DataSource')+'.prototype.remove: INVALID - missing "id"').details({ | ||
code:'INVALID', validErrs:{ id:[ 'required' ] } })); | ||
} | ||
else if(optimisticLock && !model.modifiedDT){ | ||
callback(new Error('DataSource.prototype.remove: INVALID - missing "modifiedDT"').details({ | ||
callback(new Error((model.constructor._name||'DataSource')+'.prototype.remove: INVALID - missing "modifiedDT"').details({ | ||
code:'INVALID', validErrs:{ modifiedDT:[ 'required' ] } })); | ||
@@ -424,3 +424,3 @@ } | ||
else if(count===1) callback(null, model); | ||
else callback(new Error('DataSource.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else callback(new Error((model.constructor._name||'DataSource')+'.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
}); | ||
@@ -430,5 +430,5 @@ else model.constructor.collection().find(query).remove(function(err, count){ | ||
else if(count===1) callback(null, model); | ||
else callback(new Error('DataSource.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else callback(new Error((model.constructor._name||'DataSource')+'.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
}); | ||
} | ||
}); |
@@ -274,3 +274,3 @@ 'use strict'; | ||
if(!res || (res.status!==200 && res.status!==400) || ((res.body||{}).error && (res.body||{}).error.indexOf('IndexAlreadyExistsException')===-1)){ | ||
if(numOfFails >= maxNumOfFails) throw new Error('ElasticSearchDataSource: Cannot ensure ElasticSearch index "' +indexUrl+ '" ' +JSON.stringify((err||{}).message)+ ' ' + JSON.stringify(err || (res||{}).body || '')); | ||
if(numOfFails >= maxNumOfFails) throw new Error((ModelCnst._name||'ElasticSearchDataSource')+': Cannot ensure ElasticSearch index "' +indexUrl+ '" ' +JSON.stringify((err||{}).message)+ ' ' + JSON.stringify(err || (res||{}).body || '')); | ||
else { | ||
@@ -295,3 +295,3 @@ numOfFails++; | ||
// fail | ||
throw new Error('ElasticSearchDataSource: Cannot ensure ElasticSearch mappings "' +indexUrl +'/'+ type +'/_mapping'+ '" ' + JSON.stringify(err || res.body || '')); | ||
throw new Error((ModelCnst._name||'ElasticSearchDataSource')+': Cannot ensure ElasticSearch mappings "' +indexUrl +'/'+ type +'/_mapping'+ '" ' + JSON.stringify(err || res.body || '')); | ||
} | ||
@@ -298,0 +298,0 @@ else { |
@@ -171,2 +171,4 @@ 'use strict'; | ||
FileSystem.addMethod('init', function(cb){ | ||
var ModelCnst = this; | ||
this.extendDefaults({ | ||
@@ -178,3 +180,3 @@ connection:{ | ||
fsExt.existsOrCreate(this.getDefaults().connection.dirPath, function(err){ | ||
if(err) throw new Error('FileSystemDataSource: init failed').cause(err); | ||
if(err) throw new Error((ModelCnst._name||'FileSystemDataSource')+': init failed').cause(err); | ||
else if(typeof cb === 'function') cb(); | ||
@@ -206,3 +208,3 @@ }); | ||
getData(defaults.connection.dirPath, defaults.query, function(err, records){ | ||
if(err) return cb(new Error('FileSystemDataSource exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'FileSystemDataSource')+' exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -227,3 +229,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getData(defaults.connection.dirPath, defaults.query, function(err, records){ | ||
if(err) return cb(new Error('FileSystemSource one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'FileSystemDataSource')+' one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -248,3 +250,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getData(defaults.connection.dirPath, defaults.query, function(err, records){ | ||
if(err) return cb(new Error('FileSystemDataSource all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'FileSystemDataSource')+' all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -269,3 +271,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getData(defaults.connection.dirPath, defaults.query, function(err, records){ | ||
if(err) return cb(new Error('FileSystemDataSource count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'FileSystemDataSource')+' count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -297,3 +299,3 @@ var matchedRecords = sift(defaults.query, records); | ||
for(var i=0;i<data.length;i++){ | ||
if(typeof data[i].id !== 'string') return cb(new Error('FileSystemDataSource create: INVALID').details({ code:'INVALID', validErrs:{ id:['required'] } })); | ||
if(typeof data[i].id !== 'string') return cb(new Error((ModelCnst._name||'FileSystemDataSource')+' create: INVALID').details({ code:'INVALID', validErrs:{ id:['required'] } })); | ||
else { | ||
@@ -357,3 +359,3 @@ data[i].fullPath = defaults.connection.dirPath + '/' + data[i].id; | ||
}, function(err){ | ||
if(err) cb(new Error('FileSystemDataSource create: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'FileSystemDataSource')+' create: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else cb(null, multiple ? data : data[0]); | ||
@@ -386,3 +388,3 @@ }); | ||
getData(defaults.connection.dirPath, defaults.query, function(err, records){ | ||
if(err) return cb(new Error('FileSystemDataSource remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'FileSystemDataSource')+' remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -420,3 +422,3 @@ var toRemove = sift(defaults.query, records); | ||
}, function(err){ | ||
if(err) cb(new Error('FileSystemDataSource remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'FileSystemDataSource')+' remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else { | ||
@@ -451,3 +453,3 @@ | ||
if(!model.isValid()) { | ||
callback(new Error('DataSource.prototype.remove: INVALID').details({ | ||
callback(new Error((model.constructor._name||'FileSystemDataSource')+'.prototype.remove: INVALID').details({ | ||
code:'INVALID', | ||
@@ -458,7 +460,7 @@ validErrs: model.validErrs() | ||
else if(!model.id) { | ||
callback(new Error('DataSource.prototype.remove: INVALID - missing "id"').details({ | ||
callback(new Error((model.constructor._name||'FileSystemDataSource')+'.prototype.remove: INVALID - missing "id"').details({ | ||
code:'INVALID', validErrs:{ id:[ 'required' ] } })); | ||
} | ||
else if(optimisticLock && !model.modifiedDT){ | ||
callback(new Error('DataSource.prototype.remove: INVALID - missing "modifiedDT"').details({ | ||
callback(new Error((model.constructor._name||'FileSystemDataSource')+'.prototype.remove: INVALID - missing "modifiedDT"').details({ | ||
code:'INVALID', validErrs:{ modifiedDT:[ 'required' ] } })); | ||
@@ -474,3 +476,3 @@ } | ||
else if(count===1) callback(null, model); | ||
else callback(new Error('DataSource.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else callback(new Error((model.constructor._name||'FileSystemDataSource')+'.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
}); | ||
@@ -480,3 +482,3 @@ else model.constructor.collection().find(query).remove(function(err, count){ | ||
else if(count===1) callback(null, model); | ||
else callback(new Error('DataSource.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else callback(new Error((model.constructor._name||'FileSystemDataSource')+'.prototype.remove: NOTFOUND').details({ code:'NOTFOUND' })); | ||
}); | ||
@@ -500,3 +502,3 @@ } | ||
fsExt.readFile(file.fullPath, opts, function(err, data){ | ||
if(err) cb(new Error('FileSystemDataSource instance read: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.read: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else cb(null, opts.toString ? data.toString() : data); | ||
@@ -519,5 +521,5 @@ }); | ||
file.constructor.collection().findId(file.id).one(function(err, currentFile){ | ||
if(err) cb(new Error('FileSystem prototype write: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) cb(new Error('FileSystem prototype write: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else if(currentFile.modifiedDT.getTime() - file.modifiedDT.getTime() !== 0) cb(new Error('FileSystem prototype write: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.write: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.write: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else if(currentFile.modifiedDT.getTime() - file.modifiedDT.getTime() !== 0) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.write: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
else write(); | ||
@@ -530,5 +532,5 @@ }); | ||
fsExt.writeFile(file.fullPath, data, function(err){ | ||
if(err) cb(new Error('FileSystemDataSource instance write: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.write: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else fsExt.getFileInfo(file.id, file.fullPath, function(err, fileInfo){ | ||
if(err) cb(new Error('FileSystemDataSource instance write: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.write: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, file.constructor.new(fileInfo)); | ||
@@ -556,5 +558,5 @@ }); | ||
file.constructor.collection().findId(file.id).one(function(err, currentFile){ | ||
if(err) cb(new Error('FileSystem prototype write: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) cb(new Error('FileSystem prototype write: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else if(currentFile.modifiedDT.getTime() - file.modifiedDT.getTime() !== 0) cb(new Error('FileSystem prototype write: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.rename: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.rename: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else if(currentFile.modifiedDT.getTime() - file.modifiedDT.getTime() !== 0) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.rename: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
else rename(); | ||
@@ -567,5 +569,5 @@ }); | ||
fs.rename(oldPath, newPath, function(err){ | ||
if(err) cb(new Error('FileSystemDataSource instance write: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.rename: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else fsExt.getFileInfo(newId, newPath, function(err, fileInfo){ | ||
if(err) cb(new Error('FileSystemDataSource instance write: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) cb(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.rename: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, file.constructor.new(fileInfo)); | ||
@@ -585,11 +587,11 @@ }); | ||
// move inside self is not allowed | ||
if(file.id === parentId) callback(new Error('FileSystem.prototype.move: Parent is same as child').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
if(file.id === parentId) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: Parent is same as child').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
// dont trust user data, load old document to ensure data integrity | ||
else file.constructor.collection().findId(file.id).one(function(err, currentFile){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) callback(new Error('FileSystem.prototype.move: NOTFOUND').details({ code:'NOTFOUND' })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else if(file.ancestors[ file.ancestors.length-1 ] === parentId) callback(null, file); // not moved | ||
else if(file.constructor.getDefaults().options.optimisticLock && currentFile.modifiedDT.getTime() - file.modifiedDT.getTime() !== 0) { | ||
callback(new Error('FileSystem.prototype.move: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
} | ||
@@ -600,3 +602,3 @@ // parent is "root" | ||
moveFile(parent, currentFile, true, function(err, movedFileInfo){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else callback(null, file.constructor.new(movedFileInfo)); | ||
@@ -607,6 +609,6 @@ }); | ||
else file.constructor.collection().findId(parentId).one(function(err, parent){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!parent || parent.isFile) callback(new Error('FileSystem.prototype.move: Parent not found, or it is file').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!parent || parent.isFile) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: Parent not found, or it is file').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
else moveFile(parent, currentFile, true, function(err, movedFileInfo){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else callback(null, file.constructor.new(movedFileInfo)); | ||
@@ -626,11 +628,11 @@ }); | ||
// move inside self is not allowed | ||
if(file.id === parentId) callback(new Error('FileSystem.prototype.move: Parent is same as child').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
if(file.id === parentId) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: Parent is same as child').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
// dont trust user data, load old document to ensure data integrity | ||
else file.constructor.collection().findId(file.id).one(function(err, currentFile){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) callback(new Error('FileSystem.prototype.move: NOTFOUND').details({ code:'NOTFOUND' })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!currentFile) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: NOTFOUND').details({ code:'NOTFOUND' })); | ||
else if(file.ancestors[ file.ancestors.length-1 ] === parentId) callback(null, file); // not moved | ||
else if(file.constructor.getDefaults().options.optimisticLock && currentFile.modifiedDT.getTime() - file.modifiedDT.getTime() !== 0) { | ||
callback(new Error('FileSystem.prototype.move: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: version NOTFOUND').details({ code:'NOTFOUND' })); | ||
} | ||
@@ -641,3 +643,3 @@ // parent is "root" | ||
moveFile(parent, currentFile, false, function(err, movedFileInfo){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else callback(null, file.constructor.new(movedFileInfo)); | ||
@@ -648,6 +650,6 @@ }); | ||
else file.constructor.collection().findId(parentId).one(function(err, parent){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!parent || parent.isFile) callback(new Error('FileSystem.prototype.move: Parent not found, or it is file').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else if(!parent || parent.isFile) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: Parent not found, or it is file').details({ code:'INVALID', validErrs:{ ancestors:['invalid'] } })); | ||
else moveFile(parent, currentFile, false, function(err, movedFileInfo){ | ||
if(err) callback(new Error('FileSystem.prototype.move: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) callback(new Error((file.constructor._name||'FileSystemDataSource')+'.prototype.copy: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else callback(null, file.constructor.new(movedFileInfo)); | ||
@@ -654,0 +656,0 @@ }); |
@@ -116,2 +116,4 @@ 'use strict'; | ||
JsonFile.addMethod('init', function(cb){ | ||
var ModelCnst = this; | ||
this.extendDefaults({ | ||
@@ -123,3 +125,3 @@ connection:{ | ||
fsExt.existsOrCreate(this.getDefaults().connection.filePath, { data:'[]' }, function(err){ | ||
if(err) throw new Error('JsonDataSource: init failed').cause(err); | ||
if(err) throw new Error((ModelCnst._name||'JsonDataSource')+': init failed').cause(err); | ||
else if(typeof cb === 'function') cb(); | ||
@@ -158,3 +160,3 @@ }); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -179,3 +181,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -200,3 +202,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -221,3 +223,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -241,3 +243,3 @@ var matchedRecords = sift(defaults.query, records); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -264,4 +266,4 @@ | ||
q.all(function(err, items){ | ||
if(err) cb(new Error('JsonFileDataSource create: failed to check id duplicity').cause(err)); | ||
else if(items.length>0) cb(new Error('JsonFileDataSource create: one or more document with same id exists').details({ code:'EXECFAIL' })); | ||
if(err) cb(new Error((ModelCnst._name||'JsonDataSource')+' create: failed to check id duplicity').cause(err)); | ||
else if(items.length>0) cb(new Error((ModelCnst._name||'JsonDataSource')+' create: one or more document with same id exists').details({ code:'EXECFAIL' })); | ||
else { | ||
@@ -271,3 +273,3 @@ records = records.concat(data); | ||
fsExt.writeFile(defaults.connection.filePath, stringify(records), function(err){ | ||
if(err) cb(new Error('JsonFileDataSource create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'JsonDataSource')+' create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, multiple ? data : data[0]); | ||
@@ -282,3 +284,3 @@ }); | ||
fsExt.writeFile(defaults.connection.filePath, stringify(records), function(err){ | ||
if(err) cb(new Error('JsonFileDataSource create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'JsonDataSource')+' create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, multiple ? data : data[0]); | ||
@@ -301,3 +303,3 @@ }); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -323,3 +325,3 @@ // be carefull if bulk updating and optimisticLock, need to manual update modifiedDT | ||
fsExt.writeFile(defaults.connection.filePath, stringify(records), function(err){ | ||
if(err) cb(new Error('JsonFileDataSource update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'JsonDataSource')+' update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, count); | ||
@@ -340,3 +342,3 @@ }); | ||
getFileData(defaults.connection.filePath, function(err, records){ | ||
if(err) return cb(new Error('JsonDataSource remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'JsonDataSource')+' remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -357,3 +359,3 @@ var toDelete = sift(defaults.query, records); | ||
fsExt.writeFile(defaults.connection.filePath, stringify(records), function(err){ | ||
if(err) cb(new Error('JsonFileDataSource remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'JsonDataSource')+' remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, count); | ||
@@ -360,0 +362,0 @@ }); |
@@ -106,3 +106,3 @@ 'use strict'; | ||
if(!defaults.connection.collection) return cb(new Error('MemoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -127,3 +127,3 @@ | ||
if(!defaults.connection.collection) return cb(new Error('MamoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -148,3 +148,3 @@ | ||
if(!defaults.connection.collection) return cb(new Error('MemoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -169,3 +169,3 @@ | ||
if(!defaults.connection.collection) return cb(new Error('MemoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -188,3 +188,3 @@ | ||
if(!defaults.connection.collection) return cb(new Error('MemoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -208,4 +208,4 @@ | ||
if(ids.length>0) ModelCnst.collection().findId(ids).all(function(err, items){ | ||
if(err) cb(new Error('MemoryDataSource create: failed to check id duplicity').cause(err)); | ||
else if(items.length>0) cb(new Error('MemoryDataSource create: one or more document with same id exists').details({ code:'EXECFAIL' })); | ||
if(err) cb(new Error((ModelCnst._name||'MemoryDataSource')+' create: failed to check id duplicity').cause(err)); | ||
else if(items.length>0) cb(new Error((ModelCnst._name||'MemoryDataSource')+' create: one or more document with same id exists').details({ code:'EXECFAIL' })); | ||
else { | ||
@@ -232,3 +232,3 @@ records = memDB[ defaults.connection.collection ] = records.concat(data); | ||
if(!defaults.connection.collection) return cb(new Error('MemoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -267,3 +267,3 @@ | ||
if(!defaults.connection.collection) return cb(new Error('MemoryDataSource: CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })) | ||
if(!defaults.connection.collection) return cb(new Error((ModelCnst._name||'MemoryDataSource')+': CONNFAIL - defaults.connection.collection is not defined').details({ code:'CONNFAIL' })); | ||
var records = memDB[ defaults.connection.collection ] = memDB[ defaults.connection.collection ] || []; | ||
@@ -270,0 +270,0 @@ |
@@ -69,2 +69,4 @@ 'use strict'; | ||
Mongo.addMethod('init', function(cb){ | ||
var ModelCnst = this; | ||
// cerate mongoUrl | ||
@@ -82,3 +84,3 @@ this._defaults.connection.mongoUrl = mongo.createMongoUrl(this._defaults.connection); | ||
this.ensureIndex(this.getDefaults().connection, indexes, function(err, indexNames){ | ||
if(err) throw new Error('MongoDataSource init: index ensuring failed').cause(err); | ||
if(err) throw new Error((ModelCnst._name||'MongoDataSource')+' init: index ensuring failed').cause(err); | ||
// console.log(indexNames); | ||
@@ -173,3 +175,3 @@ if(typeof cb === 'function') cb(null, indexNames); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -179,3 +181,3 @@ var coll = db.collection(defaults.connection.collection); | ||
args.push(function(err, data){ | ||
if(err) return cb(new Error('MongoDataSource exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else return cb(null, data); | ||
@@ -186,3 +188,3 @@ }); | ||
catch(err){ | ||
return cb(new Error('MongoDataSource exec: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
return cb(new Error((ModelCnst._name||'MongoDataSource')+' exec: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
} | ||
@@ -201,7 +203,7 @@ }); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
var coll = db.collection(defaults.connection.collection); | ||
coll.findOne(defaults.query || {}, defaults.options || {}, function(err, data){ | ||
if(err) return cb(new Error('MongoDataSource one: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' one: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else return cb(null, data); | ||
@@ -222,3 +224,3 @@ }); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -235,3 +237,3 @@ var coll = db.collection(defaults.connection.collection); | ||
stream.on('error', function(err){ | ||
cb(new Error('MongoDataSource all: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
cb(new Error((ModelCnst._name||'MongoDataSource')+' all: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
}); | ||
@@ -250,3 +252,3 @@ }); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -259,3 +261,3 @@ // limit, skip count does not make sense | ||
coll.count(defaults.query || {}, defaults.options || {}, function(err, data){ | ||
if(err) return cb(new Error('MongoDataSource count: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' count: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else return cb(null, data); | ||
@@ -295,3 +297,3 @@ }); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -301,5 +303,5 @@ var coll = db.collection(defaults.connection.collection); | ||
if(err){ | ||
var mError = ModelCnst.parseError(err, 'MongoDataSource update'); | ||
var mError = ModelCnst.parseError(err, (ModelCnst._name||'MongoDataSource')+' create'); | ||
if(mError) cb(mError); | ||
else cb(new Error('MongoDataSource create: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else cb(new Error((ModelCnst._name||'MongoDataSource')+' create: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
} | ||
@@ -343,3 +345,3 @@ else cb(null, multiple ? (result.ops||[]) : (result.ops||[])[0]); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
@@ -349,5 +351,5 @@ var coll = db.collection(defaults.connection.collection); | ||
if(err){ | ||
var mError = ModelCnst.parseError(err, 'MongoDataSource update'); | ||
var mError = ModelCnst.parseError(err, (ModelCnst._name||'MongoDataSource')+' update'); | ||
if(mError) cb(mError); | ||
else cb(new Error('MongoDataSource update: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else cb(new Error((ModelCnst._name||'MongoDataSource')+' update: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
} | ||
@@ -369,7 +371,7 @@ else return cb(null, result.modifiedCount || 0); | ||
mongo.getDb(defaults.connection.mongoUrl, function(err, db){ | ||
if(err) return cb(new Error('MongoDataSource remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
var coll = db.collection(defaults.connection.collection); | ||
coll.deleteMany(defaults.query || {}, {w:1}, function(err, result){ | ||
if(err) return cb(new Error('MongoDataSource remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) return cb(new Error((ModelCnst._name||'MongoDataSource')+' remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else return cb(null, result.deletedCount || 0); | ||
@@ -376,0 +378,0 @@ }); |
@@ -310,3 +310,3 @@ 'use strict'; | ||
if(ModelCnst.authRequest) ModelCnst.authRequest(ModelCnst, parseMode, defaults, reqData, function(err){ | ||
if(err) done(new Error('RestDataSource: Authorization failed').cause(err)); | ||
if(err) done(new Error((ModelCnst._name||'RestDataSource')+': Authorization failed').cause(err)); | ||
else eReq(defaults); | ||
@@ -323,3 +323,3 @@ }); | ||
.end(function(err, res){ | ||
if(!res) done(new Error('RestDataSource: Request failed').cause(err)); | ||
if(!res) done(new Error((ModelCnst._name||'RestDataSource')+': Request failed').cause(err)); | ||
else if(res.statusType === 5){ // server error | ||
@@ -380,5 +380,5 @@ done(res.error, ModelCnst.parseError(defaults, res.status, res.body)); | ||
// this is last try, | ||
else done(new Error('RestDataSource: Max repeated requests reached').cause(err)); | ||
else done(new Error((ModelCnst._name||'RestDataSource')+': Max repeated requests reached').cause(err)); | ||
} | ||
else if(!res) done(new Error('RestDataSource: No response')); // connection error | ||
else if(!res) done(new Error((ModelCnst._name||'RestDataSource')+': No response')); // connection error | ||
else if(res.statusType === 5){ // server error | ||
@@ -436,4 +436,4 @@ done(res.error, ModelCnst.parseError(defaults, res.status, res.body)); | ||
execRequest(ModelCnst, null, defaults, args, function(err, resData, count){ | ||
if(err && resData) cb(new Error('RestDataSource exec: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error('RestDataSource exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) cb(new Error((ModelCnst._name||'RestDataSource')+' exec: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error((ModelCnst._name||'RestDataSource')+' exec: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else cb(null, resData); | ||
@@ -459,4 +459,4 @@ }); | ||
execRequest(ModelCnst, (defaults.query.id ? 'single' : 'list'), defaults, null, function(err, resData, count){ | ||
if(err && resData) cb(new Error('RestDataSource one: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error('RestDataSource one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) cb(new Error((ModelCnst._name||'RestDataSource')+' one: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error((ModelCnst._name||'RestDataSource')+' one: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else { | ||
@@ -482,4 +482,4 @@ cb(null, Array.isArray(resData) ? resData[0] : resData); | ||
readAll(ModelCnst, defaults, function(err, resData, count){ | ||
if(err && resData) cb(new Error('RestDataSource all: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error('RestDataSource all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) cb(new Error((ModelCnst._name||'RestDataSource')+' all: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error((ModelCnst._name||'RestDataSource')+' all: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else { | ||
@@ -505,4 +505,4 @@ resData.count = count; | ||
execRequest(ModelCnst, null, defaults, null, function(err, resData, count){ | ||
if(err && resData) cb(new Error('RestDataSource count: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error('RestDataSource count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) cb(new Error((ModelCnst._name||'RestDataSource')+' count: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) cb(new Error((ModelCnst._name||'RestDataSource')+' count: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else { | ||
@@ -542,4 +542,4 @@ cb(null, count); | ||
execRequest(ModelCnst, 'single', defaults, data[i], function(err, resData, count){ | ||
if(err && resData) next(new Error('RestDataSource create: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) next(new Error('RestDataSource create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) next(new Error((ModelCnst._name||'RestDataSource')+' create: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) next(new Error((ModelCnst._name||'RestDataSource')+' create: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else { | ||
@@ -574,3 +574,3 @@ data[i] = object.extend(data[i], resData); // extend, because not all rest services returns newly created item, they just returns id, or success message | ||
ModelCnst.collection(defaults).all(function(err, items){ | ||
if(err) cb(new Error('RestDataSource update: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'RestDataSource')+' update: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else updateAll(items); | ||
@@ -594,4 +594,4 @@ }); | ||
execRequest(ModelCnst, null, defaults, items[i], function(err, resData, count){ | ||
if(err && resData) next(new Error('RestDataSource update: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) next(new Error('RestDataSource update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) next(new Error((ModelCnst._name||'RestDataSource')+' update: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) next(new Error((ModelCnst._name||'RestDataSource')+' update: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else { | ||
@@ -621,3 +621,3 @@ updatedCount++; | ||
ModelCnst.collection(defaults).all(function(err, items){ | ||
if(err) cb(new Error('RestDataSource remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
if(err) cb(new Error((ModelCnst._name||'RestDataSource')+' remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else removeAll(items); | ||
@@ -638,4 +638,4 @@ }); | ||
execRequest(ModelCnst, null, defaults, items[i], function(err, resData, count){ | ||
if(err && resData) next(new Error('RestDataSource remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) next(new Error('RestDataSource remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
if(err && resData) next(new Error((ModelCnst._name||'RestDataSource')+' remove: EXECFAIL').details({ code:'EXECFAIL', cause:err })); | ||
else if(err) next(new Error((ModelCnst._name||'RestDataSource')+' remove: CONNFAIL').details({ code:'CONNFAIL', cause:err })); | ||
else { | ||
@@ -642,0 +642,0 @@ removedCount++; |
{ | ||
"name": "nodee-model", | ||
"preferGlobal": false, | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"author": "NODEE - Matus Szabo <matus@nodee.io>", | ||
@@ -6,0 +6,0 @@ "description": "Advanced, database agnostic ODM", |
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
228465
4908