v0.0.28
This commit is contained in:
@ -22,9 +22,10 @@ module.exports.isArrayOf = function(expectedType, value, name) {
|
||||
throw new TypeError([name, " should be an array of ", expectedType.name, "."].join(""));
|
||||
};
|
||||
|
||||
module.exports.isTypeOf = function(expectedType, value, name) {
|
||||
module.exports.isTypeOf = function(expectedType, value, name, nullAllowed) {
|
||||
if (nullAllowed && value === null) return;
|
||||
if (!(value instanceof expectedType))
|
||||
throw new TypeError([name, " should be of type '", expectedType.name, "'."].join(""));
|
||||
throw new TypeError([name, " should be of type '", expectedType.name, "'", nullAllowed ? " or null": "", "."].join(""));
|
||||
};
|
||||
|
||||
module.exports.positive = function(value, name) {
|
||||
|
@ -46,8 +46,6 @@ EventStoreAllCatchUpSubscription.prototype._readEventsTill = function(
|
||||
var done = lastCommitPosition === null
|
||||
? slice.isEndOfStream
|
||||
: slice.nextPosition.compareTo(new results.Position(lastCommitPosition, lastCommitPosition)) >= 0;
|
||||
if (!done && slice.isEndOfStream)
|
||||
return Promise.resolve(done).delay(10);
|
||||
return Promise.resolve(done);
|
||||
});
|
||||
})
|
||||
|
@ -492,7 +492,10 @@ EventStoreNodeConnection.prototype.subscribeToAllFrom = function(
|
||||
lastCheckpoint, resolveLinkTos, eventAppeared, liveProcessingStarted, subscriptionDropped,
|
||||
userCredentials, readBatchSize
|
||||
) {
|
||||
if (typeof eventAppeared !== 'function') throw new TypeError("eventAppeared must be a function.");
|
||||
ensure.isTypeOf(results.Position, lastCheckpoint, "lastCheckpoint", true);
|
||||
ensure.isTypeOf(Function, eventAppeared, "eventAppeared", false);
|
||||
if (liveProcessingStarted) ensure.isTypeOf(Function, liveProcessingStarted, "liveProcessingStarted", false);
|
||||
if (subscriptionDropped) ensure.isTypeOf(Function, subscriptionDropped, "subscriptionDropped", false);
|
||||
|
||||
var catchUpSubscription =
|
||||
new EventStoreAllCatchUpSubscription(this, this._settings.log, lastCheckpoint, resolveLinkTos,
|
||||
|
Reference in New Issue
Block a user