[TS/JS] Move TS tests to dedicated folder and deps upgrade (#7508)

* Move TS tests to dedicated folder and deps upgrade

* Attempt to fix generate_code

* Fix dir on CI

* Add js extension

* Fix missing extension

* Harmonize with test gen

* Unexplained code gen change

* Restore yarn.lock

* Naive attempt to fix bazel stuff

* Pin @bazel/typescript to 5.2.0

* Attempt to fix bazel

* More tweak

* Upgrade deps

* Tweak?

* Fix path

* Fix test package

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Björn Harrtell 2022-09-13 05:03:23 +02:00 committed by GitHub
parent 036032373b
commit 4fca4dc60c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
125 changed files with 15405 additions and 494 deletions

View File

@ -459,7 +459,7 @@ jobs:
- name: compile
run: yarn compile
- name: test
working-directory: tests
working-directory: tests/ts
run: python3 TypeScriptTest.py
build-dart:

View File

@ -1,4 +1,4 @@
// automatically generated by the FlatBuffers compiler, do not modify
export { HelloReply } from './models/hello-reply';
export { HelloRequest } from './models/hello-request';
export { HelloReply } from './models/hello-reply.js';
export { HelloRequest } from './models/hello-request.js';

View File

@ -16,7 +16,7 @@
"test": "tests"
},
"scripts": {
"test": "npm run compile && cd tests && python3 ./TypeScriptTest.py",
"test": "npm run compile && cd tests/ts && python3 ./TypeScriptTest.py",
"compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c",
"prepublishOnly": "npm install --only=dev && npm run compile"
},
@ -35,12 +35,12 @@
"homepage": "https://google.github.io/flatbuffers/",
"dependencies": {},
"devDependencies": {
"@bazel/typescript": "^5.2.0",
"@types/node": "17.0.21",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"rollup": "^2.78.0",
"typescript": "^4.5.5"
"@bazel/typescript": "5.2.0",
"@types/node": "18.7.16",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"eslint": "^8.23.1",
"rollup": "^2.79.0",
"typescript": "^4.8.3"
}
}

View File

