Comparing version 1.9.2 to 1.10.0
@@ -30,2 +30,3 @@ /* jshint node: true */ | ||
util = require('util'), | ||
path = require('path'), | ||
zlib = require('zlib'); | ||
@@ -394,2 +395,3 @@ | ||
this._needPush = false; | ||
this._downstream = null; | ||
@@ -412,2 +414,6 @@ this.on('finish', function () { | ||
BlockEncoder.prototype.getDownstream = function () { | ||
return this._downstream; | ||
}; | ||
BlockEncoder.prototype._write = function (val, encoding, cb) { | ||
@@ -567,3 +573,3 @@ var codec = this._codec; | ||
var encoder = new BlockEncoder(schema, opts); | ||
encoder.pipe(fs.createWriteStream(path, {defaultEncoding: 'binary'})); | ||
encoder._downstream = encoder.pipe(fs.createWriteStream(path, {defaultEncoding: 'binary'})); | ||
return encoder; | ||
@@ -646,3 +652,3 @@ } | ||
} catch (err) { | ||
if (~schema.indexOf('/')) { | ||
if (~schema.indexOf(path.sep)) { | ||
// This can't be a valid name, so we interpret is as a filepath. This | ||
@@ -649,0 +655,0 @@ // makes is always feasible to read a file, independent of its name |
@@ -447,2 +447,3 @@ /* jshint node: true */ | ||
var tap = new Tap(buf); | ||
var args; | ||
try { | ||
@@ -456,3 +457,3 @@ var info = self._finalizeHandshake(tap, handshakeReq); | ||
self._idType._read(tap); // Skip metadata. | ||
var args = self._decodeArguments(tap, serverHashString, message); | ||
args = self._decodeArguments(tap, serverHashString, message); | ||
} catch (err) { | ||
@@ -552,4 +553,5 @@ done(err); | ||
var tap = new Tap(buf); | ||
var info; | ||
try { | ||
var info = self._finalizeHandshake(tap, handshakeReq); | ||
info = self._finalizeHandshake(tap, handshakeReq); | ||
} catch (err) { | ||
@@ -574,4 +576,5 @@ self.emit('error', err); | ||
var tap = new Tap(buf); | ||
var id; | ||
try { | ||
var id = self._idType._read(tap); | ||
id = self._idType._read(tap); | ||
if (!id) { | ||
@@ -591,4 +594,5 @@ throw new Error('missing ID'); | ||
var args; | ||
try { | ||
var args = self._decodeArguments( | ||
args = self._decodeArguments( | ||
tap, | ||
@@ -709,5 +713,7 @@ self._serverHashString, | ||
var validationErr = null; | ||
var handshakeReq; | ||
var serverHashString; | ||
try { | ||
var handshakeReq = HANDSHAKE_REQUEST_TYPE._read(reqTap); | ||
var serverHashString = handshakeReq.serverHash.toString('binary'); | ||
handshakeReq = HANDSHAKE_REQUEST_TYPE._read(reqTap); | ||
serverHashString = handshakeReq.serverHash.toString('binary'); | ||
} catch (err) { | ||
@@ -836,5 +842,7 @@ validationErr = err; | ||
var name; | ||
var req; | ||
try { | ||
self._idType._read(reqTap); // Skip metadata. | ||
var name = STRING_TYPE._read(reqTap); | ||
name = STRING_TYPE._read(reqTap); | ||
self._message = self._ptcl._messages[name]; | ||
@@ -844,3 +852,3 @@ if (!self._message) { | ||
} | ||
var req = self._decodeRequest(reqTap, self._message); | ||
req = self._decodeRequest(reqTap, self._message); | ||
} catch (err) { | ||
@@ -919,9 +927,12 @@ onResponse(err); | ||
self._pending++; | ||
var name; | ||
var message; | ||
var req; | ||
try { | ||
var name = STRING_TYPE._read(reqTap); | ||
var message = self._ptcl._messages[name]; | ||
name = STRING_TYPE._read(reqTap); | ||
message = self._ptcl._messages[name]; | ||
if (!message) { | ||
throw new Error('unknown message: ' + name); | ||
} | ||
var req = self._decodeRequest(reqTap, message); | ||
req = self._decodeRequest(reqTap, message); | ||
} catch (err) { | ||
@@ -928,0 +939,0 @@ onResponse(err); |
@@ -96,3 +96,4 @@ /* jshint node: true */ | ||
// reference. | ||
return opts.registry[attrs] = createType({type: attrs}, opts); | ||
type = opts.registry[attrs] = createType({type: attrs}, opts); | ||
return type; | ||
} | ||
@@ -1716,3 +1717,3 @@ throw new Error(f('undefined type name: %s', attrs)); | ||
field = this._fields[i]; | ||
value = field._type._copy(val[field._name], opts); | ||
value = field._type._copy(typeof val[field._name] == 'undefined' ? field.getDefault() : val[field._name], opts); | ||
if (hook) { | ||
@@ -1794,4 +1795,5 @@ value = hook(field, value, this); | ||
LogicalType.prototype._check = function (any, cb) { | ||
var val; | ||
try { | ||
var val = this._toValue(any); | ||
val = this._toValue(any); | ||
} catch (err) { | ||
@@ -1798,0 +1800,0 @@ if (cb) { |
@@ -143,3 +143,6 @@ /* jshint node: true */ | ||
this._max = m; | ||
this._nextInt = function () { return state = (a * state + c) % m; }; | ||
this._nextInt = function () { | ||
state = (a * state + c) % m; | ||
return state; | ||
}; | ||
} | ||
@@ -146,0 +149,0 @@ |
{ | ||
"name": "avro-js", | ||
"version": "1.9.2", | ||
"version": "1.10.0", | ||
"author": "Avro Developers <dev@avro.apache.org>", | ||
@@ -37,5 +37,8 @@ "description": "JavaScript Avro implementation", | ||
"scripts": { | ||
"cover": "istanbul cover _mocha", | ||
"test": "mocha", | ||
"clean": "rm -rf coverage node_modules" | ||
"cover": "istanbul cover _mocha -- -f interop -i", | ||
"test": "mocha -f interop -i", | ||
"clean": "rm -rf coverage node_modules", | ||
"lint": "jshint lib test", | ||
"interop-data-generate": "node test/interop_data_generate.js", | ||
"interop-data-test": "mocha test/interop_data_test.js" | ||
}, | ||
@@ -47,3 +50,3 @@ "dependencies": { | ||
"coveralls": "^3.0.7", | ||
"istanbul": "^0.3.19", | ||
"istanbul": "^0.4.5", | ||
"jshint": "^2.10.2", | ||
@@ -50,0 +53,0 @@ "mocha": "^6.2.2", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
168447
13
4886
1