Socket
Socket
Sign inDemoInstall

flatbuffers

Package Overview
Dependencies
0
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 23.3.3 to 23.5.8

README.md

10

js/builder.js

@@ -235,3 +235,3 @@ "use strict";

if (obj != this.offset()) {
throw new Error('FlatBuffers: struct must be serialized inline.');
throw new TypeError('FlatBuffers: struct must be serialized inline.');
}

@@ -245,3 +245,3 @@ }

if (this.isNested) {
throw new Error('FlatBuffers: object serialization must not be nested.');
throw new TypeError('FlatBuffers: object serialization must not be nested.');
}

@@ -379,3 +379,3 @@ }

if (file_identifier.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
throw new Error('FlatBuffers: file identifier must be length ' +
throw new TypeError('FlatBuffers: file identifier must be length ' +
constants_js_1.FILE_IDENTIFIER_LENGTH);

@@ -411,3 +411,3 @@ }

if (!ok) {
throw new Error('FlatBuffers: field ' + field + ' must be set');
throw new TypeError('FlatBuffers: field ' + field + ' must be set');
}

@@ -517,3 +517,3 @@ }

else {
throw new Error('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
throw new TypeError('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
}

@@ -520,0 +520,0 @@ }

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

"use strict";var flatbuffers=(()=>{var I=(u,t)=>()=>(t||u((t={exports:{}}).exports,t),t.exports);var _=I(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});l.SIZE_PREFIX_LENGTH=l.FILE_IDENTIFIER_LENGTH=l.SIZEOF_INT=l.SIZEOF_SHORT=void 0;l.SIZEOF_SHORT=2;l.SIZEOF_INT=4;l.FILE_IDENTIFIER_LENGTH=4;l.SIZE_PREFIX_LENGTH=4});var w=I(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.isLittleEndian=o.float64=o.float32=o.int32=void 0;o.int32=new Int32Array(2);o.float32=new Float32Array(o.int32.buffer);o.float64=new Float64Array(o.int32.buffer);o.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var N=I(b=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.Encoding=void 0;var j;(function(u){u[u.UTF8_BYTES=1]="UTF8_BYTES",u[u.UTF16_STRING=2]="UTF16_STRING"})(j=b.Encoding||(b.Encoding={}))});var T=I(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.ByteBuffer=void 0;var d=_(),a=w(),m=N(),f=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new f(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return a.int32[0]=this.readInt32(t),a.float32[0]}readFloat64(t){return a.int32[a.isLittleEndian?0:1]=this.readInt32(t),a.int32[a.isLittleEndian?1:0]=this.readInt32(t+4),a.float64[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){a.float32[0]=e,this.writeInt32(t,a.int32[0])}writeFloat64(t,e){a.float64[0]=e,this.writeInt32(t,a.int32[a.isLittleEndian?0:1]),this.writeInt32(t+4,a.int32[a.isLittleEndian?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+d.SIZEOF_INT+d.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<d.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+d.SIZEOF_INT+e));return t}__offset(t,e){let i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let i=this.readInt32(t);t+=d.SIZEOF_INT;let s=this.bytes_.subarray(t,t+i);return e===m.Encoding.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+d.SIZEOF_INT}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=d.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+d.FILE_IDENTIFIER_LENGTH);for(let e=0;e<d.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+d.SIZEOF_INT+e))return!1;return!0}createScalarList(t,e){let i=[];for(let s=0;s<e;++s){let n=t(s);n!==null&&i.push(n)}return i}createObjList(t,e){let i=[];for(let s=0;s<e;++s){let n=t(s);n!==null&&i.push(n.unpack())}return i}};F.ByteBuffer=f});var L=I(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.Builder=void 0;var S=T(),h=_(),E=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=S.ByteBuffer.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){let s=this.bb.capacity();this.bb=E.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=e<<1,s=S.ByteBuffer.allocate(i);return s.setPosition(i-e),s.bytes().set(t.bytes(),i-e),s}addOffset(t){this.prep(h.SIZEOF_INT,0),this.writeInt32(this.offset()-t+h.SIZEOF_INT)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*h.SIZEOF_SHORT;this.addInt16(n);let c=0,B=this.space;t:for(e=0;e<this.vtables.length;e++){let O=this.bb.capacity()-this.vtables[e];if(n==this.bb.readInt16(O)){for(let p=h.SIZEOF_SHORT;p<n;p+=h.SIZEOF_SHORT)if(this.bb.readInt16(B+p)!=this.bb.readInt16(O+p))continue t;c=this.vtables[e];break}}return c?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,c-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){let s=i?h.SIZE_PREFIX_LENGTH:0;if(e){let n=e;if(this.prep(this.minalign,h.SIZEOF_INT+h.FILE_IDENTIFIER_LENGTH+s),n.length!=h.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+h.FILE_IDENTIFIER_LENGTH);for(let c=h.FILE_IDENTIFIER_LENGTH-1;c>=0;c--)this.writeInt8(n.charCodeAt(c))}this.prep(this.minalign,h.SIZEOF_INT+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(s)&&this.bb.readInt16(s+e)!=0))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(h.SIZEOF_INT,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let i=0,s=this.space,n=this.bb.bytes();i<e.length;i++)n[s++]=e[i];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let i=0;i<t.length;++i){let s=t[i];if(s!==null)e.push(this.createObjectOffset(s));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};y.Builder=E});var D=I(r=>{Object.defineProperty(r,"__esModule",{value:!0});r.ByteBuffer=r.Builder=r.Encoding=r.isLittleEndian=r.float64=r.float32=r.int32=r.SIZE_PREFIX_LENGTH=r.FILE_IDENTIFIER_LENGTH=r.SIZEOF_INT=r.SIZEOF_SHORT=void 0;var v=_();Object.defineProperty(r,"SIZEOF_SHORT",{enumerable:!0,get:function(){return v.SIZEOF_SHORT}});var R=_();Object.defineProperty(r,"SIZEOF_INT",{enumerable:!0,get:function(){return R.SIZEOF_INT}});var U=_();Object.defineProperty(r,"FILE_IDENTIFIER_LENGTH",{enumerable:!0,get:function(){return U.FILE_IDENTIFIER_LENGTH}});var Z=_();Object.defineProperty(r,"SIZE_PREFIX_LENGTH",{enumerable:!0,get:function(){return Z.SIZE_PREFIX_LENGTH}});var g=w();Object.defineProperty(r,"int32",{enumerable:!0,get:function(){return g.int32}});Object.defineProperty(r,"float32",{enumerable:!0,get:function(){return g.float32}});Object.defineProperty(r,"float64",{enumerable:!0,get:function(){return g.float64}});Object.defineProperty(r,"isLittleEndian",{enumerable:!0,get:function(){return g.isLittleEndian}});var H=N();Object.defineProperty(r,"Encoding",{enumerable:!0,get:function(){return H.Encoding}});var P=L();Object.defineProperty(r,"Builder",{enumerable:!0,get:function(){return P.Builder}});var G=T();Object.defineProperty(r,"ByteBuffer",{enumerable:!0,get:function(){return G.ByteBuffer}})});return D();})();
"use strict";var flatbuffers=(()=>{var I=(u,t)=>()=>(t||u((t={exports:{}}).exports,t),t.exports);var _=I(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});l.SIZE_PREFIX_LENGTH=l.FILE_IDENTIFIER_LENGTH=l.SIZEOF_INT=l.SIZEOF_SHORT=void 0;l.SIZEOF_SHORT=2;l.SIZEOF_INT=4;l.FILE_IDENTIFIER_LENGTH=4;l.SIZE_PREFIX_LENGTH=4});var w=I(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.isLittleEndian=o.float64=o.float32=o.int32=void 0;o.int32=new Int32Array(2);o.float32=new Float32Array(o.int32.buffer);o.float64=new Float64Array(o.int32.buffer);o.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var T=I(b=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.Encoding=void 0;var j;(function(u){u[u.UTF8_BYTES=1]="UTF8_BYTES",u[u.UTF16_STRING=2]="UTF16_STRING"})(j=b.Encoding||(b.Encoding={}))});var N=I(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.ByteBuffer=void 0;var d=_(),a=w(),m=T(),f=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new f(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return a.int32[0]=this.readInt32(t),a.float32[0]}readFloat64(t){return a.int32[a.isLittleEndian?0:1]=this.readInt32(t),a.int32[a.isLittleEndian?1:0]=this.readInt32(t+4),a.float64[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){a.float32[0]=e,this.writeInt32(t,a.int32[0])}writeFloat64(t,e){a.float64[0]=e,this.writeInt32(t,a.int32[a.isLittleEndian?0:1]),this.writeInt32(t+4,a.int32[a.isLittleEndian?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+d.SIZEOF_INT+d.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<d.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+d.SIZEOF_INT+e));return t}__offset(t,e){let i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let i=this.readInt32(t);t+=d.SIZEOF_INT;let s=this.bytes_.subarray(t,t+i);return e===m.Encoding.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+d.SIZEOF_INT}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=d.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+d.FILE_IDENTIFIER_LENGTH);for(let e=0;e<d.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+d.SIZEOF_INT+e))return!1;return!0}createScalarList(t,e){let i=[];for(let s=0;s<e;++s){let n=t(s);n!==null&&i.push(n)}return i}createObjList(t,e){let i=[];for(let s=0;s<e;++s){let n=t(s);n!==null&&i.push(n.unpack())}return i}};F.ByteBuffer=f});var L=I(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.Builder=void 0;var S=N(),h=_(),E=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=S.ByteBuffer.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){let s=this.bb.capacity();this.bb=E.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=e<<1,s=S.ByteBuffer.allocate(i);return s.setPosition(i-e),s.bytes().set(t.bytes(),i-e),s}addOffset(t){this.prep(h.SIZEOF_INT,0),this.writeInt32(this.offset()-t+h.SIZEOF_INT)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*h.SIZEOF_SHORT;this.addInt16(n);let c=0,B=this.space;t:for(e=0;e<this.vtables.length;e++){let O=this.bb.capacity()-this.vtables[e];if(n==this.bb.readInt16(O)){for(let p=h.SIZEOF_SHORT;p<n;p+=h.SIZEOF_SHORT)if(this.bb.readInt16(B+p)!=this.bb.readInt16(O+p))continue t;c=this.vtables[e];break}}return c?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,c-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){let s=i?h.SIZE_PREFIX_LENGTH:0;if(e){let n=e;if(this.prep(this.minalign,h.SIZEOF_INT+h.FILE_IDENTIFIER_LENGTH+s),n.length!=h.FILE_IDENTIFIER_LENGTH)throw new TypeError("FlatBuffers: file identifier must be length "+h.FILE_IDENTIFIER_LENGTH);for(let c=h.FILE_IDENTIFIER_LENGTH-1;c>=0;c--)this.writeInt8(n.charCodeAt(c))}this.prep(this.minalign,h.SIZEOF_INT+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(s)&&this.bb.readInt16(s+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(h.SIZEOF_INT,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let i=0,s=this.space,n=this.bb.bytes();i<e.length;i++)n[s++]=e[i];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let i=0;i<t.length;++i){let s=t[i];if(s!==null)e.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};y.Builder=E});var D=I(r=>{Object.defineProperty(r,"__esModule",{value:!0});r.ByteBuffer=r.Builder=r.Encoding=r.isLittleEndian=r.float64=r.float32=r.int32=r.SIZE_PREFIX_LENGTH=r.FILE_IDENTIFIER_LENGTH=r.SIZEOF_INT=r.SIZEOF_SHORT=void 0;var v=_();Object.defineProperty(r,"SIZEOF_SHORT",{enumerable:!0,get:function(){return v.SIZEOF_SHORT}});var R=_();Object.defineProperty(r,"SIZEOF_INT",{enumerable:!0,get:function(){return R.SIZEOF_INT}});var U=_();Object.defineProperty(r,"FILE_IDENTIFIER_LENGTH",{enumerable:!0,get:function(){return U.FILE_IDENTIFIER_LENGTH}});var Z=_();Object.defineProperty(r,"SIZE_PREFIX_LENGTH",{enumerable:!0,get:function(){return Z.SIZE_PREFIX_LENGTH}});var g=w();Object.defineProperty(r,"int32",{enumerable:!0,get:function(){return g.int32}});Object.defineProperty(r,"float32",{enumerable:!0,get:function(){return g.float32}});Object.defineProperty(r,"float64",{enumerable:!0,get:function(){return g.float64}});Object.defineProperty(r,"isLittleEndian",{enumerable:!0,get:function(){return g.isLittleEndian}});var H=T();Object.defineProperty(r,"Encoding",{enumerable:!0,get:function(){return H.Encoding}});var P=L();Object.defineProperty(r,"Builder",{enumerable:!0,get:function(){return P.Builder}});var G=N();Object.defineProperty(r,"ByteBuffer",{enumerable:!0,get:function(){return G.ByteBuffer}})});return D();})();
import { ByteBuffer } from './byte-buffer.js';
import { Builder } from './builder.js';
export declare type Offset = number;
export declare type Table = {
export type Offset = number;
export type Table = {
bb: ByteBuffer;

@@ -6,0 +6,0 @@ bb_pos: number;

@@ -232,3 +232,3 @@ import { ByteBuffer } from "./byte-buffer.js";

if (obj != this.offset()) {
throw new Error('FlatBuffers: struct must be serialized inline.');
throw new TypeError('FlatBuffers: struct must be serialized inline.');
}

@@ -242,3 +242,3 @@ }

if (this.isNested) {
throw new Error('FlatBuffers: object serialization must not be nested.');
throw new TypeError('FlatBuffers: object serialization must not be nested.');
}

@@ -376,3 +376,3 @@ }

