Comparing version 2.1.1 to 2.2.0
{ | ||
"name": "thriftrw", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "thrift encoding/decoding using bufrw", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -23,2 +23,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
/* eslint max-statements:[0, 99] */ | ||
/* eslint complexity:[0, 16] */ | ||
'use strict'; | ||
@@ -81,5 +82,6 @@ | ||
self.isArgument = null; | ||
self.isResult = null; | ||
self.Constructor = null; | ||
self.surface = null; | ||
self.rw = new StructRW(self); | ||
self.rw = new self.RW(self); | ||
self.linked = false; | ||
@@ -90,2 +92,4 @@ } | ||
ThriftStruct.prototype.typeid = TYPE.STRUCT; | ||
ThriftStruct.prototype.RW = StructRW; | ||
ThriftStruct.prototype.isUnion = false; | ||
@@ -156,3 +160,3 @@ ThriftStruct.prototype.toBuffer = function toBuffer(struct) { | ||
field.defaultValue !== null && field.defaultValue !== undefined || | ||
self.isArgument || self.isResult, | ||
self.isArgument || self.isResult || self.isUnion, | ||
'every field must be marked optional, required, or have a default value on ' + | ||
@@ -380,2 +384,3 @@ self.name + ' including "' + field.name + '" in strict mode' | ||
offset = result.offset; | ||
// TODO promote return error of set to a ReadResult error | ||
self.spec.set(struct, field.name, result.value); | ||
@@ -382,0 +387,0 @@ } |
@@ -43,2 +43,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
require('./exception'); | ||
require('./union'); | ||
require('./service'); | ||
@@ -45,0 +46,0 @@ require('./thrift'); |
@@ -174,3 +174,5 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
try { | ||
var thriftGraph = new Thrift({source: 'struct Graph { 1: required map<byte, byte> (js.type = "bogus") edges }'}); | ||
var thriftGraph = new Thrift({ | ||
source: 'struct Graph { 1: required map<byte, byte> (js.type = "bogus") edges }' | ||
}); | ||
assert.ok(!thriftGraph, 'should not parse'); | ||
@@ -177,0 +179,0 @@ } catch (err) { |
@@ -32,2 +32,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var ThriftException = require('./exception').ThriftException; | ||
var ThriftUnion = require('./union').ThriftUnion; | ||
var ThriftEnum = require('./enum').ThriftEnum; | ||
@@ -118,4 +119,4 @@ | ||
Struct: 'compileStruct', | ||
Typedef: 'compileTypedef' | ||
// TODO Union: 'compileUnion' | ||
Typedef: 'compileTypedef', | ||
Union: 'compileUnion' | ||
}; | ||
@@ -152,2 +153,11 @@ | ||
Thrift.prototype.compileUnion = function compileUnion(def) { | ||
var self = this; | ||
var spec = new ThriftUnion({strict: self.strict}); | ||
spec.compile(def, self); | ||
self.claim(spec.fullName, def); | ||
self.types[spec.fullName] = spec; | ||
return spec; | ||
}; | ||
Thrift.prototype.compileTypedef = function compileTypedef(def) { | ||
@@ -154,0 +164,0 @@ var self = this; |
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
334600
110
6010
3