neo4j-driver
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -161,6 +161,5 @@ /** | ||
// Queue up a 'reset', to ensure the next user gets a clean | ||
// session to work with. No need to flush, this will get sent | ||
// along with whatever the next thing the user wants to do with | ||
// this session ends up being, so we save the network round trip. | ||
// session to work with. | ||
conn.reset(); | ||
conn.sync(); | ||
@@ -167,0 +166,0 @@ // Return connection to the pool |
@@ -90,4 +90,5 @@ /** | ||
value: function putBytes(position, data) { | ||
// TODO: If data is larger than our chunk size or so, we're very likely better off just passing this buffer on rather than doing the copy here | ||
// TODO: *however* note that we need some way to find out when the data has been written (and thus the buffer can be re-used) if we take that approach | ||
// TODO: If data is larger than our chunk size or so, we're very likely better off just passing this buffer on | ||
// rather than doing the copy here TODO: *however* note that we need some way to find out when the data has been | ||
// written (and thus the buffer can be re-used) if we take that approach | ||
while (data.remaining() > 0) { | ||
@@ -123,6 +124,6 @@ // Ensure there is an open chunk, and that it has at least one byte of space left | ||
/** | ||
/** | ||
* Bolt messages are encoded in one or more chunks, and the boundary between two messages | ||
* is encoded as a 0-length chunk, `00 00`. This inserts such a message boundary, closing | ||
* any currently open chunk as needed | ||
* any currently open chunk as needed | ||
*/ | ||
@@ -129,0 +130,0 @@ }, { |
@@ -406,3 +406,15 @@ /** | ||
value: function reset(observer) { | ||
this._queueObserver(observer); | ||
this._isHandlingFailure = true; | ||
var self = this; | ||
var wrappedObs = { | ||
onNext: observer ? observer.onNext : NO_OP, | ||
onError: observer ? observer.onError : NO_OP, | ||
onCompleted: function onCompleted() { | ||
self._isHandlingFailure = false; | ||
if (observer) { | ||
observer.onCompleted(); | ||
} | ||
} | ||
}; | ||
this._queueObserver(wrappedObs); | ||
this._packer.packStruct(RESET); | ||
@@ -409,0 +421,0 @@ this._chunker.messageBoundary(); |
@@ -56,6 +56,6 @@ /** | ||
end = start + length; | ||
buffer.position = end; | ||
buffer.position = Math.min(end, buffer.length); | ||
return buffer._buffer.toString('utf8', start, end); | ||
} else if (buffer instanceof _buf2['default'].CombinedBuffer) { | ||
var out = streamDecodeCombinedBuffer(buffer._buffers, length, function (partBuffer) { | ||
var out = streamDecodeCombinedBuffer(buffer, length, function (partBuffer) { | ||
return decoder.write(partBuffer._buffer); | ||
@@ -89,3 +89,3 @@ }, function () { | ||
if (buffer instanceof _buf2['default'].HeapBuffer) { | ||
return decoder.decode(buffer.readView(length)); | ||
return decoder.decode(buffer.readView(Math.min(length, buffer.length - buffer.position))); | ||
} else { | ||
@@ -97,3 +97,3 @@ // Decoding combined buffer is complicated. For simplicity, for now, | ||
tmpBuf.writeUInt8(buffer.readUInt8()); | ||
}; | ||
} | ||
tmpBuf.reset(); | ||
@@ -109,16 +109,20 @@ return decoder.decode(tmpBuf.readView(length)); | ||
var remainingBytesToRead = length; | ||
var position = combinedBuffers.position; | ||
combinedBuffers._updatePos(Math.min(length, combinedBuffers.length - position)); | ||
// Reduce CombinedBuffers to a decoded string | ||
var out = combinedBuffers.reduce(function (last, partBuffer) { | ||
var out = combinedBuffers._buffers.reduce(function (last, partBuffer) { | ||
if (remainingBytesToRead <= 0) { | ||
return last; | ||
} | ||
if (partBuffer.length > remainingBytesToRead) { | ||
// When we don't want the whole buffer | ||
var lastSlice = partBuffer.readSlice(remainingBytesToRead); | ||
partBuffer._updatePos(remainingBytesToRead); | ||
remainingBytesToRead = 0; | ||
} else if (position >= partBuffer.length) { | ||
position -= partBuffer.length; | ||
return ''; | ||
} else { | ||
partBuffer._updatePos(position - partBuffer.position); | ||
var bytesToRead = Math.min(partBuffer.length - position, remainingBytesToRead); | ||
var lastSlice = partBuffer.readSlice(bytesToRead); | ||
partBuffer._updatePos(bytesToRead); | ||
remainingBytesToRead = Math.max(remainingBytesToRead - lastSlice.length, 0); | ||
position = 0; | ||
return last + decodeFn(lastSlice); | ||
} | ||
remainingBytesToRead -= partBuffer.length; | ||
return last + decodeFn(partBuffer); | ||
}, ''); | ||
@@ -125,0 +129,0 @@ return out + endFn(); |
{ | ||
"name": "neo4j-driver", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Connect to Neo4j 3.0.0 and up from JavaScript", | ||
@@ -23,3 +23,3 @@ "author": "Neo Technology Inc.", | ||
"browserify": "^11.0.0", | ||
"esdoc": "^0.4.0", | ||
"esdoc": "0.4.6", | ||
"esdoc-importpath-plugin": "0.0.1", | ||
@@ -26,0 +26,0 @@ "glob": "^5.0.14", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3193209
42300
7