Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thriftrw

Package Overview
Dependencies
Maintainers
5
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thriftrw - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

.gitignore

28

CHANGELOG.md

@@ -0,1 +1,29 @@

# v3.3.0
ThriftRW is now in its own organization on Github!
- Adds `toBuffer` and `fromBuffer` to `StructRW`.
- Fixes the missing `Argument` and `Result` constructors on function models.
- Allows i64 properties with the `(js.type = 'Date')` annotation to coerce
arrays of bytes, buffers, and longs, all representing miliseconds since the
Epoch.
# v3.2.0
- Aliases byte as i8 in accordance with upstream Thrift changes.
# v3.1.0
- Adds `thrift.getServiceEndpoints(service)`
# v3.0.3
- Exposes the functions in parent services properly.
# v3.0.1
- Implement IDLs interface
- Implement preliminary benchmark
- Include and PascalCase notes added to README
# v3.0.0

@@ -2,0 +30,0 @@

14

i64.js

@@ -46,4 +46,3 @@ // Copyright (c) 2015 Uber Technologies, Inc.

if (value instanceof Buffer) {
value.copy(buffer, offset, 0, 8);
return destResult.reset(null, offset + 8);
return this.writeBufferInt64Into(destResult, value, buffer, offset);
} else if (typeof value === 'number') {

@@ -64,2 +63,7 @@ buffer.writeInt32BE(value / Math.pow(2, 32), offset, true);

I64RW.prototype.writeBufferInt64Into = function writeBufferInt64Into(destResult, value, buffer, offset) {
value.copy(buffer, offset, 0, 8);
return destResult.reset(null, offset + 8);
};
I64RW.prototype.writeObjectInt64Into =

@@ -147,2 +151,8 @@ function writeObjectInt64Into(destResult, value, buffer, offset) {

I64DateRW.prototype.poolWriteInto = function poolWriteInto(destResult, value, buffer, offset) {
if (value instanceof Buffer) {
return this.writeBufferInt64Into(destResult, value, buffer, offset);
}
if (Array.isArray(value)) {
return this.writeArrayInt64Into(destResult, value, buffer, offset);
}
if (typeof value === 'string') {

@@ -149,0 +159,0 @@ value = Date.parse(value);

10

package.json
{
"name": "thriftrw",
"version": "3.2.0",
"version": "3.3.0",
"description": "thrift encoding/decoding using bufrw",
"keywords": [],
"author": "Lei Zhao <leizha@uber.com>",
"repository": "git://github.com/uber/thriftrw.git",
"repository": "git://github.com/thriftrw/thriftrw-node.git",
"main": "index.js",
"homepage": "https://github.com/uber/thriftrw",
"homepage": "https://github.com/thriftrw/thriftrw-node",
"bugs": {
"url": "https://github.com/uber/thriftrw/issues",
"url": "https://github.com/thriftrw/thriftrw-node/issues",
"email": "leizha@uber.com"

@@ -42,3 +42,3 @@ },

"type": "MIT",
"url": "http://github.com/uber/thriftrw/raw/master/LICENSE"
"url": "http://github.com/thriftrw/thriftrw-node/raw/master/LICENSE"
}

@@ -45,0 +45,0 @@ ],

@@ -510,3 +510,4 @@ # thriftrw

ISO-8601 timestamp or milliseconds since the epoch (as returned by
`Date.now()`) in place of a Date.
`Date.now()`) in place of a Date, as well as the equivalent in buffers or
arrays of bytes.

@@ -522,3 +523,3 @@ For [TCurl][], this means that you can both read and write ISO-8601 for

[thriftrw-python]: https://github.com/uber/thriftrw-python
[thriftrw-python]: https://github.com/thriftrw/thriftrw-python

@@ -555,4 +556,4 @@ ## Installation

[cover]: https://coveralls.io/r/uber/thriftrw
[dep-png]: https://david-dm.org/uber/thriftrw.png
[dep]: https://david-dm.org/uber/thriftrw
[dep-png]: https://david-dm.org/thriftrw/thriftrw-node.png
[dep]: https://david-dm.org/thriftrw/thriftrw-node
[test-png]: https://ci.testling.com/uber/thriftrw.png

@@ -559,0 +560,0 @@ [tes]: https://ci.testling.com/uber/thriftrw

@@ -45,3 +45,2 @@ // Copyright (c) 2015 Uber Technologies, Inc.

this.args = model.compileStruct(argsStruct);
this.Arguments = this.args.Constructor;

@@ -64,3 +63,2 @@ var returnType = def.returns;

this.result = model.compileStruct(resultStruct);
this.Result = this.result.Constructor;

@@ -74,2 +72,5 @@ this.annotations = def.annotations;

this.result.link(model);
this.Arguments = this.args.Constructor;
this.Result = this.result.Constructor;
};

@@ -76,0 +77,0 @@

@@ -261,2 +261,10 @@ // Copyright (c) 2015 Uber Technologies, Inc.

StructRW.prototype.toBuffer = function toBuffer(struct) {
return bufrw.toBufferResult(this, struct);
};
StructRW.prototype.fromBuffer = function fromBuffer(buffer, offset) {
return bufrw.fromBufferResult(this, buffer, offset);
};
StructRW.prototype.poolByteLength = function poolByteLength(destResult, struct) {

@@ -263,0 +271,0 @@ var length = 1; // stop:1

@@ -198,2 +198,20 @@ // Copyright (c) 2015 Uber Technologies, Inc.

test('Accepts buffer as date', function t(assert) {
var outBuffer = new Buffer(8);
outBuffer.fill(0xff);
var inbuffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8]);
dateRW.writeInto(inbuffer, outBuffer, 0);
assert.deepEquals(outBuffer, inbuffer, 'accepts date buffer');
assert.end();
});
test('Accepts array as date', function t(assert) {
var outBuffer = new Buffer(8);
outBuffer.fill(0xff);
var inArray = [1, 2, 3, 4, 5, 6, 7, 8];
dateRW.writeInto(inArray, outBuffer, 0);
assert.deepEquals(outBuffer, new Buffer(inArray), 'accepts date buffer');
assert.end();
});
test('ThriftI64', testThrift(ThriftI64, bufferRW, TYPE.I64));

@@ -64,3 +64,3 @@ // Copyright (c) 2015 Uber Technologies, Inc.

test('HealthRW', testRW.cases(Health.rw, [
var cases = [

@@ -83,4 +83,18 @@ // good

]));
];
test('HealthRW', testRW.cases(Health.rw, cases));
test('HealthRW to Buffer', function t(assert) {
var res = Health.rw.toBuffer(cases[0][0]);
assert.deepEqual(res.value, new Buffer(cases[0][1]), 'buffer matches');
assert.end();
});
test('HealthRW from Buffer', function t(assert) {
var res = Health.rw.fromBuffer(new Buffer(cases[0][1]));
assert.deepEqual(res.value, cases[0][0], 'object matches');
assert.end();
});
test('complains of missing required field', function t(assert) {

@@ -87,0 +101,0 @@ var res = Health.rw.readFrom(new Buffer([

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc