Skip to content

Commit

Permalink
Merge pull request #20 from Producement/js_to_ts
Browse files Browse the repository at this point in the history
Fixed missing target from flatbuffers_js with flatbuffers_ts in flatbuffers
  • Loading branch information
jerson authored May 12, 2022
2 parents 13d067e + 9195983 commit 92cb414
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Makefile.flatbuffers
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: flatbuffers
flatbuffers: flatbuffers_dart flatbuffers_go flatbuffers_js
flatbuffers: flatbuffers_dart flatbuffers_go flatbuffers_ts

flatbuffers_deps:
cd /tmp && \
Expand Down
48 changes: 48 additions & 0 deletions wasm/example/libs/model/armor-decode-request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// automatically generated by the FlatBuffers compiler, do not modify

import * as flatbuffers from 'flatbuffers';

export class ArmorDecodeRequest {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):ArmorDecodeRequest {
this.bb_pos = i;
this.bb = bb;
return this;
}

static getRootAsArmorDecodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorDecodeRequest):ArmorDecodeRequest {
return (obj || new ArmorDecodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsArmorDecodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorDecodeRequest):ArmorDecodeRequest {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new ArmorDecodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

packet():string|null
packet(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
packet(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

static startArmorDecodeRequest(builder:flatbuffers.Builder) {
builder.startObject(1);
}

static addPacket(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, packetOffset, 0);
}

static endArmorDecodeRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}

static createArmorDecodeRequest(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset):flatbuffers.Offset {
ArmorDecodeRequest.startArmorDecodeRequest(builder);
ArmorDecodeRequest.addPacket(builder, packetOffset);
return ArmorDecodeRequest.endArmorDecodeRequest(builder);
}
}
68 changes: 68 additions & 0 deletions wasm/example/libs/model/armor-encode-request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// automatically generated by the FlatBuffers compiler, do not modify

import * as flatbuffers from 'flatbuffers';

export class ArmorEncodeRequest {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):ArmorEncodeRequest {
this.bb_pos = i;
this.bb = bb;
return this;
}

static getRootAsArmorEncodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorEncodeRequest):ArmorEncodeRequest {
return (obj || new ArmorEncodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsArmorEncodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorEncodeRequest):ArmorEncodeRequest {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new ArmorEncodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

packet(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
}

packetLength():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}

packetArray():Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
}

static startArmorEncodeRequest(builder:flatbuffers.Builder) {
builder.startObject(1);
}

static addPacket(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, packetOffset, 0);
}

static createPacketVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
builder.startVector(1, data.length, 1);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt8(data[i]!);
}
return builder.endVector();
}

static startPacketVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}

static endArmorEncodeRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}

