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

thrift

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thrift - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0-hotfix.1

CHANGES.md

6

lib/nodejs/lib/thrift/binary_protocol.js

@@ -36,2 +36,6 @@ /*

TBinaryProtocol.VERSION_MASK = VERSION_MASK;
TBinaryProtocol.VERSION_1 = VERSION_1;
TBinaryProtocol.TYPE_MASK = TYPE_MASK
function TBinaryProtocol(trans, strictRead, strictWrite) {

@@ -306,4 +310,2 @@ this.trans = trans;

switch (type) {
case Type.STOP:
return;
case Type.BOOL:

@@ -310,0 +312,0 @@ this.readBool();

@@ -22,2 +22,3 @@ /*

var InputBufferUnderrunError = require('./input_buffer_underrun_error');
var THeaderTransport = require('./header_transport');

@@ -37,2 +38,4 @@ module.exports = TBufferedTransport;

TBufferedTransport.prototype = new THeaderTransport();
TBufferedTransport.prototype.reset = function() {

@@ -39,0 +42,0 @@ this.inBuf = new Buffer(this.defaultReadBufferSize);

@@ -857,4 +857,2 @@ /*

switch (type) {
case Type.STOP:
return;
case Type.BOOL:

@@ -861,0 +859,0 @@ this.readBool();

@@ -77,7 +77,4 @@ /*

self.initialize_retry_vars();
self.flush_offline_queue();
self.offline_queue.forEach(function(data) {
self.connection.write(data);
});
self.emit("connect");

@@ -181,2 +178,14 @@ });

Connection.prototype.flush_offline_queue = function () {
var self = this;
var offline_queue = this.offline_queue;
// Reset offline queue
this.offline_queue = [];
// Attempt to write queued items
offline_queue.forEach(function(data) {
self.write(data);
});
};
Connection.prototype.write = function(data) {

@@ -226,2 +235,7 @@ if (!this.connected) {

this.retry_timer = setTimeout(function () {
if (self.connection.destroyed) {
self.retry_timer = null;
return;
}
log.debug("Retrying connection...");

@@ -248,3 +262,7 @@

exports.createConnection = function(host, port, options) {
var stream = net.createConnection(port, host);
var stream = net.createConnection( {
port: port,
host: host,
timeout: options.connect_timeout || options.timeout || 0
});
var connection = new Connection(stream, options);

@@ -313,7 +331,4 @@ connection.host = host;

self.offline_queue.forEach(function(data) {
self.connection.write(data);
});
self.flush_offline_queue();
this.connection.addListener("error", function(err) {

@@ -362,2 +377,14 @@ self.emit("error", err);

StdIOConnection.prototype.flush_offline_queue = function () {
var self = this;
var offline_queue = this.offline_queue;
// Reset offline queue
this.offline_queue = [];
// Attempt to write queued items
offline_queue.forEach(function(data) {
self.write(data);
});
};
StdIOConnection.prototype.write = function(data) {

@@ -364,0 +391,0 @@ if (!this.connected) {

@@ -22,2 +22,3 @@ /*

var InputBufferUnderrunError = require('./input_buffer_underrun_error');
var THeaderTransport = require('./header_transport');

@@ -34,2 +35,4 @@ module.exports = TFramedTransport;

TFramedTransport.prototype = new THeaderTransport();
TFramedTransport.receiver = function(callback, seqid) {

@@ -36,0 +39,0 @@ var residual = null;

@@ -75,1 +75,2 @@ /*

exports.TCompactProtocol = require('./compact_protocol');
exports.THeaderProtocol = require('./header_protocol');

@@ -741,4 +741,2 @@ /*

switch (type) {
case Type.STOP:
return;
case Type.BOOL:

@@ -745,0 +743,0 @@ this.readBool();

@@ -26,2 +26,3 @@ /*

var TBinaryProtocol = require('./binary_protocol');
var THeaderProtocol = require('./header_protocol');
var InputBufferUnderrunError = require('./input_buffer_underrun_error');

@@ -47,3 +48,3 @@

var input = new protocol(transportWithData);
var output = new protocol(new transport(undefined, function(buf) {
var outputCb = function(buf) {
try {

@@ -55,4 +56,13 @@ stream.write(buf);

}
}));
};
var output = new protocol(new transport(undefined, outputCb));
// Read and write need to be performed on the same transport
// for THeaderProtocol because we should only respond with
// headers if the request contains headers
if (protocol === THeaderProtocol) {
output = input;
output.trans.onFlush = outputCb;
}
try {

@@ -59,0 +69,0 @@ do {

@@ -71,1 +71,42 @@ Thrift Node.js Library

Several example clients and servers are included in the thrift/lib/nodejs/examples folder and the cross language tutorial thrift/tutorial/nodejs folder.
## Use on browsers
You can use code generated with js:node on browsers with Webpack. Here is an example.
thrift --gen js:node,ts,es6,with_ns
```
import * as thrift from 'thrift/browser';
import { MyServiceClient } from '../gen-nodejs/MyService';
let host = window.location.hostname;
let port = 443;
let opts = {
transport: thrift.TBufferedTransport,
protocol: thrift.TJSONProtocol,
headers: {
'Content-Type': 'application/vnd.apache.thrift.json',
},
https: true,
path: '/url/path',
useCORS: true,
};
let connection = thrift.createXHRConnection(host, port, opts);
let thriftClient = thrift.createXHRClient(MyServiceClient, connection);
connection.on('error', (err) => {
console.error(err);
});
thriftClient.myService(param)
.then((result) => {
console.log(result);
})
.catch((err) => {
....
});
```
Note that thrift/index.js must be renamed or skipped for browsers.

@@ -9,3 +9,3 @@ {

},
"version": "0.12.0",
"version": "0.13.0-hotfix.1",
"author": {

@@ -34,2 +34,3 @@ "name": "Apache Thrift Developers",

},
"browser": "./lib/nodejs/lib/thrift/browser.js",
"main": "./lib/nodejs/lib/thrift",

@@ -51,4 +52,6 @@ "engines": {

"eslint-plugin-prettier": "^3.0.0",
"html-validator-cli": "^4.1.4",
"istanbul": "^0.4.5",
"jsdoc": "^3.5.5",
"json-int64": "^1.0.0",
"prettier": "^1.14.3",

@@ -59,2 +62,3 @@ "tape": "^4.9.0",

"@types/node": "^10.12.6",
"@types/node-int64": "^0.4.29",
"@types/q": "^1.5.1"

@@ -61,0 +65,0 @@ },

@@ -7,8 +7,9 @@ Apache Thrift

Thrift is a lightweight, language-independent software stack with an
associated code generation mechanism for point-to-point RPC. Thrift provides
clean abstractions for data transport, data serialization, and application
level processing. The code generation system takes a simple definition
language as input and generates code across programming languages that
uses the abstracted stack to build interoperable RPC clients and servers.
Thrift is a lightweight, language-independent software stack for
point-to-point RPC implementation.
Thrift provides clean abstractions and implementations for data transport,
data serialization, and application level processing. The code generation
system takes a simple definition language as input and generates code
across programming languages that uses the abstracted stack to build
interoperable RPC clients and servers.

@@ -19,7 +20,11 @@ ![Apache Thrift Layered Architecture](doc/images/thrift-layers.png)

languages to share data and call remote procedures. With support
for [25 programming languages](LANGUAGES.md), chances are Thrift
for [28 programming languages](LANGUAGES.md), chances are Thrift
supports the languages that you currently use.
Thrift is specifically designed to support non-atomic version changes
across client and server code.
across client and server code. This allows you to upgrade your
server while still being able service older clients; or have newer
clients issue requests to older servers. An excellent community-provided
write-up about thrift and compatibility when versioning an API can be
found in the [Thrift Missing Guide](https://diwakergupta.github.io/thrift-missing-guide/#_versioning_compatibility).

@@ -35,3 +40,4 @@ For more details on Thrift's design and implementation, see the Thrift

| :----- | :----- | :------- | :------------ | :--------- | :------ |
| [`master`](https://github.com/apache/thrift/tree/master) | [![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift) | [![Build status](https://ci.appveyor.com/api/projects/status/github/apache/thrift?branch=master&svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/1345/badge.svg)](https://scan.coverity.com/projects/thrift) | | [![Website](https://img.shields.io/badge/official-website-brightgreen.svg)](https://thrift.apache.org/) |
| [`master`](https://github.com/apache/thrift/tree/master) | [![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift/branches) | [![Build status](https://ci.appveyor.com/api/projects/status/github/apache/thrift?branch=master&svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/1345/badge.svg)](https://scan.coverity.com/projects/thrift) | | [![Website](https://img.shields.io/badge/official-website-brightgreen.svg)](https://thrift.apache.org/) |
| [`0.12.0`](https://github.com/apache/thrift/tree/0.12.0) | [![Build Status](https://travis-ci.org/apache/thrift.svg?branch=0.12.0)](https://travis-ci.org/apache/thrift/branches) | | | | |

@@ -38,0 +44,0 @@ Releases

Sorry, the diff of this file is not supported yet

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