Updated protobufjs to latest version
This commit is contained in:
parent
e0446cfb3e
commit
83cfa8fe1c
|
@ -44,7 +44,7 @@
|
|||
"@types/long": "^3.0.31",
|
||||
"@types/node": "^6.0.47",
|
||||
"long": "^3.2",
|
||||
"protobufjs": "^5.0",
|
||||
"protobufjs": "^6.7.3",
|
||||
"uuid": "^3.0.1",
|
||||
"uuid-parse": "^1.0.0"
|
||||
},
|
||||
|
|
|
@ -27,16 +27,17 @@ util.inherits(AppendToStreamOperation, OperationBase);
|
|||
AppendToStreamOperation.prototype._createRequestDto = function() {
|
||||
var dtos = this._events.map(function(ev) {
|
||||
var eventId = new Buffer(uuidParse.parse(ev.eventId));
|
||||
return new ClientMessage.NewEvent({
|
||||
event_id: eventId, event_type: ev.type,
|
||||
data_content_type: ev.isJson ? 1 : 0, metadata_content_type: 0,
|
||||
data: ev.data, metadata: ev.metadata});
|
||||
return {
|
||||
eventId: eventId, eventType: ev.type,
|
||||
dataContentType: ev.isJson ? 1 : 0, metadataContentType: 0,
|
||||
data: ev.data, metadata: ev.metadata
|
||||
};
|
||||
});
|
||||
return new ClientMessage.WriteEvents({
|
||||
event_stream_id: this._stream,
|
||||
expected_version: this._expectedVersion,
|
||||
eventStreamId: this._stream,
|
||||
expectedVersion: this._expectedVersion,
|
||||
events: dtos,
|
||||
require_master: this._requireMaster});
|
||||
requireMaster: this._requireMaster});
|
||||
};
|
||||
|
||||
AppendToStreamOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -72,7 +73,7 @@ AppendToStreamOperation.prototype._inspectResponse = function(response) {
|
|||
};
|
||||
|
||||
AppendToStreamOperation.prototype._transformResponse = function(response) {
|
||||
return new WriteResult(response.last_event_number, new Position(response.prepare_position || -1, response.commit_position || -1));
|
||||
return new WriteResult(response.lastEventNumber, new Position(response.preparePosition || -1, response.commitPosition || -1));
|
||||
};
|
||||
|
||||
AppendToStreamOperation.prototype.toString = function() {
|
||||
|
|
|
@ -23,7 +23,10 @@ function CommitTransactionOperation(log, cb, requireMaster, transactionId, userC
|
|||
util.inherits(CommitTransactionOperation, OperationBase);
|
||||
|
||||
CommitTransactionOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.TransactionCommit(this._transactionId, this._requireMaster);
|
||||
return new ClientMessage.TransactionCommit({
|
||||
transactionId: this._transactionId,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
CommitTransactionOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -56,8 +59,8 @@ CommitTransactionOperation.prototype._inspectResponse = function(response) {
|
|||
};
|
||||
|
||||
CommitTransactionOperation.prototype._transformResponse = function(response) {
|
||||
var logPosition = new results.Position(response.prepare_position || -1, response.commit_position || -1);
|
||||
return new results.WriteResult(response.last_event_number, logPosition);
|
||||
var logPosition = new results.Position(response.preparePosition || -1, response.commitPosition || -1);
|
||||
return new results.WriteResult(response.lastEventNumber, logPosition);
|
||||
};
|
||||
|
||||
CommitTransactionOperation.prototype.toString = function() {
|
||||
|
|
|
@ -27,21 +27,25 @@ function ConnectToPersistentSubscriptionOperation(
|
|||
util.inherits(ConnectToPersistentSubscriptionOperation, SubscriptionOperation);
|
||||
|
||||
ConnectToPersistentSubscriptionOperation.prototype._createSubscriptionPackage = function() {
|
||||
var dto = new ClientMessage.ConnectToPersistentSubscription(this._groupName, this._streamId, this._bufferSize);
|
||||
var dto = new ClientMessage.ConnectToPersistentSubscription({
|
||||
subscriptionId: this._groupName,
|
||||
eventStreamId: this._streamId,
|
||||
allowedInFlightMessages: this._bufferSize
|
||||
});
|
||||
return new TcpPackage(TcpCommand.ConnectToPersistentSubscription,
|
||||
this._userCredentials !== null ? TcpFlags.Authenticated : TcpFlags.None,
|
||||
this._correlationId,
|
||||
this._userCredentials !== null ? this._userCredentials.username : null,
|
||||
this._userCredentials !== null ? this._userCredentials.password : null,
|
||||
createBufferSegment(dto.toBuffer()));
|
||||
createBufferSegment(ClientMessage.ConnectToPersistentSubscription.encode(dto).finish()));
|
||||
};
|
||||
|
||||
ConnectToPersistentSubscriptionOperation.prototype._inspectPackage = function(pkg) {
|
||||
if (pkg.command === TcpCommand.PersistentSubscriptionConfirmation)
|
||||
{
|
||||
var dto = ClientMessage.PersistentSubscriptionConfirmation.decode(pkg.data.toBuffer());
|
||||
this._confirmSubscription(dto.last_commit_position, dto.last_event_number);
|
||||
this._subscriptionId = dto.subscription_id;
|
||||
this._confirmSubscription(dto.lastCommitPosition, dto.lastEventNumber);
|
||||
this._subscriptionId = dto.subscriptionId;
|
||||
return new InspectionResult(InspectionDecision.Subscribed, "SubscriptionConfirmation");
|
||||
}
|
||||
if (pkg.command === TcpCommand.PersistentSubscriptionStreamEventAppeared)
|
||||
|
@ -86,8 +90,8 @@ ConnectToPersistentSubscriptionOperation.prototype._createSubscriptionObject = f
|
|||
ConnectToPersistentSubscriptionOperation.prototype.notifyEventsProcessed = function(processedEvents) {
|
||||
ensure.notNull(processedEvents, "processedEvents");
|
||||
var dto = new ClientMessage.PersistentSubscriptionAckEvents({
|
||||
subscription_id: this._subscriptionId,
|
||||
processed_event_ids: processedEvents.map(function (x) {
|
||||
subscriptionId: this._subscriptionId,
|
||||
processedEventIds: processedEvents.map(function (x) {
|
||||
return new Buffer(uuidParse.parse(x));
|
||||
})
|
||||
});
|
||||
|
@ -97,25 +101,26 @@ ConnectToPersistentSubscriptionOperation.prototype.notifyEventsProcessed = funct
|
|||
this._correlationId,
|
||||
this._userCredentials !== null ? this._userCredentials.username : null,
|
||||
this._userCredentials !== null ? this._userCredentials.password : null,
|
||||
createBufferSegment(dto.encode().toBuffer()));
|
||||
createBufferSegment(ClientMessage.PersistentSubscriptionAckEvents.encode(dto).finish()));
|
||||
this._enqueueSend(pkg);
|
||||
};
|
||||
|
||||
ConnectToPersistentSubscriptionOperation.prototype.notifyEventsFailed = function(processedEvents, action, reason) {
|
||||
ensure.notNull(processedEvents, "processedEvents");
|
||||
ensure.notNull(reason, "reason");
|
||||
var dto = new ClientMessage.PersistentSubscriptionNakEvents(
|
||||
this._subscriptionId,
|
||||
processedEvents.map(function(x) { return new Buffer(uuidParse.parse(x)); }),
|
||||
reason,
|
||||
action);
|
||||
var dto = new ClientMessage.PersistentSubscriptionNakEvents({
|
||||
subscriptionId: this._subscriptionId,
|
||||
processedEventIds: processedEvents.map(function(x) { return new Buffer(uuidParse.parse(x)); }),
|
||||
message: reason,
|
||||
action: action
|
||||
});
|
||||
|
||||
var pkg = new TcpPackage(TcpCommand.PersistentSubscriptionNakEvents,
|
||||
this._userCredentials !== null ? TcpFlags.Authenticated : TcpFlags.None,
|
||||
this._correlationId,
|
||||
this._userCredentials !== null ? this._userCredentials.username : null,
|
||||
this._userCredentials !== null ? this._userCredentials.password : null,
|
||||
createBufferSegment(dto.toBuffer()));
|
||||
createBufferSegment(ClientMessage.PersistentSubscriptionNakEvents.encode(dto).finish()));
|
||||
this._enqueueSend(pkg);
|
||||
};
|
||||
|
||||
|
|
|
@ -36,11 +36,24 @@ function CreatePersistentSubscriptionOperation(log, cb, stream, groupName, setti
|
|||
util.inherits(CreatePersistentSubscriptionOperation, OperationBase);
|
||||
|
||||
CreatePersistentSubscriptionOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.CreatePersistentSubscription(this._groupName, this._stream, this._resolveLinkTos,
|
||||
this._startFromBeginning, this._messageTimeoutMilliseconds, this._recordStatistics, this._liveBufferSize,
|
||||
this._readBatchSize, this._bufferSize, this._maxRetryCount,
|
||||
this._namedConsumerStrategy === SystemConsumerStrategies.RoundRobin, this._checkPointAfter,
|
||||
this._maxCheckPointCount, this._minCheckPointCount, this._maxSubscriberCount, this._namedConsumerStrategy);
|
||||
return new ClientMessage.CreatePersistentSubscription({
|
||||
subscriptionGroupName: this._groupName,
|
||||
eventStreamId: this._stream,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
startFrom: this._startFromBeginning,
|
||||
messageTimeoutMilliseconds: this._messageTimeoutMilliseconds,
|
||||
recordStatistics: this._recordStatistics,
|
||||
liveBufferSize: this._liveBufferSize,
|
||||
readBatchSize: this._readBatchSize,
|
||||
bufferSize: this._bufferSize,
|
||||
maxRetryCount: this._maxRetryCount,
|
||||
preferRoundRobin: this._namedConsumerStrategy === SystemConsumerStrategies.RoundRobin,
|
||||
checkpointAfterTime: this._checkPointAfter,
|
||||
checkpointMaxCount: this._maxCheckPointCount,
|
||||
checkpointMinCount: this._minCheckPointCount,
|
||||
subscriberMaxCount: this._maxSubscriberCount,
|
||||
namedConsumerStrategy: this._namedConsumerStrategy
|
||||
});
|
||||
};
|
||||
|
||||
CreatePersistentSubscriptionOperation.prototype._inspectResponse = function(response) {
|
||||
|
|
|
@ -21,7 +21,10 @@ function DeletePersistentSubscriptionOperation(log, cb, stream, groupName, userC
|
|||
util.inherits(DeletePersistentSubscriptionOperation, OperationBase);
|
||||
|
||||
DeletePersistentSubscriptionOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.DeletePersistentSubscription(this._groupName, this._stream);
|
||||
return new ClientMessage.DeletePersistentSubscription({
|
||||
subscriptionGroupName: this._groupName,
|
||||
eventStreamId: this._stream
|
||||
});
|
||||
};
|
||||
|
||||
DeletePersistentSubscriptionOperation.prototype._inspectResponse = function(response) {
|
||||
|
|
|
@ -25,7 +25,12 @@ function DeleteStreamOperation(log, cb, requireMaster, stream, expectedVersion,
|
|||
util.inherits(DeleteStreamOperation, OperationBase);
|
||||
|
||||
DeleteStreamOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.DeleteStream(this._stream, this._expectedVersion, this._requireMaster, this._hardDelete);
|
||||
return new ClientMessage.DeleteStream({
|
||||
eventStreamId: this._stream,
|
||||
expectedVersion: this._expectedVersion,
|
||||
requireMaster: this._requireMaster,
|
||||
hardDelete: this._hardDelete
|
||||
});
|
||||
};
|
||||
|
||||
DeleteStreamOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -58,7 +63,7 @@ DeleteStreamOperation.prototype._inspectResponse = function(response) {
|
|||
};
|
||||
|
||||
DeleteStreamOperation.prototype._transformResponse = function(response) {
|
||||
return new results.DeleteResult(new results.Position(response.prepare_position || -1, response.commit_position || -1));
|
||||
return new results.DeleteResult(new results.Position(response.preparePosition || -1, response.commitPosition || -1));
|
||||
};
|
||||
|
||||
DeleteStreamOperation.prototype.toString = function() {
|
||||
|
|
|
@ -51,7 +51,7 @@ OperationBase.prototype._succeed = function() {
|
|||
|
||||
OperationBase.prototype.createNetworkPackage = function(correlationId) {
|
||||
var dto = this._createRequestDto();
|
||||
var buf = dto.toBuffer();
|
||||
var buf = dto.constructor.encode(dto).finish();
|
||||
return new TcpPackage(
|
||||
this._requestCommand,
|
||||
this.userCredentials ? TcpFlags.Authenticated : TcpFlags.None,
|
||||
|
@ -117,10 +117,10 @@ OperationBase.prototype._inspectNotHandled = function(pkg)
|
|||
return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy");
|
||||
|
||||
case ClientMessage.NotHandled.NotHandledReason.NotMaster:
|
||||
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additional_info);
|
||||
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additionalInfo);
|
||||
return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotMaster",
|
||||
{host: masterInfo.external_tcp_address, port: masterInfo.external_tcp_port},
|
||||
{host: masterInfo.external_secure_tcp_address, port: masterInfo.external_secure_tcp_port});
|
||||
{host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort},
|
||||
{host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort});
|
||||
|
||||
default:
|
||||
this.log.error("Unknown NotHandledReason: %s.", message.reason);
|
||||
|
|
|
@ -25,7 +25,13 @@ function ReadAllEventsBackwardOperation(
|
|||
util.inherits(ReadAllEventsBackwardOperation, OperationBase);
|
||||
|
||||
ReadAllEventsBackwardOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.ReadAllEvents(this._position.commitPosition, this._position.preparePosition, this._maxCount, this._resolveLinkTos, this._requireMaster);
|
||||
return new ClientMessage.ReadAllEvents({
|
||||
commitPosition: this._position.commitPosition,
|
||||
preparePosition: this._position.preparePosition,
|
||||
maxCount: this._maxCount,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
ReadAllEventsBackwardOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -48,8 +54,8 @@ ReadAllEventsBackwardOperation.prototype._inspectResponse = function(response) {
|
|||
ReadAllEventsBackwardOperation.prototype._transformResponse = function(response) {
|
||||
return new results.AllEventsSlice(
|
||||
ReadDirection.Backward,
|
||||
new results.Position(response.commit_position, response.prepare_position),
|
||||
new results.Position(response.next_commit_position, response.next_prepare_position),
|
||||
new results.Position(response.commitPosition, response.preparePosition),
|
||||
new results.Position(response.nextCommitPosition, response.nextPreparePosition),
|
||||
response.events
|
||||
)
|
||||
};
|
||||
|
|
|
@ -25,7 +25,13 @@ function ReadAllEventsForwardOperation(
|
|||
util.inherits(ReadAllEventsForwardOperation, OperationBase);
|
||||
|
||||
ReadAllEventsForwardOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.ReadAllEvents(this._position.commitPosition, this._position.preparePosition, this._maxCount, this._resolveLinkTos, this._requireMaster);
|
||||
return new ClientMessage.ReadAllEvents({
|
||||
commitPosition: this._position.commitPosition,
|
||||
preparePosition: this._position.preparePosition,
|
||||
maxCount: this._maxCount,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
ReadAllEventsForwardOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -48,8 +54,8 @@ ReadAllEventsForwardOperation.prototype._inspectResponse = function(response) {
|
|||
ReadAllEventsForwardOperation.prototype._transformResponse = function(response) {
|
||||
return new results.AllEventsSlice(
|
||||
ReadDirection.Forward,
|
||||
new results.Position(response.commit_position, response.prepare_position),
|
||||
new results.Position(response.next_commit_position, response.next_prepare_position),
|
||||
new results.Position(response.commitPosition, response.preparePosition),
|
||||
new results.Position(response.nextCommitPosition, response.nextPreparePosition),
|
||||
response.events
|
||||
)
|
||||
};
|
||||
|
|
|
@ -21,7 +21,12 @@ function ReadEventOperation(log, cb, stream, eventNumber, resolveLinkTos, requir
|
|||
util.inherits(ReadEventOperation, OperationBase);
|
||||
|
||||
ReadEventOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.ReadEvent(this._stream, this._eventNumber, this._resolveLinkTos, this._requireMaster);
|
||||
return new ClientMessage.ReadEvent({
|
||||
eventStreamId: this._stream,
|
||||
eventNumber: this._eventNumber,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
ReadEventOperation.prototype._inspectResponse = function(response) {
|
||||
|
|
|
@ -27,7 +27,13 @@ function ReadStreamEventsBackwardOperation(
|
|||
util.inherits(ReadStreamEventsBackwardOperation, OperationBase);
|
||||
|
||||
ReadStreamEventsBackwardOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.ReadStreamEvents(this._stream, this._fromEventNumber, this._maxCount, this._resolveLinkTos, this._requireMaster);
|
||||
return new ClientMessage.ReadStreamEvents({
|
||||
eventStreamId: this._stream,
|
||||
fromEventNumber: this._fromEventNumber,
|
||||
maxCount: this._maxCount,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
ReadStreamEventsBackwardOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -60,9 +66,9 @@ ReadStreamEventsBackwardOperation.prototype._transformResponse = function(respon
|
|||
this._fromEventNumber,
|
||||
ReadDirection.Backward,
|
||||
response.events,
|
||||
response.next_event_number,
|
||||
response.last_event_number,
|
||||
response.is_end_of_stream
|
||||
response.nextEventNumber,
|
||||
response.lastEventNumber,
|
||||
response.isEndOfStream
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,13 @@ function ReadStreamEventsForwardOperation(
|
|||
util.inherits(ReadStreamEventsForwardOperation, OperationBase);
|
||||
|
||||
ReadStreamEventsForwardOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.ReadStreamEvents(this._stream, this._fromEventNumber, this._maxCount, this._resolveLinkTos, this._requireMaster);
|
||||
return new ClientMessage.ReadStreamEvents({
|
||||
eventStreamId: this._stream,
|
||||
fromEventNumber: this._fromEventNumber,
|
||||
maxCount: this._maxCount,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
ReadStreamEventsForwardOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -60,9 +66,9 @@ ReadStreamEventsForwardOperation.prototype._transformResponse = function(respons
|
|||
this._fromEventNumber,
|
||||
ReadDirection.Forward,
|
||||
response.events,
|
||||
response.next_event_number,
|
||||
response.last_event_number,
|
||||
response.is_end_of_stream
|
||||
response.nextEventNumber,
|
||||
response.lastEventNumber,
|
||||
response.isEndOfStream
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,11 @@ function StartTransactionOperation(log, cb, requireMaster, stream, expectedVersi
|
|||
util.inherits(StartTransactionOperation, OperationBase);
|
||||
|
||||
StartTransactionOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.TransactionStart(this._stream, this._expectedVersion, this._requireMaster);
|
||||
return new ClientMessage.TransactionStart({
|
||||
eventStreamId: this._stream,
|
||||
expectedVersion: this._expectedVersion,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
};
|
||||
|
||||
StartTransactionOperation.prototype._inspectResponse = function(response) {
|
||||
|
@ -57,7 +61,7 @@ StartTransactionOperation.prototype._inspectResponse = function(response) {
|
|||
};
|
||||
|
||||
StartTransactionOperation.prototype._transformResponse = function(response) {
|
||||
return new EventStoreTransaction(response.transaction_id, this.userCredentials, this._parentConnection);
|
||||
return new EventStoreTransaction(response.transactionId, this.userCredentials, this._parentConnection);
|
||||
};
|
||||
|
||||
StartTransactionOperation.prototype.toString = function() {
|
||||
|
|
|
@ -64,7 +64,7 @@ SubscriptionOperation.prototype.unsubscribe = function() {
|
|||
|
||||
SubscriptionOperation.prototype._createUnsubscriptionPackage = function() {
|
||||
var msg = new ClientMessage.UnsubscribeFromStream();
|
||||
var data = new BufferSegment(msg.toBuffer());
|
||||
var data = new BufferSegment(ClientMessage.UnsubscribeFromStream.encode(msg).finish());
|
||||
return new TcpPackage(TcpCommand.UnsubscribeFromStream, TcpFlags.None, this._correlationId, null, null, data);
|
||||
};
|
||||
|
||||
|
@ -141,10 +141,10 @@ SubscriptionOperation.prototype.inspectPackage = function(pkg) {
|
|||
return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy");
|
||||
|
||||
case ClientMessage.NotHandled.NotHandledReason.NotMaster:
|
||||
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additional_info);
|
||||
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additionalInfo);
|
||||
return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotMaster",
|
||||
{host: masterInfo.external_tcp_address, port: masterInfo.external_tcp_port},
|
||||
{host: masterInfo.external_secure_tcp_address, port: masterInfo.external_secure_tcp_port});
|
||||
{host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort},
|
||||
{host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort});
|
||||
|
||||
default:
|
||||
this._log.error("Unknown NotHandledReason: %s.", message.reason);
|
||||
|
|
|
@ -23,12 +23,17 @@ util.inherits(TransactionalWriteOperation, OperationBase);
|
|||
TransactionalWriteOperation.prototype._createRequestDto = function() {
|
||||
var dtos = this._events.map(function(ev) {
|
||||
var eventId = new Buffer(uuidParse.parse(ev.eventId));
|
||||
return new ClientMessage.NewEvent({
|
||||
event_id: eventId, event_type: ev.type,
|
||||
data_content_type: ev.isJson ? 1 : 0, metadata_content_type: 0,
|
||||
data: ev.data, metadata: ev.metadata});
|
||||
return {
|
||||
eventId: eventId, eventType: ev.type,
|
||||
dataContentType: ev.isJson ? 1 : 0, metadataContentType: 0,
|
||||
data: ev.data, metadata: ev.metadata
|
||||
};
|
||||
});
|
||||
return new ClientMessage.TransactionWrite({
|
||||
transactionId: this._transactionId,
|
||||
events: dtos,
|
||||
requireMaster: this._requireMaster
|
||||
});
|
||||
return new ClientMessage.TransactionWrite(this._transactionId, dtos, this._requireMaster);
|
||||
};
|
||||
|
||||
TransactionalWriteOperation.prototype._inspectResponse = function(response) {
|
||||
|
|
|
@ -36,11 +36,24 @@ function UpdatePersistentSubscriptionOperation(log, cb, stream, groupName, setti
|
|||
util.inherits(UpdatePersistentSubscriptionOperation, OperationBase);
|
||||
|
||||
UpdatePersistentSubscriptionOperation.prototype._createRequestDto = function() {
|
||||
return new ClientMessage.UpdatePersistentSubscription(this._groupName, this._stream, this._resolveLinkTos,
|
||||
this._startFromBeginning, this._messageTimeoutMilliseconds, this._recordStatistics, this._liveBufferSize,
|
||||
this._readBatchSize, this._bufferSize, this._maxRetryCount,
|
||||
this._namedConsumerStrategy === SystemConsumerStrategies.RoundRobin, this._checkPointAfter,
|
||||
this._maxCheckPointCount, this._minCheckPointCount, this._maxSubscriberCount, this._namedConsumerStrategy);
|
||||
return new ClientMessage.UpdatePersistentSubscription({
|
||||
subscriptionGroupName: this._groupName,
|
||||
eventStreamId: this._stream,
|
||||
resolveLinkTos: this._resolveLinkTos,
|
||||
startFrom: this._startFromBeginning,
|
||||
messageTimeoutMilliseconds: this._messageTimeoutMilliseconds,
|
||||
recordStatistics: this._recordStatistics,
|
||||
liveBufferSize: this._liveBufferSize,
|
||||
readBatchSize: this._readBatchSize,
|
||||
bufferSize: this._bufferSize,
|
||||
maxRetryCount: this._maxRetryCount,
|
||||
preferRoundRobin: this._namedConsumerStrategy === SystemConsumerStrategies.RoundRobin,
|
||||
checkpointAfterTime: this._checkPointAfter,
|
||||
checkpointMaxCount: this._maxCheckPointCount,
|
||||
checkpointMinCount: this._minCheckPointCount,
|
||||
subscriberMaxCount: this._maxSubscriberCount,
|
||||
namedConsumerStrategy: this._namedConsumerStrategy
|
||||
});
|
||||
};
|
||||
|
||||
UpdatePersistentSubscriptionOperation.prototype._inspectResponse = function(response) {
|
||||
|
|
|
@ -20,20 +20,23 @@ function VolatileSubscriptionOperation(
|
|||
util.inherits(VolatileSubscriptionOperation, SubscriptionOperation);
|
||||
|
||||
VolatileSubscriptionOperation.prototype._createSubscriptionPackage = function() {
|
||||
var dto = new ClientMessage.SubscribeToStream(this._streamId, this._resolveLinkTos);
|
||||
var dto = new ClientMessage.SubscribeToStream({
|
||||
eventStreamId: this._streamId,
|
||||
resolveLinkTos: this._resolveLinkTos
|
||||
});
|
||||
return new TcpPackage(TcpCommand.SubscribeToStream,
|
||||
this._userCredentials !== null ? TcpFlags.Authenticated : TcpFlags.None,
|
||||
this._correlationId,
|
||||
this._userCredentials !== null ? this._userCredentials.username : null,
|
||||
this._userCredentials !== null ? this._userCredentials.password : null,
|
||||
new BufferSegment(dto.toBuffer()));
|
||||
new BufferSegment(ClientMessage.SubscribeToStream.encode(dto).finish()));
|
||||
};
|
||||
|
||||
VolatileSubscriptionOperation.prototype._inspectPackage = function(pkg) {
|
||||
try {
|
||||
if (pkg.command === TcpCommand.SubscriptionConfirmation) {
|
||||
var dto = ClientMessage.SubscriptionConfirmation.decode(pkg.data.toBuffer());
|
||||
this._confirmSubscription(dto.last_commit_position, dto.last_event_number);
|
||||
this._confirmSubscription(dto.lastCommitPosition, dto.lastEventNumber);
|
||||
return new InspectionResult(InspectionDecision.Subscribed, "SubscriptionConfirmation");
|
||||
}
|
||||
if (pkg.command === TcpCommand.StreamEventAppeared) {
|
||||
|
|
12200
src/messages/messages.js
12200
src/messages/messages.js
File diff suppressed because it is too large
Load Diff
|
@ -53,15 +53,15 @@ Object.freeze(EventReadStatus);
|
|||
* @property {boolean} isJson
|
||||
*/
|
||||
function RecordedEvent(ev) {
|
||||
this.eventStreamId = ev.event_stream_id;
|
||||
this.eventId = uuidParse.unparse(ev.event_id.buffer, ev.event_id.offset);
|
||||
this.eventNumber = ev.event_number;
|
||||
this.eventType = ev.event_type;
|
||||
this.created = new Date(ev.created_epoch ? ev.created_epoch.toNumber() : 0);
|
||||
this.createdEpoch = ev.created_epoch ? ev.created_epoch.toNumber() : 0;
|
||||
this.data = ev.data ? ev.data.toBuffer() : new Buffer(0);
|
||||
this.metadata = ev.metadata ? ev.metadata.toBuffer() : new Buffer(0);
|
||||
this.isJson = ev.data_content_type === 1;
|
||||
this.eventStreamId = ev.eventStreamId;
|
||||
this.eventId = uuidParse.unparse(ev.eventId);
|
||||
this.eventNumber = ev.eventNumber;
|
||||
this.eventType = ev.eventType;
|
||||
this.created = new Date(ev.createdEpoch ? ev.createdEpoch.toNumber() : 0);
|
||||
this.createdEpoch = ev.createdEpoch ? ev.createdEpoch.toNumber() : 0;
|
||||
this.data = ev.data ? ev.data : new Buffer(0);
|
||||
this.metadata = ev.metadata ? ev.metadata : new Buffer(0);
|
||||
this.isJson = ev.dataContentType === 1;
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ function ResolvedEvent(ev) {
|
|||
this.link = ev.link === null ? null : new RecordedEvent(ev.link);
|
||||
this.originalEvent = this.link || this.event;
|
||||
this.isResolved = this.link !== null && this.event !== null;
|
||||
this.originalPosition = (ev.commit_position && ev.prepare_position) ? new Position(ev.commit_position, ev.prepare_position) : null;
|
||||
this.originalPosition = (ev.commitPosition && ev.preparePosition) ? new Position(ev.commitPosition, ev.preparePosition) : null;
|
||||
this.originalStreamId = this.originalEvent && this.originalEvent.eventStreamId;
|
||||
this.originalEventNumber = this.originalEvent && this.originalEvent.eventNumber;
|
||||
Object.freeze(this);
|
||||
|
|
117
yarn.lock
117
yarn.lock
|
@ -2,10 +2,57 @@
|
|||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@protobufjs/aspromise@^1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.1.tgz#22526b2959bbc8dcc531dfcf569a9e2a1eeb3e1f"
|
||||
|
||||
"@protobufjs/base64@^1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.1.tgz#8f10115d2b1ac2c25f3602e55eba708e56bcd2bb"
|
||||
|
||||
"@protobufjs/codegen@^1.0.8":
|
||||
version "1.0.8"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-1.0.8.tgz#d29e3d48a9445d77ccbffa420379b29dc37c6d7d"
|
||||
|
||||
"@protobufjs/eventemitter@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70"
|
||||
|
||||
"@protobufjs/fetch@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45"
|
||||
dependencies:
|
||||
"@protobufjs/aspromise" "^1.1.1"
|
||||
"@protobufjs/inquire" "^1.1.0"
|
||||
|
||||
"@protobufjs/float@^1.0.2":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1"
|
||||
|
||||
"@protobufjs/inquire@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089"
|
||||
|
||||
"@protobufjs/path@^1.1.2":
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d"
|
||||
|
||||
"@protobufjs/pool@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54"
|
||||
|
||||
"@protobufjs/utf8@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
|
||||
|
||||
"@types/long@^3.0.31":
|
||||
version "3.0.31"
|
||||
resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.31.tgz#08635b0d0d322676940c1a88a7a9cef661c6f34a"
|
||||
|
||||
"@types/node@7.0.12":
|
||||
version "7.0.12"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9"
|
||||
|
||||
"@types/node@^6.0.47":
|
||||
version "6.0.63"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.63.tgz#e08acbbd5946e0e95990b1c76f3ce5b7882a48eb"
|
||||
|
@ -121,13 +168,6 @@ arrify@^1.0.0, arrify@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
|
||||
|
||||
ascli@~1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ascli/-/ascli-1.0.1.tgz#bcfa5974a62f18e81cabaeb49732ab4a88f906bc"
|
||||
dependencies:
|
||||
colour "~0.7.1"
|
||||
optjs "~3.2.2"
|
||||
|
||||
asn1.js@^4.0.0:
|
||||
version "4.9.1"
|
||||
resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40"
|
||||
|
@ -391,12 +431,6 @@ builtin-status-codes@^3.0.0:
|
|||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
|
||||
|
||||
bytebuffer@~5:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/bytebuffer/-/bytebuffer-5.0.1.tgz#582eea4b1a873b6d020a48d58df85f0bba6cfddd"
|
||||
dependencies:
|
||||
long "~3"
|
||||
|
||||
caching-transform@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1"
|
||||
|
@ -409,10 +443,6 @@ camelcase@^1.0.2:
|
|||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
|
||||
|
||||
camelcase@^2.0.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
|
||||
|
||||
camelcase@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"
|
||||
|
@ -477,7 +507,7 @@ cliui@^2.1.0:
|
|||
right-align "^0.1.1"
|
||||
wordwrap "0.0.2"
|
||||
|
||||
cliui@^3.0.3, cliui@^3.2.0:
|
||||
cliui@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
|
||||
dependencies:
|
||||
|
@ -497,10 +527,6 @@ color-support@^1.1.0:
|
|||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.2.tgz#49cc99b89d1bdef1292e9d9323c66971a33eb89d"
|
||||
|
||||
colour@~0.7.1:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/colour/-/colour-0.7.1.tgz#9cb169917ec5d12c0736d3e8685746df1cadf778"
|
||||
|
||||
combined-stream@^1.0.5, combined-stream@~1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009"
|
||||
|
@ -1380,7 +1406,7 @@ log-driver@1.2.5:
|
|||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056"
|
||||
|
||||
long@^3.2, long@~3:
|
||||
long@^3.2, long@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b"
|
||||
|
||||
|
@ -1654,10 +1680,6 @@ optimist@^0.6.1:
|
|||
minimist "~0.0.1"
|
||||
wordwrap "~0.0.2"
|
||||
|
||||
optjs@~3.2.2:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/optjs/-/optjs-3.2.2.tgz#69a6ce89c442a44403141ad2f9b370bd5bb6f4ee"
|
||||
|
||||
os-browserify@^0.2.0:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.2.1.tgz#63fc4ccee5d2d7763d26bbf8601078e6c2e0044f"
|
||||
|
@ -1773,14 +1795,23 @@ process@^0.11.0:
|
|||
version "0.11.9"
|
||||
resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1"
|
||||
|
||||
protobufjs@^5.0:
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-5.0.2.tgz#59748d7dcf03d2db22c13da9feb024e16ab80c91"
|
||||
protobufjs@^6.7.3:
|
||||
version "6.7.3"
|
||||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.7.3.tgz#9270aa5d75dfe4d37df1dec87c444a72140d0e1c"
|
||||
dependencies:
|
||||
ascli "~1"
|
||||
bytebuffer "~5"
|
||||
glob "^7.0.5"
|
||||
yargs "^3.10.0"
|
||||
"@protobufjs/aspromise" "^1.1.1"
|
||||
"@protobufjs/base64" "^1.1.1"
|
||||
"@protobufjs/codegen" "^1.0.8"
|
||||
"@protobufjs/eventemitter" "^1.1.0"
|
||||
"@protobufjs/fetch" "^1.1.0"
|
||||
"@protobufjs/float" "^1.0.2"
|
||||
"@protobufjs/inquire" "^1.1.0"
|
||||
"@protobufjs/path" "^1.1.2"
|
||||
"@protobufjs/pool" "^1.1.0"
|
||||
"@protobufjs/utf8" "^1.1.0"
|
||||
"@types/long" "^3.0.31"
|
||||
"@types/node" "7.0.12"
|
||||
long "^3.2.0"
|
||||
|
||||
prr@~0.0.0:
|
||||
version "0.0.0"
|
||||
|
@ -2421,10 +2452,6 @@ window-size@0.1.0:
|
|||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
|
||||
|
||||
window-size@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
|
||||
|
||||
wordwrap@0.0.2, wordwrap@~0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
||||
|
@ -2452,7 +2479,7 @@ xtend@^4.0.0:
|
|||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
|
||||
|
||||
y18n@^3.2.0, y18n@^3.2.1:
|
||||
y18n@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
|
||||
|
||||
|
@ -2476,18 +2503,6 @@ yargs-parser@^5.0.0:
|
|||
dependencies:
|
||||
camelcase "^3.0.0"
|
||||
|
||||
yargs@^3.10.0:
|
||||
version "3.32.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"
|
||||
dependencies:
|
||||
camelcase "^2.0.1"
|
||||
cliui "^3.0.3"
|
||||
decamelize "^1.1.1"
|
||||
os-locale "^1.4.0"
|
||||
string-width "^1.0.1"
|
||||
window-size "^0.1.4"
|
||||
y18n "^3.2.0"
|
||||
|
||||
yargs@^6.0.0:
|
||||
version "6.6.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"
|
||||
|
|
Loading…
Reference in New Issue
Block a user