Comparing version 1.8.0-0 to 1.9.0-0
@@ -15,3 +15,3 @@ // Generated by CoffeeScript 1.4.0 | ||
module.exports.SerializeQuery = function(query) { | ||
return util.toArrayBuffer(NodePB.Serialize(query, "Query")); | ||
return NodePB.Serialize(query, "Query"); | ||
}; | ||
@@ -18,0 +18,0 @@ |
88
net.js
// Generated by CoffeeScript 1.4.0 | ||
var Connection, HttpConnection, TcpConnection, ar, aropt, bufferConcat, cursors, deconstructDatum, err, events, net, pb, r, util, varar, | ||
var Connection, HttpConnection, TcpConnection, ar, aropt, cursors, deconstructDatum, err, events, net, pb, r, util, varar, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -117,3 +117,3 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
this.open = false; | ||
this.buffer = new ArrayBuffer(0); | ||
this.buffer = new Buffer(0); | ||
this._events = this._events || {}; | ||
@@ -139,7 +139,7 @@ errCallback = function(e) { | ||
var response, responseBuffer, responseLength, _results; | ||
this.buffer = bufferConcat(this.buffer, buf); | ||
this.buffer = Buffer.concat([this.buffer, buf]); | ||
_results = []; | ||
while (this.buffer.byteLength >= 4) { | ||
responseLength = (new DataView(this.buffer)).getUint32(0, true); | ||
if (!(this.buffer.byteLength >= (4 + responseLength))) { | ||
while (this.buffer.length >= 4) { | ||
responseLength = this.buffer.readUInt32LE(0); | ||
if (!(this.buffer.length >= (4 + responseLength))) { | ||
break; | ||
@@ -353,9 +353,12 @@ } | ||
Connection.prototype._sendQuery = function(query) { | ||
var data, finalArray, length; | ||
var data, i, totalBuf; | ||
data = pb.SerializeQuery(query); | ||
length = data.byteLength; | ||
finalArray = new Uint8Array(length + 4); | ||
(new DataView(finalArray.buffer)).setInt32(0, length, true); | ||
finalArray.set(new Uint8Array(data), 4); | ||
return this.write(finalArray.buffer); | ||
totalBuf = new Buffer(data.length + 4); | ||
totalBuf.writeUInt32LE(data.length, 0); | ||
i = 0; | ||
while (i < data.length) { | ||
totalBuf.set(i + 4, data.get(i)); | ||
i++; | ||
} | ||
return this.write(totalBuf); | ||
}; | ||
@@ -395,14 +398,12 @@ | ||
this.rawSocket.once('connect', function() { | ||
var buf, buf_view, handshake_callback; | ||
buf = new ArrayBuffer(8); | ||
buf_view = new DataView(buf); | ||
buf_view.setUint32(0, 0x723081e1, true); | ||
buf_view.setUint32(4, _this.authKey.length, true); | ||
var buf, handshake_callback; | ||
buf = new Buffer(8); | ||
buf.writeUInt32LE(0x723081e1, 0); | ||
buf.writeUInt32LE(_this.authKey.length, 4); | ||
_this.write(buf); | ||
_this.rawSocket.write(_this.authKey, 'ascii'); | ||
handshake_callback = function(buf) { | ||
var arr, b, i, status_buf, status_str, _i, _len, _ref; | ||
arr = util.toArrayBuffer(buf); | ||
_this.buffer = bufferConcat(_this.buffer, arr); | ||
_ref = new Uint8Array(_this.buffer); | ||
var b, i, status_buf, status_str, _i, _len, _ref; | ||
_this.buffer = Buffer.concat([_this.buffer, buf]); | ||
_ref = _this.buffer; | ||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { | ||
@@ -414,7 +415,7 @@ b = _ref[i]; | ||
_this.buffer = _this.buffer.slice(i + 1); | ||
status_str = String.fromCharCode.apply(null, new Uint8Array(status_buf)); | ||
status_str = status_buf.toString(); | ||
clearTimeout(timeout); | ||
if (status_str === "SUCCESS") { | ||
_this.rawSocket.on('data', function(buf) { | ||
return _this._data(util.toArrayBuffer(buf)); | ||
return _this._data(buf); | ||
}); | ||
@@ -454,10 +455,3 @@ _this.emit('connect'); | ||
TcpConnection.prototype.write = function(chunk) { | ||
var buf, byte, i, _i, _len, _ref; | ||
buf = new Buffer(chunk.byteLength); | ||
_ref = new Uint8Array(chunk); | ||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { | ||
byte = _ref[i]; | ||
buf[i] = byte; | ||
} | ||
return this.rawSocket.write(buf); | ||
return this.rawSocket.write(chunk); | ||
}; | ||
@@ -516,3 +510,3 @@ | ||
HttpConnection.prototype.write = function(chunk) { | ||
var xhr, | ||
var array, i, view, xhr, | ||
_this = this; | ||
@@ -523,7 +517,25 @@ xhr = new XMLHttpRequest; | ||
xhr.onreadystatechange = function(e) { | ||
var b, buf; | ||
if (xhr.readyState === 4 && xhr.status === 200) { | ||
return _this._data(xhr.response); | ||
buf = new Buffer((function() { | ||
var _i, _len, _ref, _results; | ||
_ref = new Uint8Array(xhr.response); | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
b = _ref[_i]; | ||
_results.push(b); | ||
} | ||
return _results; | ||
})()); | ||
return _this._data(buf); | ||
} | ||
}; | ||
return xhr.send(chunk); | ||
array = new ArrayBuffer(chunk.length); | ||
view = new Uint8Array(array); | ||
i = 0; | ||
while (i < chunk.length) { | ||
view[i] = chunk.get(i); | ||
i++; | ||
} | ||
return xhr.send(array); | ||
}; | ||
@@ -535,10 +547,2 @@ | ||
bufferConcat = function(buf1, buf2) { | ||
var view; | ||
view = new Uint8Array(buf1.byteLength + buf2.byteLength); | ||
view.set(new Uint8Array(buf1), 0); | ||
view.set(new Uint8Array(buf2), buf1.byteLength); | ||
return view.buffer; | ||
}; | ||
module.exports.connect = ar(function(host, callback) { | ||
@@ -545,0 +549,0 @@ if (!(typeof host === 'string' || typeof host === 'object')) { |
{ "name" : "rethinkdb" | ||
, "version" : "1.8.0-0" | ||
, "version" : "1.9.0-0" | ||
, "main" : "rethinkdb" | ||
@@ -4,0 +4,0 @@ , "description" : "This package provides the JavaScript driver library for the RethinkDB database server for use either from node or your web-browser." |
@@ -21,3 +21,3 @@ // Generated by CoffeeScript 1.4.0 | ||
querypb = new protodef.Query(query); | ||
return querypb.toArrayBuffer(); | ||
return querypb.toBuffer(); | ||
} | ||
@@ -27,6 +27,16 @@ }; | ||
module.exports.ParseResponse = function(data) { | ||
var array, i, response, view; | ||
if (native_pb.ParseResponse != null) { | ||
return native_pb.ParseResponse(data); | ||
} else { | ||
return protodef.Response.decode(data); | ||
array = new ArrayBuffer(data.length); | ||
view = new Uint8Array(array); | ||
i = 0; | ||
while (i < data.length) { | ||
view[i] = data.get(i); | ||
i++; | ||
} | ||
response = protodef.Response.decode(array); | ||
response.token = response.token.toInt(); | ||
return response; | ||
} | ||
@@ -33,0 +43,0 @@ }; |
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
138321
4185
1