static createArmorEncodeRequest(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset):flatbuffers.Offset {
ArmorEncodeRequest.startArmorEncodeRequest(builder);
ArmorEncodeRequest.addPacket(builder, packetOffset);
return ArmorEncodeRequest.endArmorEncodeRequest(builder);
}
}
2 changes: 1 addition & 1 deletion wasm/example/libs/model/file-hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ isBinary():boolean {
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

mutate_isBinary(value:boolean):boolean {
mutate_is_binary(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);

if (offset === 0) {
Expand Down
12 changes: 6 additions & 6 deletions wasm/example/libs/model/int-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ static getSizePrefixedRootAsIntResponse(bb:flatbuffers.ByteBuffer, obj?:IntRespo
return (obj || new IntResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

output():flatbuffers.Long {
output():bigint {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

mutate_output(value:flatbuffers.Long):boolean {
mutate_output(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);

if (offset === 0) {
Expand All @@ -47,8 +47,8 @@ static startIntResponse(builder:flatbuffers.Builder) {
builder.startObject(2);
}

static addOutput(builder:flatbuffers.Builder, output:flatbuffers.Long) {
builder.addFieldInt64(0, output, builder.createLong(0, 0));
static addOutput(builder:flatbuffers.Builder, output:bigint) {
builder.addFieldInt64(0, output, BigInt('0'));
}

static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
Expand All @@ -60,7 +60,7 @@ static endIntResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
return offset;
}

static createIntResponse(builder:flatbuffers.Builder, output:flatbuffers.Long, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
static createIntResponse(builder:flatbuffers.Builder, output:bigint, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
IntResponse.startIntResponse(builder);
IntResponse.addOutput(builder, output);
IntResponse.addError(builder, errorOffset);
Expand Down
4 changes: 2 additions & 2 deletions wasm/example/libs/model/key-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ compressionLevel():number {
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

mutate_compressionLevel(value:number):boolean {
mutate_compression_level(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 10);

if (offset === 0) {
Expand All @@ -124,7 +124,7 @@ rsaBits():number {
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

mutate_rsaBits(value:number):boolean {
mutate_rsa_bits(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 12);

if (offset === 0) {
Expand Down
40 changes: 20 additions & 20 deletions wasm/example/libs/model/private-key-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ static getSizePrefixedRootAsPrivateKeyMetadata(bb:flatbuffers.ByteBuffer, obj?:P
return (obj || new PrivateKeyMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

keyID():string|null
keyID(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyID(optionalEncoding?:any):string|Uint8Array|null {
keyId():string|null
keyId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyId(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

keyIDShort():string|null
keyIDShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIDShort(optionalEncoding?:any):string|Uint8Array|null {
keyIdShort():string|null
keyIdShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIdShort(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
Expand All @@ -48,9 +48,9 @@ fingerprint(optionalEncoding?:any):string|Uint8Array|null {
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

keyIDNumeric():string|null
keyIDNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIDNumeric(optionalEncoding?:any):string|Uint8Array|null {
keyIdNumeric():string|null
keyIdNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIdNumeric(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
Expand All @@ -60,7 +60,7 @@ isSubKey():boolean {
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

mutate_isSubKey(value:boolean):boolean {
mutate_is_sub_key(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 14);

if (offset === 0) {
Expand Down Expand Up @@ -91,12 +91,12 @@ static startPrivateKeyMetadata(builder:flatbuffers.Builder) {
builder.startObject(7);
}

static addKeyID(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, keyIDOffset, 0);
static addKeyId(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, keyIdOffset, 0);
}

static addKeyIDShort(builder:flatbuffers.Builder, keyIDShortOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, keyIDShortOffset, 0);
static addKeyIdShort(builder:flatbuffers.Builder, keyIdShortOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, keyIdShortOffset, 0);
}

static addCreationTime(builder:flatbuffers.Builder, creationTimeOffset:flatbuffers.Offset) {
Expand All @@ -107,8 +107,8 @@ static addFingerprint(builder:flatbuffers.Builder, fingerprintOffset:flatbuffers
builder.addFieldOffset(3, fingerprintOffset, 0);
}

static addKeyIDNumeric(builder:flatbuffers.Builder, keyIDNumericOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, keyIDNumericOffset, 0);
static addKeyIdNumeric(builder:flatbuffers.Builder, keyIdNumericOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, keyIdNumericOffset, 0);
}

static addIsSubKey(builder:flatbuffers.Builder, isSubKey:boolean) {
Expand All @@ -124,13 +124,13 @@ static endPrivateKeyMetadata(builder:flatbuffers.Builder):flatbuffers.Offset {
return offset;
}

static createPrivateKeyMetadata(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset, keyIDShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIDNumericOffset:flatbuffers.Offset, isSubKey:boolean, encrypted:boolean):flatbuffers.Offset {
static createPrivateKeyMetadata(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset, keyIdShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIdNumericOffset:flatbuffers.Offset, isSubKey:boolean, encrypted:boolean):flatbuffers.Offset {
PrivateKeyMetadata.startPrivateKeyMetadata(builder);
PrivateKeyMetadata.addKeyID(builder, keyIDOffset);
PrivateKeyMetadata.addKeyIDShort(builder, keyIDShortOffset);
PrivateKeyMetadata.addKeyId(builder, keyIdOffset);
PrivateKeyMetadata.addKeyIdShort(builder, keyIdShortOffset);
PrivateKeyMetadata.addCreationTime(builder, creationTimeOffset);
PrivateKeyMetadata.addFingerprint(builder, fingerprintOffset);
PrivateKeyMetadata.addKeyIDNumeric(builder, keyIDNumericOffset);
PrivateKeyMetadata.addKeyIdNumeric(builder, keyIdNumericOffset);
PrivateKeyMetadata.addIsSubKey(builder, isSubKey);
PrivateKeyMetadata.addEncrypted(builder, encrypted);
return PrivateKeyMetadata.endPrivateKeyMetadata(builder);
Expand Down
40 changes: 20 additions & 20 deletions wasm/example/libs/model/public-key-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ static getSizePrefixedRootAsPublicKeyMetadata(bb:flatbuffers.ByteBuffer, obj?:Pu
return (obj || new PublicKeyMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

keyID():string|null
keyID(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyID(optionalEncoding?:any):string|Uint8Array|null {
keyId():string|null
keyId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyId(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

keyIDShort():string|null
keyIDShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIDShort(optionalEncoding?:any):string|Uint8Array|null {
keyIdShort():string|null
keyIdShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIdShort(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
Expand All @@ -48,9 +48,9 @@ fingerprint(optionalEncoding?:any):string|Uint8Array|null {
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

keyIDNumeric():string|null
keyIDNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIDNumeric(optionalEncoding?:any):string|Uint8Array|null {
keyIdNumeric():string|null
keyIdNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
keyIdNumeric(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
Expand All @@ -60,7 +60,7 @@ isSubKey():boolean {
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

mutate_isSubKey(value:boolean):boolean {
mutate_is_sub_key(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 14);

if (offset === 0) {
Expand All @@ -75,12 +75,12 @@ static startPublicKeyMetadata(builder:flatbuffers.Builder) {
builder.startObject(6);
}

static addKeyID(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, keyIDOffset, 0);
static addKeyId(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, keyIdOffset, 0);
}

static addKeyIDShort(builder:flatbuffers.Builder, keyIDShortOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, keyIDShortOffset, 0);
static addKeyIdShort(builder:flatbuffers.Builder, keyIdShortOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, keyIdShortOffset, 0);
}

static addCreationTime(builder:flatbuffers.Builder, creationTimeOffset:flatbuffers.Offset) {
Expand All @@ -91,8 +91,8 @@ static addFingerprint(builder:flatbuffers.Builder, fingerprintOffset:flatbuffers
builder.addFieldOffset(3, fingerprintOffset, 0);
}

static addKeyIDNumeric(builder:flatbuffers.Builder, keyIDNumericOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, keyIDNumericOffset, 0);
static addKeyIdNumeric(builder:flatbuffers.Builder, keyIdNumericOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, keyIdNumericOffset, 0);
}

static addIsSubKey(builder:flatbuffers.Builder, isSubKey:boolean) {
Expand All @@ -104,13 +104,13 @@ static endPublicKeyMetadata(builder:flatbuffers.Builder):flatbuffers.Offset {
return offset;
}

static createPublicKeyMetadata(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset, keyIDShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIDNumericOffset:flatbuffers.Offset, isSubKey:boolean):flatbuffers.Offset {
static createPublicKeyMetadata(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset, keyIdShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIdNumericOffset:flatbuffers.Offset, isSubKey:boolean):flatbuffers.Offset {
PublicKeyMetadata.startPublicKeyMetadata(builder);
PublicKeyMetadata.addKeyID(builder, keyIDOffset);
PublicKeyMetadata.addKeyIDShort(builder, keyIDShortOffset);
PublicKeyMetadata.addKeyId(builder, keyIdOffset);
PublicKeyMetadata.addKeyIdShort(builder, keyIdShortOffset);
PublicKeyMetadata.addCreationTime(builder, creationTimeOffset);
PublicKeyMetadata.addFingerprint(builder, fingerprintOffset);
PublicKeyMetadata.addKeyIDNumeric(builder, keyIDNumericOffset);
PublicKeyMetadata.addKeyIdNumeric(builder, keyIdNumericOffset);
PublicKeyMetadata.addIsSubKey(builder, isSubKey);
return PublicKeyMetadata.endPublicKeyMetadata(builder);
}
Expand Down

0 comments on commit 92cb414

Please sign in to comment.