@ -165,7 +165,6 @@ flatc(
NO_INCL_OPTS
+ CPP_OPTS
+ CS_OPTS
+ TS_OPTS
+ [
"--binary",
"--java",
@ -180,6 +179,15 @@ flatc(
data="monsterdata_test.json",
)
flatc(
NO_INCL_OPTS
+ TS_OPTS,
schema="monster_test.fbs",
prefix="ts",
include="include_test",
data="monsterdata_test.json",
)
flatc(
["--lua", "--bfbs-filenames", str(tests_path)],
schema="monster_test.fbs",
@ -235,14 +243,21 @@ flatc(
)
flatc(
BASE_OPTS + CPP_OPTS + CS_OPTS + TS_OPTS + JAVA_OPTS + KOTLIN_OPTS + PHP_OPTS,
BASE_OPTS + CPP_OPTS + CS_OPTS + JAVA_OPTS + KOTLIN_OPTS + PHP_OPTS,
prefix="union_vector",
schema="union_vector/union_vector.fbs",
)
flatc(
BASE_OPTS + TS_OPTS,
prefix="ts/union_vector",
schema="union_vector/union_vector.fbs",
)
flatc(
BASE_OPTS + TS_OPTS + ["--gen-name-strings", "--gen-mutable"],
include="include_test",
prefix="ts",
schema="monster_test.fbs",
)
@ -257,13 +272,14 @@ flatc(
flatc(
BASE_OPTS + TS_OPTS + ["-b"],
include="include_test",
prefix="ts",
schema="monster_test.fbs",
data="unicode_test.json",
)
flatc(
BASE_OPTS + TS_OPTS + ["--gen-name-strings"],
prefix="union_vector",
prefix="ts/union_vector",
schema="union_vector/union_vector.fbs",
)
@ -357,7 +373,8 @@ flatc(
# Optional Scalars
optional_scalars_schema = "optional_scalars.fbs"
flatc(["--java", "--kotlin", "--lobster", "--ts"], schema=optional_scalars_schema)
flatc(["--java", "--kotlin", "--lobster"], schema=optional_scalars_schema)
flatc(TS_OPTS, schema=optional_scalars_schema, prefix="ts")
flatc(["--csharp", "--python", "--gen-object-api"], schema=optional_scalars_schema)

View File

@ -263,7 +263,7 @@ class TsGenerator : public BaseGenerator {
namer_.EscapeKeyword(pair.second) + ", ";
}
code.resize(code.size() - 2);
code += "} from '" + include_name + "';\n";
code += "} from '" + include_name + ".js';\n";
}
code += "\n";
}
@ -760,9 +760,9 @@ class TsGenerator : public BaseGenerator {
import.bare_file_path = bare_file_path;
import.rel_file_path = rel_file_path;
import.import_statement =
"import { " + symbols_expression + " } from '" + rel_file_path + "';";
"import { " + symbols_expression + " } from '" + rel_file_path + ".js';";
import.export_statement =
"export { " + symbols_expression + " } from '." + bare_file_path + "';";
"export { " + symbols_expression + " } from '." + bare_file_path + ".js';";
import.dependency = &dependency;
import.dependent = &dependent;

View File

@ -1,6 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//:build_defs.bzl", "flatbuffer_cc_library")
load("//:typescript.bzl", "flatbuffer_ts_library")
package(default_visibility = ["//visibility:private"])
@ -215,12 +214,3 @@ flatbuffer_cc_library(
"--cpp-ptr-type flatbuffers::unique_ptr",
],
)
flatbuffer_ts_library(
name = "typescript_ts_fbs",
srcs = ["typescript_keywords.fbs"],
deps = [
"//tests/test_dir:include_ts_fbs",
"//tests/test_dir:typescript_transitive_ts_fbs",
],
)

View File

@ -26,8 +26,8 @@ class TsTests():
assert_file_and_contents(
"foo_generated.ts",
[
"export { Bar } from './bar';",
"export { Foo } from './foo';",
"export { Bar } from './bar.js';",
"export { Foo } from './foo.js';",
],
)
@ -46,8 +46,8 @@ class TsTests():
assert_file_and_contents(
"foo_generated.ts",
[
"export { Bar } from './bar';",
"export { Foo } from './foo';",
"export { Bar } from './bar.js';",
"export { Foo } from './foo.js';",
],
)
@ -66,8 +66,8 @@ class TsTests():
assert_file_and_contents(
"foo_with_ns_generated.ts",
[
"export { Bar } from './bar/bar';",
"export { Foo } from './something/foo';",
"export { Bar } from './bar/bar.js';",
"export { Foo } from './something/foo.js';",
],
)
@ -77,7 +77,7 @@ class TsTests():
"something/foo.ts",
[
"export class Foo {",
"import { Bar } from '../bar/bar';",
"import { Bar } from '../bar/bar.js';",
],
)
@ -92,9 +92,9 @@ class TsTests():
assert_file_and_contents(
"foo_generated.ts",
[
"export { Bar } from './bar'",
"export { Baz } from './baz'",
"export { Foo } from './foo'",
"export { Bar } from './bar.js'",
"export { Baz } from './baz.js'",
"export { Foo } from './foo.js'",
],
)
@ -102,7 +102,7 @@ class TsTests():
assert_file_and_contents(
"foo.ts",
[
"import { Bar } from './bar';",
"import { Bar } from './bar.js';",
"export class Foo {",
],
)
@ -111,7 +111,7 @@ class TsTests():
assert_file_and_contents(
"bar.ts",
[
"import { Baz } from './baz';",
"import { Baz } from './baz.js';",
"export class Bar {",
],
)
@ -134,7 +134,7 @@ class TsTests():
assert_file_and_contents(
"foo_generated.ts",
[
"import {Bar as Bar} from './bar_generated';",
"import {Bar as Bar} from './bar_generated.js';",
"export class Foo {",
],
)
@ -151,7 +151,7 @@ class TsTests():
assert_file_and_contents(
"foo_with_ns_generated.ts",
[
"import {Bar as Bar} from './bar_with_ns_generated';",
"import {Bar as Bar} from './bar_with_ns_generated.js';",
"export class Foo {",
],
)
@ -168,7 +168,7 @@ class TsTests():
assert_file_and_contents(
"foo_generated.ts",
[
"import {Bar as Bar} from './bar_generated';",
"import {Bar as Bar} from './bar_generated.js';",
"export class Foo {",
],
)
@ -178,7 +178,7 @@ class TsTests():
assert_file_and_contents(
"bar_generated.ts",
[
"import {Baz as Baz} from './baz_generated';",
"import {Baz as Baz} from './baz_generated.js';",
"export class Bar {",
],
)

View File

@ -1,7 +0,0 @@
{
"dependencies": {
"esm": "^3.2.25",
"flatbuffers": "../",
"grpc": "^1.24.6"
}
}

12
tests/ts/BUILD.bazel Normal file
View File

@ -0,0 +1,12 @@
load("//:typescript.bzl", "flatbuffer_ts_library")
package(default_visibility = ["//visibility:private"])
flatbuffer_ts_library(
name = "typescript_ts_fbs",
srcs = ["typescript_keywords.fbs"],
deps = [
"//tests/ts/test_dir:include_ts_fbs",
"//tests/ts/test_dir:typescript_transitive_ts_fbs",
],
)

View File

@ -1,7 +1,7 @@
// Run this using JavaScriptTest.sh
import assert from 'assert'
import fs from 'fs'
import * as flexbuffers from 'flatbuffers/js/flexbuffers'
import * as flexbuffers from 'flatbuffers/js/flexbuffers.js'
function main() {
testSingleValueBuffers();
@ -341,7 +341,7 @@ function testRoundTripWithBuilder() {
}
function testGoldBuffer() {
const data = new Uint8Array(fs.readFileSync('gold_flexbuffer_example.bin')).buffer;
const data = new Uint8Array(fs.readFileSync('../gold_flexbuffer_example.bin')).buffer;
const b1 = flexbuffers.toReference(data).get("bools").get(1);
assert.strictEqual(b1.isBool(), true);
assert.strictEqual(b1.boolValue(), false);

View File

@ -3,18 +3,18 @@ import assert from 'assert'
import fs from 'fs'
import * as flatbuffers from 'flatbuffers'
import { Monster, MonsterT } from './my-game/example/monster'
import { Test, TestT } from './my-game/example/test'
import { Stat } from './my-game/example/stat'
import { Vec3 } from './my-game/example/vec3'
import { Color } from './my-game/example/color';
import { Any } from './my-game/example/any';
import { Monster, MonsterT } from './my-game/example/monster.js'
import { Test, TestT } from './my-game/example/test.js'
import { Stat } from './my-game/example/stat.js'
import { Vec3 } from './my-game/example/vec3.js'
import { Color } from './my-game/example/color.js';
import { Any } from './my-game/example/any.js';
function main() {
// First, let's test reading a FlatBuffer generated by C++ code:
// This file was generated from monsterdata_test.json
var data = new Uint8Array(fs.readFileSync('monsterdata_test.mon'));
var data = new Uint8Array(fs.readFileSync('../monsterdata_test.mon'));
// Now test it:
@ -285,8 +285,8 @@ function test64bit() {
}
function testUnicode() {
var correct = fs.readFileSync('unicode_test.mon');
var json = JSON.parse(fs.readFileSync('unicode_test.json', 'utf8'));
var correct = fs.readFileSync('../unicode_test.mon');
var json = JSON.parse(fs.readFileSync('../unicode_test.json', 'utf8'));
// Test reading
function testReadingUnicode(bb) {

View File

@ -1,10 +1,10 @@
import assert from 'assert'
import * as flatbuffers from 'flatbuffers'
import { Character } from './union_vector/character'
import { BookReader, BookReaderT } from './union_vector/book-reader'
import { Attacker, AttackerT } from './union_vector/attacker'
import { Movie, MovieT } from './union_vector/movie'
import { Character } from './union_vector/character.js'
import { BookReader, BookReaderT } from './union_vector/book-reader.js'
import { Attacker, AttackerT } from './union_vector/attacker.js'
import { Movie, MovieT } from './union_vector/movie.js'
var charTypes = [
Character.Belle,

View File

@ -25,7 +25,7 @@ from pathlib import Path
tests_path = Path(__file__).parent.resolve()
# Get the root path as an absolute path, so all derived paths are absolute.
root_path = tests_path.parent.absolute()
root_path = tests_path.parent.parent.absolute()
# Windows works with subprocess.run a bit differently.
is_windows = platform.system() == "Windows"
@ -62,26 +62,26 @@ check_call(["npm", "install", "--silent"])
print("Invoking flatc...")
flatc(
options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
schema="monster_test.fbs",
include="include_test",
schema="../monster_test.fbs",
include="../include_test",
)
flatc(
options=["--gen-object-api", "-b"],
schema="monster_test.fbs",
include="include_test",
data="unicode_test.json",
schema="../monster_test.fbs",
include="../include_test",
data="../unicode_test.json",
)
flatc(
options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
schema="union_vector/union_vector.fbs",
schema="../union_vector/union_vector.fbs",
prefix="union_vector",
)
flatc(
options=["--ts", "--gen-name-strings"],
schema="optional_scalars.fbs",
schema="../optional_scalars.fbs",
)
flatc(
@ -90,9 +90,9 @@ flatc(
"typescript_keywords.fbs",
"test_dir/typescript_include.fbs",
"test_dir/typescript_transitive_include.fbs",
"../reflection/reflection.fbs",
"../../reflection/reflection.fbs",
],
include="../",
include="../../",
)
flatc(
@ -107,15 +107,15 @@ flatc(
"typescript_keywords.fbs",
"test_dir/typescript_include.fbs",
"test_dir/typescript_transitive_include.fbs",
"../reflection/reflection.fbs",
"../../reflection/reflection.fbs",
],
include="../",
include="../../",
)
print("Running TypeScript Compiler...")
check_call(["tsc"])
NODE_CMD = ["node", "-r", "esm"]
NODE_CMD = ["node"]
print("Running TypeScript Tests...")
check_call(NODE_CMD + ["JavaScriptTest"])

5
tests/ts/foobar/abc.js Normal file
View File

@ -0,0 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var Abc;
(function (Abc) {
Abc[Abc["a"] = 0] = "a";
})(Abc || (Abc = {}));

5
tests/ts/foobar/abc.ts Normal file
View File

@ -0,0 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum Abc {
a = 0
}

5
tests/ts/foobar/class.js Normal file
View File

@ -0,0 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var class_;
(function (class_) {
class_[class_["arguments_"] = 0] = "arguments_";
})(class_ || (class_ = {}));

5
tests/ts/foobar/class.ts Normal file
View File

@ -0,0 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum class_ {
arguments_ = 0
}

View File

@ -0,0 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify
export { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from './my-game/example2/monster.js';
export { Ability, AbilityT } from './my-game/example/ability.js';
export { Any, unionToAny, unionListToAny } from './my-game/example/any.js';
export { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from './my-game/example/any-ambiguous-aliases.js';
export { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from './my-game/example/any-unique-aliases.js';
export { Color } from './my-game/example/color.js';
export { Monster, MonsterT } from './my-game/example/monster.js';
export { Race } from './my-game/example/race.js';
export { Referrable, ReferrableT } from './my-game/example/referrable.js';
export { Stat, StatT } from './my-game/example/stat.js';
export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs.js';
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs.js';
export { Test, TestT } from './my-game/example/test.js';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum.js';
export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases.js';
export { Vec3, Vec3T } from './my-game/example/vec3.js';
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';

Binary file not shown.

View File

@ -0,0 +1,54 @@
// automatically generated by the FlatBuffers compiler, do not modify
export class Ability {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
id() {
return this.bb.readUint32(this.bb_pos);
}
mutate_id(value) {
this.bb.writeUint32(this.bb_pos + 0, value);
return true;
}
distance() {
return this.bb.readUint32(this.bb_pos + 4);
}
mutate_distance(value) {
this.bb.writeUint32(this.bb_pos + 4, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame_Example_Ability';
}
static sizeOf() {
return 8;
}
static createAbility(builder, id, distance) {
builder.prep(4, 8);
builder.writeInt32(distance);
builder.writeInt32(id);
return builder.offset();
}
unpack() {
return new AbilityT(this.id(), this.distance());
}
unpackTo(_o) {
_o.id = this.id();
_o.distance = this.distance();
}
}
export class AbilityT {
constructor(id = 0, distance = 0) {
this.id = id;
this.distance = distance;
}
pack(builder) {
return Ability.createAbility(builder, this.id, this.distance);
}
}

View File

@ -0,0 +1,77 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Ability {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Ability {
this.bb_pos = i;
this.bb = bb;
return this;
}
id():number {
return this.bb!.readUint32(this.bb_pos);
}
mutate_id(value:number):boolean {
this.bb!.writeUint32(this.bb_pos + 0, value);
return true;
}
distance():number {
return this.bb!.readUint32(this.bb_pos + 4);
}
mutate_distance(value:number):boolean {
this.bb!.writeUint32(this.bb_pos + 4, value);
return true;
}
static getFullyQualifiedName():string {
return 'MyGame_Example_Ability';
}
static sizeOf():number {
return 8;
}
static createAbility(builder:flatbuffers.Builder, id: number, distance: number):flatbuffers.Offset {
builder.prep(4, 8);
builder.writeInt32(distance);
builder.writeInt32(id);
return builder.offset();
}
unpack(): AbilityT {
return new AbilityT(
this.id(),
this.distance()
);
}
unpackTo(_o: AbilityT): void {
_o.id = this.id();
_o.distance = this.distance();
}
}
export class AbilityT {
constructor(
public id: number = 0,
public distance: number = 0
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return Ability.createAbility(builder,
this.id,
this.distance
);
}
}

View File

@ -0,0 +1,27 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Monster } from '../../my-game/example/monster.js';
export var AnyAmbiguousAliases;
(function (AnyAmbiguousAliases) {
AnyAmbiguousAliases[AnyAmbiguousAliases["NONE"] = 0] = "NONE";
AnyAmbiguousAliases[AnyAmbiguousAliases["M1"] = 1] = "M1";
AnyAmbiguousAliases[AnyAmbiguousAliases["M2"] = 2] = "M2";
AnyAmbiguousAliases[AnyAmbiguousAliases["M3"] = 3] = "M3";
})(AnyAmbiguousAliases || (AnyAmbiguousAliases = {}));
export function unionToAnyAmbiguousAliases(type, accessor) {
switch (AnyAmbiguousAliases[type]) {
case 'NONE': return null;
case 'M1': return accessor(new Monster());
case 'M2': return accessor(new Monster());
case 'M3': return accessor(new Monster());
default: return null;
}
}
export function unionListToAnyAmbiguousAliases(type, accessor, index) {
switch (AnyAmbiguousAliases[type]) {
case 'NONE': return null;
case 'M1': return accessor(index, new Monster());
case 'M2': return accessor(index, new Monster());
case 'M3': return accessor(index, new Monster());
default: return null;
}
}

View File

@ -0,0 +1,38 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Monster, MonsterT } from '../../my-game/example/monster.js';
export enum AnyAmbiguousAliases {
NONE = 0,
M1 = 1,
M2 = 2,
M3 = 3
}
export function unionToAnyAmbiguousAliases(
type: AnyAmbiguousAliases,
accessor: (obj:Monster) => Monster|null
): Monster|null {
switch(AnyAmbiguousAliases[type]) {
case 'NONE': return null;
case 'M1': return accessor(new Monster())! as Monster;
case 'M2': return accessor(new Monster())! as Monster;
case 'M3': return accessor(new Monster())! as Monster;
default: return null;
}
}
export function unionListToAnyAmbiguousAliases(
type: AnyAmbiguousAliases,
accessor: (index: number, obj:Monster) => Monster|null,
index: number
): Monster|null {
switch(AnyAmbiguousAliases[type]) {
case 'NONE': return null;
case 'M1': return accessor(index, new Monster())! as Monster;
case 'M2': return accessor(index, new Monster())! as Monster;
case 'M3': return accessor(index, new Monster())! as Monster;
default: return null;
}
}

View File

@ -0,0 +1,29 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js';
import { Monster } from '../../my-game/example/monster.js';
import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.js';
export var AnyUniqueAliases;
(function (AnyUniqueAliases) {
AnyUniqueAliases[AnyUniqueAliases["NONE"] = 0] = "NONE";
AnyUniqueAliases[AnyUniqueAliases["M"] = 1] = "M";
AnyUniqueAliases[AnyUniqueAliases["TS"] = 2] = "TS";
AnyUniqueAliases[AnyUniqueAliases["M2"] = 3] = "M2";
})(AnyUniqueAliases || (AnyUniqueAliases = {}));
export function unionToAnyUniqueAliases(type, accessor) {
switch (AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(new Monster());
case 'TS': return accessor(new TestSimpleTableWithEnum());
case 'M2': return accessor(new MyGame_Example2_Monster());
default: return null;
}
}
export function unionListToAnyUniqueAliases(type, accessor, index) {
switch (AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(index, new Monster());
case 'TS': return accessor(index, new TestSimpleTableWithEnum());
case 'M2': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
}

View File

@ -0,0 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
import { Monster, MonsterT } from '../../my-game/example/monster.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
export enum AnyUniqueAliases {
NONE = 0,
M = 1,
TS = 2,
M2 = 3
}
export function unionToAnyUniqueAliases(
type: AnyUniqueAliases,
accessor: (obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null
): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(new Monster())! as Monster;
case 'TS': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
case 'M2': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}
export function unionListToAnyUniqueAliases(
type: AnyUniqueAliases,
accessor: (index: number, obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null,
index: number
): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(index, new Monster())! as Monster;
case 'TS': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
case 'M2': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}

View File

@ -0,0 +1,29 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js';
import { Monster } from '../../my-game/example/monster.js';
import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.js';
export var Any;
(function (Any) {
Any[Any["NONE"] = 0] = "NONE";
Any[Any["Monster"] = 1] = "Monster";
Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum";
Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster";
})(Any || (Any = {}));
export function unionToAny(type, accessor) {
switch (Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(new Monster());
case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster());
default: return null;
}
}
export function unionListToAny(type, accessor, index) {
switch (Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(index, new Monster());
case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
}

View File

@ -0,0 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
import { Monster, MonsterT } from '../../my-game/example/monster.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
export enum Any {
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
MyGame_Example2_Monster = 3
}
export function unionToAny(
type: Any,
accessor: (obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null
): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(new Monster())! as Monster;
case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}
export function unionListToAny(
type: Any,
accessor: (index: number, obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null,
index: number
): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(index, new Monster())! as Monster;
case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}

View File

@ -0,0 +1,17 @@
// automatically generated by the FlatBuffers compiler, do not modify
/**
* Composite components of Monster color.
*/
export var Color;
(function (Color) {
Color[Color["Red"] = 1] = "Red";
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Color[Color["Green"] = 2] = "Green";
/**
* \brief color Blue (1u << 3)
*/
Color[Color["Blue"] = 8] = "Blue";
})(Color || (Color = {}));

View File

@ -0,0 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify
/**
* Composite components of Monster color.
*/
export enum Color {
Red = 1,
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Green = 2,
/**
* \brief color Blue (1u << 3)
*/
Blue = 8
}

View File

@ -0,0 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var LongEnum;
(function (LongEnum) {
LongEnum["LongOne"] = "2";
LongEnum["LongTwo"] = "4";
LongEnum["LongBig"] = "1099511627776";
})(LongEnum || (LongEnum = {}));

View File

@ -0,0 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum LongEnum {
LongOne = '2',
LongTwo = '4',
LongBig = '1099511627776'
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var Race;
(function (Race) {
Race[Race["None"] = -1] = "None";
Race[Race["Human"] = 0] = "Human";
Race[Race["Dwarf"] = 1] = "Dwarf";
Race[Race["Elf"] = 2] = "Elf";
})(Race || (Race = {}));

View File

@ -0,0 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum Race {
None = -1,
Human = 0,
Dwarf = 1,
Elf = 2
}

View File

@ -0,0 +1,70 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Referrable {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsReferrable(bb, obj) {
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsReferrable(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_id(value) {
const offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb.writeUint64(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame_Example_Referrable';
}
static startReferrable(builder) {
builder.startObject(1);
}
static addId(builder, id) {
builder.addFieldInt64(0, id, BigInt('0'));
}
static endReferrable(builder) {
const offset = builder.endObject();
return offset;
}
static createReferrable(builder, id) {
Referrable.startReferrable(builder);
Referrable.addId(builder, id);
return Referrable.endReferrable(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new ReferrableT(this.id());
}
unpackTo(_o) {
_o.id = this.id();
}
}
export class ReferrableT {
constructor(id = BigInt('0')) {
this.id = id;
}
pack(builder) {
return Referrable.createReferrable(builder, this.id);
}
}

View File

@ -0,0 +1,95 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Referrable {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:Referrable):Referrable {
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:Referrable):Referrable {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id():bigint {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_id(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb!.writeUint64(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName():string {
return 'MyGame_Example_Referrable';
}
static startReferrable(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static addId(builder:flatbuffers.Builder, id:bigint) {
builder.addFieldInt64(0, id, BigInt('0'));
}
static endReferrable(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createReferrable(builder:flatbuffers.Builder, id:bigint):flatbuffers.Offset {
Referrable.startReferrable(builder);
Referrable.addId(builder, id);
return Referrable.endReferrable(builder);
}
serialize():Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):Referrable {
return Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer))
}
unpack(): ReferrableT {
return new ReferrableT(
this.id()
);
}
unpackTo(_o: ReferrableT): void {
_o.id = this.id();
}
}
export class ReferrableT {
constructor(
public id: bigint = BigInt('0')
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return Referrable.createReferrable(builder,
this.id
);
}
}

View File

@ -0,0 +1,99 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Stat {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsStat(bb, obj) {
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsStat(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
val() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_val(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
count() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_count(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame_Example_Stat';
}
static startStat(builder) {
builder.startObject(3);
}
static addId(builder, idOffset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addVal(builder, val) {
builder.addFieldInt64(1, val, BigInt('0'));
}
static addCount(builder, count) {
builder.addFieldInt16(2, count, 0);
}
static endStat(builder) {
const offset = builder.endObject();
return offset;
}
static createStat(builder, idOffset, val, count) {
Stat.startStat(builder);
Stat.addId(builder, idOffset);
Stat.addVal(builder, val);
Stat.addCount(builder, count);
return Stat.endStat(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new StatT(this.id(), this.val(), this.count());
}
unpackTo(_o) {
_o.id = this.id();
_o.val = this.val();
_o.count = this.count();
}
}
export class StatT {
constructor(id = null, val = BigInt('0'), count = 0) {
this.id = id;
this.val = val;
this.count = count;
}
pack(builder) {
const id = (this.id !== null ? builder.createString(this.id) : 0);
return Stat.createStat(builder, id, this.val, this.count);
}
}

View File

@ -0,0 +1,138 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Stat {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Stat {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id():string|null
id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
id(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;
}
val():bigint {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_val(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb!.writeInt64(this.bb_pos + offset, value);
return true;
}
count():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
mutate_count(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName():string {
return 'MyGame_Example_Stat';
}
static startStat(builder:flatbuffers.Builder) {
builder.startObject(3);
}
static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addVal(builder:flatbuffers.Builder, val:bigint) {
builder.addFieldInt64(1, val, BigInt('0'));
}
static addCount(builder:flatbuffers.Builder, count:number) {
builder.addFieldInt16(2, count, 0);
}
static endStat(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset {
Stat.startStat(builder);
Stat.addId(builder, idOffset);
Stat.addVal(builder, val);
Stat.addCount(builder, count);
return Stat.endStat(builder);
}
serialize():Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):Stat {
return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer))
}
unpack(): StatT {
return new StatT(
this.id(),
this.val(),
this.count()
);
}
unpackTo(_o: StatT): void {
_o.id = this.id();
_o.val = this.val();
_o.count = this.count();
}
}
export class StatT {
constructor(
public id: string|Uint8Array|null = null,
public val: bigint = BigInt('0'),
public count: number = 0
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const id = (this.id !== null ? builder.createString(this.id!) : 0);
return Stat.createStat(builder,
id,
this.val,
this.count
);
}
}

View File

@ -0,0 +1,52 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { StructOfStructs } from '../../my-game/example/struct-of-structs.js';
export class StructOfStructsOfStructs {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame_Example_StructOfStructsOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructsOfStructs(builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance) {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsOfStructsT((this.a() !== null ? this.a().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
}
}
export class StructOfStructsOfStructsT {
constructor(a = null) {
this.a = a;
}
pack(builder) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u;
return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder, ((_c = (_b = (_a = this.a) === null || _a === void 0 ? void 0 : _a.a) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : 0), ((_f = (_e = (_d = this.a) === null || _d === void 0 ? void 0 : _d.a) === null || _e === void 0 ? void 0 : _e.distance) !== null && _f !== void 0 ? _f : 0), ((_j = (_h = (_g = this.a) === null || _g === void 0 ? void 0 : _g.b) === null || _h === void 0 ? void 0 : _h.a) !== null && _j !== void 0 ? _j : 0), ((_m = (_l = (_k = this.a) === null || _k === void 0 ? void 0 : _k.b) === null || _l === void 0 ? void 0 : _l.b) !== null && _m !== void 0 ? _m : 0), ((_r = (_q = (_p = this.a) === null || _p === void 0 ? void 0 : _p.c) === null || _q === void 0 ? void 0 : _q.id) !== null && _r !== void 0 ? _r : 0), ((_u = (_t = (_s = this.a) === null || _s === void 0 ? void 0 : _s.c) === null || _t === void 0 ? void 0 : _t.distance) !== null && _u !== void 0 ? _u : 0));
}
}

View File

@ -0,0 +1,74 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
export class StructOfStructsOfStructs {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj?:StructOfStructs):StructOfStructs|null {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb!);
}
static getFullyQualifiedName():string {
return 'MyGame_Example_StructOfStructsOfStructs';
}
static sizeOf():number {
return 20;
}
static createStructOfStructsOfStructs(builder:flatbuffers.Builder, a_a_id: number, a_a_distance: number, a_b_a: number, a_b_b: number, a_c_id: number, a_c_distance: number):flatbuffers.Offset {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack(): StructOfStructsOfStructsT {
return new StructOfStructsOfStructsT(
(this.a() !== null ? this.a()!.unpack() : null)
);
}
unpackTo(_o: StructOfStructsOfStructsT): void {
_o.a = (this.a() !== null ? this.a()!.unpack() : null);
}
}
export class StructOfStructsOfStructsT {
constructor(
public a: StructOfStructsT|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder,
(this.a?.a?.id ?? 0),
(this.a?.a?.distance ?? 0),
(this.a?.b?.a ?? 0),
(this.a?.b?.b ?? 0),
(this.a?.c?.id ?? 0),
(this.a?.c?.distance ?? 0)
);
}
}

View File

@ -0,0 +1,62 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Ability } from '../../my-game/example/ability.js';
import { Test } from '../../my-game/example/test.js';
export class StructOfStructs {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new Ability()).__init(this.bb_pos, this.bb);
}
b(obj) {
return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
}
c(obj) {
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame_Example_StructOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructs(builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(c_distance);
builder.writeInt32(c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b_b);
builder.writeInt16(b_a);
builder.prep(4, 8);
builder.writeInt32(a_distance);
builder.writeInt32(a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsT((this.a() !== null ? this.a().unpack() : null), (this.b() !== null ? this.b().unpack() : null), (this.c() !== null ? this.c().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
_o.b = (this.b() !== null ? this.b().unpack() : null);
_o.c = (this.c() !== null ? this.c().unpack() : null);
}
}
export class StructOfStructsT {
constructor(a = null, b = null, c = null) {
this.a = a;
this.b = b;
this.c = c;
}
pack(builder) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
return StructOfStructs.createStructOfStructs(builder, ((_b = (_a = this.a) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.a) === null || _c === void 0 ? void 0 : _c.distance) !== null && _d !== void 0 ? _d : 0), ((_f = (_e = this.b) === null || _e === void 0 ? void 0 : _e.a) !== null && _f !== void 0 ? _f : 0), ((_h = (_g = this.b) === null || _g === void 0 ? void 0 : _g.b) !== null && _h !== void 0 ? _h : 0), ((_k = (_j = this.c) === null || _j === void 0 ? void 0 : _j.id) !== null && _k !== void 0 ? _k : 0), ((_m = (_l = this.c) === null || _l === void 0 ? void 0 : _l.distance) !== null && _m !== void 0 ? _m : 0));
}
}

View File

@ -0,0 +1,88 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Ability, AbilityT } from '../../my-game/example/ability.js';
import { Test, TestT } from '../../my-game/example/test.js';
export class StructOfStructs {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj?:Ability):Ability|null {
return (obj || new Ability()).__init(this.bb_pos, this.bb!);
}
b(obj?:Test):Test|null {
return (obj || new Test()).__init(this.bb_pos + 8, this.bb!);
}
c(obj?:Ability):Ability|null {
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb!);
}
static getFullyQualifiedName():string {
return 'MyGame_Example_StructOfStructs';
}
static sizeOf():number {
return 20;
}
static createStructOfStructs(builder:flatbuffers.Builder, a_id: number, a_distance: number, b_a: number, b_b: number, c_id: number, c_distance: number):flatbuffers.Offset {
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(c_distance);
builder.writeInt32(c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b_b);
builder.writeInt16(b_a);
builder.prep(4, 8);
builder.writeInt32(a_distance);
builder.writeInt32(a_id);
return builder.offset();
}
unpack(): StructOfStructsT {
return new StructOfStructsT(
(this.a() !== null ? this.a()!.unpack() : null),
(this.b() !== null ? this.b()!.unpack() : null),
(this.c() !== null ? this.c()!.unpack() : null)
);
}
unpackTo(_o: StructOfStructsT): void {
_o.a = (this.a() !== null ? this.a()!.unpack() : null);
_o.b = (this.b() !== null ? this.b()!.unpack() : null);
_o.c = (this.c() !== null ? this.c()!.unpack() : null);
}
}
export class StructOfStructsT {
constructor(
public a: AbilityT|null = null,
public b: TestT|null = null,
public c: AbilityT|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return StructOfStructs.createStructOfStructs(builder,
(this.a?.id ?? 0),
(this.a?.distance ?? 0),
(this.b?.a ?? 0),
(this.b?.b ?? 0),
(this.c?.id ?? 0),
(this.c?.distance ?? 0)
);
}
}

View File

@ -0,0 +1,71 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Color } from '../../my-game/example/color.js';
export class TestSimpleTableWithEnum {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsTestSimpleTableWithEnum(bb, obj) {
return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsTestSimpleTableWithEnum(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
color() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Green;
}
mutate_color(value) {
const offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb.writeUint8(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame_Example_TestSimpleTableWithEnum';
}
static startTestSimpleTableWithEnum(builder) {
builder.startObject(1);
}
static addColor(builder, color) {
builder.addFieldInt8(0, color, Color.Green);
}
static endTestSimpleTableWithEnum(builder) {
const offset = builder.endObject();
return offset;
}
static createTestSimpleTableWithEnum(builder, color) {
TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
TestSimpleTableWithEnum.addColor(builder, color);
return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new TestSimpleTableWithEnumT(this.color());
}
unpackTo(_o) {
_o.color = this.color();
}
}
export class TestSimpleTableWithEnumT {
constructor(color = Color.Green) {
this.color = color;
}
pack(builder) {
return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder, this.color);
}
}

View File

@ -0,0 +1,96 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Color } from '../../my-game/example/color.js';
export class TestSimpleTableWithEnum {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum {
return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
color():Color {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readUint8(this.bb_pos + offset) : Color.Green;
}
mutate_color(value:Color):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb!.writeUint8(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName():string {
return 'MyGame_Example_TestSimpleTableWithEnum';
}
static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static addColor(builder:flatbuffers.Builder, color:Color) {
builder.addFieldInt8(0, color, Color.Green);
}
static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:Color):flatbuffers.Offset {
TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
TestSimpleTableWithEnum.addColor(builder, color);
return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
}
serialize():Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):TestSimpleTableWithEnum {
return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer))
}
unpack(): TestSimpleTableWithEnumT {
return new TestSimpleTableWithEnumT(
this.color()
);
}
unpackTo(_o: TestSimpleTableWithEnumT): void {
_o.color = this.color();
}
}
export class TestSimpleTableWithEnumT {
constructor(
public color: Color = Color.Green
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder,
this.color
);
}
}

View File

@ -0,0 +1,55 @@
// automatically generated by the FlatBuffers compiler, do not modify
export class Test {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a() {
return this.bb.readInt16(this.bb_pos);
}
mutate_a(value) {
this.bb.writeInt16(this.bb_pos + 0, value);
return true;
}
b() {
return this.bb.readInt8(this.bb_pos + 2);
}
mutate_b(value) {
this.bb.writeInt8(this.bb_pos + 2, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame_Example_Test';
}
static sizeOf() {
return 4;
}
static createTest(builder, a, b) {
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b);
builder.writeInt16(a);
return builder.offset();
}
unpack() {
return new TestT(this.a(), this.b());
}
unpackTo(_o) {
_o.a = this.a();
_o.b = this.b();
}
}
export class TestT {
constructor(a = 0, b = 0) {
this.a = a;
this.b = b;
}
pack(builder) {
return Test.createTest(builder, this.a, this.b);
}
}

View File

@ -0,0 +1,78 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Test {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Test {
this.bb_pos = i;
this.bb = bb;
return this;
}
a():number {
return this.bb!.readInt16(this.bb_pos);
}
mutate_a(value:number):boolean {
this.bb!.writeInt16(this.bb_pos + 0, value);
return true;
}
b():number {
return this.bb!.readInt8(this.bb_pos + 2);
}
mutate_b(value:number):boolean {
this.bb!.writeInt8(this.bb_pos + 2, value);
return true;
}
static getFullyQualifiedName():string {
return 'MyGame_Example_Test';
}
static sizeOf():number {
return 4;
}
static createTest(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset {
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b);
builder.writeInt16(a);
return builder.offset();
}
unpack(): TestT {
return new TestT(
this.a(),
this.b()
);
}
unpackTo(_o: TestT): void {
_o.a = this.a();
_o.b = this.b();
}
}
export class TestT {
constructor(
public a: number = 0,
public b: number = 0
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return Test.createTest(builder,
this.a,
this.b
);
}
}

View File

@ -0,0 +1,290 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class TypeAliases {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsTypeAliases(bb, obj) {
return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsTypeAliases(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
i8() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
}
mutate_i8(value) {
const offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, value);
return true;
}
u8() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
}
mutate_u8(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb.writeUint8(this.bb_pos + offset, value);
return true;
}
i16() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
mutate_i16(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeInt16(this.bb_pos + offset, value);
return true;
}
u16() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_u16(value) {
const offset = this.bb.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
i32() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
mutate_i32(value) {
const offset = this.bb.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
u32() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
}
mutate_u32(value) {
const offset = this.bb.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb.writeUint32(this.bb_pos + offset, value);
return true;
}
i64() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_i64(value) {
const offset = this.bb.__offset(this.bb_pos, 16);
if (offset === 0) {
return false;
}
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
u64() {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_u64(value) {
const offset = this.bb.__offset(this.bb_pos, 18);
if (offset === 0) {
return false;
}
this.bb.writeUint64(this.bb_pos + offset, value);
return true;
}
f32() {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
mutate_f32(value) {
const offset = this.bb.__offset(this.bb_pos, 20);
if (offset === 0) {
return false;
}
this.bb.writeFloat32(this.bb_pos + offset, value);
return true;
}
f64() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
mutate_f64(value) {
const offset = this.bb.__offset(this.bb_pos, 22);
if (offset === 0) {
return false;
}
this.bb.writeFloat64(this.bb_pos + offset, value);
return true;
}
v8(index) {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
}
v8Length() {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
v8Array() {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
}
vf64(index) {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
}
vf64Length() {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
vf64Array() {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? new Float64Array(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 getFullyQualifiedName() {
return 'MyGame_Example_TypeAliases';
}
static startTypeAliases(builder) {
builder.startObject(12);
}
static addI8(builder, i8) {
builder.addFieldInt8(0, i8, 0);
}
static addU8(builder, u8) {
builder.addFieldInt8(1, u8, 0);
}
static addI16(builder, i16) {
builder.addFieldInt16(2, i16, 0);
}
static addU16(builder, u16) {
builder.addFieldInt16(3, u16, 0);
}
static addI32(builder, i32) {
builder.addFieldInt32(4, i32, 0);
}
static addU32(builder, u32) {
builder.addFieldInt32(5, u32, 0);
}
static addI64(builder, i64) {
builder.addFieldInt64(6, i64, BigInt('0'));
}
static addU64(builder, u64) {
builder.addFieldInt64(7, u64, BigInt('0'));
}
static addF32(builder, f32) {
builder.addFieldFloat32(8, f32, 0.0);
}
static addF64(builder, f64) {
builder.addFieldFloat64(9, f64, 0.0);
}
static addV8(builder, v8Offset) {
builder.addFieldOffset(10, v8Offset, 0);
}
static createV8Vector(builder, data) {
builder.startVector(1, data.length, 1);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt8(data[i]);
}
return builder.endVector();
}
static startV8Vector(builder, numElems) {
builder.startVector(1, numElems, 1);
}
static addVf64(builder, vf64Offset) {
builder.addFieldOffset(11, vf64Offset, 0);
}
static createVf64Vector(builder, data) {
builder.startVector(8, data.length, 8);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat64(data[i]);
}
return builder.endVector();
}
static startVf64Vector(builder, numElems) {
builder.startVector(8, numElems, 8);
}
static endTypeAliases(builder) {
const offset = builder.endObject();
return offset;
}
static createTypeAliases(builder, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, v8Offset, vf64Offset) {
TypeAliases.startTypeAliases(builder);
TypeAliases.addI8(builder, i8);
TypeAliases.addU8(builder, u8);
TypeAliases.addI16(builder, i16);
TypeAliases.addU16(builder, u16);
TypeAliases.addI32(builder, i32);
TypeAliases.addU32(builder, u32);
TypeAliases.addI64(builder, i64);
TypeAliases.addU64(builder, u64);
TypeAliases.addF32(builder, f32);
TypeAliases.addF64(builder, f64);
TypeAliases.addV8(builder, v8Offset);
TypeAliases.addVf64(builder, vf64Offset);
return TypeAliases.endTypeAliases(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new TypeAliasesT(this.i8(), this.u8(), this.i16(), this.u16(), this.i32(), this.u32(), this.i64(), this.u64(), this.f32(), this.f64(), this.bb.createScalarList(this.v8.bind(this), this.v8Length()), this.bb.createScalarList(this.vf64.bind(this), this.vf64Length()));
}
unpackTo(_o) {
_o.i8 = this.i8();
_o.u8 = this.u8();
_o.i16 = this.i16();
_o.u16 = this.u16();
_o.i32 = this.i32();
_o.u32 = this.u32();
_o.i64 = this.i64();
_o.u64 = this.u64();
_o.f32 = this.f32();
_o.f64 = this.f64();
_o.v8 = this.bb.createScalarList(this.v8.bind(this), this.v8Length());
_o.vf64 = this.bb.createScalarList(this.vf64.bind(this), this.vf64Length());
}
}
export class TypeAliasesT {
constructor(i8 = 0, u8 = 0, i16 = 0, u16 = 0, i32 = 0, u32 = 0, i64 = BigInt('0'), u64 = BigInt('0'), f32 = 0.0, f64 = 0.0, v8 = [], vf64 = []) {
this.i8 = i8;
this.u8 = u8;
this.i16 = i16;
this.u16 = u16;
this.i32 = i32;
this.u32 = u32;
this.i64 = i64;
this.u64 = u64;
this.f32 = f32;
this.f64 = f64;
this.v8 = v8;
this.vf64 = vf64;
}
pack(builder) {
const v8 = TypeAliases.createV8Vector(builder, this.v8);
const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
return TypeAliases.createTypeAliases(builder, this.i8, this.u8, this.i16, this.u16, this.i32, this.u32, this.i64, this.u64, this.f32, this.f64, v8, vf64);
}
}

View File

@ -0,0 +1,405 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class TypeAliases {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
i8():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
}
mutate_i8(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, value);
return true;
}
u8():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
}
mutate_u8(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb!.writeUint8(this.bb_pos + offset, value);
return true;
}
i16():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
mutate_i16(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeInt16(this.bb_pos + offset, value);
return true;
}
u16():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
mutate_u16(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb!.writeUint16(this.bb_pos + offset, value);
return true;
}
i32():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
mutate_i32(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
u32():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}
mutate_u32(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb!.writeUint32(this.bb_pos + offset, value);
return true;
}
i64():bigint {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_i64(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 16);
if (offset === 0) {
return false;
}
this.bb!.writeInt64(this.bb_pos + offset, value);
return true;
}
u64():bigint {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_u64(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 18);
if (offset === 0) {
return false;
}
this.bb!.writeUint64(this.bb_pos + offset, value);
return true;
}
f32():number {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}
mutate_f32(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 20);
if (offset === 0) {
return false;
}
this.bb!.writeFloat32(this.bb_pos + offset, value);
return true;
}
f64():number {
const offset = this.bb!.__offset(this.bb_pos, 22);
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
}
mutate_f64(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 22);
if (offset === 0) {
return false;
}
this.bb!.writeFloat64(this.bb_pos + offset, value);
return true;
}
v8(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
}
v8Length():number {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
v8Array():Int8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
}
vf64(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
}
vf64Length():number {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
vf64Array():Float64Array|null {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? new Float64Array(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 getFullyQualifiedName():string {
return 'MyGame_Example_TypeAliases';
}
static startTypeAliases(builder:flatbuffers.Builder) {
builder.startObject(12);
}
static addI8(builder:flatbuffers.Builder, i8:number) {
builder.addFieldInt8(0, i8, 0);
}
static addU8(builder:flatbuffers.Builder, u8:number) {
builder.addFieldInt8(1, u8, 0);
}
static addI16(builder:flatbuffers.Builder, i16:number) {
builder.addFieldInt16(2, i16, 0);
}
static addU16(builder:flatbuffers.Builder, u16:number) {
builder.addFieldInt16(3, u16, 0);
}
static addI32(builder:flatbuffers.Builder, i32:number) {
builder.addFieldInt32(4, i32, 0);
}
static addU32(builder:flatbuffers.Builder, u32:number) {
builder.addFieldInt32(5, u32, 0);
}
static addI64(builder:flatbuffers.Builder, i64:bigint) {
builder.addFieldInt64(6, i64, BigInt('0'));
}
static addU64(builder:flatbuffers.Builder, u64:bigint) {
builder.addFieldInt64(7, u64, BigInt('0'));
}
static addF32(builder:flatbuffers.Builder, f32:number) {
builder.addFieldFloat32(8, f32, 0.0);
}
static addF64(builder:flatbuffers.Builder, f64:number) {
builder.addFieldFloat64(9, f64, 0.0);
}
static addV8(builder:flatbuffers.Builder, v8Offset:flatbuffers.Offset) {
builder.addFieldOffset(10, v8Offset, 0);
}
static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array):flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createV8Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array|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 startV8Vector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addVf64(builder:flatbuffers.Builder, vf64Offset:flatbuffers.Offset) {
builder.addFieldOffset(11, vf64Offset, 0);
}
static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
builder.startVector(8, data.length, 8);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat64(data[i]!);
}
return builder.endVector();
}
static startVf64Vector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:bigint, u64:bigint, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset {
TypeAliases.startTypeAliases(builder);
TypeAliases.addI8(builder, i8);
TypeAliases.addU8(builder, u8);
TypeAliases.addI16(builder, i16);
TypeAliases.addU16(builder, u16);
TypeAliases.addI32(builder, i32);
TypeAliases.addU32(builder, u32);
TypeAliases.addI64(builder, i64);
TypeAliases.addU64(builder, u64);
TypeAliases.addF32(builder, f32);
TypeAliases.addF64(builder, f64);
TypeAliases.addV8(builder, v8Offset);
TypeAliases.addVf64(builder, vf64Offset);
return TypeAliases.endTypeAliases(builder);
}
serialize():Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):TypeAliases {
return TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer))
}
unpack(): TypeAliasesT {
return new TypeAliasesT(
this.i8(),
this.u8(),
this.i16(),
this.u16(),
this.i32(),
this.u32(),
this.i64(),
this.u64(),
this.f32(),
this.f64(),
this.bb!.createScalarList(this.v8.bind(this), this.v8Length()),
this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length())
);
}
unpackTo(_o: TypeAliasesT): void {
_o.i8 = this.i8();
_o.u8 = this.u8();
_o.i16 = this.i16();
_o.u16 = this.u16();
_o.i32 = this.i32();
_o.u32 = this.u32();
_o.i64 = this.i64();
_o.u64 = this.u64();
_o.f32 = this.f32();
_o.f64 = this.f64();
_o.v8 = this.bb!.createScalarList(this.v8.bind(this), this.v8Length());
_o.vf64 = this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length());
}
}
export class TypeAliasesT {
constructor(
public i8: number = 0,
public u8: number = 0,
public i16: number = 0,
public u16: number = 0,
public i32: number = 0,
public u32: number = 0,
public i64: bigint = BigInt('0'),
public u64: bigint = BigInt('0'),
public f32: number = 0.0,
public f64: number = 0.0,
public v8: (number)[] = [],
public vf64: (number)[] = []
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const v8 = TypeAliases.createV8Vector(builder, this.v8);
const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
return TypeAliases.createTypeAliases(builder,
this.i8,
this.u8,
this.i16,
this.u16,
this.i32,
this.u32,
this.i64,
this.u64,
this.f32,
this.f64,
v8,
vf64
);
}
}

View File

@ -0,0 +1,98 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Test } from '../../my-game/example/test.js';
export class Vec3 {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
x() {
return this.bb.readFloat32(this.bb_pos);
}
mutate_x(value) {
this.bb.writeFloat32(this.bb_pos + 0, value);
return true;
}
y() {
return this.bb.readFloat32(this.bb_pos + 4);
}
mutate_y(value) {
this.bb.writeFloat32(this.bb_pos + 4, value);
return true;
}
z() {
return this.bb.readFloat32(this.bb_pos + 8);
}
mutate_z(value) {
this.bb.writeFloat32(this.bb_pos + 8, value);
return true;
}
test1() {
return this.bb.readFloat64(this.bb_pos + 16);
}
mutate_test1(value) {
this.bb.writeFloat64(this.bb_pos + 16, value);
return true;
}
test2() {
return this.bb.readUint8(this.bb_pos + 24);
}
mutate_test2(value) {
this.bb.writeUint8(this.bb_pos + 24, value);
return true;
}
test3(obj) {
return (obj || new Test()).__init(this.bb_pos + 26, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame_Example_Vec3';
}
static sizeOf() {
return 32;
}
static createVec3(builder, x, y, z, test1, test2, test3_a, test3_b) {
builder.prep(8, 32);
builder.pad(2);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(test3_b);
builder.writeInt16(test3_a);
builder.pad(1);
builder.writeInt8(test2);
builder.writeFloat64(test1);
builder.pad(4);
builder.writeFloat32(z);
builder.writeFloat32(y);
builder.writeFloat32(x);
return builder.offset();
}
unpack() {
return new Vec3T(this.x(), this.y(), this.z(), this.test1(), this.test2(), (this.test3() !== null ? this.test3().unpack() : null));
}
unpackTo(_o) {
_o.x = this.x();
_o.y = this.y();
_o.z = this.z();
_o.test1 = this.test1();
_o.test2 = this.test2();
_o.test3 = (this.test3() !== null ? this.test3().unpack() : null);
}
}
export class Vec3T {
constructor(x = 0.0, y = 0.0, z = 0.0, test1 = 0.0, test2 = 0, test3 = null) {
this.x = x;
this.y = y;
this.z = z;
this.test1 = test1;
this.test2 = test2;
this.test3 = test3;
}
pack(builder) {
var _a, _b, _c, _d;
return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, ((_b = (_a = this.test3) === null || _a === void 0 ? void 0 : _a.a) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.test3) === null || _c === void 0 ? void 0 : _c.b) !== null && _d !== void 0 ? _d : 0));
}
}

View File

@ -0,0 +1,137 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Color } from '../../my-game/example/color.js';
import { Test, TestT } from '../../my-game/example/test.js';
export class Vec3 {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
this.bb_pos = i;
this.bb = bb;
return this;
}
x():number {
return this.bb!.readFloat32(this.bb_pos);
}
mutate_x(value:number):boolean {
this.bb!.writeFloat32(this.bb_pos + 0, value);
return true;
}
y():number {
return this.bb!.readFloat32(this.bb_pos + 4);
}
mutate_y(value:number):boolean {
this.bb!.writeFloat32(this.bb_pos + 4, value);
return true;
}
z():number {
return this.bb!.readFloat32(this.bb_pos + 8);
}
mutate_z(value:number):boolean {
this.bb!.writeFloat32(this.bb_pos + 8, value);
return true;
}
test1():number {
return this.bb!.readFloat64(this.bb_pos + 16);
}
mutate_test1(value:number):boolean {
this.bb!.writeFloat64(this.bb_pos + 16, value);
return true;
}
test2():Color {
return this.bb!.readUint8(this.bb_pos + 24);
}
mutate_test2(value:Color):boolean {
this.bb!.writeUint8(this.bb_pos + 24, value);
return true;
}
test3(obj?:Test):Test|null {
return (obj || new Test()).__init(this.bb_pos + 26, this.bb!);
}
static getFullyQualifiedName():string {
return 'MyGame_Example_Vec3';
}
static sizeOf():number {
return 32;
}
static createVec3(builder:flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: Color, test3_a: number, test3_b: number):flatbuffers.Offset {
builder.prep(8, 32);
builder.pad(2);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(test3_b);
builder.writeInt16(test3_a);
builder.pad(1);
builder.writeInt8(test2);
builder.writeFloat64(test1);
builder.pad(4);
builder.writeFloat32(z);
builder.writeFloat32(y);
builder.writeFloat32(x);
return builder.offset();
}
unpack(): Vec3T {
return new Vec3T(
this.x(),
this.y(),
this.z(),
this.test1(),
this.test2(),
(this.test3() !== null ? this.test3()!.unpack() : null)
);
}
unpackTo(_o: Vec3T): void {
_o.x = this.x();
_o.y = this.y();
_o.z = this.z();
_o.test1 = this.test1();
_o.test2 = this.test2();
_o.test3 = (this.test3() !== null ? this.test3()!.unpack() : null);
}
}
export class Vec3T {
constructor(
public x: number = 0.0,
public y: number = 0.0,
public z: number = 0.0,
public test1: number = 0.0,
public test2: Color = 0,
public test3: TestT|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return Vec3.createVec3(builder,
this.x,
this.y,
this.z,
this.test1,
this.test2,
(this.test3?.a ?? 0),
(this.test3?.b ?? 0)
);
}
}

View File

@ -0,0 +1,50 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Monster {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsMonster(bb, obj) {
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsMonster(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getFullyQualifiedName() {
return 'MyGame_Example2_Monster';
}
static startMonster(builder) {
builder.startObject(0);
}
static endMonster(builder) {
const offset = builder.endObject();
return offset;
}
static createMonster(builder) {
Monster.startMonster(builder);
return Monster.endMonster(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new MonsterT();
}
unpackTo(_o) { }
}
export class MonsterT {
constructor() { }
pack(builder) {
return Monster.createMonster(builder);
}
}

View File

@ -0,0 +1,66 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Monster {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster {
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getFullyQualifiedName():string {
return 'MyGame_Example2_Monster';
}
static startMonster(builder:flatbuffers.Builder) {
builder.startObject(0);
}
static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
Monster.startMonster(builder);
return Monster.endMonster(builder);
}
serialize():Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):Monster {
return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer))
}
unpack(): MonsterT {
return new MonsterT();
}
unpackTo(_o: MonsterT): void {}
}
export class MonsterT {
constructor(){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return Monster.createMonster(builder);
}
}

View File

@ -0,0 +1,50 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class InParentNamespace {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsInParentNamespace(bb, obj) {
return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsInParentNamespace(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getFullyQualifiedName() {
return 'MyGame_InParentNamespace';
}
static startInParentNamespace(builder) {
builder.startObject(0);
}
static endInParentNamespace(builder) {
const offset = builder.endObject();
return offset;
}
static createInParentNamespace(builder) {
InParentNamespace.startInParentNamespace(builder);
return InParentNamespace.endInParentNamespace(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return InParentNamespace.getRootAsInParentNamespace(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new InParentNamespaceT();
}
unpackTo(_o) { }
}
export class InParentNamespaceT {
constructor() { }
pack(builder) {
return InParentNamespace.createInParentNamespace(builder);
}
}

View File

@ -0,0 +1,66 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class InParentNamespace {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:InParentNamespace):InParentNamespace {
return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:InParentNamespace):InParentNamespace {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getFullyQualifiedName():string {
return 'MyGame_InParentNamespace';
}
static startInParentNamespace(builder:flatbuffers.Builder) {
builder.startObject(0);
}
static endInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
InParentNamespace.startInParentNamespace(builder);
return InParentNamespace.endInParentNamespace(builder);
}
serialize():Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):InParentNamespace {
return InParentNamespace.getRootAsInParentNamespace(new flatbuffers.ByteBuffer(buffer))
}
unpack(): InParentNamespaceT {
return new InParentNamespaceT();
}
unpackTo(_o: InParentNamespaceT): void {}
}
export class InParentNamespaceT {
constructor(){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return InParentNamespace.createInParentNamespace(builder);
}
}

View File

@ -0,0 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum OptionalByte {
None = 0,
One = 1,
Two = 2
}

View File

@ -0,0 +1,427 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { OptionalByte } from '../optional-scalars/optional-byte.js';
export class ScalarStuff {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff {
return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
return bb.__has_identifier('NULL');
}
justI8():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
}
maybeI8():number|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : null;
}
defaultI8():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 42;
}
justU8():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
}
maybeU8():number|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readUint8(this.bb_pos + offset) : null;
}
defaultU8():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 42;
}
justI16():number {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
maybeI16():number|null {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : null;
}
defaultI16():number {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 42;
}
justU16():number {
const offset = this.bb!.__offset(this.bb_pos, 22);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
maybeU16():number|null {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : null;
}
defaultU16():number {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 42;
}
justI32():number {
const offset = this.bb!.__offset(this.bb_pos, 28);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
maybeI32():number|null {
const offset = this.bb!.__offset(this.bb_pos, 30);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : null;
}
defaultI32():number {
const offset = this.bb!.__offset(this.bb_pos, 32);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 42;
}
justU32():number {
const offset = this.bb!.__offset(this.bb_pos, 34);
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}
maybeU32():number|null {
const offset = this.bb!.__offset(this.bb_pos, 36);
return offset ? this.bb!.readUint32(this.bb_pos + offset) : null;
}
defaultU32():number {
const offset = this.bb!.__offset(this.bb_pos, 38);
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 42;
}
justI64():bigint {
const offset = this.bb!.__offset(this.bb_pos, 40);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
maybeI64():bigint|null {
const offset = this.bb!.__offset(this.bb_pos, 42);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : null;
}
defaultI64():bigint {
const offset = this.bb!.__offset(this.bb_pos, 44);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('42');
}
justU64():bigint {
const offset = this.bb!.__offset(this.bb_pos, 46);
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}
maybeU64():bigint|null {
const offset = this.bb!.__offset(this.bb_pos, 48);
return offset ? this.bb!.readUint64(this.bb_pos + offset) : null;
}
defaultU64():bigint {
const offset = this.bb!.__offset(this.bb_pos, 50);
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('42');
}
justF32():number {
const offset = this.bb!.__offset(this.bb_pos, 52);
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}
maybeF32():number|null {
const offset = this.bb!.__offset(this.bb_pos, 54);
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : null;
}
defaultF32():number {
const offset = this.bb!.__offset(this.bb_pos, 56);
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 42.0;
}
justF64():number {
const offset = this.bb!.__offset(this.bb_pos, 58);
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
}
maybeF64():number|null {
const offset = this.bb!.__offset(this.bb_pos, 60);
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null;
}
defaultF64():number {
const offset = this.bb!.__offset(this.bb_pos, 62);
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 42.0;
}
justBool():boolean {
const offset = this.bb!.__offset(this.bb_pos, 64);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
maybeBool():boolean|null {
const offset = this.bb!.__offset(this.bb_pos, 66);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : null;
}
defaultBool():boolean {
const offset = this.bb!.__offset(this.bb_pos, 68);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true;
}
justEnum():OptionalByte {
const offset = this.bb!.__offset(this.bb_pos, 70);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.None;
}
maybeEnum():OptionalByte|null {
const offset = this.bb!.__offset(this.bb_pos, 72);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : null;
}
defaultEnum():OptionalByte {
const offset = this.bb!.__offset(this.bb_pos, 74);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.One;
}
static getFullyQualifiedName():string {
return 'optional_scalars_ScalarStuff';
}
static startScalarStuff(builder:flatbuffers.Builder) {
builder.startObject(36);
}
static addJustI8(builder:flatbuffers.Builder, justI8:number) {
builder.addFieldInt8(0, justI8, 0);
}
static addMaybeI8(builder:flatbuffers.Builder, maybeI8:number) {
builder.addFieldInt8(1, maybeI8, 0);
}
static addDefaultI8(builder:flatbuffers.Builder, defaultI8:number) {
builder.addFieldInt8(2, defaultI8, 42);
}
static addJustU8(builder:flatbuffers.Builder, justU8:number) {
builder.addFieldInt8(3, justU8, 0);
}
static addMaybeU8(builder:flatbuffers.Builder, maybeU8:number) {
builder.addFieldInt8(4, maybeU8, 0);
}
static addDefaultU8(builder:flatbuffers.Builder, defaultU8:number) {
builder.addFieldInt8(5, defaultU8, 42);
}
static addJustI16(builder:flatbuffers.Builder, justI16:number) {
builder.addFieldInt16(6, justI16, 0);
}
static addMaybeI16(builder:flatbuffers.Builder, maybeI16:number) {
builder.addFieldInt16(7, maybeI16, 0);
}
static addDefaultI16(builder:flatbuffers.Builder, defaultI16:number) {
builder.addFieldInt16(8, defaultI16, 42);
}
static addJustU16(builder:flatbuffers.Builder, justU16:number) {
builder.addFieldInt16(9, justU16, 0);
}
static addMaybeU16(builder:flatbuffers.Builder, maybeU16:number) {
builder.addFieldInt16(10, maybeU16, 0);
}
static addDefaultU16(builder:flatbuffers.Builder, defaultU16:number) {
builder.addFieldInt16(11, defaultU16, 42);
}
static addJustI32(builder:flatbuffers.Builder, justI32:number) {
builder.addFieldInt32(12, justI32, 0);
}
static addMaybeI32(builder:flatbuffers.Builder, maybeI32:number) {
builder.addFieldInt32(13, maybeI32, 0);
}
static addDefaultI32(builder:flatbuffers.Builder, defaultI32:number) {
builder.addFieldInt32(14, defaultI32, 42);
}
static addJustU32(builder:flatbuffers.Builder, justU32:number) {
builder.addFieldInt32(15, justU32, 0);
}
static addMaybeU32(builder:flatbuffers.Builder, maybeU32:number) {
builder.addFieldInt32(16, maybeU32, 0);
}
static addDefaultU32(builder:flatbuffers.Builder, defaultU32:number) {
builder.addFieldInt32(17, defaultU32, 42);
}
static addJustI64(builder:flatbuffers.Builder, justI64:bigint) {
builder.addFieldInt64(18, justI64, BigInt('0'));
}
static addMaybeI64(builder:flatbuffers.Builder, maybeI64:bigint) {
builder.addFieldInt64(19, maybeI64, BigInt(0));
}
static addDefaultI64(builder:flatbuffers.Builder, defaultI64:bigint) {
builder.addFieldInt64(20, defaultI64, BigInt('42'));
}
static addJustU64(builder:flatbuffers.Builder, justU64:bigint) {
builder.addFieldInt64(21, justU64, BigInt('0'));
}
static addMaybeU64(builder:flatbuffers.Builder, maybeU64:bigint) {
builder.addFieldInt64(22, maybeU64, BigInt(0));
}
static addDefaultU64(builder:flatbuffers.Builder, defaultU64:bigint) {
builder.addFieldInt64(23, defaultU64, BigInt('42'));
}
static addJustF32(builder:flatbuffers.Builder, justF32:number) {
builder.addFieldFloat32(24, justF32, 0.0);
}
static addMaybeF32(builder:flatbuffers.Builder, maybeF32:number) {
builder.addFieldFloat32(25, maybeF32, 0);
}
static addDefaultF32(builder:flatbuffers.Builder, defaultF32:number) {
builder.addFieldFloat32(26, defaultF32, 42.0);
}
static addJustF64(builder:flatbuffers.Builder, justF64:number) {
builder.addFieldFloat64(27, justF64, 0.0);
}
static addMaybeF64(builder:flatbuffers.Builder, maybeF64:number) {
builder.addFieldFloat64(28, maybeF64, 0);
}
static addDefaultF64(builder:flatbuffers.Builder, defaultF64:number) {
builder.addFieldFloat64(29, defaultF64, 42.0);
}
static addJustBool(builder:flatbuffers.Builder, justBool:boolean) {
builder.addFieldInt8(30, +justBool, +false);
}
static addMaybeBool(builder:flatbuffers.Builder, maybeBool:boolean) {
builder.addFieldInt8(31, +maybeBool, 0);
}
static addDefaultBool(builder:flatbuffers.Builder, defaultBool:boolean) {
builder.addFieldInt8(32, +defaultBool, +true);
}
static addJustEnum(builder:flatbuffers.Builder, justEnum:OptionalByte) {
builder.addFieldInt8(33, justEnum, OptionalByte.None);
}
static addMaybeEnum(builder:flatbuffers.Builder, maybeEnum:OptionalByte) {
builder.addFieldInt8(34, maybeEnum, 0);
}
static addDefaultEnum(builder:flatbuffers.Builder, defaultEnum:OptionalByte) {
builder.addFieldInt8(35, defaultEnum, OptionalByte.One);
}
static endScalarStuff(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'NULL');
}
static finishSizePrefixedScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'NULL', true);
}
static createScalarStuff(builder:flatbuffers.Builder, justI8:number, maybeI8:number|null, defaultI8:number, justU8:number, maybeU8:number|null, defaultU8:number, justI16:number, maybeI16:number|null, defaultI16:number, justU16:number, maybeU16:number|null, defaultU16:number, justI32:number, maybeI32:number|null, defaultI32:number, justU32:number, maybeU32:number|null, defaultU32:number, justI64:bigint, maybeI64:bigint|null, defaultI64:bigint, justU64:bigint, maybeU64:bigint|null, defaultU64:bigint, justF32:number, maybeF32:number|null, defaultF32:number, justF64:number, maybeF64:number|null, defaultF64:number, justBool:boolean, maybeBool:boolean|null, defaultBool:boolean, justEnum:OptionalByte, maybeEnum:OptionalByte|null, defaultEnum:OptionalByte):flatbuffers.Offset {
ScalarStuff.startScalarStuff(builder);
ScalarStuff.addJustI8(builder, justI8);
if (maybeI8 !== null)
ScalarStuff.addMaybeI8(builder, maybeI8);
ScalarStuff.addDefaultI8(builder, defaultI8);
ScalarStuff.addJustU8(builder, justU8);
if (maybeU8 !== null)
ScalarStuff.addMaybeU8(builder, maybeU8);
ScalarStuff.addDefaultU8(builder, defaultU8);
ScalarStuff.addJustI16(builder, justI16);
if (maybeI16 !== null)
ScalarStuff.addMaybeI16(builder, maybeI16);
ScalarStuff.addDefaultI16(builder, defaultI16);
ScalarStuff.addJustU16(builder, justU16);
if (maybeU16 !== null)
ScalarStuff.addMaybeU16(builder, maybeU16);
ScalarStuff.addDefaultU16(builder, defaultU16);
ScalarStuff.addJustI32(builder, justI32);
if (maybeI32 !== null)
ScalarStuff.addMaybeI32(builder, maybeI32);
ScalarStuff.addDefaultI32(builder, defaultI32);
ScalarStuff.addJustU32(builder, justU32);
if (maybeU32 !== null)
ScalarStuff.addMaybeU32(builder, maybeU32);
ScalarStuff.addDefaultU32(builder, defaultU32);
ScalarStuff.addJustI64(builder, justI64);
if (maybeI64 !== null)
ScalarStuff.addMaybeI64(builder, maybeI64);
ScalarStuff.addDefaultI64(builder, defaultI64);
ScalarStuff.addJustU64(builder, justU64);
if (maybeU64 !== null)
ScalarStuff.addMaybeU64(builder, maybeU64);
ScalarStuff.addDefaultU64(builder, defaultU64);
ScalarStuff.addJustF32(builder, justF32);
if (maybeF32 !== null)
ScalarStuff.addMaybeF32(builder, maybeF32);
ScalarStuff.addDefaultF32(builder, defaultF32);
ScalarStuff.addJustF64(builder, justF64);
if (maybeF64 !== null)
ScalarStuff.addMaybeF64(builder, maybeF64);
ScalarStuff.addDefaultF64(builder, defaultF64);
ScalarStuff.addJustBool(builder, justBool);
if (maybeBool !== null)
ScalarStuff.addMaybeBool(builder, maybeBool);
ScalarStuff.addDefaultBool(builder, defaultBool);
ScalarStuff.addJustEnum(builder, justEnum);
if (maybeEnum !== null)
ScalarStuff.addMaybeEnum(builder, maybeEnum);
ScalarStuff.addDefaultEnum(builder, defaultEnum);
return ScalarStuff.endScalarStuff(builder);
}
}

View File

@ -0,0 +1,4 @@
// automatically generated by the FlatBuffers compiler, do not modify
export { OptionalByte } from './optional-scalars/optional-byte.js';
export { ScalarStuff } from './optional-scalars/scalar-stuff.js';

7
tests/ts/package.json Normal file
View File

@ -0,0 +1,7 @@
{
"type": "module",
"dependencies": {
"@grpc/grpc-js": "^1.7.0",
"flatbuffers": "../../"
}
}

View File

@ -0,0 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
/**
* New schema language features that are not supported by old code generators.
*/
export enum AdvancedFeatures {
AdvancedArrayFeatures = '1',
AdvancedUnionFeatures = '2',
OptionalScalars = '4',
DefaultVectorsAndStrings = '8'
}

View File

@ -0,0 +1,23 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var BaseType;
(function (BaseType) {
BaseType[BaseType["None"] = 0] = "None";
BaseType[BaseType["UType"] = 1] = "UType";
BaseType[BaseType["Bool"] = 2] = "Bool";
BaseType[BaseType["Byte"] = 3] = "Byte";
BaseType[BaseType["UByte"] = 4] = "UByte";
BaseType[BaseType["Short"] = 5] = "Short";
BaseType[BaseType["UShort"] = 6] = "UShort";
BaseType[BaseType["Int"] = 7] = "Int";
BaseType[BaseType["UInt"] = 8] = "UInt";
BaseType[BaseType["Long"] = 9] = "Long";
BaseType[BaseType["ULong"] = 10] = "ULong";
BaseType[BaseType["Float"] = 11] = "Float";
BaseType[BaseType["Double"] = 12] = "Double";
BaseType[BaseType["String"] = 13] = "String";
BaseType[BaseType["Vector"] = 14] = "Vector";
BaseType[BaseType["Obj"] = 15] = "Obj";
BaseType[BaseType["Union"] = 16] = "Union";
BaseType[BaseType["Array"] = 17] = "Array";
BaseType[BaseType["MaxBaseType"] = 18] = "MaxBaseType";
})(BaseType || (BaseType = {}));

View File

@ -0,0 +1,23 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum BaseType {
None = 0,
UType = 1,
Bool = 2,
Byte = 3,
UByte = 4,
Short = 5,
UShort = 6,
Int = 7,
UInt = 8,
Long = 9,
ULong = 10,
Float = 11,
Double = 12,
String = 13,
Vector = 14,
Obj = 15,
Union = 16,
Array = 17,
MaxBaseType = 18
}

View File

@ -0,0 +1,110 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Type } from '../reflection/type.js';
export class EnumVal {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsEnumVal(bb, obj) {
return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsEnumVal(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
value() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_value(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
unionType(obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
documentation(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName() {
return 'reflection_EnumVal';
}
static startEnumVal(builder) {
builder.startObject(5);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addValue(builder, value) {
builder.addFieldInt64(1, value, BigInt('0'));
}
static addUnionType(builder, unionTypeOffset) {
builder.addFieldOffset(3, unionTypeOffset, 0);
}
static addDocumentation(builder, documentationOffset) {
builder.addFieldOffset(4, documentationOffset, 0);
}
static createDocumentationVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startDocumentationVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static endEnumVal(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // name
return offset;
}
unpack() {
return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
}
unpackTo(_o) {
_o.name = this.name();
_o.value = this.value();
_o.unionType = (this.unionType() !== null ? this.unionType().unpack() : null);
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
}
}
export class EnumValT {
constructor(name = null, value = BigInt('0'), unionType = null, documentation = []) {
this.name = name;
this.value = value;
this.unionType = unionType;
this.documentation = documentation;
}
pack(builder) {
const name = (this.name !== null ? builder.createString(this.name) : 0);
const unionType = (this.unionType !== null ? this.unionType.pack(builder) : 0);
const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
EnumVal.startEnumVal(builder);
EnumVal.addName(builder, name);
EnumVal.addValue(builder, this.value);
EnumVal.addUnionType(builder, unionType);
EnumVal.addDocumentation(builder, documentation);
return EnumVal.endEnumVal(builder);
}
}

View File

@ -0,0 +1,149 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Type, TypeT } from '../reflection/type.js';
export class EnumVal {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):EnumVal {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
value():bigint {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_value(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb!.writeInt64(this.bb_pos + offset, value);
return true;
}
unionType(obj?:Type):Type|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
documentation(index: number):string
documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName():string {
return 'reflection_EnumVal';
}
static startEnumVal(builder:flatbuffers.Builder) {
builder.startObject(5);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addValue(builder:flatbuffers.Builder, value:bigint) {
builder.addFieldInt64(1, value, BigInt('0'));
}
static addUnionType(builder:flatbuffers.Builder, unionTypeOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, unionTypeOffset, 0);
}
static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, documentationOffset, 0);
}
static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static endEnumVal(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // name
return offset;
}
unpack(): EnumValT {
return new EnumValT(
this.name(),
this.value(),
(this.unionType() !== null ? this.unionType()!.unpack() : null),
this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
);
}
unpackTo(_o: EnumValT): void {
_o.name = this.name();
_o.value = this.value();
_o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null);
_o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
}
}
export class EnumValT {
constructor(
public name: string|Uint8Array|null = null,
public value: bigint = BigInt('0'),
public unionType: TypeT|null = null,
public documentation: (string)[] = []
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
const unionType = (this.unionType !== null ? this.unionType!.pack(builder) : 0);
const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
EnumVal.startEnumVal(builder);
EnumVal.addName(builder, name);
EnumVal.addValue(builder, this.value);
EnumVal.addUnionType(builder, unionType);
EnumVal.addDocumentation(builder, documentation);
return EnumVal.endEnumVal(builder);
}
}

175
tests/ts/reflection/enum.js Normal file
View File

@ -0,0 +1,175 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { EnumVal } from '../reflection/enum-val.js';
import { KeyValue } from '../reflection/key-value.js';
import { Type } from '../reflection/type.js';
export class Enum {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsEnum(bb, obj) {
return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsEnum(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
values(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new EnumVal()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
valuesLength() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
isUnion() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
mutate_is_union(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, +value);
return true;
}
underlyingType(obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
attributes(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
attributesLength() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
declarationFile(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static getFullyQualifiedName() {
return 'reflection_Enum';
}
static startEnum(builder) {
builder.startObject(7);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addValues(builder, valuesOffset) {
builder.addFieldOffset(1, valuesOffset, 0);
}
static createValuesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startValuesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addIsUnion(builder, isUnion) {
builder.addFieldInt8(2, +isUnion, +false);
}
static addUnderlyingType(builder, underlyingTypeOffset) {
builder.addFieldOffset(3, underlyingTypeOffset, 0);
}
static addAttributes(builder, attributesOffset) {
builder.addFieldOffset(4, attributesOffset, 0);
}
static createAttributesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startAttributesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder, documentationOffset) {
builder.addFieldOffset(5, documentationOffset, 0);
}
static createDocumentationVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startDocumentationVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDeclarationFile(builder, declarationFileOffset) {
builder.addFieldOffset(6, declarationFileOffset, 0);
}
static endEnum(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // name
builder.requiredField(offset, 6); // values
builder.requiredField(offset, 10); // underlying_type
return offset;
}
unpack() {
return new EnumT(this.name(), this.bb.createObjList(this.values.bind(this), this.valuesLength()), this.isUnion(), (this.underlyingType() !== null ? this.underlyingType().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
}
unpackTo(_o) {
_o.name = this.name();
_o.values = this.bb.createObjList(this.values.bind(this), this.valuesLength());
_o.isUnion = this.isUnion();
_o.underlyingType = (this.underlyingType() !== null ? this.underlyingType().unpack() : null);
_o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.declarationFile = this.declarationFile();
}
}
export class EnumT {
constructor(name = null, values = [], isUnion = false, underlyingType = null, attributes = [], documentation = [], declarationFile = null) {
this.name = name;
this.values = values;
this.isUnion = isUnion;
this.underlyingType = underlyingType;
this.attributes = attributes;
this.documentation = documentation;
this.declarationFile = declarationFile;
}
pack(builder) {
const name = (this.name !== null ? builder.createString(this.name) : 0);
const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
const underlyingType = (this.underlyingType !== null ? this.underlyingType.pack(builder) : 0);
const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
Enum.startEnum(builder);
Enum.addName(builder, name);
Enum.addValues(builder, values);
Enum.addIsUnion(builder, this.isUnion);
Enum.addUnderlyingType(builder, underlyingType);
Enum.addAttributes(builder, attributes);
Enum.addDocumentation(builder, documentation);
Enum.addDeclarationFile(builder, declarationFile);
return Enum.endEnum(builder);
}
}

234
tests/ts/reflection/enum.ts Normal file
View File

@ -0,0 +1,234 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { EnumVal, EnumValT } from '../reflection/enum-val.js';
import { KeyValue, KeyValueT } from '../reflection/key-value.js';
import { Type, TypeT } from '../reflection/type.js';
export class Enum {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Enum {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
values(index: number, obj?:EnumVal):EnumVal|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new EnumVal()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
valuesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
isUnion():boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
mutate_is_union(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, +value);
return true;
}
underlyingType(obj?:Type):Type|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
attributes(index: number, obj?:KeyValue):KeyValue|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
attributesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index: number):string
documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
/**
* File that this Enum is declared in.
*/
declarationFile():string|null
declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
declarationFile(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static getFullyQualifiedName():string {
return 'reflection_Enum';
}
static startEnum(builder:flatbuffers.Builder) {
builder.startObject(7);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addValues(builder:flatbuffers.Builder, valuesOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, valuesOffset, 0);
}
static createValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startValuesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addIsUnion(builder:flatbuffers.Builder, isUnion:boolean) {
builder.addFieldInt8(2, +isUnion, +false);
}
static addUnderlyingType(builder:flatbuffers.Builder, underlyingTypeOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, underlyingTypeOffset, 0);
}
static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, attributesOffset, 0);
}
static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
builder.addFieldOffset(5, documentationOffset, 0);
}
static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
builder.addFieldOffset(6, declarationFileOffset, 0);
}
static endEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // name
builder.requiredField(offset, 6) // values
builder.requiredField(offset, 10) // underlying_type
return offset;
}
unpack(): EnumT {
return new EnumT(
this.name(),
this.bb!.createObjList(this.values.bind(this), this.valuesLength()),
this.isUnion(),
(this.underlyingType() !== null ? this.underlyingType()!.unpack() : null),
this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
this.declarationFile()
);
}
unpackTo(_o: EnumT): void {
_o.name = this.name();
_o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength());
_o.isUnion = this.isUnion();
_o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null);
_o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.declarationFile = this.declarationFile();
}
}
export class EnumT {
constructor(
public name: string|Uint8Array|null = null,
public values: (EnumValT)[] = [],
public isUnion: boolean = false,
public underlyingType: TypeT|null = null,
public attributes: (KeyValueT)[] = [],
public documentation: (string)[] = [],
public declarationFile: string|Uint8Array|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
const underlyingType = (this.underlyingType !== null ? this.underlyingType!.pack(builder) : 0);
const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
Enum.startEnum(builder);
Enum.addName(builder, name);
Enum.addValues(builder, values);
Enum.addIsUnion(builder, this.isUnion);
Enum.addUnderlyingType(builder, underlyingType);
Enum.addAttributes(builder, attributes);
Enum.addDocumentation(builder, documentation);
Enum.addDeclarationFile(builder, declarationFile);
return Enum.endEnum(builder);
}
}

View File

@ -0,0 +1,284 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { KeyValue } from '../reflection/key-value.js';
import { Type } from '../reflection/type.js';
export class Field {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsField(bb, obj) {
return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsField(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
type(obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
id() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_id(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
offset() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_offset(value) {
const offset = this.bb.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
defaultInteger() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_default_integer(value) {
const offset = this.bb.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
defaultReal() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
mutate_default_real(value) {
const offset = this.bb.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb.writeFloat64(this.bb_pos + offset, value);
return true;
}
deprecated() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
mutate_deprecated(value) {
const offset = this.bb.__offset(this.bb_pos, 16);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, +value);
return true;
}
required() {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
mutate_required(value) {
const offset = this.bb.__offset(this.bb_pos, 18);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, +value);
return true;
}
key() {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
mutate_key(value) {
const offset = this.bb.__offset(this.bb_pos, 20);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, +value);
return true;
}
attributes(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
attributesLength() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength() {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
optional() {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
mutate_optional(value) {
const offset = this.bb.__offset(this.bb_pos, 26);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, +value);
return true;
}
/**
* Number of padding octets to always add after this field. Structs only.
*/
padding() {
const offset = this.bb.__offset(this.bb_pos, 28);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_padding(value) {
const offset = this.bb.__offset(this.bb_pos, 28);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'reflection_Field';
}
static startField(builder) {
builder.startObject(13);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addType(builder, typeOffset) {
builder.addFieldOffset(1, typeOffset, 0);
}
static addId(builder, id) {
builder.addFieldInt16(2, id, 0);
}
static addOffset(builder, offset) {
builder.addFieldInt16(3, offset, 0);
}
static addDefaultInteger(builder, defaultInteger) {
builder.addFieldInt64(4, defaultInteger, BigInt('0'));
}
static addDefaultReal(builder, defaultReal) {
builder.addFieldFloat64(5, defaultReal, 0.0);
}
static addDeprecated(builder, deprecated) {
builder.addFieldInt8(6, +deprecated, +false);
}
static addRequired(builder, required) {
builder.addFieldInt8(7, +required, +false);
}
static addKey(builder, key) {
builder.addFieldInt8(8, +key, +false);
}
static addAttributes(builder, attributesOffset) {
builder.addFieldOffset(9, attributesOffset, 0);
}
static createAttributesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startAttributesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder, documentationOffset) {
builder.addFieldOffset(10, documentationOffset, 0);
}
static createDocumentationVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startDocumentationVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addOptional(builder, optional) {
builder.addFieldInt8(11, +optional, +false);
}
static addPadding(builder, padding) {
builder.addFieldInt16(12, padding, 0);
}
static endField(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // name
builder.requiredField(offset, 6); // type
return offset;
}
unpack() {
return new FieldT(this.name(), (this.type() !== null ? this.type().unpack() : null), this.id(), this.offset(), this.defaultInteger(), this.defaultReal(), this.deprecated(), this.required(), this.key(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding());
}
unpackTo(_o) {
_o.name = this.name();
_o.type = (this.type() !== null ? this.type().unpack() : null);
_o.id = this.id();
_o.offset = this.offset();
_o.defaultInteger = this.defaultInteger();
_o.defaultReal = this.defaultReal();
_o.deprecated = this.deprecated();
_o.required = this.required();
_o.key = this.key();
_o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.optional = this.optional();
_o.padding = this.padding();
}
}
export class FieldT {
constructor(name = null, type = null, id = 0, offset = 0, defaultInteger = BigInt('0'), defaultReal = 0.0, deprecated = false, required = false, key = false, attributes = [], documentation = [], optional = false, padding = 0) {
this.name = name;
this.type = type;
this.id = id;
this.offset = offset;
this.defaultInteger = defaultInteger;
this.defaultReal = defaultReal;
this.deprecated = deprecated;
this.required = required;
this.key = key;
this.attributes = attributes;
this.documentation = documentation;
this.optional = optional;
this.padding = padding;
}
pack(builder) {
const name = (this.name !== null ? builder.createString(this.name) : 0);
const type = (this.type !== null ? this.type.pack(builder) : 0);
const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
Field.startField(builder);
Field.addName(builder, name);
Field.addType(builder, type);
Field.addId(builder, this.id);
Field.addOffset(builder, this.offset);
Field.addDefaultInteger(builder, this.defaultInteger);
Field.addDefaultReal(builder, this.defaultReal);
Field.addDeprecated(builder, this.deprecated);
Field.addRequired(builder, this.required);
Field.addKey(builder, this.key);
Field.addAttributes(builder, attributes);
Field.addDocumentation(builder, documentation);
Field.addOptional(builder, this.optional);
Field.addPadding(builder, this.padding);
return Field.endField(builder);
}
}

View File

@ -0,0 +1,377 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { KeyValue, KeyValueT } from '../reflection/key-value.js';
import { Type, TypeT } from '../reflection/type.js';
export class Field {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Field {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
type(obj?:Type):Type|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
id():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
mutate_id(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeUint16(this.bb_pos + offset, value);
return true;
}
offset():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
mutate_offset(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb!.writeUint16(this.bb_pos + offset, value);
return true;
}
defaultInteger():bigint {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_default_integer(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb!.writeInt64(this.bb_pos + offset, value);
return true;
}
defaultReal():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
}
mutate_default_real(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb!.writeFloat64(this.bb_pos + offset, value);
return true;
}
deprecated():boolean {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
mutate_deprecated(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 16);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, +value);
return true;
}
required():boolean {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
mutate_required(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 18);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, +value);
return true;
}
key():boolean {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
mutate_key(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 20);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, +value);
return true;
}
attributes(index: number, obj?:KeyValue):KeyValue|null {
const offset = this.bb!.__offset(this.bb_pos, 22);
return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
attributesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 22);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index: number):string
documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength():number {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
optional():boolean {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
mutate_optional(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 26);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, +value);
return true;
}
/**
* Number of padding octets to always add after this field. Structs only.
*/
padding():number {
const offset = this.bb!.__offset(this.bb_pos, 28);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
mutate_padding(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 28);
if (offset === 0) {
return false;
}
this.bb!.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName():string {
return 'reflection_Field';
}
static startField(builder:flatbuffers.Builder) {
builder.startObject(13);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, typeOffset, 0);
}
static addId(builder:flatbuffers.Builder, id:number) {
builder.addFieldInt16(2, id, 0);
}
static addOffset(builder:flatbuffers.Builder, offset:number) {
builder.addFieldInt16(3, offset, 0);
}
static addDefaultInteger(builder:flatbuffers.Builder, defaultInteger:bigint) {
builder.addFieldInt64(4, defaultInteger, BigInt('0'));
}
static addDefaultReal(builder:flatbuffers.Builder, defaultReal:number) {
builder.addFieldFloat64(5, defaultReal, 0.0);
}
static addDeprecated(builder:flatbuffers.Builder, deprecated:boolean) {
builder.addFieldInt8(6, +deprecated, +false);
}
static addRequired(builder:flatbuffers.Builder, required:boolean) {
builder.addFieldInt8(7, +required, +false);
}
static addKey(builder:flatbuffers.Builder, key:boolean) {
builder.addFieldInt8(8, +key, +false);
}
static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
builder.addFieldOffset(9, attributesOffset, 0);
}
static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
builder.addFieldOffset(10, documentationOffset, 0);
}
static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addOptional(builder:flatbuffers.Builder, optional:boolean) {
builder.addFieldInt8(11, +optional, +false);
}
static addPadding(builder:flatbuffers.Builder, padding:number) {
builder.addFieldInt16(12, padding, 0);
}
static endField(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // name
builder.requiredField(offset, 6) // type
return offset;
}
unpack(): FieldT {
return new FieldT(
this.name(),
(this.type() !== null ? this.type()!.unpack() : null),
this.id(),
this.offset(),
this.defaultInteger(),
this.defaultReal(),
this.deprecated(),
this.required(),
this.key(),
this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
this.optional(),
this.padding()
);
}
unpackTo(_o: FieldT): void {
_o.name = this.name();
_o.type = (this.type() !== null ? this.type()!.unpack() : null);
_o.id = this.id();
_o.offset = this.offset();
_o.defaultInteger = this.defaultInteger();
_o.defaultReal = this.defaultReal();
_o.deprecated = this.deprecated();
_o.required = this.required();
_o.key = this.key();
_o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.optional = this.optional();
_o.padding = this.padding();
}
}
export class FieldT {
constructor(
public name: string|Uint8Array|null = null,
public type: TypeT|null = null,
public id: number = 0,
public offset: number = 0,
public defaultInteger: bigint = BigInt('0'),
public defaultReal: number = 0.0,
public deprecated: boolean = false,
public required: boolean = false,
public key: boolean = false,
public attributes: (KeyValueT)[] = [],
public documentation: (string)[] = [],
public optional: boolean = false,
public padding: number = 0
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
const type = (this.type !== null ? this.type!.pack(builder) : 0);
const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
Field.startField(builder);
Field.addName(builder, name);
Field.addType(builder, type);
Field.addId(builder, this.id);
Field.addOffset(builder, this.offset);
Field.addDefaultInteger(builder, this.defaultInteger);
Field.addDefaultReal(builder, this.defaultReal);
Field.addDeprecated(builder, this.deprecated);
Field.addRequired(builder, this.required);
Field.addKey(builder, this.key);
Field.addAttributes(builder, attributes);
Field.addDocumentation(builder, documentation);
Field.addOptional(builder, this.optional);
Field.addPadding(builder, this.padding);
return Field.endField(builder);
}
}

View File

@ -0,0 +1,69 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class KeyValue {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsKeyValue(bb, obj) {
return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsKeyValue(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
key(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
value(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static getFullyQualifiedName() {
return 'reflection_KeyValue';
}
static startKeyValue(builder) {
builder.startObject(2);
}
static addKey(builder, keyOffset) {
builder.addFieldOffset(0, keyOffset, 0);
}
static addValue(builder, valueOffset) {
builder.addFieldOffset(1, valueOffset, 0);
}
static endKeyValue(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // key
return offset;
}
static createKeyValue(builder, keyOffset, valueOffset) {
KeyValue.startKeyValue(builder);
KeyValue.addKey(builder, keyOffset);
KeyValue.addValue(builder, valueOffset);
return KeyValue.endKeyValue(builder);
}
unpack() {
return new KeyValueT(this.key(), this.value());
}
unpackTo(_o) {
_o.key = this.key();
_o.value = this.value();
}
}
export class KeyValueT {
constructor(key = null, value = null) {
this.key = key;
this.value = value;
}
pack(builder) {
const key = (this.key !== null ? builder.createString(this.key) : 0);
const value = (this.value !== null ? builder.createString(this.value) : 0);
return KeyValue.createKeyValue(builder, key, value);
}
}

View File

@ -0,0 +1,98 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class KeyValue {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):KeyValue {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
key():string|null
key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
key(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;
}
value():string|null
value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
value(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;
}
static getFullyQualifiedName():string {
return 'reflection_KeyValue';
}
static startKeyValue(builder:flatbuffers.Builder) {
builder.startObject(2);
}
static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, keyOffset, 0);
}
static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, valueOffset, 0);
}
static endKeyValue(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // key
return offset;
}
static createKeyValue(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset {
KeyValue.startKeyValue(builder);
KeyValue.addKey(builder, keyOffset);
KeyValue.addValue(builder, valueOffset);
return KeyValue.endKeyValue(builder);
}
unpack(): KeyValueT {
return new KeyValueT(
this.key(),
this.value()
);
}
unpackTo(_o: KeyValueT): void {
_o.key = this.key();
_o.value = this.value();
}
}
export class KeyValueT {
constructor(
public key: string|Uint8Array|null = null,
public value: string|Uint8Array|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const key = (this.key !== null ? builder.createString(this.key!) : 0);
const value = (this.value !== null ? builder.createString(this.value!) : 0);
return KeyValue.createKeyValue(builder,
key,
value
);
}
}

View File

@ -0,0 +1,201 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Field } from '../reflection/field.js';
import { KeyValue } from '../reflection/key-value.js';
export class Object_ {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsObject(bb, obj) {
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsObject(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
fields(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new Field()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
fieldsLength() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
isStruct() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
mutate_is_struct(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, +value);
return true;
}
minalign() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
mutate_minalign(value) {
const offset = this.bb.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
bytesize() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
mutate_bytesize(value) {
const offset = this.bb.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
attributes(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
attributesLength() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
declarationFile(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static getFullyQualifiedName() {
return 'reflection_Object';
}
static startObject(builder) {
builder.startObject(8);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addFields(builder, fieldsOffset) {
builder.addFieldOffset(1, fieldsOffset, 0);
}
static createFieldsVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startFieldsVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addIsStruct(builder, isStruct) {
builder.addFieldInt8(2, +isStruct, +false);
}
static addMinalign(builder, minalign) {
builder.addFieldInt32(3, minalign, 0);
}
static addBytesize(builder, bytesize) {
builder.addFieldInt32(4, bytesize, 0);
}
static addAttributes(builder, attributesOffset) {
builder.addFieldOffset(5, attributesOffset, 0);
}
static createAttributesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startAttributesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder, documentationOffset) {
builder.addFieldOffset(6, documentationOffset, 0);
}
static createDocumentationVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startDocumentationVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDeclarationFile(builder, declarationFileOffset) {
builder.addFieldOffset(7, declarationFileOffset, 0);
}
static endObject(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // name
builder.requiredField(offset, 6); // fields
return offset;
}
static createObject(builder, nameOffset, fieldsOffset, isStruct, minalign, bytesize, attributesOffset, documentationOffset, declarationFileOffset) {
Object_.startObject(builder);
Object_.addName(builder, nameOffset);
Object_.addFields(builder, fieldsOffset);
Object_.addIsStruct(builder, isStruct);
Object_.addMinalign(builder, minalign);
Object_.addBytesize(builder, bytesize);
Object_.addAttributes(builder, attributesOffset);
Object_.addDocumentation(builder, documentationOffset);
Object_.addDeclarationFile(builder, declarationFileOffset);
return Object_.endObject(builder);
}
unpack() {
return new Object_T(this.name(), this.bb.createObjList(this.fields.bind(this), this.fieldsLength()), this.isStruct(), this.minalign(), this.bytesize(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
}
unpackTo(_o) {
_o.name = this.name();
_o.fields = this.bb.createObjList(this.fields.bind(this), this.fieldsLength());
_o.isStruct = this.isStruct();
_o.minalign = this.minalign();
_o.bytesize = this.bytesize();
_o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.declarationFile = this.declarationFile();
}
}
export class Object_T {
constructor(name = null, fields = [], isStruct = false, minalign = 0, bytesize = 0, attributes = [], documentation = [], declarationFile = null) {
this.name = name;
this.fields = fields;
this.isStruct = isStruct;
this.minalign = minalign;
this.bytesize = bytesize;
this.attributes = attributes;
this.documentation = documentation;
this.declarationFile = declarationFile;
}
pack(builder) {
const name = (this.name !== null ? builder.createString(this.name) : 0);
const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
return Object_.createObject(builder, name, fields, this.isStruct, this.minalign, this.bytesize, attributes, documentation, declarationFile);
}
}

View File

@ -0,0 +1,277 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Field, FieldT } from '../reflection/field.js';
import { KeyValue, KeyValueT } from '../reflection/key-value.js';
export class Object_ {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
fields(index: number, obj?:Field):Field|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new Field()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
fieldsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
isStruct():boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}
mutate_is_struct(value:boolean):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, +value);
return true;
}
minalign():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
mutate_minalign(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
bytesize():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
mutate_bytesize(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
attributes(index: number, obj?:KeyValue):KeyValue|null {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
attributesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index: number):string
documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength():number {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
/**
* File that this Object is declared in.
*/
declarationFile():string|null
declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
declarationFile(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static getFullyQualifiedName():string {
return 'reflection_Object';
}
static startObject(builder:flatbuffers.Builder) {
builder.startObject(8);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addFields(builder:flatbuffers.Builder, fieldsOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, fieldsOffset, 0);
}
static createFieldsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startFieldsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addIsStruct(builder:flatbuffers.Builder, isStruct:boolean) {
builder.addFieldInt8(2, +isStruct, +false);
}
static addMinalign(builder:flatbuffers.Builder, minalign:number) {
builder.addFieldInt32(3, minalign, 0);
}
static addBytesize(builder:flatbuffers.Builder, bytesize:number) {
builder.addFieldInt32(4, bytesize, 0);
}
static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
builder.addFieldOffset(5, attributesOffset, 0);
}
static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
builder.addFieldOffset(6, documentationOffset, 0);
}
static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
builder.addFieldOffset(7, declarationFileOffset, 0);
}
static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // name
builder.requiredField(offset, 6) // fields
return offset;
}
static createObject(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, fieldsOffset:flatbuffers.Offset, isStruct:boolean, minalign:number, bytesize:number, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
Object_.startObject(builder);
Object_.addName(builder, nameOffset);
Object_.addFields(builder, fieldsOffset);
Object_.addIsStruct(builder, isStruct);
Object_.addMinalign(builder, minalign);
Object_.addBytesize(builder, bytesize);
Object_.addAttributes(builder, attributesOffset);
Object_.addDocumentation(builder, documentationOffset);
Object_.addDeclarationFile(builder, declarationFileOffset);
return Object_.endObject(builder);
}
unpack(): Object_T {
return new Object_T(
this.name(),
this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()),
this.isStruct(),
this.minalign(),
this.bytesize(),
this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
this.declarationFile()
);
}
unpackTo(_o: Object_T): void {
_o.name = this.name();
_o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength());
_o.isStruct = this.isStruct();
_o.minalign = this.minalign();
_o.bytesize = this.bytesize();
_o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.declarationFile = this.declarationFile();
}
}
export class Object_T {
constructor(
public name: string|Uint8Array|null = null,
public fields: (FieldT)[] = [],
public isStruct: boolean = false,
public minalign: number = 0,
public bytesize: number = 0,
public attributes: (KeyValueT)[] = [],
public documentation: (string)[] = [],
public declarationFile: string|Uint8Array|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
return Object_.createObject(builder,
name,
fields,
this.isStruct,
this.minalign,
this.bytesize,
attributes,
documentation,
declarationFile
);
}
}

View File

@ -0,0 +1,131 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { KeyValue } from '../reflection/key-value.js';
import { Object_ } from '../reflection/object.js';
export class RPCCall {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsRPCCall(bb, obj) {
return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsRPCCall(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
request(obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
response(obj) {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
attributes(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
attributesLength() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName() {
return 'reflection_RPCCall';
}
static startRPCCall(builder) {
builder.startObject(5);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addRequest(builder, requestOffset) {
builder.addFieldOffset(1, requestOffset, 0);
}
static addResponse(builder, responseOffset) {
builder.addFieldOffset(2, responseOffset, 0);
}
static addAttributes(builder, attributesOffset) {
builder.addFieldOffset(3, attributesOffset, 0);
}
static createAttributesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startAttributesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder, documentationOffset) {
builder.addFieldOffset(4, documentationOffset, 0);
}
static createDocumentationVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startDocumentationVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static endRPCCall(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // name
builder.requiredField(offset, 6); // request
builder.requiredField(offset, 8); // response
return offset;
}
unpack() {
return new RPCCallT(this.name(), (this.request() !== null ? this.request().unpack() : null), (this.response() !== null ? this.response().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
}
unpackTo(_o) {
_o.name = this.name();
_o.request = (this.request() !== null ? this.request().unpack() : null);
_o.response = (this.response() !== null ? this.response().unpack() : null);
_o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
}
}
export class RPCCallT {
constructor(name = null, request = null, response = null, attributes = [], documentation = []) {
this.name = name;
this.request = request;
this.response = response;
this.attributes = attributes;
this.documentation = documentation;
}
pack(builder) {
const name = (this.name !== null ? builder.createString(this.name) : 0);
const request = (this.request !== null ? this.request.pack(builder) : 0);
const response = (this.response !== null ? this.response.pack(builder) : 0);
const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
RPCCall.startRPCCall(builder);
RPCCall.addName(builder, name);
RPCCall.addRequest(builder, request);
RPCCall.addResponse(builder, response);
RPCCall.addAttributes(builder, attributes);
RPCCall.addDocumentation(builder, documentation);
return RPCCall.endRPCCall(builder);
}
}

View File

@ -0,0 +1,173 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { KeyValue, KeyValueT } from '../reflection/key-value.js';
import { Object_, Object_T } from '../reflection/object.js';
export class RPCCall {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):RPCCall {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
request(obj?:Object_):Object_|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
response(obj?:Object_):Object_|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
attributes(index: number, obj?:KeyValue):KeyValue|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
attributesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index: number):string
documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName():string {
return 'reflection_RPCCall';
}
static startRPCCall(builder:flatbuffers.Builder) {
builder.startObject(5);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, requestOffset, 0);
}
static addResponse(builder:flatbuffers.Builder, responseOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, responseOffset, 0);
}
static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, attributesOffset, 0);
}
static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, documentationOffset, 0);
}
static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static endRPCCall(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // name
builder.requiredField(offset, 6) // request
builder.requiredField(offset, 8) // response
return offset;
}
unpack(): RPCCallT {
return new RPCCallT(
this.name(),
(this.request() !== null ? this.request()!.unpack() : null),
(this.response() !== null ? this.response()!.unpack() : null),
this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
);
}
unpackTo(_o: RPCCallT): void {
_o.name = this.name();
_o.request = (this.request() !== null ? this.request()!.unpack() : null);
_o.response = (this.response() !== null ? this.response()!.unpack() : null);
_o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
}
}
export class RPCCallT {
constructor(
public name: string|Uint8Array|null = null,
public request: Object_T|null = null,
public response: Object_T|null = null,
public attributes: (KeyValueT)[] = [],
public documentation: (string)[] = []
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
const request = (this.request !== null ? this.request!.pack(builder) : 0);
const response = (this.response !== null ? this.response!.pack(builder) : 0);
const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
RPCCall.startRPCCall(builder);
RPCCall.addName(builder, name);
RPCCall.addRequest(builder, request);
RPCCall.addResponse(builder, response);
RPCCall.addAttributes(builder, attributes);
RPCCall.addDocumentation(builder, documentation);
return RPCCall.endRPCCall(builder);
}
}

View File

@ -0,0 +1,88 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
/**
* File specific information.
* Symbols declared within a file may be recovered by iterating over all
* symbols and examining the `declaration_file` field.
*/
export class SchemaFile {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsSchemaFile(bb, obj) {
return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsSchemaFile(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
filename(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
includedFilenames(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
includedFilenamesLength() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName() {
return 'reflection_SchemaFile';
}
static startSchemaFile(builder) {
builder.startObject(2);
}
static addFilename(builder, filenameOffset) {
builder.addFieldOffset(0, filenameOffset, 0);
}
static addIncludedFilenames(builder, includedFilenamesOffset) {
builder.addFieldOffset(1, includedFilenamesOffset, 0);
}
static createIncludedFilenamesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startIncludedFilenamesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static endSchemaFile(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // filename
return offset;
}
static createSchemaFile(builder, filenameOffset, includedFilenamesOffset) {
SchemaFile.startSchemaFile(builder);
SchemaFile.addFilename(builder, filenameOffset);
SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
return SchemaFile.endSchemaFile(builder);
}
unpack() {
return new SchemaFileT(this.filename(), this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()));
}
unpackTo(_o) {
_o.filename = this.filename();
_o.includedFilenames = this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
}
}
export class SchemaFileT {
constructor(filename = null, includedFilenames = []) {
this.filename = filename;
this.includedFilenames = includedFilenames;
}
pack(builder) {
const filename = (this.filename !== null ? builder.createString(this.filename) : 0);
const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
return SchemaFile.createSchemaFile(builder, filename, includedFilenames);
}
}

View File

@ -0,0 +1,126 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
/**
* File specific information.
* Symbols declared within a file may be recovered by iterating over all
* symbols and examining the `declaration_file` field.
*/
export class SchemaFile {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
/**
* Filename, relative to project root.
*/
filename():string|null
filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
filename(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;
}
/**
* Names of included files, relative to project root.
*/
includedFilenames(index: number):string
includedFilenames(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
includedFilenames(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
includedFilenamesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName():string {
return 'reflection_SchemaFile';
}
static startSchemaFile(builder:flatbuffers.Builder) {
builder.startObject(2);
}
static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, filenameOffset, 0);
}
static addIncludedFilenames(builder:flatbuffers.Builder, includedFilenamesOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, includedFilenamesOffset, 0);
}
static createIncludedFilenamesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startIncludedFilenamesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static endSchemaFile(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // filename
return offset;
}
static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset, includedFilenamesOffset:flatbuffers.Offset):flatbuffers.Offset {
SchemaFile.startSchemaFile(builder);
SchemaFile.addFilename(builder, filenameOffset);
SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
return SchemaFile.endSchemaFile(builder);
}
unpack(): SchemaFileT {
return new SchemaFileT(
this.filename(),
this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength())
);
}
unpackTo(_o: SchemaFileT): void {
_o.filename = this.filename();
_o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
}
}
export class SchemaFileT {
constructor(
public filename: string|Uint8Array|null = null,
public includedFilenames: (string)[] = []
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const filename = (this.filename !== null ? builder.createString(this.filename!) : 0);
const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
return SchemaFile.createSchemaFile(builder,
filename,
includedFilenames
);
}
}

View File

@ -0,0 +1,213 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Enum } from '../reflection/enum.js';
import { Object_ } from '../reflection/object.js';
import { SchemaFile } from '../reflection/schema-file.js';
import { Service } from '../reflection/service.js';
export class Schema {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsSchema(bb, obj) {
return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsSchema(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static bufferHasIdentifier(bb) {
return bb.__has_identifier('BFBS');
}
objects(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
objectsLength() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
enums(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new Enum()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
enumsLength() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
fileIdent(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
fileExt(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
rootTable(obj) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
services(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? (obj || new Service()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
servicesLength() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
advancedFeatures() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_advanced_features(value) {
const offset = this.bb.__offset(this.bb_pos, 16);
if (offset === 0) {
return false;
}
this.bb.writeUint64(this.bb_pos + offset, value);
return true;
}
/**
* All the files used in this compilation. Files are relative to where
* flatc was invoked.
*/
fbsFiles(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? (obj || new SchemaFile()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
fbsFilesLength() {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName() {
return 'reflection_Schema';
}
static startSchema(builder) {
builder.startObject(8);
}
static addObjects(builder, objectsOffset) {
builder.addFieldOffset(0, objectsOffset, 0);
}
static createObjectsVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startObjectsVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addEnums(builder, enumsOffset) {
builder.addFieldOffset(1, enumsOffset, 0);
}
static createEnumsVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startEnumsVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addFileIdent(builder, fileIdentOffset) {
builder.addFieldOffset(2, fileIdentOffset, 0);
}
static addFileExt(builder, fileExtOffset) {
builder.addFieldOffset(3, fileExtOffset, 0);
}
static addRootTable(builder, rootTableOffset) {
builder.addFieldOffset(4, rootTableOffset, 0);
}
static addServices(builder, servicesOffset) {
builder.addFieldOffset(5, servicesOffset, 0);
}
static createServicesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startServicesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addAdvancedFeatures(builder, advancedFeatures) {
builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
}
static addFbsFiles(builder, fbsFilesOffset) {
builder.addFieldOffset(7, fbsFilesOffset, 0);
}
static createFbsFilesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startFbsFilesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static endSchema(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // objects
builder.requiredField(offset, 6); // enums
return offset;
}
static finishSchemaBuffer(builder, offset) {
builder.finish(offset, 'BFBS');
}
static finishSizePrefixedSchemaBuffer(builder, offset) {
builder.finish(offset, 'BFBS', true);
}
unpack() {
return new SchemaT(this.bb.createObjList(this.objects.bind(this), this.objectsLength()), this.bb.createObjList(this.enums.bind(this), this.enumsLength()), this.fileIdent(), this.fileExt(), (this.rootTable() !== null ? this.rootTable().unpack() : null), this.bb.createObjList(this.services.bind(this), this.servicesLength()), this.advancedFeatures(), this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()));
}
unpackTo(_o) {
_o.objects = this.bb.createObjList(this.objects.bind(this), this.objectsLength());
_o.enums = this.bb.createObjList(this.enums.bind(this), this.enumsLength());
_o.fileIdent = this.fileIdent();
_o.fileExt = this.fileExt();
_o.rootTable = (this.rootTable() !== null ? this.rootTable().unpack() : null);
_o.services = this.bb.createObjList(this.services.bind(this), this.servicesLength());
_o.advancedFeatures = this.advancedFeatures();
_o.fbsFiles = this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
}
}
export class SchemaT {
constructor(objects = [], enums = [], fileIdent = null, fileExt = null, rootTable = null, services = [], advancedFeatures = BigInt('0'), fbsFiles = []) {
this.objects = objects;
this.enums = enums;
this.fileIdent = fileIdent;
this.fileExt = fileExt;
this.rootTable = rootTable;
this.services = services;
this.advancedFeatures = advancedFeatures;
this.fbsFiles = fbsFiles;
}
pack(builder) {
const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent) : 0);
const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt) : 0);
const rootTable = (this.rootTable !== null ? this.rootTable.pack(builder) : 0);
const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
Schema.startSchema(builder);
Schema.addObjects(builder, objects);
Schema.addEnums(builder, enums);
Schema.addFileIdent(builder, fileIdent);
Schema.addFileExt(builder, fileExt);
Schema.addRootTable(builder, rootTable);
Schema.addServices(builder, services);
Schema.addAdvancedFeatures(builder, this.advancedFeatures);
Schema.addFbsFiles(builder, fbsFiles);
return Schema.endSchema(builder);
}
}

View File

@ -0,0 +1,276 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Enum, EnumT } from '../reflection/enum.js';
import { Object_, Object_T } from '../reflection/object.js';
import { SchemaFile, SchemaFileT } from '../reflection/schema-file.js';
import { Service, ServiceT } from '../reflection/service.js';
export class Schema {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Schema {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
return bb.__has_identifier('BFBS');
}
objects(index: number, obj?:Object_):Object_|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
objectsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
enums(index: number, obj?:Enum):Enum|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new Enum()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
enumsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
fileIdent():string|null
fileIdent(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
fileIdent(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
fileExt():string|null
fileExt(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
fileExt(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
rootTable(obj?:Object_):Object_|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
services(index: number, obj?:Service):Service|null {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? (obj || new Service()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
servicesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
advancedFeatures():bigint {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_advanced_features(value:bigint):boolean {
const offset = this.bb!.__offset(this.bb_pos, 16);
if (offset === 0) {
return false;
}
this.bb!.writeUint64(this.bb_pos + offset, value);
return true;
}
/**
* All the files used in this compilation. Files are relative to where
* flatc was invoked.
*/
fbsFiles(index: number, obj?:SchemaFile):SchemaFile|null {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? (obj || new SchemaFile()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
fbsFilesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName():string {
return 'reflection_Schema';
}
static startSchema(builder:flatbuffers.Builder) {
builder.startObject(8);
}
static addObjects(builder:flatbuffers.Builder, objectsOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, objectsOffset, 0);
}
static createObjectsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startObjectsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addEnums(builder:flatbuffers.Builder, enumsOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, enumsOffset, 0);
}
static createEnumsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startEnumsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addFileIdent(builder:flatbuffers.Builder, fileIdentOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, fileIdentOffset, 0);
}
static addFileExt(builder:flatbuffers.Builder, fileExtOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, fileExtOffset, 0);
}
static addRootTable(builder:flatbuffers.Builder, rootTableOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, rootTableOffset, 0);
}
static addServices(builder:flatbuffers.Builder, servicesOffset:flatbuffers.Offset) {
builder.addFieldOffset(5, servicesOffset, 0);
}
static createServicesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startServicesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addAdvancedFeatures(builder:flatbuffers.Builder, advancedFeatures:bigint) {
builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
}
static addFbsFiles(builder:flatbuffers.Builder, fbsFilesOffset:flatbuffers.Offset) {
builder.addFieldOffset(7, fbsFilesOffset, 0);
}
static createFbsFilesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startFbsFilesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static endSchema(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // objects
builder.requiredField(offset, 6) // enums
return offset;
}
static finishSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'BFBS');
}
static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'BFBS', true);
}
unpack(): SchemaT {
return new SchemaT(
this.bb!.createObjList(this.objects.bind(this), this.objectsLength()),
this.bb!.createObjList(this.enums.bind(this), this.enumsLength()),
this.fileIdent(),
this.fileExt(),
(this.rootTable() !== null ? this.rootTable()!.unpack() : null),
this.bb!.createObjList(this.services.bind(this), this.servicesLength()),
this.advancedFeatures(),
this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength())
);
}
unpackTo(_o: SchemaT): void {
_o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength());
_o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength());
_o.fileIdent = this.fileIdent();
_o.fileExt = this.fileExt();
_o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null);
_o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength());
_o.advancedFeatures = this.advancedFeatures();
_o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
}
}
export class SchemaT {
constructor(
public objects: (Object_T)[] = [],
public enums: (EnumT)[] = [],
public fileIdent: string|Uint8Array|null = null,
public fileExt: string|Uint8Array|null = null,
public rootTable: Object_T|null = null,
public services: (ServiceT)[] = [],
public advancedFeatures: bigint = BigInt('0'),
public fbsFiles: (SchemaFileT)[] = []
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent!) : 0);
const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt!) : 0);
const rootTable = (this.rootTable !== null ? this.rootTable!.pack(builder) : 0);
const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
Schema.startSchema(builder);
Schema.addObjects(builder, objects);
Schema.addEnums(builder, enums);
Schema.addFileIdent(builder, fileIdent);
Schema.addFileExt(builder, fileExt);
Schema.addRootTable(builder, rootTable);
Schema.addServices(builder, services);
Schema.addAdvancedFeatures(builder, this.advancedFeatures);
Schema.addFbsFiles(builder, fbsFiles);
return Schema.endSchema(builder);
}
}

View File

@ -0,0 +1,146 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { KeyValue } from '../reflection/key-value.js';
import { RPCCall } from '../reflection/rpccall.js';
export class Service {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsService(bb, obj) {
return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsService(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
calls(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new RPCCall()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
callsLength() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
attributes(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
attributesLength() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index, optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
declarationFile(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static getFullyQualifiedName() {
return 'reflection_Service';
}
static startService(builder) {
builder.startObject(5);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addCalls(builder, callsOffset) {
builder.addFieldOffset(1, callsOffset, 0);
}
static createCallsVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startCallsVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addAttributes(builder, attributesOffset) {
builder.addFieldOffset(2, attributesOffset, 0);
}
static createAttributesVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startAttributesVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder, documentationOffset) {
builder.addFieldOffset(3, documentationOffset, 0);
}
static createDocumentationVector(builder, data) {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]);
}
return builder.endVector();
}
static startDocumentationVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDeclarationFile(builder, declarationFileOffset) {
builder.addFieldOffset(4, declarationFileOffset, 0);
}
static endService(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // name
return offset;
}
static createService(builder, nameOffset, callsOffset, attributesOffset, documentationOffset, declarationFileOffset) {
Service.startService(builder);
Service.addName(builder, nameOffset);
Service.addCalls(builder, callsOffset);
Service.addAttributes(builder, attributesOffset);
Service.addDocumentation(builder, documentationOffset);
Service.addDeclarationFile(builder, declarationFileOffset);
return Service.endService(builder);
}
unpack() {
return new ServiceT(this.name(), this.bb.createObjList(this.calls.bind(this), this.callsLength()), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
}
unpackTo(_o) {
_o.name = this.name();
_o.calls = this.bb.createObjList(this.calls.bind(this), this.callsLength());
_o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.declarationFile = this.declarationFile();
}
}
export class ServiceT {
constructor(name = null, calls = [], attributes = [], documentation = [], declarationFile = null) {
this.name = name;
this.calls = calls;
this.attributes = attributes;
this.documentation = documentation;
this.declarationFile = declarationFile;
}
pack(builder) {
const name = (this.name !== null ? builder.createString(this.name) : 0);
const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
return Service.createService(builder, name, calls, attributes, documentation, declarationFile);
}
}

View File

@ -0,0 +1,201 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { KeyValue, KeyValueT } from '../reflection/key-value.js';
import { RPCCall, RPCCallT } from '../reflection/rpccall.js';
export class Service {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Service {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
calls(index: number, obj?:RPCCall):RPCCall|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new RPCCall()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
callsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
attributes(index: number, obj?:KeyValue):KeyValue|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
attributesLength():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
documentation(index: number):string
documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
}
documentationLength():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
/**
* File that this Service is declared in.
*/
declarationFile():string|null
declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
declarationFile(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;
}
static getFullyQualifiedName():string {
return 'reflection_Service';
}
static startService(builder:flatbuffers.Builder) {
builder.startObject(5);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addCalls(builder:flatbuffers.Builder, callsOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, callsOffset, 0);
}
static createCallsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startCallsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, attributesOffset, 0);
}
static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, documentationOffset, 0);
}
static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, declarationFileOffset, 0);
}
static endService(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 4) // name
return offset;
}
static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, callsOffset:flatbuffers.Offset, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
Service.startService(builder);
Service.addName(builder, nameOffset);
Service.addCalls(builder, callsOffset);
Service.addAttributes(builder, attributesOffset);
Service.addDocumentation(builder, documentationOffset);
Service.addDeclarationFile(builder, declarationFileOffset);
return Service.endService(builder);
}
unpack(): ServiceT {
return new ServiceT(
this.name(),
this.bb!.createObjList(this.calls.bind(this), this.callsLength()),
this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
this.declarationFile()
);
}
unpackTo(_o: ServiceT): void {
_o.name = this.name();
_o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength());
_o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
_o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
_o.declarationFile = this.declarationFile();
}
}
export class ServiceT {
constructor(
public name: string|Uint8Array|null = null,
public calls: (RPCCallT)[] = [],
public attributes: (KeyValueT)[] = [],
public documentation: (string)[] = [],
public declarationFile: string|Uint8Array|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
return Service.createService(builder,
name,
calls,
attributes,
documentation,
declarationFile
);
}
}

161
tests/ts/reflection/type.js Normal file
View File

@ -0,0 +1,161 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { BaseType } from '../reflection/base-type.js';
export class Type {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsType(bb, obj) {
return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsType(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
baseType() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
}
mutate_base_type(value) {
const offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb.writeInt8(this.bb_pos + offset, value);
return true;
}
element() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
}
mutate_element(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;
}
index() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
}
mutate_index(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
fixedLength() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_fixed_length(value) {
const offset = this.bb.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
/**
* The size (octets) of the `base_type` field.
*/
baseSize() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readUint32(this.bb_pos + offset) : 4;
}
mutate_base_size(value) {
const offset = this.bb.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb.writeUint32(this.bb_pos + offset, value);
return true;
}
/**
* The size (octets) of the `element` field, if present.
*/
elementSize() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
}
mutate_element_size(value) {
const offset = this.bb.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb.writeUint32(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'reflection_Type';
}
static startType(builder) {
builder.startObject(6);
}
static addBaseType(builder, baseType) {
builder.addFieldInt8(0, baseType, BaseType.None);
}
static addElement(builder, element) {
builder.addFieldInt8(1, element, BaseType.None);
}
static addIndex(builder, index) {
builder.addFieldInt32(2, index, -1);
}
static addFixedLength(builder, fixedLength) {
builder.addFieldInt16(3, fixedLength, 0);
}
static addBaseSize(builder, baseSize) {
builder.addFieldInt32(4, baseSize, 4);
}
static addElementSize(builder, elementSize) {
builder.addFieldInt32(5, elementSize, 0);
}
static endType(builder) {
const offset = builder.endObject();
return offset;
}
static createType(builder, baseType, element, index, fixedLength, baseSize, elementSize) {
Type.startType(builder);
Type.addBaseType(builder, baseType);
Type.addElement(builder, element);
Type.addIndex(builder, index);
Type.addFixedLength(builder, fixedLength);
Type.addBaseSize(builder, baseSize);
Type.addElementSize(builder, elementSize);
return Type.endType(builder);
}
unpack() {
return new TypeT(this.baseType(), this.element(), this.index(), this.fixedLength(), this.baseSize(), this.elementSize());
}
unpackTo(_o) {
_o.baseType = this.baseType();
_o.element = this.element();
_o.index = this.index();
_o.fixedLength = this.fixedLength();
_o.baseSize = this.baseSize();
_o.elementSize = this.elementSize();
}
}
export class TypeT {
constructor(baseType = BaseType.None, element = BaseType.None, index = -1, fixedLength = 0, baseSize = 4, elementSize = 0) {
this.baseType = baseType;
this.element = element;
this.index = index;
this.fixedLength = fixedLength;
this.baseSize = baseSize;
this.elementSize = elementSize;
}
pack(builder) {
return Type.createType(builder, this.baseType, this.element, this.index, this.fixedLength, this.baseSize, this.elementSize);
}
}

219
tests/ts/reflection/type.ts Normal file
View File

@ -0,0 +1,219 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { BaseType } from '../reflection/base-type.js';
export class Type {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Type {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
baseType():BaseType {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
}
mutate_base_type(value:BaseType):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb!.writeInt8(this.bb_pos + offset, value);
return true;
}
element():BaseType {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
}
mutate_element(value:BaseType):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;
}
index():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
}
mutate_index(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
fixedLength():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}
mutate_fixed_length(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb!.writeUint16(this.bb_pos + offset, value);
return true;
}
/**
* The size (octets) of the `base_type` field.
*/
baseSize():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 4;
}
mutate_base_size(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb!.writeUint32(this.bb_pos + offset, value);
return true;
}
/**
* The size (octets) of the `element` field, if present.
*/
elementSize():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}
mutate_element_size(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb!.writeUint32(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName():string {
return 'reflection_Type';
}
static startType(builder:flatbuffers.Builder) {
builder.startObject(6);
}
static addBaseType(builder:flatbuffers.Builder, baseType:BaseType) {
builder.addFieldInt8(0, baseType, BaseType.None);
}
static addElement(builder:flatbuffers.Builder, element:BaseType) {
builder.addFieldInt8(1, element, BaseType.None);
}
static addIndex(builder:flatbuffers.Builder, index:number) {
builder.addFieldInt32(2, index, -1);
}
static addFixedLength(builder:flatbuffers.Builder, fixedLength:number) {
builder.addFieldInt16(3, fixedLength, 0);
}
static addBaseSize(builder:flatbuffers.Builder, baseSize:number) {
builder.addFieldInt32(4, baseSize, 4);
}
static addElementSize(builder:flatbuffers.Builder, elementSize:number) {
builder.addFieldInt32(5, elementSize, 0);
}
static endType(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createType(builder:flatbuffers.Builder, baseType:BaseType, element:BaseType, index:number, fixedLength:number, baseSize:number, elementSize:number):flatbuffers.Offset {
Type.startType(builder);
Type.addBaseType(builder, baseType);
Type.addElement(builder, element);
Type.addIndex(builder, index);
Type.addFixedLength(builder, fixedLength);
Type.addBaseSize(builder, baseSize);
Type.addElementSize(builder, elementSize);
return Type.endType(builder);
}
unpack(): TypeT {
return new TypeT(
this.baseType(),
this.element(),
this.index(),
this.fixedLength(),
this.baseSize(),
this.elementSize()
);
}
unpackTo(_o: TypeT): void {
_o.baseType = this.baseType();
_o.element = this.element();
_o.index = this.index();
_o.fixedLength = this.fixedLength();
_o.baseSize = this.baseSize();
_o.elementSize = this.elementSize();
}
}
export class TypeT {
constructor(
public baseType: BaseType = BaseType.None,
public element: BaseType = BaseType.None,
public index: number = -1,
public fixedLength: number = 0,
public baseSize: number = 4,
public elementSize: number = 0
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return Type.createType(builder,
this.baseType,
this.element,
this.index,
this.fixedLength,
this.baseSize,
this.elementSize
);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var class_;
(function (class_) {
class_[class_["new_"] = 0] = "new_";
class_[class_["instanceof_"] = 1] = "instanceof_";
})(class_ || (class_ = {}));

View File

@ -0,0 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum class_ {
new_ = 0,
instanceof_ = 1
}

View File

@ -0,0 +1,166 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Abc } from '../foobar/abc.js';
import { class_ as foobar_class_ } from '../foobar/class.js';
import { Schema } from '../reflection/schema.js';
import { class_ } from '../typescript/class.js';
export class Object_ {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsObject(bb, obj) {
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsObject(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
return_() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
mutate_return(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;
}
if_() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
mutate_if(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
switch_() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
mutate_switch(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
enum_() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readInt32(this.bb_pos + offset) : class_.new_;
}
mutate_enum(value) {
const offset = this.bb.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
enum2() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readInt32(this.bb_pos + offset) : foobar_class_.arguments_;
}
mutate_enum2(value) {
const offset = this.bb.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
enum3() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readInt32(this.bb_pos + offset) : Abc.a;
}
mutate_enum3(value) {
const offset = this.bb.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
reflect(obj) {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? (obj || new Schema()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
static getFullyQualifiedName() {
return 'typescript_Object';
}
static startObject(builder) {
builder.startObject(7);
}
static addReturn(builder, return_) {
builder.addFieldInt32(0, return_, 0);
}
static addIf(builder, if_) {
builder.addFieldInt32(1, if_, 0);
}
static addSwitch(builder, switch_) {
builder.addFieldInt32(2, switch_, 0);
}
static addEnum(builder, enum_) {
builder.addFieldInt32(3, enum_, class_.new_);
}
static addEnum2(builder, enum2) {
builder.addFieldInt32(4, enum2, foobar_class_.arguments_);
}
static addEnum3(builder, enum3) {
builder.addFieldInt32(5, enum3, Abc.a);
}
static addReflect(builder, reflectOffset) {
builder.addFieldOffset(6, reflectOffset, 0);
}
static endObject(builder) {
const offset = builder.endObject();
return offset;
}
unpack() {
return new Object_T(this.return_(), this.if_(), this.switch_(), this.enum_(), this.enum2(), this.enum3(), (this.reflect() !== null ? this.reflect().unpack() : null));
}
unpackTo(_o) {
_o.return_ = this.return_();
_o.if_ = this.if_();
_o.switch_ = this.switch_();
_o.enum_ = this.enum_();
_o.enum2 = this.enum2();
_o.enum3 = this.enum3();
_o.reflect = (this.reflect() !== null ? this.reflect().unpack() : null);
}
}
export class Object_T {
constructor(return_ = 0, if_ = 0, switch_ = 0, enum_ = class_.new_, enum2 = foobar_class_.arguments_, enum3 = Abc.a, reflect = null) {
this.return_ = return_;
this.if_ = if_;
this.switch_ = switch_;
this.enum_ = enum_;
this.enum2 = enum2;
this.enum3 = enum3;
this.reflect = reflect;
}
pack(builder) {
const reflect = (this.reflect !== null ? this.reflect.pack(builder) : 0);
Object_.startObject(builder);
Object_.addReturn(builder, this.return_);
Object_.addIf(builder, this.if_);
Object_.addSwitch(builder, this.switch_);
Object_.addEnum(builder, this.enum_);
Object_.addEnum2(builder, this.enum2);
Object_.addEnum3(builder, this.enum3);
Object_.addReflect(builder, reflect);
return Object_.endObject(builder);
}
}

View File

@ -0,0 +1,222 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Abc } from '../foobar/abc.js';
import { class_ as foobar_class_ } from '../foobar/class.js';
import { Schema, SchemaT } from '../reflection/schema.js';
import { class_ } from '../typescript/class.js';
export class Object_ {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
return_():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
mutate_return(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;
}
if_():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
mutate_if(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
switch_():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
mutate_switch(value:number):boolean {
const offset = this.bb!.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
enum_():class_ {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : class_.new_;
}
mutate_enum(value:class_):boolean {
const offset = this.bb!.__offset(this.bb_pos, 10);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
enum2():foobar_class_ {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : foobar_class_.arguments_;
}
mutate_enum2(value:foobar_class_):boolean {
const offset = this.bb!.__offset(this.bb_pos, 12);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
enum3():Abc {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
}
mutate_enum3(value:Abc):boolean {
const offset = this.bb!.__offset(this.bb_pos, 14);
if (offset === 0) {
return false;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
reflect(obj?:Schema):Schema|null {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? (obj || new Schema()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}
static getFullyQualifiedName():string {
return 'typescript_Object';
}
static startObject(builder:flatbuffers.Builder) {
builder.startObject(7);
}
static addReturn(builder:flatbuffers.Builder, return_:number) {
builder.addFieldInt32(0, return_, 0);
}
static addIf(builder:flatbuffers.Builder, if_:number) {
builder.addFieldInt32(1, if_, 0);
}
static addSwitch(builder:flatbuffers.Builder, switch_:number) {
builder.addFieldInt32(2, switch_, 0);
}
static addEnum(builder:flatbuffers.Builder, enum_:class_) {
builder.addFieldInt32(3, enum_, class_.new_);
}
static addEnum2(builder:flatbuffers.Builder, enum2:foobar_class_) {
builder.addFieldInt32(4, enum2, foobar_class_.arguments_);
}
static addEnum3(builder:flatbuffers.Builder, enum3:Abc) {
builder.addFieldInt32(5, enum3, Abc.a);
}
static addReflect(builder:flatbuffers.Builder, reflectOffset:flatbuffers.Offset) {
builder.addFieldOffset(6, reflectOffset, 0);
}
static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
unpack(): Object_T {
return new Object_T(
this.return_(),
this.if_(),
this.switch_(),
this.enum_(),
this.enum2(),
this.enum3(),
(this.reflect() !== null ? this.reflect()!.unpack() : null)
);
}
unpackTo(_o: Object_T): void {
_o.return_ = this.return_();
_o.if_ = this.if_();
_o.switch_ = this.switch_();
_o.enum_ = this.enum_();
_o.enum2 = this.enum2();
_o.enum3 = this.enum3();
_o.reflect = (this.reflect() !== null ? this.reflect()!.unpack() : null);
}
}
export class Object_T {
constructor(
public return_: number = 0,
public if_: number = 0,
public switch_: number = 0,
public enum_: class_ = class_.new_,
public enum2: foobar_class_ = foobar_class_.arguments_,
public enum3: Abc = Abc.a,
public reflect: SchemaT|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const reflect = (this.reflect !== null ? this.reflect!.pack(builder) : 0);
Object_.startObject(builder);
Object_.addReturn(builder, this.return_);
Object_.addIf(builder, this.if_);
Object_.addSwitch(builder, this.switch_);
Object_.addEnum(builder, this.enum_);
Object_.addEnum2(builder, this.enum2);
Object_.addEnum3(builder, this.enum3);
Object_.addReflect(builder, reflect);
return Object_.endObject(builder);
}
}

View File

@ -0,0 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
export var class_;
(function (class_) {
class_[class_["arguments_"] = 0] = "arguments_";
})(class_ || (class_ = {}));

View File

@ -0,0 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
export enum class_ {
arguments_ = 0
}

Some files were not shown because too many files have changed in this diff Show More