Comparing version 0.1.1 to 0.1.2
@@ -0,1 +1,8 @@ | ||
0.1.2 / 2016-09-06 | ||
================== | ||
* Add optional "meta" prop to JobConfig | ||
* Fix missing @throws to HubManager#queueJob | ||
* Fix queueForTermination not marked as protected | ||
0.1.1 / 2016-09-01 | ||
@@ -2,0 +9,0 @@ ================== |
@@ -164,2 +164,3 @@ var createUUID = require('uuid').v4; | ||
* @throws {JobNotFoundError} | ||
* @throws {InvalidUniqueKeyError} | ||
*/ | ||
@@ -232,2 +233,3 @@ HubManager.prototype.queueJob = function(job, params) { | ||
* | ||
* @protected | ||
* @param {TrackedJob} trackedJob | ||
@@ -234,0 +236,0 @@ */ |
@@ -17,2 +17,3 @@ var path = require('path'); | ||
* @property {function} [onProgress=null] | ||
* @property {object} [meta={}] | ||
*/ | ||
@@ -185,2 +186,9 @@ | ||
} | ||
if (jobConfig.meta && typeof jobConfig.meta !== 'object') { | ||
throw new errors.InvalidJobConfigError( | ||
'Job ' + JSON.stringify(jobName) + ' config must have an object for "meta", if specified', | ||
jobName, | ||
'meta' | ||
); | ||
} | ||
} | ||
@@ -204,3 +212,4 @@ else { | ||
onReject: jobConfig.onReject || null, | ||
onProgress: jobConfig.onProgress || null | ||
onProgress: jobConfig.onProgress || null, | ||
meta: jobConfig.meta || {} | ||
}; | ||
@@ -207,0 +216,0 @@ }; |
{ | ||
"name": "jobhub", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Manages running jobs in child processes", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -185,3 +185,4 @@ var path = require('path'); | ||
'onResolve', | ||
'onReject' | ||
'onReject', | ||
'meta' | ||
].sort(); | ||
@@ -198,3 +199,4 @@ | ||
onReject: function() {}, | ||
onProgress: function() {} | ||
onProgress: function() {}, | ||
meta: {} | ||
}; | ||
@@ -213,2 +215,3 @@ var parsed = util.parseJobConfig('FOO', jobConfig); | ||
expect(parsed.onProgress).toBe(jobConfig.onProgress); | ||
expect(parsed.meta).toBe(jobConfig.meta); | ||
}); | ||
@@ -232,2 +235,4 @@ | ||
expect(parsed.onProgress).toBe(null); | ||
expect(parsed.meta).toBeA(Object); | ||
expect(parsed.meta).toEqual({}); | ||
}); | ||
@@ -276,2 +281,4 @@ | ||
expect(parsed.onProgress).toBe(null); | ||
expect(parsed.meta).toBeA(Object); | ||
expect(parsed.meta).toEqual({}); | ||
}); | ||
@@ -371,2 +378,11 @@ | ||
}); | ||
it('should throw a InvalidJobConfigError if "meta" is specified and not an object', function() { | ||
expect(function() { | ||
util.parseJobConfig('FOO', { run: function() {}, meta: 5 }); | ||
}).toThrowWithProps(errors.InvalidJobConfigError, { | ||
jobName: 'FOO', | ||
propName: 'meta' | ||
}); | ||
}); | ||
}); | ||
@@ -373,0 +389,0 @@ |
112287
3243