if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
throw new Error('FlatBuffers: file identifier must be length ' +
throw new TypeError('FlatBuffers: file identifier must be length ' +
FILE_IDENTIFIER_LENGTH);

@@ -408,3 +408,3 @@ }

if (!ok) {
throw new Error('FlatBuffers: field ' + field + ' must be set');
throw new TypeError('FlatBuffers: field ' + field + ' must be set');
}

@@ -514,3 +514,3 @@ }

else {
throw new Error('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
throw new TypeError('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
}

@@ -517,0 +517,0 @@ }

import { ByteBuffer } from './byte-buffer.js';
import { Builder } from './builder.js';
export declare type Offset = number;
export declare type Table = {
export type Offset = number;
export type Table = {
bb: ByteBuffer;

@@ -6,0 +6,0 @@ bb_pos: number;

{
"name": "flatbuffers",
"version": "23.3.3",
"version": "23.5.8",
"description": "Memory Efficient Serialization Library",

@@ -32,3 +32,3 @@ "files": [

"author": "The FlatBuffers project",
"license": "SEE LICENSE IN LICENSE.txt",
"license": "SEE LICENSE IN LICENSE",
"bugs": {

@@ -40,10 +40,9 @@ "url": "https://github.com/google/flatbuffers/issues"

"devDependencies": {
"@bazel/typescript": "5.2.0",
"@types/node": "18.7.16",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"esbuild": "^0.16.4",
"eslint": "^8.29.0",
"typescript": "^4.8.3"
"@types/node": "18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"esbuild": "^0.17.14",
"eslint": "^8.37.0",
"typescript": "5.0.4"
}
}

@@ -271,3 +271,3 @@ import { ByteBuffer } from "./byte-buffer.js"

if (obj != this.offset()) {
throw new Error('FlatBuffers: struct must be serialized inline.');
throw new TypeError('FlatBuffers: struct must be serialized inline.');
}

@@ -282,3 +282,3 @@ }

if (this.isNested) {
throw new Error('FlatBuffers: object serialization must not be nested.');
throw new TypeError('FlatBuffers: object serialization must not be nested.');
}

@@ -434,3 +434,3 @@ }

if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
throw new Error('FlatBuffers: file identifier must be length ' +
throw new TypeError('FlatBuffers: file identifier must be length ' +
FILE_IDENTIFIER_LENGTH);

@@ -469,3 +469,3 @@ }

if (!ok) {
throw new Error('FlatBuffers: field ' + field + ' must be set');
throw new TypeError('FlatBuffers: field ' + field + ' must be set');
}

@@ -583,3 +583,3 @@ }

} else {
throw new Error(
throw new TypeError(
'FlatBuffers: Argument for createObjectOffsetList cannot contain null.');

@@ -586,0 +586,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc