mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 06:30:54 +00:00
[TS/JS] Entry point per namespace and reworked 1.x compatible single file build (#7510)
* [TS/JS] Entry point per namespace * Fix handling of outputpath and array_test * Attempt to fix generate_code * Fix cwd for ts in generate_code * Attempt to fixup bazel and some docs * Add --ts-flat-files to bazel build to get bundle * Move to DEFAULT_FLATC_TS_ARGS * Attempt to add esbuild * Attempt to use npm instead * Remove futile attempt to add esbuild * Attempt to as bazel esbuild * Shuffle * Upgrade bazel deps * Revert failed attempts to get bazel working * Ignore flatc tests for now * Add esbuild dependency * `package.json` Include esbuild * `WORKSPACE` Add fetching esbuild binary * Update WORKSPACE * Unfreeze Lockfile * Update WORKSPACE * Update BUILD.bazel * Rework to suggest instead of running external bundler * Add esbuild generation to test script * Prelim bundle test * Run test JavaScriptTest from flatbuffers 1.x * Deps upgrade * Clang format fix * Revert bazel changes * Fix newline * Generate with type declarations * Handle "empty" root namespace * Adjust tests for typescript_keywords.ts * Separate test procedure for old node resolution module output * Fix rel path for root level re-exports * Bazel support for esbuild-based flatc Unfortunately, we lose typing information because the new esbuild method of generating single files does not generate type information. The method used here is a bit hack-ish because it relies on parsing the console output of flatc to figure out what to do. * Try to fix bazel build for when node isn't present on host * Auto formatting fixes * Fix missing generated code Co-authored-by: Derek Bailey <derekbailey@google.com> Co-authored-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export var EnumInNestedNS;
|
||||
(function (EnumInNestedNS) {
|
||||
EnumInNestedNS[EnumInNestedNS["A"] = 0] = "A";
|
||||
EnumInNestedNS[EnumInNestedNS["B"] = 1] = "B";
|
||||
EnumInNestedNS[EnumInNestedNS["C"] = 2] = "C";
|
||||
})(EnumInNestedNS || (EnumInNestedNS = {}));
|
||||
@@ -1,8 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum EnumInNestedNS{
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export class StructInNestedNS {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readInt32(this.bb_pos);
|
||||
}
|
||||
mutate_a(value) {
|
||||
this.bb.writeInt32(this.bb_pos + 0, value);
|
||||
return true;
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt32(this.bb_pos + 4);
|
||||
}
|
||||
mutate_b(value) {
|
||||
this.bb.writeInt32(this.bb_pos + 4, value);
|
||||
return true;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'NamespaceA.NamespaceB.StructInNestedNS';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 8;
|
||||
}
|
||||
static createStructInNestedNS(builder, a, b) {
|
||||
builder.prep(4, 8);
|
||||
builder.writeInt32(b);
|
||||
builder.writeInt32(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new StructInNestedNST(this.a(), this.b());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
}
|
||||
}
|
||||
export class StructInNestedNST {
|
||||
constructor(a = 0, b = 0) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
pack(builder) {
|
||||
return StructInNestedNS.createStructInNestedNS(builder, this.a, this.b);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
|
||||
export class StructInNestedNS {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):StructInNestedNS {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():number {
|
||||
return this.bb!.readInt32(this.bb_pos);
|
||||
}
|
||||
|
||||
mutate_a(value:number):boolean {
|
||||
this.bb!.writeInt32(this.bb_pos + 0, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
b():number {
|
||||
return this.bb!.readInt32(this.bb_pos + 4);
|
||||
}
|
||||
|
||||
mutate_b(value:number):boolean {
|
||||
this.bb!.writeInt32(this.bb_pos + 4, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'NamespaceA.NamespaceB.StructInNestedNS';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 8;
|
||||
}
|
||||
|
||||
static createStructInNestedNS(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset {
|
||||
builder.prep(4, 8);
|
||||
builder.writeInt32(b);
|
||||
builder.writeInt32(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): StructInNestedNST {
|
||||
return new StructInNestedNST(
|
||||
this.a(),
|
||||
this.b()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: StructInNestedNST): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
}
|
||||
}
|
||||
|
||||
export class StructInNestedNST {
|
||||
constructor(
|
||||
public a: number = 0,
|
||||
public b: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return StructInNestedNS.createStructInNestedNS(builder,
|
||||
this.a,
|
||||
this.b
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export class TableInNestedNS {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsTableInNestedNS(bb, obj) {
|
||||
return (obj || new TableInNestedNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsTableInNestedNS(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableInNestedNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
foo() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
mutate_foo(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
this.bb.writeInt32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'NamespaceA.NamespaceB.TableInNestedNS';
|
||||
}
|
||||
static startTableInNestedNS(builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
static addFoo(builder, foo) {
|
||||
builder.addFieldInt32(0, foo, 0);
|
||||
}
|
||||
static endTableInNestedNS(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static createTableInNestedNS(builder, foo) {
|
||||
TableInNestedNS.startTableInNestedNS(builder);
|
||||
TableInNestedNS.addFoo(builder, foo);
|
||||
return TableInNestedNS.endTableInNestedNS(builder);
|
||||
}
|
||||
unpack() {
|
||||
return new TableInNestedNST(this.foo());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.foo = this.foo();
|
||||
}
|
||||
}
|
||||
export class TableInNestedNST {
|
||||
constructor(foo = 0) {
|
||||
this.foo = foo;
|
||||
}
|
||||
pack(builder) {
|
||||
return TableInNestedNS.createTableInNestedNS(builder, this.foo);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
|
||||
export class TableInNestedNS {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TableInNestedNS {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTableInNestedNS(bb:flatbuffers.ByteBuffer, obj?:TableInNestedNS):TableInNestedNS {
|
||||
return (obj || new TableInNestedNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTableInNestedNS(bb:flatbuffers.ByteBuffer, obj?:TableInNestedNS):TableInNestedNS {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableInNestedNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
foo():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
mutate_foo(value:number):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb!.writeInt32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'NamespaceA.NamespaceB.TableInNestedNS';
|
||||
}
|
||||
|
||||
static startTableInNestedNS(builder:flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addFoo(builder:flatbuffers.Builder, foo:number) {
|
||||
builder.addFieldInt32(0, foo, 0);
|
||||
}
|
||||
|
||||
static endTableInNestedNS(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTableInNestedNS(builder:flatbuffers.Builder, foo:number):flatbuffers.Offset {
|
||||
TableInNestedNS.startTableInNestedNS(builder);
|
||||
TableInNestedNS.addFoo(builder, foo);
|
||||
return TableInNestedNS.endTableInNestedNS(builder);
|
||||
}
|
||||
|
||||
unpack(): TableInNestedNST {
|
||||
return new TableInNestedNST(
|
||||
this.foo()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TableInNestedNST): void {
|
||||
_o.foo = this.foo();
|
||||
}
|
||||
}
|
||||
|
||||
export class TableInNestedNST {
|
||||
constructor(
|
||||
public foo: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return TableInNestedNS.createTableInNestedNS(builder,
|
||||
this.foo
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { TableInNestedNS } from '../../namespace-a/namespace-b/table-in-nested-n-s';
|
||||
export var UnionInNestedNS;
|
||||
(function (UnionInNestedNS) {
|
||||
UnionInNestedNS[UnionInNestedNS["NONE"] = 0] = "NONE";
|
||||
UnionInNestedNS[UnionInNestedNS["TableInNestedNS"] = 1] = "TableInNestedNS";
|
||||
})(UnionInNestedNS || (UnionInNestedNS = {}));
|
||||
export function unionToUnionInNestedNS(type, accessor) {
|
||||
switch (UnionInNestedNS[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'TableInNestedNS': return accessor(new TableInNestedNS());
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
export function unionListToUnionInNestedNS(type, accessor, index) {
|
||||
switch (UnionInNestedNS[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'TableInNestedNS': return accessor(index, new TableInNestedNS());
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import { TableInNestedNS, TableInNestedNST } from '../../namespace-a/namespace-b/table-in-nested-n-s';
|
||||
|
||||
|
||||
export enum UnionInNestedNS{
|
||||
NONE = 0,
|
||||
TableInNestedNS = 1
|
||||
}
|
||||
|
||||
export function unionToUnionInNestedNS(
|
||||
type: UnionInNestedNS,
|
||||
accessor: (obj:TableInNestedNS) => TableInNestedNS|null
|
||||
): TableInNestedNS|null {
|
||||
switch(UnionInNestedNS[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'TableInNestedNS': return accessor(new TableInNestedNS())! as TableInNestedNS;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function unionListToUnionInNestedNS(
|
||||
type: UnionInNestedNS,
|
||||
accessor: (index: number, obj:TableInNestedNS) => TableInNestedNS|null,
|
||||
index: number
|
||||
): TableInNestedNS|null {
|
||||
switch(UnionInNestedNS[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'TableInNestedNS': return accessor(index, new TableInNestedNS())! as TableInNestedNS;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { TableInC } from '../namespace-c/table-in-c';
|
||||
export class SecondTableInA {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsSecondTableInA(bb, obj) {
|
||||
return (obj || new SecondTableInA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsSecondTableInA(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new SecondTableInA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
referToC(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableInC()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'NamespaceA.SecondTableInA';
|
||||
}
|
||||
static startSecondTableInA(builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
static addReferToC(builder, referToCOffset) {
|
||||
builder.addFieldOffset(0, referToCOffset, 0);
|
||||
}
|
||||
static endSecondTableInA(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static createSecondTableInA(builder, referToCOffset) {
|
||||
SecondTableInA.startSecondTableInA(builder);
|
||||
SecondTableInA.addReferToC(builder, referToCOffset);
|
||||
return SecondTableInA.endSecondTableInA(builder);
|
||||
}
|
||||
unpack() {
|
||||
return new SecondTableInAT((this.referToC() !== null ? this.referToC().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.referToC = (this.referToC() !== null ? this.referToC().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class SecondTableInAT {
|
||||
constructor(referToC = null) {
|
||||
this.referToC = referToC;
|
||||
}
|
||||
pack(builder) {
|
||||
const referToC = (this.referToC !== null ? this.referToC.pack(builder) : 0);
|
||||
return SecondTableInA.createSecondTableInA(builder, referToC);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { TableInC, TableInCT } from '../namespace-c/table-in-c';
|
||||
|
||||
|
||||
export class SecondTableInA {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):SecondTableInA {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsSecondTableInA(bb:flatbuffers.ByteBuffer, obj?:SecondTableInA):SecondTableInA {
|
||||
return (obj || new SecondTableInA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsSecondTableInA(bb:flatbuffers.ByteBuffer, obj?:SecondTableInA):SecondTableInA {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new SecondTableInA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
referToC(obj?:TableInC):TableInC|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableInC()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'NamespaceA.SecondTableInA';
|
||||
}
|
||||
|
||||
static startSecondTableInA(builder:flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addReferToC(builder:flatbuffers.Builder, referToCOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, referToCOffset, 0);
|
||||
}
|
||||
|
||||
static endSecondTableInA(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createSecondTableInA(builder:flatbuffers.Builder, referToCOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
SecondTableInA.startSecondTableInA(builder);
|
||||
SecondTableInA.addReferToC(builder, referToCOffset);
|
||||
return SecondTableInA.endSecondTableInA(builder);
|
||||
}
|
||||
|
||||
unpack(): SecondTableInAT {
|
||||
return new SecondTableInAT(
|
||||
(this.referToC() !== null ? this.referToC()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: SecondTableInAT): void {
|
||||
_o.referToC = (this.referToC() !== null ? this.referToC()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class SecondTableInAT {
|
||||
constructor(
|
||||
public referToC: TableInCT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const referToC = (this.referToC !== null ? this.referToC!.pack(builder) : 0);
|
||||
|
||||
return SecondTableInA.createSecondTableInA(builder,
|
||||
referToC
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { EnumInNestedNS } from '../namespace-a/namespace-b/enum-in-nested-n-s';
|
||||
import { StructInNestedNS } from '../namespace-a/namespace-b/struct-in-nested-n-s';
|
||||
import { TableInNestedNS } from '../namespace-a/namespace-b/table-in-nested-n-s';
|
||||
import { UnionInNestedNS, unionToUnionInNestedNS } from '../namespace-a/namespace-b/union-in-nested-n-s';
|
||||
export class TableInFirstNS {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsTableInFirstNS(bb, obj) {
|
||||
return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsTableInFirstNS(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
fooTable(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableInNestedNS()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
fooEnum() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : EnumInNestedNS.A;
|
||||
}
|
||||
mutate_foo_enum(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
this.bb.writeInt8(this.bb_pos + offset, value);
|
||||
return true;
|
||||
}
|
||||
fooUnionType() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb.readUint8(this.bb_pos + offset) : UnionInNestedNS.NONE;
|
||||
}
|
||||
fooUnion(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
|
||||
}
|
||||
fooStruct(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 12);
|
||||
return offset ? (obj || new StructInNestedNS()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'NamespaceA.TableInFirstNS';
|
||||
}
|
||||
static startTableInFirstNS(builder) {
|
||||
builder.startObject(5);
|
||||
}
|
||||
static addFooTable(builder, fooTableOffset) {
|
||||
builder.addFieldOffset(0, fooTableOffset, 0);
|
||||
}
|
||||
static addFooEnum(builder, fooEnum) {
|
||||
builder.addFieldInt8(1, fooEnum, EnumInNestedNS.A);
|
||||
}
|
||||
static addFooUnionType(builder, fooUnionType) {
|
||||
builder.addFieldInt8(2, fooUnionType, UnionInNestedNS.NONE);
|
||||
}
|
||||
static addFooUnion(builder, fooUnionOffset) {
|
||||
builder.addFieldOffset(3, fooUnionOffset, 0);
|
||||
}
|
||||
static addFooStruct(builder, fooStructOffset) {
|
||||
builder.addFieldStruct(4, fooStructOffset, 0);
|
||||
}
|
||||
static endTableInFirstNS(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
unpack() {
|
||||
return new TableInFirstNST((this.fooTable() !== null ? this.fooTable().unpack() : null), this.fooEnum(), this.fooUnionType(), (() => {
|
||||
let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this));
|
||||
if (temp === null) {
|
||||
return null;
|
||||
}
|
||||
return temp.unpack();
|
||||
})(), (this.fooStruct() !== null ? this.fooStruct().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.fooTable = (this.fooTable() !== null ? this.fooTable().unpack() : null);
|
||||
_o.fooEnum = this.fooEnum();
|
||||
_o.fooUnionType = this.fooUnionType();
|
||||
_o.fooUnion = (() => {
|
||||
let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this));
|
||||
if (temp === null) {
|
||||
return null;
|
||||
}
|
||||
return temp.unpack();
|
||||
})();
|
||||
_o.fooStruct = (this.fooStruct() !== null ? this.fooStruct().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class TableInFirstNST {
|
||||
constructor(fooTable = null, fooEnum = EnumInNestedNS.A, fooUnionType = UnionInNestedNS.NONE, fooUnion = null, fooStruct = null) {
|
||||
this.fooTable = fooTable;
|
||||
this.fooEnum = fooEnum;
|
||||
this.fooUnionType = fooUnionType;
|
||||
this.fooUnion = fooUnion;
|
||||
this.fooStruct = fooStruct;
|
||||
}
|
||||
pack(builder) {
|
||||
const fooTable = (this.fooTable !== null ? this.fooTable.pack(builder) : 0);
|
||||
const fooUnion = builder.createObjectOffset(this.fooUnion);
|
||||
TableInFirstNS.startTableInFirstNS(builder);
|
||||
TableInFirstNS.addFooTable(builder, fooTable);
|
||||
TableInFirstNS.addFooEnum(builder, this.fooEnum);
|
||||
TableInFirstNS.addFooUnionType(builder, this.fooUnionType);
|
||||
TableInFirstNS.addFooUnion(builder, fooUnion);
|
||||
TableInFirstNS.addFooStruct(builder, (this.fooStruct !== null ? this.fooStruct.pack(builder) : 0));
|
||||
return TableInFirstNS.endTableInFirstNS(builder);
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { EnumInNestedNS } from '../namespace-a/namespace-b/enum-in-nested-n-s';
|
||||
import { StructInNestedNS, StructInNestedNST } from '../namespace-a/namespace-b/struct-in-nested-n-s';
|
||||
import { TableInNestedNS, TableInNestedNST } from '../namespace-a/namespace-b/table-in-nested-n-s';
|
||||
import { UnionInNestedNS, unionToUnionInNestedNS, unionListToUnionInNestedNS } from '../namespace-a/namespace-b/union-in-nested-n-s';
|
||||
|
||||
|
||||
export class TableInFirstNS {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TableInFirstNS {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):TableInFirstNS {
|
||||
return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):TableInFirstNS {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
fooTable(obj?:TableInNestedNS):TableInNestedNS|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableInNestedNS()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
fooEnum():EnumInNestedNS {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : EnumInNestedNS.A;
|
||||
}
|
||||
|
||||
mutate_foo_enum(value:EnumInNestedNS):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb!.writeInt8(this.bb_pos + offset, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
fooUnionType():UnionInNestedNS {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readUint8(this.bb_pos + offset) : UnionInNestedNS.NONE;
|
||||
}
|
||||
|
||||
fooUnion<T extends flatbuffers.Table>(obj:any):any|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
|
||||
}
|
||||
|
||||
fooStruct(obj?:StructInNestedNS):StructInNestedNS|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? (obj || new StructInNestedNS()).__init(this.bb_pos + offset, this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'NamespaceA.TableInFirstNS';
|
||||
}
|
||||
|
||||
static startTableInFirstNS(builder:flatbuffers.Builder) {
|
||||
builder.startObject(5);
|
||||
}
|
||||
|
||||
static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, fooTableOffset, 0);
|
||||
}
|
||||
|
||||
static addFooEnum(builder:flatbuffers.Builder, fooEnum:EnumInNestedNS) {
|
||||
builder.addFieldInt8(1, fooEnum, EnumInNestedNS.A);
|
||||
}
|
||||
|
||||
static addFooUnionType(builder:flatbuffers.Builder, fooUnionType:UnionInNestedNS) {
|
||||
builder.addFieldInt8(2, fooUnionType, UnionInNestedNS.NONE);
|
||||
}
|
||||
|
||||
static addFooUnion(builder:flatbuffers.Builder, fooUnionOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(3, fooUnionOffset, 0);
|
||||
}
|
||||
|
||||
static addFooStruct(builder:flatbuffers.Builder, fooStructOffset:flatbuffers.Offset) {
|
||||
builder.addFieldStruct(4, fooStructOffset, 0);
|
||||
}
|
||||
|
||||
static endTableInFirstNS(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
unpack(): TableInFirstNST {
|
||||
return new TableInFirstNST(
|
||||
(this.fooTable() !== null ? this.fooTable()!.unpack() : null),
|
||||
this.fooEnum(),
|
||||
this.fooUnionType(),
|
||||
(() => {
|
||||
let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this));
|
||||
if(temp === null) { return null; }
|
||||
return temp.unpack()
|
||||
})(),
|
||||
(this.fooStruct() !== null ? this.fooStruct()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TableInFirstNST): void {
|
||||
_o.fooTable = (this.fooTable() !== null ? this.fooTable()!.unpack() : null);
|
||||
_o.fooEnum = this.fooEnum();
|
||||
_o.fooUnionType = this.fooUnionType();
|
||||
_o.fooUnion = (() => {
|
||||
let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this));
|
||||
if(temp === null) { return null; }
|
||||
return temp.unpack()
|
||||
})();
|
||||
_o.fooStruct = (this.fooStruct() !== null ? this.fooStruct()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class TableInFirstNST {
|
||||
constructor(
|
||||
public fooTable: TableInNestedNST|null = null,
|
||||
public fooEnum: EnumInNestedNS = EnumInNestedNS.A,
|
||||
public fooUnionType: UnionInNestedNS = UnionInNestedNS.NONE,
|
||||
public fooUnion: TableInNestedNST|null = null,
|
||||
public fooStruct: StructInNestedNST|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const fooTable = (this.fooTable !== null ? this.fooTable!.pack(builder) : 0);
|
||||
const fooUnion = builder.createObjectOffset(this.fooUnion);
|
||||
|
||||
TableInFirstNS.startTableInFirstNS(builder);
|
||||
TableInFirstNS.addFooTable(builder, fooTable);
|
||||
TableInFirstNS.addFooEnum(builder, this.fooEnum);
|
||||
TableInFirstNS.addFooUnionType(builder, this.fooUnionType);
|
||||
TableInFirstNS.addFooUnion(builder, fooUnion);
|
||||
TableInFirstNS.addFooStruct(builder, (this.fooStruct !== null ? this.fooStruct!.pack(builder) : 0));
|
||||
|
||||
return TableInFirstNS.endTableInFirstNS(builder);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { SecondTableInA } from '../namespace-a/second-table-in-a';
|
||||
import { TableInFirstNS } from '../namespace-a/table-in-first-n-s';
|
||||
export class TableInC {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsTableInC(bb, obj) {
|
||||
return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsTableInC(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
referToA1(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableInFirstNS()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
referToA2(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new SecondTableInA()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'NamespaceC.TableInC';
|
||||
}
|
||||
static startTableInC(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addReferToA1(builder, referToA1Offset) {
|
||||
builder.addFieldOffset(0, referToA1Offset, 0);
|
||||
}
|
||||
static addReferToA2(builder, referToA2Offset) {
|
||||
builder.addFieldOffset(1, referToA2Offset, 0);
|
||||
}
|
||||
static endTableInC(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
unpack() {
|
||||
return new TableInCT((this.referToA1() !== null ? this.referToA1().unpack() : null), (this.referToA2() !== null ? this.referToA2().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.referToA1 = (this.referToA1() !== null ? this.referToA1().unpack() : null);
|
||||
_o.referToA2 = (this.referToA2() !== null ? this.referToA2().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class TableInCT {
|
||||
constructor(referToA1 = null, referToA2 = null) {
|
||||
this.referToA1 = referToA1;
|
||||
this.referToA2 = referToA2;
|
||||
}
|
||||
pack(builder) {
|
||||
const referToA1 = (this.referToA1 !== null ? this.referToA1.pack(builder) : 0);
|
||||
const referToA2 = (this.referToA2 !== null ? this.referToA2.pack(builder) : 0);
|
||||
TableInC.startTableInC(builder);
|
||||
TableInC.addReferToA1(builder, referToA1);
|
||||
TableInC.addReferToA2(builder, referToA2);
|
||||
return TableInC.endTableInC(builder);
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { SecondTableInA, SecondTableInAT } from '../namespace-a/second-table-in-a';
|
||||
import { TableInFirstNS, TableInFirstNST } from '../namespace-a/table-in-first-n-s';
|
||||
|
||||
|
||||
export class TableInC {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TableInC {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTableInC(bb:flatbuffers.ByteBuffer, obj?:TableInC):TableInC {
|
||||
return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTableInC(bb:flatbuffers.ByteBuffer, obj?:TableInC):TableInC {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
referToA1(obj?:TableInFirstNS):TableInFirstNS|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableInFirstNS()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
referToA2(obj?:SecondTableInA):SecondTableInA|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new SecondTableInA()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'NamespaceC.TableInC';
|
||||
}
|
||||
|
||||
static startTableInC(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addReferToA1(builder:flatbuffers.Builder, referToA1Offset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, referToA1Offset, 0);
|
||||
}
|
||||
|
||||
static addReferToA2(builder:flatbuffers.Builder, referToA2Offset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, referToA2Offset, 0);
|
||||
}
|
||||
|
||||
static endTableInC(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
unpack(): TableInCT {
|
||||
return new TableInCT(
|
||||
(this.referToA1() !== null ? this.referToA1()!.unpack() : null),
|
||||
(this.referToA2() !== null ? this.referToA2()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TableInCT): void {
|
||||
_o.referToA1 = (this.referToA1() !== null ? this.referToA1()!.unpack() : null);
|
||||
_o.referToA2 = (this.referToA2() !== null ? this.referToA2()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class TableInCT {
|
||||
constructor(
|
||||
public referToA1: TableInFirstNST|null = null,
|
||||
public referToA2: SecondTableInAT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const referToA1 = (this.referToA1 !== null ? this.referToA1!.pack(builder) : 0);
|
||||
const referToA2 = (this.referToA2 !== null ? this.referToA2!.pack(builder) : 0);
|
||||
|
||||
TableInC.startTableInC(builder);
|
||||
TableInC.addReferToA1(builder, referToA1);
|
||||
TableInC.addReferToA2(builder, referToA2);
|
||||
|
||||
return TableInC.endTableInC(builder);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export { StructInNestedNS, StructInNestedNST } from './namespace-a/namespace-b/struct-in-nested-n-s';
|
||||
export { TableInNestedNS, TableInNestedNST } from './namespace-a/namespace-b/table-in-nested-n-s';
|
||||
export { UnionInNestedNS, unionToUnionInNestedNS, unionListToUnionInNestedNS } from './namespace-a/namespace-b/union-in-nested-n-s';
|
||||
@@ -1,7 +0,0 @@
|
||||
export { EnumInNestedNS } from './namespace-a/namespace-b/enum-in-nested-n-s';
|
||||
export { StructInNestedNS, StructInNestedNST } from './namespace-a/namespace-b/struct-in-nested-n-s';
|
||||
export { TableInNestedNS, TableInNestedNST } from './namespace-a/namespace-b/table-in-nested-n-s';
|
||||
export { UnionInNestedNS, unionToUnionInNestedNS, unionListToUnionInNestedNS } from './namespace-a/namespace-b/union-in-nested-n-s';
|
||||
export { SecondTableInA, SecondTableInAT } from './namespace-a/second-table-in-a';
|
||||
export { TableInFirstNS, TableInFirstNST } from './namespace-a/table-in-first-n-s';
|
||||
export { TableInC, TableInCT } from './namespace-c/table-in-c';
|
||||
Reference in New Issue
Block a user