mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 14:46:26 +00:00
[TS/JS] Entry point per namespace and reworked 1.x compatible single file build (#7510)
* [TS/JS] Entry point per namespace * Fix handling of outputpath and array_test * Attempt to fix generate_code * Fix cwd for ts in generate_code * Attempt to fixup bazel and some docs * Add --ts-flat-files to bazel build to get bundle * Move to DEFAULT_FLATC_TS_ARGS * Attempt to add esbuild * Attempt to use npm instead * Remove futile attempt to add esbuild * Attempt to as bazel esbuild * Shuffle * Upgrade bazel deps * Revert failed attempts to get bazel working * Ignore flatc tests for now * Add esbuild dependency * `package.json` Include esbuild * `WORKSPACE` Add fetching esbuild binary * Update WORKSPACE * Unfreeze Lockfile * Update WORKSPACE * Update BUILD.bazel * Rework to suggest instead of running external bundler * Add esbuild generation to test script * Prelim bundle test * Run test JavaScriptTest from flatbuffers 1.x * Deps upgrade * Clang format fix * Revert bazel changes * Fix newline * Generate with type declarations * Handle "empty" root namespace * Adjust tests for typescript_keywords.ts * Separate test procedure for old node resolution module output * Fix rel path for root level re-exports * Bazel support for esbuild-based flatc Unfortunately, we lose typing information because the new esbuild method of generating single files does not generate type information. The method used here is a bit hack-ish because it relies on parsing the console output of flatc to figure out what to do. * Try to fix bazel build for when node isn't present on host * Auto formatting fixes * Fix missing generated code Co-authored-by: Derek Bailey <derekbailey@google.com> Co-authored-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
This commit is contained in:
@@ -3,15 +3,12 @@
|
||||
import assert from 'assert';
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import {
|
||||
ArrayStructT,
|
||||
ArrayTable,
|
||||
ArrayTableT,
|
||||
InnerStructT,
|
||||
NestedStructT,
|
||||
OuterStructT,
|
||||
TestEnum,
|
||||
} from './arrays_test_complex/arrays_test_complex_generated.js';
|
||||
import { ArrayStructT } from './arrays_test_complex/my-game/example/array-struct.js'
|
||||
import { ArrayTable, ArrayTableT } from './arrays_test_complex/my-game/example/array-table.js'
|
||||
import { InnerStructT } from './arrays_test_complex/my-game/example/inner-struct.js'
|
||||
import { NestedStructT } from './arrays_test_complex/my-game/example/nested-struct.js'
|
||||
import { OuterStructT } from './arrays_test_complex/my-game/example/outer-struct.js'
|
||||
import { TestEnum } from './arrays_test_complex/my-game/example/test-enum.js'
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
BigInt.prototype.toJSON = function () {
|
||||
return this.toString();
|
||||
|
||||
367
tests/ts/JavaScriptTestv1.cjs
Normal file
367
tests/ts/JavaScriptTestv1.cjs
Normal file
@@ -0,0 +1,367 @@
|
||||
// Run this using JavaScriptTest.sh
|
||||
var assert = require('assert');
|
||||
var fs = require('fs');
|
||||
|
||||
var flatbuffers = require('../../js/flatbuffers');
|
||||
var MyGame = require(process.argv[2]).MyGame;
|
||||
|
||||
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'));
|
||||
|
||||
// Now test it:
|
||||
|
||||
var bb = new flatbuffers.ByteBuffer(data);
|
||||
testBuffer(bb);
|
||||
|
||||
// Second, let's create a FlatBuffer from scratch in JavaScript, and test it also.
|
||||
// We use an initial size of 1 to exercise the reallocation algorithm,
|
||||
// normally a size larger than the typical FlatBuffer you generate would be
|
||||
// better for performance.
|
||||
var fbb = new flatbuffers.Builder(1);
|
||||
createMonster(fbb);
|
||||
serializeAndTest(fbb);
|
||||
|
||||
// clear the builder, repeat tests
|
||||
var clearIterations = 100;
|
||||
var startingCapacity = fbb.bb.capacity();
|
||||
for (var i = 0; i < clearIterations; i++) {
|
||||
fbb.clear();
|
||||
createMonster(fbb);
|
||||
serializeAndTest(fbb);
|
||||
}
|
||||
// the capacity of our buffer shouldn't increase with the same size payload
|
||||
assert.strictEqual(fbb.bb.capacity(), startingCapacity);
|
||||
|
||||
test64bit();
|
||||
testUnicode();
|
||||
fuzzTest1();
|
||||
|
||||
console.log('FlatBuffers test: completed successfully');
|
||||
}
|
||||
|
||||
function createMonster(fbb) {
|
||||
// We set up the same values as monsterdata.json:
|
||||
|
||||
var str = fbb.createString('MyMonster');
|
||||
|
||||
var inv = MyGame.Example.Monster.createInventoryVector(fbb, [0, 1, 2, 3, 4]);
|
||||
|
||||
var fred = fbb.createString('Fred');
|
||||
MyGame.Example.Monster.startMonster(fbb);
|
||||
MyGame.Example.Monster.addName(fbb, fred);
|
||||
var mon2 = MyGame.Example.Monster.endMonster(fbb);
|
||||
|
||||
MyGame.Example.Monster.startTest4Vector(fbb, 2);
|
||||
MyGame.Example.Test.createTest(fbb, 10, 20);
|
||||
MyGame.Example.Test.createTest(fbb, 30, 40);
|
||||
var test4 = fbb.endVector();
|
||||
|
||||
var testArrayOfString = MyGame.Example.Monster.createTestarrayofstringVector(fbb, [
|
||||
fbb.createString('test1'),
|
||||
fbb.createString('test2')
|
||||
]);
|
||||
|
||||
MyGame.Example.Monster.startMonster(fbb);
|
||||
MyGame.Example.Monster.addPos(fbb, MyGame.Example.Vec3.createVec3(fbb, 1, 2, 3, 3, MyGame.Example.Color.Green, 5, 6));
|
||||
MyGame.Example.Monster.addHp(fbb, 80);
|
||||
MyGame.Example.Monster.addName(fbb, str);
|
||||
MyGame.Example.Monster.addInventory(fbb, inv);
|
||||
MyGame.Example.Monster.addTestType(fbb, MyGame.Example.Any.Monster);
|
||||
MyGame.Example.Monster.addTest(fbb, mon2);
|
||||
MyGame.Example.Monster.addTest4(fbb, test4);
|
||||
MyGame.Example.Monster.addTestarrayofstring(fbb, testArrayOfString);
|
||||
MyGame.Example.Monster.addTestbool(fbb, true);
|
||||
var mon = MyGame.Example.Monster.endMonster(fbb);
|
||||
|
||||
MyGame.Example.Monster.finishMonsterBuffer(fbb, mon);
|
||||
}
|
||||
|
||||
function serializeAndTest(fbb) {
|
||||
// Write the result to a file for debugging purposes:
|
||||
// Note that the binaries are not necessarily identical, since the JSON
|
||||
// parser may serialize in a slightly different order than the above
|
||||
// JavaScript code. They are functionally equivalent though.
|
||||
|
||||
fs.writeFileSync('monsterdata_javascript_wire.mon', new Buffer(fbb.asUint8Array()));
|
||||
|
||||
// Tests mutation first. This will verify that we did not trample any other
|
||||
// part of the byte buffer.
|
||||
testMutation(fbb.dataBuffer());
|
||||
|
||||
testBuffer(fbb.dataBuffer());
|
||||
}
|
||||
|
||||
function testMutation(bb) {
|
||||
var monster = MyGame.Example.Monster.getRootAsMonster(bb);
|
||||
|
||||
monster.mutate_hp(120);
|
||||
assert.strictEqual(monster.hp(), 120);
|
||||
|
||||
monster.mutate_hp(80);
|
||||
assert.strictEqual(monster.hp(), 80);
|
||||
|
||||
var manaRes = monster.mutate_mana(10);
|
||||
assert.strictEqual(manaRes, false); // Field was NOT present, because default value.
|
||||
|
||||
// TODO: There is not the availability to mutate structs or vectors.
|
||||
}
|
||||
|
||||
function testBuffer(bb) {
|
||||
assert.ok(MyGame.Example.Monster.bufferHasIdentifier(bb));
|
||||
|
||||
var monster = MyGame.Example.Monster.getRootAsMonster(bb);
|
||||
|
||||
assert.strictEqual(monster.hp(), 80);
|
||||
assert.strictEqual(monster.mana(), 150); // default
|
||||
|
||||
assert.strictEqual(monster.name(), 'MyMonster');
|
||||
|
||||
var pos = monster.pos();
|
||||
assert.strictEqual(pos.x(), 1);
|
||||
assert.strictEqual(pos.y(), 2);
|
||||
assert.strictEqual(pos.z(), 3);
|
||||
assert.strictEqual(pos.test1(), 3);
|
||||
assert.strictEqual(pos.test2(), MyGame.Example.Color.Green);
|
||||
var t = pos.test3();
|
||||
assert.strictEqual(t.a(), 5);
|
||||
assert.strictEqual(t.b(), 6);
|
||||
|
||||
assert.strictEqual(monster.testType(), MyGame.Example.Any.Monster);
|
||||
var monster2 = new MyGame.Example.Monster();
|
||||
assert.strictEqual(monster.test(monster2) != null, true);
|
||||
assert.strictEqual(monster2.name(), 'Fred');
|
||||
|
||||
assert.strictEqual(monster.inventoryLength(), 5);
|
||||
var invsum = 0;
|
||||
for (var i = 0; i < monster.inventoryLength(); i++) {
|
||||
invsum += monster.inventory(i);
|
||||
}
|
||||
assert.strictEqual(invsum, 10);
|
||||
|
||||
var invsum2 = 0;
|
||||
var invArr = monster.inventoryArray();
|
||||
for (var i = 0; i < invArr.length; i++) {
|
||||
invsum2 += invArr[i];
|
||||
}
|
||||
assert.strictEqual(invsum2, 10);
|
||||
|
||||
var test_0 = monster.test4(0);
|
||||
var test_1 = monster.test4(1);
|
||||
assert.strictEqual(monster.test4Length(), 2);
|
||||
assert.strictEqual(test_0.a() + test_0.b() + test_1.a() + test_1.b(), 100);
|
||||
|
||||
assert.strictEqual(monster.testarrayofstringLength(), 2);
|
||||
assert.strictEqual(monster.testarrayofstring(0), 'test1');
|
||||
assert.strictEqual(monster.testarrayofstring(1), 'test2');
|
||||
|
||||
assert.strictEqual(monster.testbool(), true);
|
||||
}
|
||||
|
||||
function test64bit() {
|
||||
var fbb = new flatbuffers.Builder();
|
||||
var required = fbb.createString('required');
|
||||
|
||||
MyGame.Example.Stat.startStat(fbb);
|
||||
var stat2 = MyGame.Example.Stat.endStat(fbb);
|
||||
|
||||
MyGame.Example.Monster.startMonster(fbb);
|
||||
MyGame.Example.Monster.addName(fbb, required);
|
||||
MyGame.Example.Monster.addTestempty(fbb, stat2);
|
||||
var mon2 = MyGame.Example.Monster.endMonster(fbb);
|
||||
|
||||
MyGame.Example.Stat.startStat(fbb);
|
||||
MyGame.Example.Stat.addVal(fbb, 0x2345678987654321n);
|
||||
var stat = MyGame.Example.Stat.endStat(fbb);
|
||||
|
||||
MyGame.Example.Monster.startMonster(fbb);
|
||||
MyGame.Example.Monster.addName(fbb, required);
|
||||
MyGame.Example.Monster.addEnemy(fbb, mon2);
|
||||
MyGame.Example.Monster.addTestempty(fbb, stat);
|
||||
var mon = MyGame.Example.Monster.endMonster(fbb);
|
||||
|
||||
MyGame.Example.Monster.finishMonsterBuffer(fbb, mon);
|
||||
var bytes = fbb.asUint8Array();
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
var bb = new flatbuffers.ByteBuffer(bytes);
|
||||
assert.ok(MyGame.Example.Monster.bufferHasIdentifier(bb));
|
||||
var mon = MyGame.Example.Monster.getRootAsMonster(bb);
|
||||
|
||||
var stat = mon.testempty();
|
||||
assert.strictEqual(stat != null, true);
|
||||
assert.strictEqual(stat.val() != null, true);
|
||||
assert.strictEqual(stat.val(), 2541551405100253985n);
|
||||
|
||||
var mon2 = mon.enemy();
|
||||
assert.strictEqual(mon2 != null, true);
|
||||
stat = mon2.testempty();
|
||||
assert.strictEqual(stat != null, true);
|
||||
assert.strictEqual(stat.val() != null, true);
|
||||
assert.strictEqual(stat.val(), 0n); // default value
|
||||
}
|
||||
|
||||
function testUnicode() {
|
||||
var correct = fs.readFileSync('unicode_test.mon');
|
||||
var json = JSON.parse(fs.readFileSync('../unicode_test.json', 'utf8'));
|
||||
|
||||
// Test reading
|
||||
function testReadingUnicode(bb) {
|
||||
var monster = MyGame.Example.Monster.getRootAsMonster(bb);
|
||||
assert.strictEqual(monster.name(), json.name);
|
||||
assert.deepEqual(new Buffer(monster.name(flatbuffers.Encoding.UTF8_BYTES)), new Buffer(json.name));
|
||||
assert.strictEqual(monster.testarrayoftablesLength(), json.testarrayoftables.length);
|
||||
json.testarrayoftables.forEach(function(table, i) {
|
||||
var value = monster.testarrayoftables(i);
|
||||
assert.strictEqual(value.name(), table.name);
|
||||
assert.deepEqual(new Buffer(value.name(flatbuffers.Encoding.UTF8_BYTES)), new Buffer(table.name));
|
||||
});
|
||||
assert.strictEqual(monster.testarrayofstringLength(), json.testarrayofstring.length);
|
||||
json.testarrayofstring.forEach(function(string, i) {
|
||||
assert.strictEqual(monster.testarrayofstring(i), string);
|
||||
assert.deepEqual(new Buffer(monster.testarrayofstring(i, flatbuffers.Encoding.UTF8_BYTES)), new Buffer(string));
|
||||
});
|
||||
}
|
||||
testReadingUnicode(new flatbuffers.ByteBuffer(new Uint8Array(correct)));
|
||||
|
||||
// Test writing
|
||||
var fbb = new flatbuffers.Builder();
|
||||
var name = fbb.createString(json.name);
|
||||
var testarrayoftablesOffsets = json.testarrayoftables.map(function(table) {
|
||||
var name = fbb.createString(new Uint8Array(new Buffer(table.name)));
|
||||
MyGame.Example.Monster.startMonster(fbb);
|
||||
MyGame.Example.Monster.addName(fbb, name);
|
||||
return MyGame.Example.Monster.endMonster(fbb);
|
||||
});
|
||||
var testarrayoftablesOffset = MyGame.Example.Monster.createTestarrayoftablesVector(fbb,
|
||||
testarrayoftablesOffsets);
|
||||
var testarrayofstringOffset = MyGame.Example.Monster.createTestarrayofstringVector(fbb,
|
||||
json.testarrayofstring.map(function(string) { return fbb.createString(string); }));
|
||||
MyGame.Example.Monster.startMonster(fbb);
|
||||
MyGame.Example.Monster.addTestarrayofstring(fbb, testarrayofstringOffset);
|
||||
MyGame.Example.Monster.addTestarrayoftables(fbb, testarrayoftablesOffset);
|
||||
MyGame.Example.Monster.addName(fbb, name);
|
||||
MyGame.Example.Monster.finishSizePrefixedMonsterBuffer(fbb, MyGame.Example.Monster.endMonster(fbb));
|
||||
var bb = new flatbuffers.ByteBuffer(fbb.asUint8Array())
|
||||
bb.setPosition(4);
|
||||
testReadingUnicode(bb);
|
||||
}
|
||||
|
||||
var __imul = Math.imul ? Math.imul : function(a, b) {
|
||||
var ah = a >> 16 & 65535;
|
||||
var bh = b >> 16 & 65535;
|
||||
var al = a & 65535;
|
||||
var bl = b & 65535;
|
||||
return al * bl + (ah * bl + al * bh << 16) | 0;
|
||||
};
|
||||
|
||||
// Include simple random number generator to ensure results will be the
|
||||
// same cross platform.
|
||||
// http://en.wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator
|
||||
var lcg_seed = 48271;
|
||||
|
||||
function lcg_rand() {
|
||||
return lcg_seed = (__imul(lcg_seed, 279470273) >>> 0) % 4294967291;
|
||||
}
|
||||
|
||||
function lcg_reset() {
|
||||
lcg_seed = 48271;
|
||||
}
|
||||
|
||||
// Converts a Field ID to a virtual table offset.
|
||||
function fieldIndexToOffset(field_id) {
|
||||
// Should correspond to what EndTable() below builds up.
|
||||
var fixed_fields = 2; // Vtable size and Object Size.
|
||||
return (field_id + fixed_fields) * 2;
|
||||
}
|
||||
|
||||
// Low level stress/fuzz test: serialize/deserialize a variety of
|
||||
// different kinds of data in different combinations
|
||||
function fuzzTest1() {
|
||||
|
||||
// Values we're testing against: chosen to ensure no bits get chopped
|
||||
// off anywhere, and also be different from eachother.
|
||||
var bool_val = true;
|
||||
var char_val = -127; // 0x81
|
||||
var uchar_val = 0xFF;
|
||||
var short_val = -32222; // 0x8222;
|
||||
var ushort_val = 0xFEEE;
|
||||
var int_val = 0x83333333 | 0;
|
||||
var uint_val = 0xFDDDDDDD;
|
||||
var long_val = BigInt.asIntN(64, 0x8444444444444444n);
|
||||
var ulong_val = BigInt.asUintN(64, 0xFCCCCCCCCCCCCCCCn);
|
||||
var float_val = new Float32Array([3.14159])[0];
|
||||
var double_val = 3.14159265359;
|
||||
|
||||
var test_values_max = 11;
|
||||
var fields_per_object = 4;
|
||||
var num_fuzz_objects = 10000; // The higher, the more thorough :)
|
||||
|
||||
var builder = new flatbuffers.Builder();
|
||||
|
||||
lcg_reset(); // Keep it deterministic.
|
||||
|
||||
var objects = [];
|
||||
|
||||
// Generate num_fuzz_objects random objects each consisting of
|
||||
// fields_per_object fields, each of a random type.
|
||||
for (var i = 0; i < num_fuzz_objects; i++) {
|
||||
builder.startObject(fields_per_object);
|
||||
for (var f = 0; f < fields_per_object; f++) {
|
||||
var choice = lcg_rand() % test_values_max;
|
||||
switch (choice) {
|
||||
case 0: builder.addFieldInt8(f, bool_val, 0); break;
|
||||
case 1: builder.addFieldInt8(f, char_val, 0); break;
|
||||
case 2: builder.addFieldInt8(f, uchar_val, 0); break;
|
||||
case 3: builder.addFieldInt16(f, short_val, 0); break;
|
||||
case 4: builder.addFieldInt16(f, ushort_val, 0); break;
|
||||
case 5: builder.addFieldInt32(f, int_val, 0); break;
|
||||
case 6: builder.addFieldInt32(f, uint_val, 0); break;
|
||||
case 7: builder.addFieldInt64(f, long_val, 0n); break;
|
||||
case 8: builder.addFieldInt64(f, ulong_val, 0n); break;
|
||||
case 9: builder.addFieldFloat32(f, float_val, 0); break;
|
||||
case 10: builder.addFieldFloat64(f, double_val, 0); break;
|
||||
}
|
||||
}
|
||||
objects.push(builder.endObject());
|
||||
}
|
||||
builder.prep(8, 0); // Align whole buffer.
|
||||
|
||||
lcg_reset(); // Reset.
|
||||
|
||||
builder.finish(objects[objects.length - 1]);
|
||||
var bytes = new Uint8Array(builder.asUint8Array());
|
||||
var view = new DataView(bytes.buffer);
|
||||
|
||||
// Test that all objects we generated are readable and return the
|
||||
// expected values. We generate random objects in the same order
|
||||
// so this is deterministic.
|
||||
for (var i = 0; i < num_fuzz_objects; i++) {
|
||||
var offset = bytes.length - objects[i];
|
||||
for (var f = 0; f < fields_per_object; f++) {
|
||||
var choice = lcg_rand() % test_values_max;
|
||||
var vtable_offset = fieldIndexToOffset(f);
|
||||
var vtable = offset - view.getInt32(offset, true);
|
||||
assert.ok(vtable_offset < view.getInt16(vtable, true));
|
||||
var field_offset = offset + view.getInt16(vtable + vtable_offset, true);
|
||||
switch (choice) {
|
||||
case 0: assert.strictEqual(!!view.getInt8(field_offset), bool_val); break;
|
||||
case 1: assert.strictEqual(view.getInt8(field_offset), char_val); break;
|
||||
case 2: assert.strictEqual(view.getUint8(field_offset), uchar_val); break;
|
||||
case 3: assert.strictEqual(view.getInt16(field_offset, true), short_val); break;
|
||||
case 4: assert.strictEqual(view.getUint16(field_offset, true), ushort_val); break;
|
||||
case 5: assert.strictEqual(view.getInt32(field_offset, true), int_val); break;
|
||||
case 6: assert.strictEqual(view.getUint32(field_offset, true), uint_val); break;
|
||||
case 7: assert.strictEqual(view.getBigInt64(field_offset, true), long_val); break;
|
||||
case 8: assert.strictEqual(view.getBigUint64(field_offset, true), ulong_val); break;
|
||||
case 9: assert.strictEqual(view.getFloat32(field_offset, true), float_val); break;
|
||||
case 10: assert.strictEqual(view.getFloat64(field_offset, true), double_val); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -44,6 +44,7 @@ def check_call(args, cwd=tests_path):
|
||||
|
||||
# Execute the flatc compiler with the specified parameters
|
||||
def flatc(options, schema, prefix=None, include=None, data=None, cwd=tests_path):
|
||||
print("Invoking flatc on schema " + str(schema))
|
||||
cmd = [str(flatc_path)] + options
|
||||
if prefix:
|
||||
cmd += ["-o"] + [prefix]
|
||||
@@ -54,17 +55,23 @@ def flatc(options, schema, prefix=None, include=None, data=None, cwd=tests_path)
|
||||
cmd += [data] if isinstance(data, str) else data
|
||||
check_call(cmd)
|
||||
|
||||
# Execute esbuild with the specified parameters
|
||||
def esbuild(input, output):
|
||||
cmd = ["esbuild", input, "--outfile=" + output]
|
||||
cmd += ["--format=cjs", "--bundle", "--external:flatbuffers"]
|
||||
check_call(cmd)
|
||||
|
||||
print("Removing node_modules/ directory...")
|
||||
shutil.rmtree(Path(tests_path, "node_modules"), ignore_errors=True)
|
||||
|
||||
check_call(["npm", "install", "--silent"])
|
||||
|
||||
print("Invoking flatc...")
|
||||
flatc(
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
|
||||
schema="../monster_test.fbs",
|
||||
include="../include_test",
|
||||
)
|
||||
esbuild("monster_test.ts", "monster_test_generated.cjs")
|
||||
|
||||
flatc(
|
||||
options=["--gen-object-api", "-b"],
|
||||
@@ -74,10 +81,11 @@ flatc(
|
||||
)
|
||||
|
||||
flatc(
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
|
||||
schema="../union_vector/union_vector.fbs",
|
||||
prefix="union_vector",
|
||||
)
|
||||
esbuild("union_vector/union_vector.ts", "union_vector/union_vector_generated.cjs")
|
||||
|
||||
flatc(
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings"],
|
||||
@@ -91,31 +99,14 @@ flatc(
|
||||
)
|
||||
|
||||
flatc(
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
|
||||
schema=[
|
||||
"typescript_keywords.fbs",
|
||||
"test_dir/typescript_include.fbs",
|
||||
"test_dir/typescript_transitive_include.fbs",
|
||||
"../../reflection/reflection.fbs",
|
||||
],
|
||||
include="../../",
|
||||
)
|
||||
|
||||
flatc(
|
||||
options=["--ts", "--reflect-names", "--ts-flat-files", "--gen-name-strings", "--gen-object-api"],
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
|
||||
schema="arrays_test_complex/arrays_test_complex.fbs",
|
||||
prefix="arrays_test_complex"
|
||||
)
|
||||
esbuild("arrays_test_complex/my-game/example.ts", "arrays_test_complex/arrays_test_complex_generated.cjs")
|
||||
|
||||
flatc(
|
||||
options=[
|
||||
"--ts",
|
||||
"--reflect-names",
|
||||
"--gen-name-strings",
|
||||
"--gen-mutable",
|
||||
"--gen-object-api",
|
||||
"--ts-flat-files",
|
||||
],
|
||||
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
|
||||
schema=[
|
||||
"typescript_keywords.fbs",
|
||||
"test_dir/typescript_include.fbs",
|
||||
@@ -124,15 +115,18 @@ flatc(
|
||||
],
|
||||
include="../../",
|
||||
)
|
||||
esbuild("typescript_keywords.ts", "typescript_keywords_generated.cjs")
|
||||
|
||||
print("Running TypeScript Compiler...")
|
||||
check_call(["tsc"])
|
||||
print("Running TypeScript Compiler in old node resolution mode for no_import_ext...")
|
||||
check_call(["tsc", "-p", "./tsconfig.node.json"])
|
||||
|
||||
NODE_CMD = ["node"]
|
||||
|
||||
print("Running TypeScript Tests...")
|
||||
check_call(NODE_CMD + ["JavaScriptTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptTestv1.cjs", "./monster_test_generated.cjs"])
|
||||
check_call(NODE_CMD + ["JavaScriptUnionVectorTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptFlexBuffersTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptComplexArraysTest"])
|
||||
check_call(NODE_CMD + ["JavaScriptRequiredStringTest"])
|
||||
|
||||
451
tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs
Normal file
451
tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs
Normal file
@@ -0,0 +1,451 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// arrays_test_complex/my-game/example.ts
|
||||
var example_exports = {};
|
||||
__export(example_exports, {
|
||||
ArrayStruct: () => ArrayStruct,
|
||||
ArrayTable: () => ArrayTable,
|
||||
InnerStruct: () => InnerStruct,
|
||||
NestedStruct: () => NestedStruct,
|
||||
OuterStruct: () => OuterStruct,
|
||||
TestEnum: () => TestEnum
|
||||
});
|
||||
module.exports = __toCommonJS(example_exports);
|
||||
|
||||
// arrays_test_complex/my-game/example/inner-struct.js
|
||||
var InnerStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readFloat64(this.bb_pos);
|
||||
}
|
||||
b(index) {
|
||||
return this.bb.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
dUnderscore() {
|
||||
return this.bb.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.InnerStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 32;
|
||||
}
|
||||
static createInnerStruct(builder, a, b, c, d_underscore) {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(b?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb.createScalarList(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
};
|
||||
var InnerStructT = class {
|
||||
constructor(a = 0, b = [], c = 0, dUnderscore = BigInt("0")) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.dUnderscore = dUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/outer-struct.js
|
||||
var OuterStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return !!this.bb.readInt8(this.bb_pos);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
|
||||
}
|
||||
e(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
|
||||
}
|
||||
f(index) {
|
||||
return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.OuterStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 208;
|
||||
}
|
||||
static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
|
||||
builder.prep(8, 208);
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64(f?.[i] ?? 0);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(e_b?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat64(e_a);
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
InnerStruct.createInnerStruct(builder, item?.a, item?.b, item?.c, item?.dUnderscore);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(c_underscore_b?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new OuterStructT(this.a(), this.b(), this.cUnderscore() !== null ? this.cUnderscore().unpack() : null, this.bb.createObjList(this.d.bind(this), 3), this.e() !== null ? this.e().unpack() : null, this.bb.createScalarList(this.f.bind(this), 4));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.cUnderscore() !== null ? this.cUnderscore().unpack() : null;
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 3);
|
||||
_o.e = this.e() !== null ? this.e().unpack() : null;
|
||||
_o.f = this.bb.createScalarList(this.f.bind(this), 4);
|
||||
}
|
||||
};
|
||||
var OuterStructT = class {
|
||||
constructor(a = false, b = 0, cUnderscore = null, d = [], e = null, f = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
}
|
||||
pack(builder) {
|
||||
return OuterStruct.createOuterStruct(builder, this.a, this.b, this.cUnderscore?.a ?? 0, this.cUnderscore?.b ?? [], this.cUnderscore?.c ?? 0, this.cUnderscore?.dUnderscore ?? BigInt(0), this.d, this.e?.a ?? 0, this.e?.b ?? [], this.e?.c ?? 0, this.e?.dUnderscore ?? BigInt(0), this.f);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/test-enum.js
|
||||
var TestEnum;
|
||||
(function(TestEnum2) {
|
||||
TestEnum2[TestEnum2["A"] = 0] = "A";
|
||||
TestEnum2[TestEnum2["B"] = 1] = "B";
|
||||
TestEnum2[TestEnum2["C"] = 2] = "C";
|
||||
})(TestEnum = TestEnum || (TestEnum = {}));
|
||||
|
||||
// arrays_test_complex/my-game/example/nested-struct.js
|
||||
var NestedStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(index) {
|
||||
return this.bb.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
dOuter(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
|
||||
}
|
||||
e(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.NestedStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 1072;
|
||||
}
|
||||
static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
|
||||
builder.prep(8, 1072);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, item?.cUnderscore?.a ?? 0, item?.cUnderscore?.b ?? [], item?.cUnderscore?.c ?? 0, item?.cUnderscore?.dUnderscore ?? BigInt(0), item?.d, item?.e?.a ?? 0, item?.e?.b ?? [], item?.e?.c ?? 0, item?.e?.dUnderscore ?? BigInt(0), item?.f);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8(c_underscore?.[i] ?? 0);
|
||||
}
|
||||
builder.writeInt8(b);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32(a?.[i] ?? 0);
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.bb.createScalarList(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb.createScalarList(this.e.bind(this), 2);
|
||||
}
|
||||
};
|
||||
var NestedStructT = class {
|
||||
constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.dOuter = dOuter;
|
||||
this.e = e;
|
||||
}
|
||||
pack(builder) {
|
||||
return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/array-struct.js
|
||||
var ArrayStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
bUnderscore(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
|
||||
}
|
||||
e() {
|
||||
return this.bb.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
f(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
|
||||
}
|
||||
g(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.ArrayStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 2656;
|
||||
}
|
||||
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
|
||||
builder.prep(8, 2656);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, item?.cUnderscore?.a ?? 0, item?.cUnderscore?.b ?? [], item?.cUnderscore?.c ?? 0, item?.cUnderscore?.dUnderscore ?? BigInt(0), item?.d, item?.e?.a ?? 0, item?.e?.b ?? [], item?.e?.c ?? 0, item?.e?.dUnderscore ?? BigInt(0), item?.f);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
NestedStruct.createNestedStruct(builder, item?.a, item?.b, item?.cUnderscore, item?.dOuter, item?.e);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32(b_underscore?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb.createObjList(this.f.bind(this), 2);
|
||||
_o.g = this.bb.createScalarList(this.g.bind(this), 2);
|
||||
}
|
||||
};
|
||||
var ArrayStructT = class {
|
||||
constructor(aUnderscore = 0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
|
||||
this.aUnderscore = aUnderscore;
|
||||
this.bUnderscore = bUnderscore;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
pack(builder) {
|
||||
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/array-table.js
|
||||
var flatbuffers = __toESM(require("flatbuffers"), 1);
|
||||
var ArrayTable = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsArrayTable(bb, obj) {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsArrayTable(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier("RHUB");
|
||||
}
|
||||
a(optionalEncoding) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.ArrayTable";
|
||||
}
|
||||
static startArrayTable(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder, cUnderscoreOffset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static endArrayTable(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, "RHUB");
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, "RHUB", true);
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayTableT(this.a(), this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = this.cUnderscore() !== null ? this.cUnderscore().unpack() : null;
|
||||
}
|
||||
};
|
||||
var ArrayTableT = class {
|
||||
constructor(a = null, cUnderscore = null) {
|
||||
this.a = a;
|
||||
this.cUnderscore = cUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = this.a !== null ? builder.createString(this.a) : 0;
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0);
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
};
|
||||
@@ -1,409 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export var TestEnum;
|
||||
(function (TestEnum) {
|
||||
TestEnum[TestEnum["A"] = 0] = "A";
|
||||
TestEnum[TestEnum["B"] = 1] = "B";
|
||||
TestEnum[TestEnum["C"] = 2] = "C";
|
||||
})(TestEnum || (TestEnum = {}));
|
||||
export class InnerStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readFloat64(this.bb_pos);
|
||||
}
|
||||
b(index) {
|
||||
return this.bb.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
dUnderscore() {
|
||||
return this.bb.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 32;
|
||||
}
|
||||
static createInnerStruct(builder, a, b, c, d_underscore) {
|
||||
var _a;
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore !== null && d_underscore !== void 0 ? d_underscore : 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(((_a = b === null || b === void 0 ? void 0 : b[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb.createScalarList(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
export class InnerStructT {
|
||||
constructor(a = 0.0, b = [], c = 0, dUnderscore = BigInt('0')) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.dUnderscore = dUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
|
||||
}
|
||||
}
|
||||
export class OuterStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return !!this.bb.readInt8(this.bb_pos);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
|
||||
}
|
||||
e(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
|
||||
}
|
||||
f(index) {
|
||||
return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 208;
|
||||
}
|
||||
static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
|
||||
var _a, _b, _c;
|
||||
builder.prep(8, 208);
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64(((_a = f === null || f === void 0 ? void 0 : f[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore !== null && e_d_underscore !== void 0 ? e_d_underscore : 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(((_b = e_b === null || e_b === void 0 ? void 0 : e_b[i]) !== null && _b !== void 0 ? _b : 0));
|
||||
}
|
||||
builder.writeFloat64(e_a);
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d === null || d === void 0 ? void 0 : d[i];
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
InnerStruct.createInnerStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, item === null || item === void 0 ? void 0 : item.c, item === null || item === void 0 ? void 0 : item.dUnderscore);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore !== null && c_underscore_d_underscore !== void 0 ? c_underscore_d_underscore : 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(((_c = c_underscore_b === null || c_underscore_b === void 0 ? void 0 : c_underscore_b[i]) !== null && _c !== void 0 ? _c : 0));
|
||||
}
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new OuterStructT(this.a(), this.b(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null), this.bb.createObjList(this.d.bind(this), 3), (this.e() !== null ? this.e().unpack() : null), this.bb.createScalarList(this.f.bind(this), 4));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e().unpack() : null);
|
||||
_o.f = this.bb.createScalarList(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
export class OuterStructT {
|
||||
constructor(a = false, b = 0.0, cUnderscore = null, d = [], e = null, f = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
}
|
||||
pack(builder) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s;
|
||||
return OuterStruct.createOuterStruct(builder, this.a, this.b, ((_b = (_a = this.cUnderscore) === null || _a === void 0 ? void 0 : _a.a) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.cUnderscore) === null || _c === void 0 ? void 0 : _c.b) !== null && _d !== void 0 ? _d : []), ((_f = (_e = this.cUnderscore) === null || _e === void 0 ? void 0 : _e.c) !== null && _f !== void 0 ? _f : 0), ((_h = (_g = this.cUnderscore) === null || _g === void 0 ? void 0 : _g.dUnderscore) !== null && _h !== void 0 ? _h : BigInt(0)), this.d, ((_k = (_j = this.e) === null || _j === void 0 ? void 0 : _j.a) !== null && _k !== void 0 ? _k : 0), ((_m = (_l = this.e) === null || _l === void 0 ? void 0 : _l.b) !== null && _m !== void 0 ? _m : []), ((_q = (_p = this.e) === null || _p === void 0 ? void 0 : _p.c) !== null && _q !== void 0 ? _q : 0), ((_s = (_r = this.e) === null || _r === void 0 ? void 0 : _r.dUnderscore) !== null && _s !== void 0 ? _s : BigInt(0)), this.f);
|
||||
}
|
||||
}
|
||||
export class NestedStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(index) {
|
||||
return this.bb.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
dOuter(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
|
||||
}
|
||||
e(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 1072;
|
||||
}
|
||||
static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u, _v;
|
||||
builder.prep(8, 1072);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt((_a = e === null || e === void 0 ? void 0 : e[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer === null || d_outer === void 0 ? void 0 : d_outer[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, ((_c = (_b = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _b === void 0 ? void 0 : _b.a) !== null && _c !== void 0 ? _c : 0), ((_e = (_d = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _d === void 0 ? void 0 : _d.b) !== null && _e !== void 0 ? _e : []), ((_g = (_f = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _f === void 0 ? void 0 : _f.c) !== null && _g !== void 0 ? _g : 0), ((_j = (_h = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _h === void 0 ? void 0 : _h.dUnderscore) !== null && _j !== void 0 ? _j : BigInt(0)), item === null || item === void 0 ? void 0 : item.d, ((_l = (_k = item === null || item === void 0 ? void 0 : item.e) === null || _k === void 0 ? void 0 : _k.a) !== null && _l !== void 0 ? _l : 0), ((_p = (_m = item === null || item === void 0 ? void 0 : item.e) === null || _m === void 0 ? void 0 : _m.b) !== null && _p !== void 0 ? _p : []), ((_r = (_q = item === null || item === void 0 ? void 0 : item.e) === null || _q === void 0 ? void 0 : _q.c) !== null && _r !== void 0 ? _r : 0), ((_t = (_s = item === null || item === void 0 ? void 0 : item.e) === null || _s === void 0 ? void 0 : _s.dUnderscore) !== null && _t !== void 0 ? _t : BigInt(0)), item === null || item === void 0 ? void 0 : item.f);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8(((_u = c_underscore === null || c_underscore === void 0 ? void 0 : c_underscore[i]) !== null && _u !== void 0 ? _u : 0));
|
||||
}
|
||||
builder.writeInt8(b);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32(((_v = a === null || a === void 0 ? void 0 : a[i]) !== null && _v !== void 0 ? _v : 0));
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.bb.createScalarList(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb.createScalarList(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class NestedStructT {
|
||||
constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.dOuter = dOuter;
|
||||
this.e = e;
|
||||
}
|
||||
pack(builder) {
|
||||
return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
|
||||
}
|
||||
}
|
||||
export class ArrayStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
bUnderscore(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
|
||||
}
|
||||
e() {
|
||||
return this.bb.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
f(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
|
||||
}
|
||||
g(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 2656;
|
||||
}
|
||||
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u;
|
||||
builder.prep(8, 2656);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt((_a = g === null || g === void 0 ? void 0 : g[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f === null || f === void 0 ? void 0 : f[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, ((_c = (_b = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _b === void 0 ? void 0 : _b.a) !== null && _c !== void 0 ? _c : 0), ((_e = (_d = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _d === void 0 ? void 0 : _d.b) !== null && _e !== void 0 ? _e : []), ((_g = (_f = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _f === void 0 ? void 0 : _f.c) !== null && _g !== void 0 ? _g : 0), ((_j = (_h = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _h === void 0 ? void 0 : _h.dUnderscore) !== null && _j !== void 0 ? _j : BigInt(0)), item === null || item === void 0 ? void 0 : item.d, ((_l = (_k = item === null || item === void 0 ? void 0 : item.e) === null || _k === void 0 ? void 0 : _k.a) !== null && _l !== void 0 ? _l : 0), ((_p = (_m = item === null || item === void 0 ? void 0 : item.e) === null || _m === void 0 ? void 0 : _m.b) !== null && _p !== void 0 ? _p : []), ((_r = (_q = item === null || item === void 0 ? void 0 : item.e) === null || _q === void 0 ? void 0 : _q.c) !== null && _r !== void 0 ? _r : 0), ((_t = (_s = item === null || item === void 0 ? void 0 : item.e) === null || _s === void 0 ? void 0 : _s.dUnderscore) !== null && _t !== void 0 ? _t : BigInt(0)), item === null || item === void 0 ? void 0 : item.f);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d === null || d === void 0 ? void 0 : d[i];
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
NestedStruct.createNestedStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, item === null || item === void 0 ? void 0 : item.cUnderscore, item === null || item === void 0 ? void 0 : item.dOuter, item === null || item === void 0 ? void 0 : item.e);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32(((_u = b_underscore === null || b_underscore === void 0 ? void 0 : b_underscore[i]) !== null && _u !== void 0 ? _u : 0));
|
||||
}
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb.createObjList(this.f.bind(this), 2);
|
||||
_o.g = this.bb.createScalarList(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class ArrayStructT {
|
||||
constructor(aUnderscore = 0.0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
|
||||
this.aUnderscore = aUnderscore;
|
||||
this.bUnderscore = bUnderscore;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
pack(builder) {
|
||||
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
}
|
||||
export class ArrayTable {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsArrayTable(bb, obj) {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsArrayTable(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
a(optionalEncoding) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
static startArrayTable(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder, cUnderscoreOffset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static endArrayTable(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayTableT(this.a(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class ArrayTableT {
|
||||
constructor(a = null, cUnderscore = null) {
|
||||
this.a = a;
|
||||
this.cUnderscore = cUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = (this.a !== null ? builder.createString(this.a) : 0);
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0));
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
@@ -1,626 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
export enum TestEnum {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
|
||||
export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InnerStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():number {
|
||||
return this.bb!.readFloat64(this.bb_pos);
|
||||
}
|
||||
|
||||
b(index: number):number|null {
|
||||
return this.bb!.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
|
||||
dUnderscore():bigint {
|
||||
return this.bb!.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 32;
|
||||
}
|
||||
|
||||
static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[]|null, c: number, d_underscore: bigint):flatbuffers.Offset {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): InnerStructT {
|
||||
return new InnerStructT(
|
||||
this.a(),
|
||||
this.bb!.createScalarList<number>(this.b.bind(this), 13),
|
||||
this.c(),
|
||||
this.dUnderscore()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: InnerStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb!.createScalarList<number>(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
|
||||
export class InnerStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: number = 0.0,
|
||||
public b: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public dUnderscore: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return InnerStruct.createInnerStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.c,
|
||||
this.dUnderscore
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):OuterStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():boolean {
|
||||
return !!this.bb!.readInt8(this.bb_pos);
|
||||
}
|
||||
|
||||
b():number {
|
||||
return this.bb!.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
|
||||
}
|
||||
|
||||
d(index: number, obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb!);
|
||||
}
|
||||
|
||||
e(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
|
||||
}
|
||||
|
||||
f(index: number):number|null {
|
||||
return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 208;
|
||||
}
|
||||
|
||||
static createOuterStruct(builder:flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[]|null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[]|null, e_a: number, e_b: number[]|null, e_c: number, e_d_underscore: bigint, f: number[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 208);
|
||||
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64((f?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((e_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(e_a);
|
||||
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
InnerStruct.createInnerStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.c,
|
||||
item?.dUnderscore
|
||||
);
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): OuterStructT {
|
||||
return new OuterStructT(
|
||||
this.a(),
|
||||
this.b(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null),
|
||||
this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3),
|
||||
(this.e() !== null ? this.e()!.unpack() : null),
|
||||
this.bb!.createScalarList<number>(this.f.bind(this), 4)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: OuterStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
_o.d = this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e()!.unpack() : null);
|
||||
_o.f = this.bb!.createScalarList<number>(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
|
||||
export class OuterStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: boolean = false,
|
||||
public b: number = 0.0,
|
||||
public cUnderscore: InnerStructT|null = null,
|
||||
public d: (InnerStructT)[] = [],
|
||||
public e: InnerStructT|null = null,
|
||||
public f: (number)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return OuterStruct.createOuterStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
(this.cUnderscore?.a ?? 0),
|
||||
(this.cUnderscore?.b ?? []),
|
||||
(this.cUnderscore?.c ?? 0),
|
||||
(this.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
this.d,
|
||||
(this.e?.a ?? 0),
|
||||
(this.e?.b ?? []),
|
||||
(this.e?.c ?? 0),
|
||||
(this.e?.dUnderscore ?? BigInt(0)),
|
||||
this.f
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):NestedStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
|
||||
b():TestEnum {
|
||||
return this.bb!.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(index: number):TestEnum|null {
|
||||
return this.bb!.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
|
||||
dOuter(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
e(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 1072;
|
||||
}
|
||||
|
||||
static createNestedStruct(builder:flatbuffers.Builder, a: number[]|null, b: TestEnum, c_underscore: number[]|null, d_outer: (any|OuterStructT)[]|null, e: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 1072);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(5);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeInt8(b);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32((a?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): NestedStructT {
|
||||
return new NestedStructT(
|
||||
this.bb!.createScalarList<number>(this.a.bind(this), 2),
|
||||
this.b(),
|
||||
this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5),
|
||||
this.bb!.createScalarList<bigint>(this.e.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: NestedStructT): void {
|
||||
_o.a = this.bb!.createScalarList<number>(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb!.createScalarList<bigint>(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class NestedStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: (number)[] = [],
|
||||
public b: TestEnum = TestEnum.A,
|
||||
public cUnderscore: (TestEnum)[] = [TestEnum.A, TestEnum.A],
|
||||
public dOuter: (OuterStructT)[] = [],
|
||||
public e: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return NestedStruct.createNestedStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.cUnderscore,
|
||||
this.dOuter,
|
||||
this.e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
aUnderscore():number {
|
||||
return this.bb!.readFloat32(this.bb_pos);
|
||||
}
|
||||
|
||||
bUnderscore(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
|
||||
d(index: number, obj?:NestedStruct):NestedStruct|null {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb!);
|
||||
}
|
||||
|
||||
e():number {
|
||||
return this.bb!.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
|
||||
f(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
g(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 2656;
|
||||
}
|
||||
|
||||
static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[]|null, c: number, d: (any|NestedStructT)[]|null, e: number, f: (any|OuterStructT)[]|null, g: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 2656);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
NestedStruct.createNestedStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.cUnderscore,
|
||||
item?.dOuter,
|
||||
item?.e
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayStructT {
|
||||
return new ArrayStructT(
|
||||
this.aUnderscore(),
|
||||
this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15),
|
||||
this.c(),
|
||||
this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2),
|
||||
this.e(),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2),
|
||||
this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayStructT): void {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2);
|
||||
_o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public aUnderscore: number = 0.0,
|
||||
public bUnderscore: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public d: (NestedStructT)[] = [],
|
||||
public e: number = 0,
|
||||
public f: (OuterStructT)[] = [],
|
||||
public g: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ArrayStruct.createArrayStruct(builder,
|
||||
this.aUnderscore,
|
||||
this.bUnderscore,
|
||||
this.c,
|
||||
this.d,
|
||||
this.e,
|
||||
this.f,
|
||||
this.g
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
|
||||
a():string|null
|
||||
a(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
a(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;
|
||||
}
|
||||
|
||||
cUnderscore(obj?:ArrayStruct):ArrayStruct|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
|
||||
static startArrayTable(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
|
||||
static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
|
||||
static endArrayTable(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
|
||||
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayTableT {
|
||||
return new ArrayTableT(
|
||||
this.a(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayTableT): void {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayTableT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: string|Uint8Array|null = null,
|
||||
public cUnderscore: ArrayStructT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const a = (this.a !== null ? builder.createString(this.a!) : 0);
|
||||
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
|
||||
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
|
||||
6
tests/ts/arrays_test_complex/my-game/example.d.ts
vendored
Normal file
6
tests/ts/arrays_test_complex/my-game/example.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { ArrayStruct } from './example/array-struct.js';
|
||||
export { ArrayTable } from './example/array-table.js';
|
||||
export { InnerStruct } from './example/inner-struct.js';
|
||||
export { NestedStruct } from './example/nested-struct.js';
|
||||
export { OuterStruct } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
7
tests/ts/arrays_test_complex/my-game/example.js
Normal file
7
tests/ts/arrays_test_complex/my-game/example.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { ArrayStruct } from './example/array-struct.js';
|
||||
export { ArrayTable } from './example/array-table.js';
|
||||
export { InnerStruct } from './example/inner-struct.js';
|
||||
export { NestedStruct } from './example/nested-struct.js';
|
||||
export { OuterStruct } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
8
tests/ts/arrays_test_complex/my-game/example.ts
Normal file
8
tests/ts/arrays_test_complex/my-game/example.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { ArrayStruct } from './example/array-struct.js';
|
||||
export { ArrayTable } from './example/array-table.js';
|
||||
export { InnerStruct } from './example/inner-struct.js';
|
||||
export { NestedStruct } from './example/nested-struct.js';
|
||||
export { OuterStruct } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
31
tests/ts/arrays_test_complex/my-game/example/array-struct.d.ts
vendored
Normal file
31
tests/ts/arrays_test_complex/my-game/example/array-struct.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
export declare class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ArrayStruct;
|
||||
aUnderscore(): number;
|
||||
bUnderscore(index: number): number | null;
|
||||
c(): number;
|
||||
d(index: number, obj?: NestedStruct): NestedStruct | null;
|
||||
e(): number;
|
||||
f(index: number, obj?: OuterStruct): OuterStruct | null;
|
||||
g(index: number): bigint | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createArrayStruct(builder: flatbuffers.Builder, a_underscore: number, b_underscore: number[] | null, c: number, d: (any | NestedStructT)[] | null, e: number, f: (any | OuterStructT)[] | null, g: bigint[] | null): flatbuffers.Offset;
|
||||
unpack(): ArrayStructT;
|
||||
unpackTo(_o: ArrayStructT): void;
|
||||
}
|
||||
export declare class ArrayStructT implements flatbuffers.IGeneratedObject {
|
||||
aUnderscore: number;
|
||||
bUnderscore: (number)[];
|
||||
c: number;
|
||||
d: (NestedStructT)[];
|
||||
e: number;
|
||||
f: (OuterStructT)[];
|
||||
g: (bigint)[];
|
||||
constructor(aUnderscore?: number, bUnderscore?: (number)[], c?: number, d?: (NestedStructT)[], e?: number, f?: (OuterStructT)[], g?: (bigint)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
98
tests/ts/arrays_test_complex/my-game/example/array-struct.js
Normal file
98
tests/ts/arrays_test_complex/my-game/example/array-struct.js
Normal file
@@ -0,0 +1,98 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
export class ArrayStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
bUnderscore(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
|
||||
}
|
||||
e() {
|
||||
return this.bb.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
f(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
|
||||
}
|
||||
g(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 2656;
|
||||
}
|
||||
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
|
||||
builder.prep(8, 2656);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, (item?.cUnderscore?.a ?? 0), (item?.cUnderscore?.b ?? []), (item?.cUnderscore?.c ?? 0), (item?.cUnderscore?.dUnderscore ?? BigInt(0)), item?.d, (item?.e?.a ?? 0), (item?.e?.b ?? []), (item?.e?.c ?? 0), (item?.e?.dUnderscore ?? BigInt(0)), item?.f);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
NestedStruct.createNestedStruct(builder, item?.a, item?.b, item?.cUnderscore, item?.dOuter, item?.e);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb.createObjList(this.f.bind(this), 2);
|
||||
_o.g = this.bb.createScalarList(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class ArrayStructT {
|
||||
constructor(aUnderscore = 0.0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
|
||||
this.aUnderscore = aUnderscore;
|
||||
this.bUnderscore = bUnderscore;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
pack(builder) {
|
||||
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
}
|
||||
166
tests/ts/arrays_test_complex/my-game/example/array-struct.ts
Normal file
166
tests/ts/arrays_test_complex/my-game/example/array-struct.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
|
||||
|
||||
export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
aUnderscore():number {
|
||||
return this.bb!.readFloat32(this.bb_pos);
|
||||
}
|
||||
|
||||
bUnderscore(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
|
||||
d(index: number, obj?:NestedStruct):NestedStruct|null {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb!);
|
||||
}
|
||||
|
||||
e():number {
|
||||
return this.bb!.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
|
||||
f(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
g(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 2656;
|
||||
}
|
||||
|
||||
static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[]|null, c: number, d: (any|NestedStructT)[]|null, e: number, f: (any|OuterStructT)[]|null, g: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 2656);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
NestedStruct.createNestedStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.cUnderscore,
|
||||
item?.dOuter,
|
||||
item?.e
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayStructT {
|
||||
return new ArrayStructT(
|
||||
this.aUnderscore(),
|
||||
this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15),
|
||||
this.c(),
|
||||
this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2),
|
||||
this.e(),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2),
|
||||
this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayStructT): void {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2);
|
||||
_o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public aUnderscore: number = 0.0,
|
||||
public bUnderscore: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public d: (NestedStructT)[] = [],
|
||||
public e: number = 0,
|
||||
public f: (OuterStructT)[] = [],
|
||||
public g: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ArrayStruct.createArrayStruct(builder,
|
||||
this.aUnderscore,
|
||||
this.bUnderscore,
|
||||
this.c,
|
||||
this.d,
|
||||
this.e,
|
||||
this.f,
|
||||
this.g
|
||||
);
|
||||
}
|
||||
}
|
||||
28
tests/ts/arrays_test_complex/my-game/example/array-table.d.ts
vendored
Normal file
28
tests/ts/arrays_test_complex/my-game/example/array-table.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js';
|
||||
export declare class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ArrayTable;
|
||||
static getRootAsArrayTable(bb: flatbuffers.ByteBuffer, obj?: ArrayTable): ArrayTable;
|
||||
static getSizePrefixedRootAsArrayTable(bb: flatbuffers.ByteBuffer, obj?: ArrayTable): ArrayTable;
|
||||
static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
|
||||
a(): string | null;
|
||||
a(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
cUnderscore(obj?: ArrayStruct): ArrayStruct | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startArrayTable(builder: flatbuffers.Builder): void;
|
||||
static addA(builder: flatbuffers.Builder, aOffset: flatbuffers.Offset): void;
|
||||
static addCUnderscore(builder: flatbuffers.Builder, cUnderscoreOffset: flatbuffers.Offset): void;
|
||||
static endArrayTable(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static finishArrayTableBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
static finishSizePrefixedArrayTableBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
unpack(): ArrayTableT;
|
||||
unpackTo(_o: ArrayTableT): void;
|
||||
}
|
||||
export declare class ArrayTableT implements flatbuffers.IGeneratedObject {
|
||||
a: string | Uint8Array | null;
|
||||
cUnderscore: ArrayStructT | null;
|
||||
constructor(a?: string | Uint8Array | null, cUnderscore?: ArrayStructT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
74
tests/ts/arrays_test_complex/my-game/example/array-table.js
Normal file
74
tests/ts/arrays_test_complex/my-game/example/array-table.js
Normal file
@@ -0,0 +1,74 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { ArrayStruct } from '../../my-game/example/array-struct.js';
|
||||
export class ArrayTable {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsArrayTable(bb, obj) {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsArrayTable(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
a(optionalEncoding) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
static startArrayTable(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder, cUnderscoreOffset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static endArrayTable(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayTableT(this.a(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class ArrayTableT {
|
||||
constructor(a = null, cUnderscore = null) {
|
||||
this.a = a;
|
||||
this.cUnderscore = cUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = (this.a !== null ? builder.createString(this.a) : 0);
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0));
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
102
tests/ts/arrays_test_complex/my-game/example/array-table.ts
Normal file
102
tests/ts/arrays_test_complex/my-game/example/array-table.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js';
|
||||
|
||||
|
||||
export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
|
||||
a():string|null
|
||||
a(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
a(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;
|
||||
}
|
||||
|
||||
cUnderscore(obj?:ArrayStruct):ArrayStruct|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
|
||||
static startArrayTable(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
|
||||
static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
|
||||
static endArrayTable(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
|
||||
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayTableT {
|
||||
return new ArrayTableT(
|
||||
this.a(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayTableT): void {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayTableT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: string|Uint8Array|null = null,
|
||||
public cUnderscore: ArrayStructT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const a = (this.a !== null ? builder.createString(this.a!) : 0);
|
||||
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
|
||||
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
23
tests/ts/arrays_test_complex/my-game/example/inner-struct.d.ts
vendored
Normal file
23
tests/ts/arrays_test_complex/my-game/example/inner-struct.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): InnerStruct;
|
||||
a(): number;
|
||||
b(index: number): number | null;
|
||||
c(): number;
|
||||
dUnderscore(): bigint;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createInnerStruct(builder: flatbuffers.Builder, a: number, b: number[] | null, c: number, d_underscore: bigint): flatbuffers.Offset;
|
||||
unpack(): InnerStructT;
|
||||
unpackTo(_o: InnerStructT): void;
|
||||
}
|
||||
export declare class InnerStructT implements flatbuffers.IGeneratedObject {
|
||||
a: number;
|
||||
b: (number)[];
|
||||
c: number;
|
||||
dUnderscore: bigint;
|
||||
constructor(a?: number, b?: (number)[], c?: number, dUnderscore?: bigint);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
61
tests/ts/arrays_test_complex/my-game/example/inner-struct.js
Normal file
61
tests/ts/arrays_test_complex/my-game/example/inner-struct.js
Normal file
@@ -0,0 +1,61 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export class InnerStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readFloat64(this.bb_pos);
|
||||
}
|
||||
b(index) {
|
||||
return this.bb.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
dUnderscore() {
|
||||
return this.bb.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 32;
|
||||
}
|
||||
static createInnerStruct(builder, a, b, c, d_underscore) {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((b?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb.createScalarList(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
export class InnerStructT {
|
||||
constructor(a = 0.0, b = [], c = 0, dUnderscore = BigInt('0')) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.dUnderscore = dUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
|
||||
}
|
||||
}
|
||||
91
tests/ts/arrays_test_complex/my-game/example/inner-struct.ts
Normal file
91
tests/ts/arrays_test_complex/my-game/example/inner-struct.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
|
||||
export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InnerStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():number {
|
||||
return this.bb!.readFloat64(this.bb_pos);
|
||||
}
|
||||
|
||||
b(index: number):number|null {
|
||||
return this.bb!.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
|
||||
dUnderscore():bigint {
|
||||
return this.bb!.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 32;
|
||||
}
|
||||
|
||||
static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[]|null, c: number, d_underscore: bigint):flatbuffers.Offset {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): InnerStructT {
|
||||
return new InnerStructT(
|
||||
this.a(),
|
||||
this.bb!.createScalarList<number>(this.b.bind(this), 13),
|
||||
this.c(),
|
||||
this.dUnderscore()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: InnerStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb!.createScalarList<number>(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
|
||||
export class InnerStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: number = 0.0,
|
||||
public b: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public dUnderscore: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return InnerStruct.createInnerStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.c,
|
||||
this.dUnderscore
|
||||
);
|
||||
}
|
||||
}
|
||||
27
tests/ts/arrays_test_complex/my-game/example/nested-struct.d.ts
vendored
Normal file
27
tests/ts/arrays_test_complex/my-game/example/nested-struct.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
import { TestEnum } from '../../my-game/example/test-enum.js';
|
||||
export declare class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): NestedStruct;
|
||||
a(index: number): number | null;
|
||||
b(): TestEnum;
|
||||
cUnderscore(index: number): TestEnum | null;
|
||||
dOuter(index: number, obj?: OuterStruct): OuterStruct | null;
|
||||
e(index: number): bigint | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createNestedStruct(builder: flatbuffers.Builder, a: number[] | null, b: TestEnum, c_underscore: number[] | null, d_outer: (any | OuterStructT)[] | null, e: bigint[] | null): flatbuffers.Offset;
|
||||
unpack(): NestedStructT;
|
||||
unpackTo(_o: NestedStructT): void;
|
||||
}
|
||||
export declare class NestedStructT implements flatbuffers.IGeneratedObject {
|
||||
a: (number)[];
|
||||
b: TestEnum;
|
||||
cUnderscore: (TestEnum)[];
|
||||
dOuter: (OuterStructT)[];
|
||||
e: (bigint)[];
|
||||
constructor(a?: (number)[], b?: TestEnum, cUnderscore?: (TestEnum)[], dOuter?: (OuterStructT)[], e?: (bigint)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
import { TestEnum } from '../../my-game/example/test-enum.js';
|
||||
export class NestedStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(index) {
|
||||
return this.bb.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
dOuter(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
|
||||
}
|
||||
e(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 1072;
|
||||
}
|
||||
static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
|
||||
builder.prep(8, 1072);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, (item?.cUnderscore?.a ?? 0), (item?.cUnderscore?.b ?? []), (item?.cUnderscore?.c ?? 0), (item?.cUnderscore?.dUnderscore ?? BigInt(0)), item?.d, (item?.e?.a ?? 0), (item?.e?.b ?? []), (item?.e?.c ?? 0), (item?.e?.dUnderscore ?? BigInt(0)), item?.f);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore?.[i] ?? 0));
|
||||
}
|
||||
builder.writeInt8(b);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32((a?.[i] ?? 0));
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.bb.createScalarList(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb.createScalarList(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class NestedStructT {
|
||||
constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.dOuter = dOuter;
|
||||
this.e = e;
|
||||
}
|
||||
pack(builder) {
|
||||
return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
|
||||
}
|
||||
}
|
||||
135
tests/ts/arrays_test_complex/my-game/example/nested-struct.ts
Normal file
135
tests/ts/arrays_test_complex/my-game/example/nested-struct.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
import { TestEnum } from '../../my-game/example/test-enum.js';
|
||||
|
||||
|
||||
export class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):NestedStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
|
||||
b():TestEnum {
|
||||
return this.bb!.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(index: number):TestEnum|null {
|
||||
return this.bb!.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
|
||||
dOuter(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
e(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 1072;
|
||||
}
|
||||
|
||||
static createNestedStruct(builder:flatbuffers.Builder, a: number[]|null, b: TestEnum, c_underscore: number[]|null, d_outer: (any|OuterStructT)[]|null, e: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 1072);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(5);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeInt8(b);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32((a?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): NestedStructT {
|
||||
return new NestedStructT(
|
||||
this.bb!.createScalarList<number>(this.a.bind(this), 2),
|
||||
this.b(),
|
||||
this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5),
|
||||
this.bb!.createScalarList<bigint>(this.e.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: NestedStructT): void {
|
||||
_o.a = this.bb!.createScalarList<number>(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb!.createScalarList<bigint>(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class NestedStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: (number)[] = [],
|
||||
public b: TestEnum = TestEnum.A,
|
||||
public cUnderscore: (TestEnum)[] = [TestEnum.A, TestEnum.A],
|
||||
public dOuter: (OuterStructT)[] = [],
|
||||
public e: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return NestedStruct.createNestedStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.cUnderscore,
|
||||
this.dOuter,
|
||||
this.e
|
||||
);
|
||||
}
|
||||
}
|
||||
28
tests/ts/arrays_test_complex/my-game/example/outer-struct.d.ts
vendored
Normal file
28
tests/ts/arrays_test_complex/my-game/example/outer-struct.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
|
||||
export declare class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): OuterStruct;
|
||||
a(): boolean;
|
||||
b(): number;
|
||||
cUnderscore(obj?: InnerStruct): InnerStruct | null;
|
||||
d(index: number, obj?: InnerStruct): InnerStruct | null;
|
||||
e(obj?: InnerStruct): InnerStruct | null;
|
||||
f(index: number): number | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createOuterStruct(builder: flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[] | null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any | InnerStructT)[] | null, e_a: number, e_b: number[] | null, e_c: number, e_d_underscore: bigint, f: number[] | null): flatbuffers.Offset;
|
||||
unpack(): OuterStructT;
|
||||
unpackTo(_o: OuterStructT): void;
|
||||
}
|
||||
export declare class OuterStructT implements flatbuffers.IGeneratedObject {
|
||||
a: boolean;
|
||||
b: number;
|
||||
cUnderscore: InnerStructT | null;
|
||||
d: (InnerStructT)[];
|
||||
e: InnerStructT | null;
|
||||
f: (number)[];
|
||||
constructor(a?: boolean, b?: number, cUnderscore?: InnerStructT | null, d?: (InnerStructT)[], e?: InnerStructT | null, f?: (number)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
95
tests/ts/arrays_test_complex/my-game/example/outer-struct.js
Normal file
95
tests/ts/arrays_test_complex/my-game/example/outer-struct.js
Normal file
@@ -0,0 +1,95 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
|
||||
export class OuterStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return !!this.bb.readInt8(this.bb_pos);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
|
||||
}
|
||||
e(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
|
||||
}
|
||||
f(index) {
|
||||
return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 208;
|
||||
}
|
||||
static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
|
||||
builder.prep(8, 208);
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64((f?.[i] ?? 0));
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((e_b?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat64(e_a);
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
InnerStruct.createInnerStruct(builder, item?.a, item?.b, item?.c, item?.dUnderscore);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore_b?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new OuterStructT(this.a(), this.b(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null), this.bb.createObjList(this.d.bind(this), 3), (this.e() !== null ? this.e().unpack() : null), this.bb.createScalarList(this.f.bind(this), 4));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e().unpack() : null);
|
||||
_o.f = this.bb.createScalarList(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
export class OuterStructT {
|
||||
constructor(a = false, b = 0.0, cUnderscore = null, d = [], e = null, f = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
}
|
||||
pack(builder) {
|
||||
return OuterStruct.createOuterStruct(builder, this.a, this.b, (this.cUnderscore?.a ?? 0), (this.cUnderscore?.b ?? []), (this.cUnderscore?.c ?? 0), (this.cUnderscore?.dUnderscore ?? BigInt(0)), this.d, (this.e?.a ?? 0), (this.e?.b ?? []), (this.e?.c ?? 0), (this.e?.dUnderscore ?? BigInt(0)), this.f);
|
||||
}
|
||||
}
|
||||
152
tests/ts/arrays_test_complex/my-game/example/outer-struct.ts
Normal file
152
tests/ts/arrays_test_complex/my-game/example/outer-struct.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
|
||||
|
||||
|
||||
export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):OuterStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():boolean {
|
||||
return !!this.bb!.readInt8(this.bb_pos);
|
||||
}
|
||||
|
||||
b():number {
|
||||
return this.bb!.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
|
||||
}
|
||||
|
||||
d(index: number, obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb!);
|
||||
}
|
||||
|
||||
e(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
|
||||
}
|
||||
|
||||
f(index: number):number|null {
|
||||
return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 208;
|
||||
}
|
||||
|
||||
static createOuterStruct(builder:flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[]|null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[]|null, e_a: number, e_b: number[]|null, e_c: number, e_d_underscore: bigint, f: number[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 208);
|
||||
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64((f?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((e_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(e_a);
|
||||
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
InnerStruct.createInnerStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.c,
|
||||
item?.dUnderscore
|
||||
);
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): OuterStructT {
|
||||
return new OuterStructT(
|
||||
this.a(),
|
||||
this.b(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null),
|
||||
this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3),
|
||||
(this.e() !== null ? this.e()!.unpack() : null),
|
||||
this.bb!.createScalarList<number>(this.f.bind(this), 4)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: OuterStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
_o.d = this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e()!.unpack() : null);
|
||||
_o.f = this.bb!.createScalarList<number>(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
|
||||
export class OuterStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: boolean = false,
|
||||
public b: number = 0.0,
|
||||
public cUnderscore: InnerStructT|null = null,
|
||||
public d: (InnerStructT)[] = [],
|
||||
public e: InnerStructT|null = null,
|
||||
public f: (number)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return OuterStruct.createOuterStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
(this.cUnderscore?.a ?? 0),
|
||||
(this.cUnderscore?.b ?? []),
|
||||
(this.cUnderscore?.c ?? 0),
|
||||
(this.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
this.d,
|
||||
(this.e?.a ?? 0),
|
||||
(this.e?.b ?? []),
|
||||
(this.e?.c ?? 0),
|
||||
(this.e?.dUnderscore ?? BigInt(0)),
|
||||
this.f
|
||||
);
|
||||
}
|
||||
}
|
||||
5
tests/ts/arrays_test_complex/my-game/example/test-enum.d.ts
vendored
Normal file
5
tests/ts/arrays_test_complex/my-game/example/test-enum.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare enum TestEnum {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export var TestEnum;
|
||||
(function (TestEnum) {
|
||||
TestEnum[TestEnum["A"] = 0] = "A";
|
||||
TestEnum[TestEnum["B"] = 1] = "B";
|
||||
TestEnum[TestEnum["C"] = 2] = "C";
|
||||
})(TestEnum = TestEnum || (TestEnum = {}));
|
||||
@@ -0,0 +1,7 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum TestEnum {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
1
tests/ts/foobar.d.ts
vendored
Normal file
1
tests/ts/foobar.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { Abc } from './foobar/abc.js';
|
||||
2
tests/ts/foobar.js
Normal file
2
tests/ts/foobar.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { Abc } from './foobar/abc.js';
|
||||
@@ -1,7 +1,3 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
export enum Abc {
|
||||
a = 0
|
||||
}
|
||||
|
||||
export { Abc } from './foobar/abc.js';
|
||||
3
tests/ts/foobar/abc.d.ts
vendored
Normal file
3
tests/ts/foobar/abc.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare enum Abc {
|
||||
a = 0
|
||||
}
|
||||
@@ -2,4 +2,4 @@
|
||||
export var Abc;
|
||||
(function (Abc) {
|
||||
Abc[Abc["a"] = 0] = "a";
|
||||
})(Abc || (Abc = {}));
|
||||
})(Abc = Abc || (Abc = {}));
|
||||
|
||||
3
tests/ts/foobar/class.d.ts
vendored
Normal file
3
tests/ts/foobar/class.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare enum class_ {
|
||||
arguments_ = 0
|
||||
}
|
||||
@@ -2,4 +2,4 @@
|
||||
export var class_;
|
||||
(function (class_) {
|
||||
class_[class_["arguments_"] = 0] = "arguments_";
|
||||
})(class_ || (class_ = {}));
|
||||
})(class_ = class_ || (class_ = {}));
|
||||
|
||||
2
tests/ts/monster_test.d.ts
vendored
Normal file
2
tests/ts/monster_test.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { TableA } from './table-a.js';
|
||||
export * as MyGame from './my-game.js';
|
||||
@@ -1,17 +1,3 @@
|
||||
export { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from './my-game/example2/monster';
|
||||
export { Ability, AbilityT } from './my-game/example/ability';
|
||||
export { Any, unionToAny, unionListToAny } from './my-game/example/any';
|
||||
export { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from './my-game/example/any-ambiguous-aliases';
|
||||
export { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from './my-game/example/any-unique-aliases';
|
||||
export { Color } from './my-game/example/color';
|
||||
export { Monster, MonsterT } from './my-game/example/monster';
|
||||
export { Race } from './my-game/example/race';
|
||||
export { Referrable, ReferrableT } from './my-game/example/referrable';
|
||||
export { Stat, StatT } from './my-game/example/stat';
|
||||
export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs';
|
||||
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs';
|
||||
export { Test, TestT } from './my-game/example/test';
|
||||
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum';
|
||||
export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases';
|
||||
export { Vec3, Vec3T } from './my-game/example/vec3';
|
||||
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace';
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { TableA } from './table-a.js';
|
||||
export * as MyGame from './my-game.js';
|
||||
|
||||
@@ -1,17 +1,4 @@
|
||||
export { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from './my-game/example2/monster';
|
||||
export { Ability, AbilityT } from './my-game/example/ability';
|
||||
export { Any, unionToAny, unionListToAny } from './my-game/example/any';
|
||||
export { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from './my-game/example/any-ambiguous-aliases';
|
||||
export { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from './my-game/example/any-unique-aliases';
|
||||
export { Color } from './my-game/example/color';
|
||||
export { Monster, MonsterT } from './my-game/example/monster';
|
||||
export { Race } from './my-game/example/race';
|
||||
export { Referrable, ReferrableT } from './my-game/example/referrable';
|
||||
export { Stat, StatT } from './my-game/example/stat';
|
||||
export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs';
|
||||
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs';
|
||||
export { Test, TestT } from './my-game/example/test';
|
||||
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum';
|
||||
export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases';
|
||||
export { Vec3, Vec3T } from './my-game/example/vec3';
|
||||
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace';
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { TableA } from './table-a.js';
|
||||
export * as MyGame from './my-game.js';
|
||||
|
||||
2565
tests/ts/monster_test_generated.cjs
Normal file
2565
tests/ts/monster_test_generated.cjs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
||||
// 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';
|
||||
94
tests/ts/monster_test_grpc.d.ts
vendored
94
tests/ts/monster_test_grpc.d.ts
vendored
@@ -1,94 +0,0 @@
|
||||
// Generated GRPC code for FlatBuffers TS *** DO NOT EDIT ***
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { Stat as MyGame_Example_Stat } from './my-game/example/stat';
|
||||
import { Monster as MyGame_Example_Monster } from './my-game/example/monster';
|
||||
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
|
||||
interface IMonsterStorageService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
|
||||
Store: IMonsterStorageService_IStore;
|
||||
Retrieve: IMonsterStorageService_IRetrieve;
|
||||
GetMaxHitPoint: IMonsterStorageService_IGetMaxHitPoint;
|
||||
GetMinMaxHitPoints: IMonsterStorageService_IGetMinMaxHitPoints;
|
||||
}
|
||||
interface IMonsterStorageService_IStore extends grpc.MethodDefinition<MyGame_Example_Monster, MyGame_Example_Stat> {
|
||||
path: string; // /MyGame.Example.MonsterStorage/Store
|
||||
requestStream: boolean; // false
|
||||
responseStream: boolean; // false
|
||||
requestSerialize: grpc.serialize<MyGame_Example_Monster>;
|
||||
requestDeserialize: grpc.deserialize<MyGame_Example_Monster>;
|
||||
responseSerialize: grpc.serialize<MyGame_Example_Stat>;
|
||||
responseDeserialize: grpc.deserialize<MyGame_Example_Stat>;
|
||||
}
|
||||
|
||||
interface IMonsterStorageService_IRetrieve extends grpc.MethodDefinition<MyGame_Example_Stat, MyGame_Example_Monster> {
|
||||
path: string; // /MyGame.Example.MonsterStorage/Retrieve
|
||||
requestStream: boolean; // false
|
||||
responseStream: boolean; // true
|
||||
requestSerialize: grpc.serialize<MyGame_Example_Stat>;
|
||||
requestDeserialize: grpc.deserialize<MyGame_Example_Stat>;
|
||||
responseSerialize: grpc.serialize<MyGame_Example_Monster>;
|
||||
responseDeserialize: grpc.deserialize<MyGame_Example_Monster>;
|
||||
}
|
||||
|
||||
interface IMonsterStorageService_IGetMaxHitPoint extends grpc.MethodDefinition<MyGame_Example_Monster, MyGame_Example_Stat> {
|
||||
path: string; // /MyGame.Example.MonsterStorage/GetMaxHitPoint
|
||||
requestStream: boolean; // true
|
||||
responseStream: boolean; // false
|
||||
requestSerialize: grpc.serialize<MyGame_Example_Monster>;
|
||||
requestDeserialize: grpc.deserialize<MyGame_Example_Monster>;
|
||||
responseSerialize: grpc.serialize<MyGame_Example_Stat>;
|
||||
responseDeserialize: grpc.deserialize<MyGame_Example_Stat>;
|
||||
}
|
||||
|
||||
interface IMonsterStorageService_IGetMinMaxHitPoints extends grpc.MethodDefinition<MyGame_Example_Monster, MyGame_Example_Stat> {
|
||||
path: string; // /MyGame.Example.MonsterStorage/GetMinMaxHitPoints
|
||||
requestStream: boolean; // true
|
||||
responseStream: boolean; // true
|
||||
requestSerialize: grpc.serialize<MyGame_Example_Monster>;
|
||||
requestDeserialize: grpc.deserialize<MyGame_Example_Monster>;
|
||||
responseSerialize: grpc.serialize<MyGame_Example_Stat>;
|
||||
responseDeserialize: grpc.deserialize<MyGame_Example_Stat>;
|
||||
}
|
||||
|
||||
|
||||
export const MonsterStorageService: IMonsterStorageService;
|
||||
|
||||
export interface IMonsterStorageServer extends grpc.UntypedServiceImplementation {
|
||||
Store: grpc.handleUnaryCall<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
Retrieve: grpc.handleServerStreamingCall<MyGame_Example_Stat, MyGame_Example_Monster>;
|
||||
GetMaxHitPoint: grpc.handleClientStreamingCall<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
GetMinMaxHitPoints: grpc.handleBidiStreamingCall<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
}
|
||||
|
||||
export interface IMonsterStorageClient {
|
||||
Store(request: MyGame_Example_Monster, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
Store(request: MyGame_Example_Monster, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
Store(request: MyGame_Example_Monster, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
Retrieve(request: MyGame_Example_Stat, metadata: grpc.Metadata): grpc.ClientReadableStream<MyGame_Example_Monster>;
|
||||
Retrieve(request: MyGame_Example_Stat, options: Partial<grpc.CallOptions>): grpc.ClientReadableStream<MyGame_Example_Monster>;
|
||||
GetMaxHitPoint(callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
GetMaxHitPoint(metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
GetMaxHitPoint(options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
GetMaxHitPoint(metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
GetMinMaxHitPoints(): grpc.ClientDuplexStream<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
GetMinMaxHitPoints(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
GetMinMaxHitPoints(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
}
|
||||
|
||||
export class MonsterStorageClient extends grpc.Client implements IMonsterStorageClient {
|
||||
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
|
||||
public Store(request: MyGame_Example_Monster, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
public Store(request: MyGame_Example_Monster, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
public Store(request: MyGame_Example_Monster, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
public Retrieve(request: MyGame_Example_Stat, metadata: grpc.Metadata): grpc.ClientReadableStream<MyGame_Example_Monster>;
|
||||
public Retrieve(request: MyGame_Example_Stat, options: Partial<grpc.CallOptions>): grpc.ClientReadableStream<MyGame_Example_Monster>;
|
||||
public GetMaxHitPoint(callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
public GetMaxHitPoint(metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
public GetMaxHitPoint(options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
public GetMaxHitPoint(metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Monster) => void): grpc.ClientWritableStream<MyGame_Example_Stat>;
|
||||
public GetMinMaxHitPoints(): grpc.ClientDuplexStream<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
public GetMinMaxHitPoints(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
public GetMinMaxHitPoints(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
// Generated GRPC code for FlatBuffers TS *** DO NOT EDIT ***
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { Stat as MyGame_Example_Stat } from './my-game/example/stat';
|
||||
import { Monster as MyGame_Example_Monster } from './my-game/example/monster';
|
||||
|
||||
var grpc = require('@grpc/grpc-js');
|
||||
|
||||
function serialize_MyGame_Example_Stat(buffer_args) {
|
||||
if (!(buffer_args instanceof MyGame_Example_Stat)) {
|
||||
throw new Error('Expected argument of type Stat');
|
||||
}
|
||||
return Buffer.from(buffer_args.serialize());
|
||||
}
|
||||
|
||||
function deserialize_MyGame_Example_Stat(buffer) {
|
||||
return MyGame_Example_Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer))
|
||||
}
|
||||
|
||||
|
||||
function serialize_MyGame_Example_Monster(buffer_args) {
|
||||
if (!(buffer_args instanceof MyGame_Example_Monster)) {
|
||||
throw new Error('Expected argument of type Monster');
|
||||
}
|
||||
return Buffer.from(buffer_args.serialize());
|
||||
}
|
||||
|
||||
function deserialize_MyGame_Example_Monster(buffer) {
|
||||
return MyGame_Example_Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var MonsterStorageService = exports.MonsterStorageService = {
|
||||
Store: {
|
||||
path: '/MyGame.Example.MonsterStorage/Store',
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: flatbuffers.ByteBuffer,
|
||||
responseType: MyGame_Example_Stat,
|
||||
requestSerialize: serialize_MyGame_Example_Monster,
|
||||
requestDeserialize: deserialize_MyGame_Example_Monster,
|
||||
responseSerialize: serialize_MyGame_Example_Stat,
|
||||
responseDeserialize: deserialize_MyGame_Example_Stat,
|
||||
},
|
||||
Retrieve: {
|
||||
path: '/MyGame.Example.MonsterStorage/Retrieve',
|
||||
requestStream: false,
|
||||
responseStream: true,
|
||||
requestType: flatbuffers.ByteBuffer,
|
||||
responseType: MyGame_Example_Monster,
|
||||
requestSerialize: serialize_MyGame_Example_Stat,
|
||||
requestDeserialize: deserialize_MyGame_Example_Stat,
|
||||
responseSerialize: serialize_MyGame_Example_Monster,
|
||||
responseDeserialize: deserialize_MyGame_Example_Monster,
|
||||
},
|
||||
GetMaxHitPoint: {
|
||||
path: '/MyGame.Example.MonsterStorage/GetMaxHitPoint',
|
||||
requestStream: true,
|
||||
responseStream: false,
|
||||
requestType: flatbuffers.ByteBuffer,
|
||||
responseType: MyGame_Example_Stat,
|
||||
requestSerialize: serialize_MyGame_Example_Monster,
|
||||
requestDeserialize: deserialize_MyGame_Example_Monster,
|
||||
responseSerialize: serialize_MyGame_Example_Stat,
|
||||
responseDeserialize: deserialize_MyGame_Example_Stat,
|
||||
},
|
||||
GetMinMaxHitPoints: {
|
||||
path: '/MyGame.Example.MonsterStorage/GetMinMaxHitPoints',
|
||||
requestStream: true,
|
||||
responseStream: true,
|
||||
requestType: flatbuffers.ByteBuffer,
|
||||
responseType: MyGame_Example_Stat,
|
||||
requestSerialize: serialize_MyGame_Example_Monster,
|
||||
requestDeserialize: deserialize_MyGame_Example_Monster,
|
||||
responseSerialize: serialize_MyGame_Example_Stat,
|
||||
responseDeserialize: deserialize_MyGame_Example_Stat,
|
||||
},
|
||||
};
|
||||
exports.MonsterStorageClient = grpc.makeGenericClientConstructor(MonsterStorageService);
|
||||
Binary file not shown.
4
tests/ts/my-game.d.ts
vendored
Normal file
4
tests/ts/my-game.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { InParentNamespace } from './my-game/in-parent-namespace.js';
|
||||
export * as Example from './my-game/example.js';
|
||||
export * as Example2 from './my-game/example2.js';
|
||||
export * as OtherNameSpace from './my-game/other-name-space.js';
|
||||
5
tests/ts/my-game.js
Normal file
5
tests/ts/my-game.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { InParentNamespace } from './my-game/in-parent-namespace.js';
|
||||
export * as Example from './my-game/example.js';
|
||||
export * as Example2 from './my-game/example2.js';
|
||||
export * as OtherNameSpace from './my-game/other-name-space.js';
|
||||
6
tests/ts/my-game.ts
Normal file
6
tests/ts/my-game.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { InParentNamespace } from './my-game/in-parent-namespace.js';
|
||||
export * as Example from './my-game/example.js';
|
||||
export * as Example2 from './my-game/example2.js';
|
||||
export * as OtherNameSpace from './my-game/other-name-space.js';
|
||||
16
tests/ts/my-game/example.d.ts
vendored
Normal file
16
tests/ts/my-game/example.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export { Ability } from './example/ability.js';
|
||||
export { Any } from './example/any.js';
|
||||
export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js';
|
||||
export { AnyUniqueAliases } from './example/any-unique-aliases.js';
|
||||
export { Color } from './example/color.js';
|
||||
export { LongEnum } from './example/long-enum.js';
|
||||
export { Monster } from './example/monster.js';
|
||||
export { Race } from './example/race.js';
|
||||
export { Referrable } from './example/referrable.js';
|
||||
export { Stat } from './example/stat.js';
|
||||
export { StructOfStructs } from './example/struct-of-structs.js';
|
||||
export { StructOfStructsOfStructs } from './example/struct-of-structs-of-structs.js';
|
||||
export { Test } from './example/test.js';
|
||||
export { TestSimpleTableWithEnum } from './example/test-simple-table-with-enum.js';
|
||||
export { TypeAliases } from './example/type-aliases.js';
|
||||
export { Vec3 } from './example/vec3.js';
|
||||
17
tests/ts/my-game/example.js
Normal file
17
tests/ts/my-game/example.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { Ability } from './example/ability.js';
|
||||
export { Any } from './example/any.js';
|
||||
export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js';
|
||||
export { AnyUniqueAliases } from './example/any-unique-aliases.js';
|
||||
export { Color } from './example/color.js';
|
||||
export { LongEnum } from './example/long-enum.js';
|
||||
export { Monster } from './example/monster.js';
|
||||
export { Race } from './example/race.js';
|
||||
export { Referrable } from './example/referrable.js';
|
||||
export { Stat } from './example/stat.js';
|
||||
export { StructOfStructs } from './example/struct-of-structs.js';
|
||||
export { StructOfStructsOfStructs } from './example/struct-of-structs-of-structs.js';
|
||||
export { Test } from './example/test.js';
|
||||
export { TestSimpleTableWithEnum } from './example/test-simple-table-with-enum.js';
|
||||
export { TypeAliases } from './example/type-aliases.js';
|
||||
export { Vec3 } from './example/vec3.js';
|
||||
18
tests/ts/my-game/example.ts
Normal file
18
tests/ts/my-game/example.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { Ability } from './example/ability.js';
|
||||
export { Any } from './example/any.js';
|
||||
export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js';
|
||||
export { AnyUniqueAliases } from './example/any-unique-aliases.js';
|
||||
export { Color } from './example/color.js';
|
||||
export { LongEnum } from './example/long-enum.js';
|
||||
export { Monster } from './example/monster.js';
|
||||
export { Race } from './example/race.js';
|
||||
export { Referrable } from './example/referrable.js';
|
||||
export { Stat } from './example/stat.js';
|
||||
export { StructOfStructs } from './example/struct-of-structs.js';
|
||||
export { StructOfStructsOfStructs } from './example/struct-of-structs-of-structs.js';
|
||||
export { Test } from './example/test.js';
|
||||
export { TestSimpleTableWithEnum } from './example/test-simple-table-with-enum.js';
|
||||
export { TypeAliases } from './example/type-aliases.js';
|
||||
export { Vec3 } from './example/vec3.js';
|
||||
21
tests/ts/my-game/example/ability.d.ts
vendored
Normal file
21
tests/ts/my-game/example/ability.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Ability implements flatbuffers.IUnpackableObject<AbilityT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Ability;
|
||||
id(): number;
|
||||
mutate_id(value: number): boolean;
|
||||
distance(): number;
|
||||
mutate_distance(value: number): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createAbility(builder: flatbuffers.Builder, id: number, distance: number): flatbuffers.Offset;
|
||||
unpack(): AbilityT;
|
||||
unpackTo(_o: AbilityT): void;
|
||||
}
|
||||
export declare class AbilityT implements flatbuffers.IGeneratedObject {
|
||||
id: number;
|
||||
distance: number;
|
||||
constructor(id?: number, distance?: number);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
9
tests/ts/my-game/example/any-ambiguous-aliases.d.ts
vendored
Normal file
9
tests/ts/my-game/example/any-ambiguous-aliases.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Monster } from '../../my-game/example/monster.js';
|
||||
export declare enum AnyAmbiguousAliases {
|
||||
NONE = 0,
|
||||
M1 = 1,
|
||||
M2 = 2,
|
||||
M3 = 3
|
||||
}
|
||||
export declare function unionToAnyAmbiguousAliases(type: AnyAmbiguousAliases, accessor: (obj: Monster) => Monster | null): Monster | null;
|
||||
export declare function unionListToAnyAmbiguousAliases(type: AnyAmbiguousAliases, accessor: (index: number, obj: Monster) => Monster | null, index: number): Monster | null;
|
||||
@@ -6,7 +6,7 @@ export var AnyAmbiguousAliases;
|
||||
AnyAmbiguousAliases[AnyAmbiguousAliases["M1"] = 1] = "M1";
|
||||
AnyAmbiguousAliases[AnyAmbiguousAliases["M2"] = 2] = "M2";
|
||||
AnyAmbiguousAliases[AnyAmbiguousAliases["M3"] = 3] = "M3";
|
||||
})(AnyAmbiguousAliases || (AnyAmbiguousAliases = {}));
|
||||
})(AnyAmbiguousAliases = AnyAmbiguousAliases || (AnyAmbiguousAliases = {}));
|
||||
export function unionToAnyAmbiguousAliases(type, accessor) {
|
||||
switch (AnyAmbiguousAliases[type]) {
|
||||
case 'NONE': return null;
|
||||
|
||||
11
tests/ts/my-game/example/any-unique-aliases.d.ts
vendored
Normal file
11
tests/ts/my-game/example/any-unique-aliases.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
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 declare enum AnyUniqueAliases {
|
||||
NONE = 0,
|
||||
M = 1,
|
||||
TS = 2,
|
||||
M2 = 3
|
||||
}
|
||||
export declare function unionToAnyUniqueAliases(type: AnyUniqueAliases, accessor: (obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
|
||||
export declare 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;
|
||||
@@ -8,7 +8,7 @@ export var AnyUniqueAliases;
|
||||
AnyUniqueAliases[AnyUniqueAliases["M"] = 1] = "M";
|
||||
AnyUniqueAliases[AnyUniqueAliases["TS"] = 2] = "TS";
|
||||
AnyUniqueAliases[AnyUniqueAliases["M2"] = 3] = "M2";
|
||||
})(AnyUniqueAliases || (AnyUniqueAliases = {}));
|
||||
})(AnyUniqueAliases = AnyUniqueAliases || (AnyUniqueAliases = {}));
|
||||
export function unionToAnyUniqueAliases(type, accessor) {
|
||||
switch (AnyUniqueAliases[type]) {
|
||||
case 'NONE': return null;
|
||||
|
||||
11
tests/ts/my-game/example/any.d.ts
vendored
Normal file
11
tests/ts/my-game/example/any.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
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 declare enum Any {
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
MyGame_Example2_Monster = 3
|
||||
}
|
||||
export declare function unionToAny(type: Any, accessor: (obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
|
||||
export declare 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;
|
||||
@@ -8,7 +8,7 @@ export var Any;
|
||||
Any[Any["Monster"] = 1] = "Monster";
|
||||
Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum";
|
||||
Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster";
|
||||
})(Any || (Any = {}));
|
||||
})(Any = Any || (Any = {}));
|
||||
export function unionToAny(type, accessor) {
|
||||
switch (Any[type]) {
|
||||
case 'NONE': return null;
|
||||
|
||||
15
tests/ts/my-game/example/color.d.ts
vendored
Normal file
15
tests/ts/my-game/example/color.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*/
|
||||
export declare enum Color {
|
||||
Red = 1,
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
Green = 2,
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
Blue = 8
|
||||
}
|
||||
@@ -14,4 +14,4 @@ export var Color;
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
Color[Color["Blue"] = 8] = "Blue";
|
||||
})(Color || (Color = {}));
|
||||
})(Color = Color || (Color = {}));
|
||||
|
||||
5
tests/ts/my-game/example/long-enum.d.ts
vendored
Normal file
5
tests/ts/my-game/example/long-enum.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare enum LongEnum {
|
||||
LongOne = "2",
|
||||
LongTwo = "4",
|
||||
LongBig = "1099511627776"
|
||||
}
|
||||
@@ -4,4 +4,4 @@ export var LongEnum;
|
||||
LongEnum["LongOne"] = "2";
|
||||
LongEnum["LongTwo"] = "4";
|
||||
LongEnum["LongBig"] = "1099511627776";
|
||||
})(LongEnum || (LongEnum = {}));
|
||||
})(LongEnum = LongEnum || (LongEnum = {}));
|
||||
|
||||
325
tests/ts/my-game/example/monster.d.ts
vendored
Normal file
325
tests/ts/my-game/example/monster.d.ts
vendored
Normal file
@@ -0,0 +1,325 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
|
||||
import { Ability, AbilityT } from '../../my-game/example/ability.js';
|
||||
import { Any } from '../../my-game/example/any.js';
|
||||
import { AnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases.js';
|
||||
import { AnyUniqueAliases } from '../../my-game/example/any-unique-aliases.js';
|
||||
import { Color } from '../../my-game/example/color.js';
|
||||
import { Race } from '../../my-game/example/race.js';
|
||||
import { Referrable, ReferrableT } from '../../my-game/example/referrable.js';
|
||||
import { Stat, StatT } from '../../my-game/example/stat.js';
|
||||
import { Test, TestT } from '../../my-game/example/test.js';
|
||||
import { TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
|
||||
import { Vec3, Vec3T } from '../../my-game/example/vec3.js';
|
||||
import { InParentNamespace, InParentNamespaceT } from '../../my-game/in-parent-namespace.js';
|
||||
/**
|
||||
* an example documentation comment: "monster object"
|
||||
*/
|
||||
export declare class Monster implements flatbuffers.IUnpackableObject<MonsterT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Monster;
|
||||
static getRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
|
||||
static getSizePrefixedRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
|
||||
static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
|
||||
pos(obj?: Vec3): Vec3 | null;
|
||||
mana(): number;
|
||||
mutate_mana(value: number): boolean;
|
||||
hp(): number;
|
||||
mutate_hp(value: number): boolean;
|
||||
name(): string | null;
|
||||
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
inventory(index: number): number | null;
|
||||
inventoryLength(): number;
|
||||
inventoryArray(): Uint8Array | null;
|
||||
color(): Color;
|
||||
mutate_color(value: Color): boolean;
|
||||
testType(): Any;
|
||||
test<T extends flatbuffers.Table>(obj: any): any | null;
|
||||
test4(index: number, obj?: Test): Test | null;
|
||||
test4Length(): number;
|
||||
testarrayofstring(index: number): string;
|
||||
testarrayofstring(index: number, optionalEncoding: flatbuffers.Encoding): string | Uint8Array;
|
||||
testarrayofstringLength(): number;
|
||||
/**
|
||||
* an example documentation comment: this will end up in the generated code
|
||||
* multiline too
|
||||
*/
|
||||
testarrayoftables(index: number, obj?: Monster): Monster | null;
|
||||
testarrayoftablesLength(): number;
|
||||
enemy(obj?: Monster): Monster | null;
|
||||
testnestedflatbuffer(index: number): number | null;
|
||||
testnestedflatbufferLength(): number;
|
||||
testnestedflatbufferArray(): Uint8Array | null;
|
||||
testempty(obj?: Stat): Stat | null;
|
||||
testbool(): boolean;
|
||||
mutate_testbool(value: boolean): boolean;
|
||||
testhashs32Fnv1(): number;
|
||||
mutate_testhashs32_fnv1(value: number): boolean;
|
||||
testhashu32Fnv1(): number;
|
||||
mutate_testhashu32_fnv1(value: number): boolean;
|
||||
testhashs64Fnv1(): bigint;
|
||||
mutate_testhashs64_fnv1(value: bigint): boolean;
|
||||
testhashu64Fnv1(): bigint;
|
||||
mutate_testhashu64_fnv1(value: bigint): boolean;
|
||||
testhashs32Fnv1a(): number;
|
||||
mutate_testhashs32_fnv1a(value: number): boolean;
|
||||
testhashu32Fnv1a(): number;
|
||||
mutate_testhashu32_fnv1a(value: number): boolean;
|
||||
testhashs64Fnv1a(): bigint;
|
||||
mutate_testhashs64_fnv1a(value: bigint): boolean;
|
||||
testhashu64Fnv1a(): bigint;
|
||||
mutate_testhashu64_fnv1a(value: bigint): boolean;
|
||||
testarrayofbools(index: number): boolean | null;
|
||||
testarrayofboolsLength(): number;
|
||||
testarrayofboolsArray(): Int8Array | null;
|
||||
testf(): number;
|
||||
mutate_testf(value: number): boolean;
|
||||
testf2(): number;
|
||||
mutate_testf2(value: number): boolean;
|
||||
testf3(): number;
|
||||
mutate_testf3(value: number): boolean;
|
||||
testarrayofstring2(index: number): string;
|
||||
testarrayofstring2(index: number, optionalEncoding: flatbuffers.Encoding): string | Uint8Array;
|
||||
testarrayofstring2Length(): number;
|
||||
testarrayofsortedstruct(index: number, obj?: Ability): Ability | null;
|
||||
testarrayofsortedstructLength(): number;
|
||||
flex(index: number): number | null;
|
||||
flexLength(): number;
|
||||
flexArray(): Uint8Array | null;
|
||||
test5(index: number, obj?: Test): Test | null;
|
||||
test5Length(): number;
|
||||
vectorOfLongs(index: number): bigint | null;
|
||||
vectorOfLongsLength(): number;
|
||||
vectorOfDoubles(index: number): number | null;
|
||||
vectorOfDoublesLength(): number;
|
||||
vectorOfDoublesArray(): Float64Array | null;
|
||||
parentNamespaceTest(obj?: InParentNamespace): InParentNamespace | null;
|
||||
vectorOfReferrables(index: number, obj?: Referrable): Referrable | null;
|
||||
vectorOfReferrablesLength(): number;
|
||||
singleWeakReference(): bigint;
|
||||
mutate_single_weak_reference(value: bigint): boolean;
|
||||
vectorOfWeakReferences(index: number): bigint | null;
|
||||
vectorOfWeakReferencesLength(): number;
|
||||
vectorOfStrongReferrables(index: number, obj?: Referrable): Referrable | null;
|
||||
vectorOfStrongReferrablesLength(): number;
|
||||
coOwningReference(): bigint;
|
||||
mutate_co_owning_reference(value: bigint): boolean;
|
||||
vectorOfCoOwningReferences(index: number): bigint | null;
|
||||
vectorOfCoOwningReferencesLength(): number;
|
||||
nonOwningReference(): bigint;
|
||||
mutate_non_owning_reference(value: bigint): boolean;
|
||||
vectorOfNonOwningReferences(index: number): bigint | null;
|
||||
vectorOfNonOwningReferencesLength(): number;
|
||||
anyUniqueType(): AnyUniqueAliases;
|
||||
anyUnique<T extends flatbuffers.Table>(obj: any): any | null;
|
||||
anyAmbiguousType(): AnyAmbiguousAliases;
|
||||
anyAmbiguous<T extends flatbuffers.Table>(obj: any): any | null;
|
||||
vectorOfEnums(index: number): Color | null;
|
||||
vectorOfEnumsLength(): number;
|
||||
vectorOfEnumsArray(): Uint8Array | null;
|
||||
signedEnum(): Race;
|
||||
mutate_signed_enum(value: Race): boolean;
|
||||
testrequirednestedflatbuffer(index: number): number | null;
|
||||
testrequirednestedflatbufferLength(): number;
|
||||
testrequirednestedflatbufferArray(): Uint8Array | null;
|
||||
scalarKeySortedTables(index: number, obj?: Stat): Stat | null;
|
||||
scalarKeySortedTablesLength(): number;
|
||||
nativeInline(obj?: Test): Test | null;
|
||||
longEnumNonEnumDefault(): bigint;
|
||||
mutate_long_enum_non_enum_default(value: bigint): boolean;
|
||||
longEnumNormalDefault(): bigint;
|
||||
mutate_long_enum_normal_default(value: bigint): boolean;
|
||||
nanDefault(): number;
|
||||
mutate_nan_default(value: number): boolean;
|
||||
infDefault(): number;
|
||||
mutate_inf_default(value: number): boolean;
|
||||
positiveInfDefault(): number;
|
||||
mutate_positive_inf_default(value: number): boolean;
|
||||
infinityDefault(): number;
|
||||
mutate_infinity_default(value: number): boolean;
|
||||
positiveInfinityDefault(): number;
|
||||
mutate_positive_infinity_default(value: number): boolean;
|
||||
negativeInfDefault(): number;
|
||||
mutate_negative_inf_default(value: number): boolean;
|
||||
negativeInfinityDefault(): number;
|
||||
mutate_negative_infinity_default(value: number): boolean;
|
||||
doubleInfDefault(): number;
|
||||
mutate_double_inf_default(value: number): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startMonster(builder: flatbuffers.Builder): void;
|
||||
static addPos(builder: flatbuffers.Builder, posOffset: flatbuffers.Offset): void;
|
||||
static addMana(builder: flatbuffers.Builder, mana: number): void;
|
||||
static addHp(builder: flatbuffers.Builder, hp: number): void;
|
||||
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void;
|
||||
static addInventory(builder: flatbuffers.Builder, inventoryOffset: flatbuffers.Offset): void;
|
||||
static createInventoryVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
||||
static startInventoryVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addColor(builder: flatbuffers.Builder, color: Color): void;
|
||||
static addTestType(builder: flatbuffers.Builder, testType: Any): void;
|
||||
static addTest(builder: flatbuffers.Builder, testOffset: flatbuffers.Offset): void;
|
||||
static addTest4(builder: flatbuffers.Builder, test4Offset: flatbuffers.Offset): void;
|
||||
static startTest4Vector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addTestarrayofstring(builder: flatbuffers.Builder, testarrayofstringOffset: flatbuffers.Offset): void;
|
||||
static createTestarrayofstringVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
|
||||
static startTestarrayofstringVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addTestarrayoftables(builder: flatbuffers.Builder, testarrayoftablesOffset: flatbuffers.Offset): void;
|
||||
static createTestarrayoftablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
|
||||
static startTestarrayoftablesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addEnemy(builder: flatbuffers.Builder, enemyOffset: flatbuffers.Offset): void;
|
||||
static addTestnestedflatbuffer(builder: flatbuffers.Builder, testnestedflatbufferOffset: flatbuffers.Offset): void;
|
||||
static createTestnestedflatbufferVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
||||
static startTestnestedflatbufferVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addTestempty(builder: flatbuffers.Builder, testemptyOffset: flatbuffers.Offset): void;
|
||||
static addTestbool(builder: flatbuffers.Builder, testbool: boolean): void;
|
||||
static addTesthashs32Fnv1(builder: flatbuffers.Builder, testhashs32Fnv1: number): void;
|
||||
static addTesthashu32Fnv1(builder: flatbuffers.Builder, testhashu32Fnv1: number): void;
|
||||
static addTesthashs64Fnv1(builder: flatbuffers.Builder, testhashs64Fnv1: bigint): void;
|
||||
static addTesthashu64Fnv1(builder: flatbuffers.Builder, testhashu64Fnv1: bigint): void;
|
||||
static addTesthashs32Fnv1a(builder: flatbuffers.Builder, testhashs32Fnv1a: number): void;
|
||||
static addTesthashu32Fnv1a(builder: flatbuffers.Builder, testhashu32Fnv1a: number): void;
|
||||
static addTesthashs64Fnv1a(builder: flatbuffers.Builder, testhashs64Fnv1a: bigint): void;
|
||||
static addTesthashu64Fnv1a(builder: flatbuffers.Builder, testhashu64Fnv1a: bigint): void;
|
||||
static addTestarrayofbools(builder: flatbuffers.Builder, testarrayofboolsOffset: flatbuffers.Offset): void;
|
||||
static createTestarrayofboolsVector(builder: flatbuffers.Builder, data: boolean[]): flatbuffers.Offset;
|
||||
static startTestarrayofboolsVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addTestf(builder: flatbuffers.Builder, testf: number): void;
|
||||
static addTestf2(builder: flatbuffers.Builder, testf2: number): void;
|
||||
static addTestf3(builder: flatbuffers.Builder, testf3: number): void;
|
||||
static addTestarrayofstring2(builder: flatbuffers.Builder, testarrayofstring2Offset: flatbuffers.Offset): void;
|
||||
static createTestarrayofstring2Vector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
|
||||
static startTestarrayofstring2Vector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addTestarrayofsortedstruct(builder: flatbuffers.Builder, testarrayofsortedstructOffset: flatbuffers.Offset): void;
|
||||
static startTestarrayofsortedstructVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addFlex(builder: flatbuffers.Builder, flexOffset: flatbuffers.Offset): void;
|
||||
static createFlexVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
||||
static startFlexVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addTest5(builder: flatbuffers.Builder, test5Offset: flatbuffers.Offset): void;
|
||||
static startTest5Vector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addVectorOfLongs(builder: flatbuffers.Builder, vectorOfLongsOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfLongsVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
|
||||
static startVectorOfLongsVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addVectorOfDoubles(builder: flatbuffers.Builder, vectorOfDoublesOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfDoublesVector(builder: flatbuffers.Builder, data: number[] | Float64Array): flatbuffers.Offset;
|
||||
/**
|
||||
* @deprecated This Uint8Array overload will be removed in the future.
|
||||
*/
|
||||
static createVectorOfDoublesVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
||||
static startVectorOfDoublesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addParentNamespaceTest(builder: flatbuffers.Builder, parentNamespaceTestOffset: flatbuffers.Offset): void;
|
||||
static addVectorOfReferrables(builder: flatbuffers.Builder, vectorOfReferrablesOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfReferrablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
|
||||
static startVectorOfReferrablesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addSingleWeakReference(builder: flatbuffers.Builder, singleWeakReference: bigint): void;
|
||||
static addVectorOfWeakReferences(builder: flatbuffers.Builder, vectorOfWeakReferencesOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfWeakReferencesVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
|
||||
static startVectorOfWeakReferencesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addVectorOfStrongReferrables(builder: flatbuffers.Builder, vectorOfStrongReferrablesOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfStrongReferrablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
|
||||
static startVectorOfStrongReferrablesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addCoOwningReference(builder: flatbuffers.Builder, coOwningReference: bigint): void;
|
||||
static addVectorOfCoOwningReferences(builder: flatbuffers.Builder, vectorOfCoOwningReferencesOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfCoOwningReferencesVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
|
||||
static startVectorOfCoOwningReferencesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addNonOwningReference(builder: flatbuffers.Builder, nonOwningReference: bigint): void;
|
||||
static addVectorOfNonOwningReferences(builder: flatbuffers.Builder, vectorOfNonOwningReferencesOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfNonOwningReferencesVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
|
||||
static startVectorOfNonOwningReferencesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addAnyUniqueType(builder: flatbuffers.Builder, anyUniqueType: AnyUniqueAliases): void;
|
||||
static addAnyUnique(builder: flatbuffers.Builder, anyUniqueOffset: flatbuffers.Offset): void;
|
||||
static addAnyAmbiguousType(builder: flatbuffers.Builder, anyAmbiguousType: AnyAmbiguousAliases): void;
|
||||
static addAnyAmbiguous(builder: flatbuffers.Builder, anyAmbiguousOffset: flatbuffers.Offset): void;
|
||||
static addVectorOfEnums(builder: flatbuffers.Builder, vectorOfEnumsOffset: flatbuffers.Offset): void;
|
||||
static createVectorOfEnumsVector(builder: flatbuffers.Builder, data: Color[]): flatbuffers.Offset;
|
||||
static startVectorOfEnumsVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addSignedEnum(builder: flatbuffers.Builder, signedEnum: Race): void;
|
||||
static addTestrequirednestedflatbuffer(builder: flatbuffers.Builder, testrequirednestedflatbufferOffset: flatbuffers.Offset): void;
|
||||
static createTestrequirednestedflatbufferVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
||||
static startTestrequirednestedflatbufferVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addScalarKeySortedTables(builder: flatbuffers.Builder, scalarKeySortedTablesOffset: flatbuffers.Offset): void;
|
||||
static createScalarKeySortedTablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
|
||||
static startScalarKeySortedTablesVector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addNativeInline(builder: flatbuffers.Builder, nativeInlineOffset: flatbuffers.Offset): void;
|
||||
static addLongEnumNonEnumDefault(builder: flatbuffers.Builder, longEnumNonEnumDefault: bigint): void;
|
||||
static addLongEnumNormalDefault(builder: flatbuffers.Builder, longEnumNormalDefault: bigint): void;
|
||||
static addNanDefault(builder: flatbuffers.Builder, nanDefault: number): void;
|
||||
static addInfDefault(builder: flatbuffers.Builder, infDefault: number): void;
|
||||
static addPositiveInfDefault(builder: flatbuffers.Builder, positiveInfDefault: number): void;
|
||||
static addInfinityDefault(builder: flatbuffers.Builder, infinityDefault: number): void;
|
||||
static addPositiveInfinityDefault(builder: flatbuffers.Builder, positiveInfinityDefault: number): void;
|
||||
static addNegativeInfDefault(builder: flatbuffers.Builder, negativeInfDefault: number): void;
|
||||
static addNegativeInfinityDefault(builder: flatbuffers.Builder, negativeInfinityDefault: number): void;
|
||||
static addDoubleInfDefault(builder: flatbuffers.Builder, doubleInfDefault: number): void;
|
||||
static endMonster(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static finishMonsterBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
static finishSizePrefixedMonsterBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): Monster;
|
||||
unpack(): MonsterT;
|
||||
unpackTo(_o: MonsterT): void;
|
||||
}
|
||||
export declare class MonsterT implements flatbuffers.IGeneratedObject {
|
||||
pos: Vec3T | null;
|
||||
mana: number;
|
||||
hp: number;
|
||||
name: string | Uint8Array | null;
|
||||
inventory: (number)[];
|
||||
color: Color;
|
||||
testType: Any;
|
||||
test: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null;
|
||||
test4: (TestT)[];
|
||||
testarrayofstring: (string)[];
|
||||
testarrayoftables: (MonsterT)[];
|
||||
enemy: MonsterT | null;
|
||||
testnestedflatbuffer: (number)[];
|
||||
testempty: StatT | null;
|
||||
testbool: boolean;
|
||||
testhashs32Fnv1: number;
|
||||
testhashu32Fnv1: number;
|
||||
testhashs64Fnv1: bigint;
|
||||
testhashu64Fnv1: bigint;
|
||||
testhashs32Fnv1a: number;
|
||||
testhashu32Fnv1a: number;
|
||||
testhashs64Fnv1a: bigint;
|
||||
testhashu64Fnv1a: bigint;
|
||||
testarrayofbools: (boolean)[];
|
||||
testf: number;
|
||||
testf2: number;
|
||||
testf3: number;
|
||||
testarrayofstring2: (string)[];
|
||||
testarrayofsortedstruct: (AbilityT)[];
|
||||
flex: (number)[];
|
||||
test5: (TestT)[];
|
||||
vectorOfLongs: (bigint)[];
|
||||
vectorOfDoubles: (number)[];
|
||||
parentNamespaceTest: InParentNamespaceT | null;
|
||||
vectorOfReferrables: (ReferrableT)[];
|
||||
singleWeakReference: bigint;
|
||||
vectorOfWeakReferences: (bigint)[];
|
||||
vectorOfStrongReferrables: (ReferrableT)[];
|
||||
coOwningReference: bigint;
|
||||
vectorOfCoOwningReferences: (bigint)[];
|
||||
nonOwningReference: bigint;
|
||||
vectorOfNonOwningReferences: (bigint)[];
|
||||
anyUniqueType: AnyUniqueAliases;
|
||||
anyUnique: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null;
|
||||
anyAmbiguousType: AnyAmbiguousAliases;
|
||||
anyAmbiguous: MonsterT | null;
|
||||
vectorOfEnums: (Color)[];
|
||||
signedEnum: Race;
|
||||
testrequirednestedflatbuffer: (number)[];
|
||||
scalarKeySortedTables: (StatT)[];
|
||||
nativeInline: TestT | null;
|
||||
longEnumNonEnumDefault: bigint;
|
||||
longEnumNormalDefault: bigint;
|
||||
nanDefault: number;
|
||||
infDefault: number;
|
||||
positiveInfDefault: number;
|
||||
infinityDefault: number;
|
||||
positiveInfinityDefault: number;
|
||||
negativeInfDefault: number;
|
||||
negativeInfinityDefault: number;
|
||||
doubleInfDefault: number;
|
||||
constructor(pos?: Vec3T | null, mana?: number, hp?: number, name?: string | Uint8Array | null, inventory?: (number)[], color?: Color, testType?: Any, test?: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null, test4?: (TestT)[], testarrayofstring?: (string)[], testarrayoftables?: (MonsterT)[], enemy?: MonsterT | null, testnestedflatbuffer?: (number)[], testempty?: StatT | null, testbool?: boolean, testhashs32Fnv1?: number, testhashu32Fnv1?: number, testhashs64Fnv1?: bigint, testhashu64Fnv1?: bigint, testhashs32Fnv1a?: number, testhashu32Fnv1a?: number, testhashs64Fnv1a?: bigint, testhashu64Fnv1a?: bigint, testarrayofbools?: (boolean)[], testf?: number, testf2?: number, testf3?: number, testarrayofstring2?: (string)[], testarrayofsortedstruct?: (AbilityT)[], flex?: (number)[], test5?: (TestT)[], vectorOfLongs?: (bigint)[], vectorOfDoubles?: (number)[], parentNamespaceTest?: InParentNamespaceT | null, vectorOfReferrables?: (ReferrableT)[], singleWeakReference?: bigint, vectorOfWeakReferences?: (bigint)[], vectorOfStrongReferrables?: (ReferrableT)[], coOwningReference?: bigint, vectorOfCoOwningReferences?: (bigint)[], nonOwningReference?: bigint, vectorOfNonOwningReferences?: (bigint)[], anyUniqueType?: AnyUniqueAliases, anyUnique?: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null, anyAmbiguousType?: AnyAmbiguousAliases, anyAmbiguous?: MonsterT | null, vectorOfEnums?: (Color)[], signedEnum?: Race, testrequirednestedflatbuffer?: (number)[], scalarKeySortedTables?: (StatT)[], nativeInline?: TestT | null, longEnumNonEnumDefault?: bigint, longEnumNormalDefault?: bigint, nanDefault?: number, infDefault?: number, positiveInfDefault?: number, infinityDefault?: number, positiveInfinityDefault?: number, negativeInfDefault?: number, negativeInfinityDefault?: number, doubleInfDefault?: number);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
6
tests/ts/my-game/example/race.d.ts
vendored
Normal file
6
tests/ts/my-game/example/race.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare enum Race {
|
||||
None = -1,
|
||||
Human = 0,
|
||||
Dwarf = 1,
|
||||
Elf = 2
|
||||
}
|
||||
@@ -5,4 +5,4 @@ export var Race;
|
||||
Race[Race["Human"] = 0] = "Human";
|
||||
Race[Race["Dwarf"] = 1] = "Dwarf";
|
||||
Race[Race["Elf"] = 2] = "Elf";
|
||||
})(Race || (Race = {}));
|
||||
})(Race = Race || (Race = {}));
|
||||
|
||||
24
tests/ts/my-game/example/referrable.d.ts
vendored
Normal file
24
tests/ts/my-game/example/referrable.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Referrable implements flatbuffers.IUnpackableObject<ReferrableT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Referrable;
|
||||
static getRootAsReferrable(bb: flatbuffers.ByteBuffer, obj?: Referrable): Referrable;
|
||||
static getSizePrefixedRootAsReferrable(bb: flatbuffers.ByteBuffer, obj?: Referrable): Referrable;
|
||||
id(): bigint;
|
||||
mutate_id(value: bigint): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startReferrable(builder: flatbuffers.Builder): void;
|
||||
static addId(builder: flatbuffers.Builder, id: bigint): void;
|
||||
static endReferrable(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createReferrable(builder: flatbuffers.Builder, id: bigint): flatbuffers.Offset;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): Referrable;
|
||||
unpack(): ReferrableT;
|
||||
unpackTo(_o: ReferrableT): void;
|
||||
}
|
||||
export declare class ReferrableT implements flatbuffers.IGeneratedObject {
|
||||
id: bigint;
|
||||
constructor(id?: bigint);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
32
tests/ts/my-game/example/stat.d.ts
vendored
Normal file
32
tests/ts/my-game/example/stat.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Stat implements flatbuffers.IUnpackableObject<StatT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Stat;
|
||||
static getRootAsStat(bb: flatbuffers.ByteBuffer, obj?: Stat): Stat;
|
||||
static getSizePrefixedRootAsStat(bb: flatbuffers.ByteBuffer, obj?: Stat): Stat;
|
||||
id(): string | null;
|
||||
id(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
val(): bigint;
|
||||
mutate_val(value: bigint): boolean;
|
||||
count(): number;
|
||||
mutate_count(value: number): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startStat(builder: flatbuffers.Builder): void;
|
||||
static addId(builder: flatbuffers.Builder, idOffset: flatbuffers.Offset): void;
|
||||
static addVal(builder: flatbuffers.Builder, val: bigint): void;
|
||||
static addCount(builder: flatbuffers.Builder, count: number): void;
|
||||
static endStat(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createStat(builder: flatbuffers.Builder, idOffset: flatbuffers.Offset, val: bigint, count: number): flatbuffers.Offset;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): Stat;
|
||||
unpack(): StatT;
|
||||
unpackTo(_o: StatT): void;
|
||||
}
|
||||
export declare class StatT implements flatbuffers.IGeneratedObject {
|
||||
id: string | Uint8Array | null;
|
||||
val: bigint;
|
||||
count: number;
|
||||
constructor(id?: string | Uint8Array | null, val?: bigint, count?: number);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
18
tests/ts/my-game/example/struct-of-structs-of-structs.d.ts
vendored
Normal file
18
tests/ts/my-game/example/struct-of-structs-of-structs.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
|
||||
export declare class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): StructOfStructsOfStructs;
|
||||
a(obj?: StructOfStructs): StructOfStructs | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
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;
|
||||
unpack(): StructOfStructsOfStructsT;
|
||||
unpackTo(_o: StructOfStructsOfStructsT): void;
|
||||
}
|
||||
export declare class StructOfStructsOfStructsT implements flatbuffers.IGeneratedObject {
|
||||
a: StructOfStructsT | null;
|
||||
constructor(a?: StructOfStructsT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
@@ -46,7 +46,6 @@ export class StructOfStructsOfStructsT {
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
23
tests/ts/my-game/example/struct-of-structs.d.ts
vendored
Normal file
23
tests/ts/my-game/example/struct-of-structs.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { Ability, AbilityT } from '../../my-game/example/ability.js';
|
||||
import { Test, TestT } from '../../my-game/example/test.js';
|
||||
export declare class StructOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): StructOfStructs;
|
||||
a(obj?: Ability): Ability | null;
|
||||
b(obj?: Test): Test | null;
|
||||
c(obj?: Ability): Ability | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
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;
|
||||
unpack(): StructOfStructsT;
|
||||
unpackTo(_o: StructOfStructsT): void;
|
||||
}
|
||||
export declare class StructOfStructsT implements flatbuffers.IGeneratedObject {
|
||||
a: AbilityT | null;
|
||||
b: TestT | null;
|
||||
c: AbilityT | null;
|
||||
constructor(a?: AbilityT | null, b?: TestT | null, c?: AbilityT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
@@ -56,7 +56,6 @@ export class StructOfStructsT {
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
25
tests/ts/my-game/example/test-simple-table-with-enum.d.ts
vendored
Normal file
25
tests/ts/my-game/example/test-simple-table-with-enum.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { Color } from '../../my-game/example/color.js';
|
||||
export declare class TestSimpleTableWithEnum implements flatbuffers.IUnpackableObject<TestSimpleTableWithEnumT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): TestSimpleTableWithEnum;
|
||||
static getRootAsTestSimpleTableWithEnum(bb: flatbuffers.ByteBuffer, obj?: TestSimpleTableWithEnum): TestSimpleTableWithEnum;
|
||||
static getSizePrefixedRootAsTestSimpleTableWithEnum(bb: flatbuffers.ByteBuffer, obj?: TestSimpleTableWithEnum): TestSimpleTableWithEnum;
|
||||
color(): Color;
|
||||
mutate_color(value: Color): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startTestSimpleTableWithEnum(builder: flatbuffers.Builder): void;
|
||||
static addColor(builder: flatbuffers.Builder, color: Color): void;
|
||||
static endTestSimpleTableWithEnum(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createTestSimpleTableWithEnum(builder: flatbuffers.Builder, color: Color): flatbuffers.Offset;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): TestSimpleTableWithEnum;
|
||||
unpack(): TestSimpleTableWithEnumT;
|
||||
unpackTo(_o: TestSimpleTableWithEnumT): void;
|
||||
}
|
||||
export declare class TestSimpleTableWithEnumT implements flatbuffers.IGeneratedObject {
|
||||
color: Color;
|
||||
constructor(color?: Color);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
21
tests/ts/my-game/example/test.d.ts
vendored
Normal file
21
tests/ts/my-game/example/test.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Test implements flatbuffers.IUnpackableObject<TestT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Test;
|
||||
a(): number;
|
||||
mutate_a(value: number): boolean;
|
||||
b(): number;
|
||||
mutate_b(value: number): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createTest(builder: flatbuffers.Builder, a: number, b: number): flatbuffers.Offset;
|
||||
unpack(): TestT;
|
||||
unpackTo(_o: TestT): void;
|
||||
}
|
||||
export declare class TestT implements flatbuffers.IGeneratedObject {
|
||||
a: number;
|
||||
b: number;
|
||||
constructor(a?: number, b?: number);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
82
tests/ts/my-game/example/type-aliases.d.ts
vendored
Normal file
82
tests/ts/my-game/example/type-aliases.d.ts
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class TypeAliases implements flatbuffers.IUnpackableObject<TypeAliasesT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): TypeAliases;
|
||||
static getRootAsTypeAliases(bb: flatbuffers.ByteBuffer, obj?: TypeAliases): TypeAliases;
|
||||
static getSizePrefixedRootAsTypeAliases(bb: flatbuffers.ByteBuffer, obj?: TypeAliases): TypeAliases;
|
||||
i8(): number;
|
||||
mutate_i8(value: number): boolean;
|
||||
u8(): number;
|
||||
mutate_u8(value: number): boolean;
|
||||
i16(): number;
|
||||
mutate_i16(value: number): boolean;
|
||||
u16(): number;
|
||||
mutate_u16(value: number): boolean;
|
||||
i32(): number;
|
||||
mutate_i32(value: number): boolean;
|
||||
u32(): number;
|
||||
mutate_u32(value: number): boolean;
|
||||
i64(): bigint;
|
||||
mutate_i64(value: bigint): boolean;
|
||||
u64(): bigint;
|
||||
mutate_u64(value: bigint): boolean;
|
||||
f32(): number;
|
||||
mutate_f32(value: number): boolean;
|
||||
f64(): number;
|
||||
mutate_f64(value: number): boolean;
|
||||
v8(index: number): number | null;
|
||||
v8Length(): number;
|
||||
v8Array(): Int8Array | null;
|
||||
vf64(index: number): number | null;
|
||||
vf64Length(): number;
|
||||
vf64Array(): Float64Array | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startTypeAliases(builder: flatbuffers.Builder): void;
|
||||
static addI8(builder: flatbuffers.Builder, i8: number): void;
|
||||
static addU8(builder: flatbuffers.Builder, u8: number): void;
|
||||
static addI16(builder: flatbuffers.Builder, i16: number): void;
|
||||
static addU16(builder: flatbuffers.Builder, u16: number): void;
|
||||
static addI32(builder: flatbuffers.Builder, i32: number): void;
|
||||
static addU32(builder: flatbuffers.Builder, u32: number): void;
|
||||
static addI64(builder: flatbuffers.Builder, i64: bigint): void;
|
||||
static addU64(builder: flatbuffers.Builder, u64: bigint): void;
|
||||
static addF32(builder: flatbuffers.Builder, f32: number): void;
|
||||
static addF64(builder: flatbuffers.Builder, f64: number): void;
|
||||
static addV8(builder: flatbuffers.Builder, v8Offset: flatbuffers.Offset): void;
|
||||
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 startV8Vector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static addVf64(builder: flatbuffers.Builder, vf64Offset: flatbuffers.Offset): void;
|
||||
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 startVf64Vector(builder: flatbuffers.Builder, numElems: number): void;
|
||||
static endTypeAliases(builder: flatbuffers.Builder): flatbuffers.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;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): TypeAliases;
|
||||
unpack(): TypeAliasesT;
|
||||
unpackTo(_o: TypeAliasesT): void;
|
||||
}
|
||||
export declare class TypeAliasesT implements flatbuffers.IGeneratedObject {
|
||||
i8: number;
|
||||
u8: number;
|
||||
i16: number;
|
||||
u16: number;
|
||||
i32: number;
|
||||
u32: number;
|
||||
i64: bigint;
|
||||
u64: bigint;
|
||||
f32: number;
|
||||
f64: number;
|
||||
v8: (number)[];
|
||||
vf64: (number)[];
|
||||
constructor(i8?: number, u8?: number, i16?: number, u16?: number, i32?: number, u32?: number, i64?: bigint, u64?: bigint, f32?: number, f64?: number, v8?: (number)[], vf64?: (number)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
34
tests/ts/my-game/example/vec3.d.ts
vendored
Normal file
34
tests/ts/my-game/example/vec3.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { Color } from '../../my-game/example/color.js';
|
||||
import { Test, TestT } from '../../my-game/example/test.js';
|
||||
export declare class Vec3 implements flatbuffers.IUnpackableObject<Vec3T> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Vec3;
|
||||
x(): number;
|
||||
mutate_x(value: number): boolean;
|
||||
y(): number;
|
||||
mutate_y(value: number): boolean;
|
||||
z(): number;
|
||||
mutate_z(value: number): boolean;
|
||||
test1(): number;
|
||||
mutate_test1(value: number): boolean;
|
||||
test2(): Color;
|
||||
mutate_test2(value: Color): boolean;
|
||||
test3(obj?: Test): Test | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createVec3(builder: flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: Color, test3_a: number, test3_b: number): flatbuffers.Offset;
|
||||
unpack(): Vec3T;
|
||||
unpackTo(_o: Vec3T): void;
|
||||
}
|
||||
export declare class Vec3T implements flatbuffers.IGeneratedObject {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
test1: number;
|
||||
test2: Color;
|
||||
test3: TestT | null;
|
||||
constructor(x?: number, y?: number, z?: number, test1?: number, test2?: Color, test3?: TestT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
@@ -92,7 +92,6 @@ export class Vec3T {
|
||||
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));
|
||||
return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, (this.test3?.a ?? 0), (this.test3?.b ?? 0));
|
||||
}
|
||||
}
|
||||
|
||||
1
tests/ts/my-game/example2.d.ts
vendored
Normal file
1
tests/ts/my-game/example2.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { Monster } from './example2/monster.js';
|
||||
2
tests/ts/my-game/example2.js
Normal file
2
tests/ts/my-game/example2.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { Monster } from './example2/monster.js';
|
||||
3
tests/ts/my-game/example2.ts
Normal file
3
tests/ts/my-game/example2.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { Monster } from './example2/monster.js';
|
||||
20
tests/ts/my-game/example2/monster.d.ts
vendored
Normal file
20
tests/ts/my-game/example2/monster.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Monster implements flatbuffers.IUnpackableObject<MonsterT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Monster;
|
||||
static getRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
|
||||
static getSizePrefixedRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startMonster(builder: flatbuffers.Builder): void;
|
||||
static endMonster(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createMonster(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): Monster;
|
||||
unpack(): MonsterT;
|
||||
unpackTo(_o: MonsterT): void;
|
||||
}
|
||||
export declare class MonsterT implements flatbuffers.IGeneratedObject {
|
||||
constructor();
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
20
tests/ts/my-game/in-parent-namespace.d.ts
vendored
Normal file
20
tests/ts/my-game/in-parent-namespace.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class InParentNamespace implements flatbuffers.IUnpackableObject<InParentNamespaceT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): InParentNamespace;
|
||||
static getRootAsInParentNamespace(bb: flatbuffers.ByteBuffer, obj?: InParentNamespace): InParentNamespace;
|
||||
static getSizePrefixedRootAsInParentNamespace(bb: flatbuffers.ByteBuffer, obj?: InParentNamespace): InParentNamespace;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startInParentNamespace(builder: flatbuffers.Builder): void;
|
||||
static endInParentNamespace(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createInParentNamespace(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): InParentNamespace;
|
||||
unpack(): InParentNamespaceT;
|
||||
unpackTo(_o: InParentNamespaceT): void;
|
||||
}
|
||||
export declare class InParentNamespaceT implements flatbuffers.IGeneratedObject {
|
||||
constructor();
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
3
tests/ts/my-game/other-name-space.d.ts
vendored
Normal file
3
tests/ts/my-game/other-name-space.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { FromInclude } from './other-name-space/from-include.js';
|
||||
export { TableB } from './other-name-space/table-b.js';
|
||||
export { Unused } from './other-name-space/unused.js';
|
||||
4
tests/ts/my-game/other-name-space.js
Normal file
4
tests/ts/my-game/other-name-space.js
Normal file
@@ -0,0 +1,4 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { FromInclude } from './other-name-space/from-include.js';
|
||||
export { TableB } from './other-name-space/table-b.js';
|
||||
export { Unused } from './other-name-space/unused.js';
|
||||
5
tests/ts/my-game/other-name-space.ts
Normal file
5
tests/ts/my-game/other-name-space.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { FromInclude } from './other-name-space/from-include.js';
|
||||
export { TableB } from './other-name-space/table-b.js';
|
||||
export { Unused } from './other-name-space/unused.js';
|
||||
3
tests/ts/my-game/other-name-space/from-include.d.ts
vendored
Normal file
3
tests/ts/my-game/other-name-space/from-include.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare enum FromInclude {
|
||||
IncludeVal = "0"
|
||||
}
|
||||
5
tests/ts/my-game/other-name-space/from-include.js
Normal file
5
tests/ts/my-game/other-name-space/from-include.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export var FromInclude;
|
||||
(function (FromInclude) {
|
||||
FromInclude["IncludeVal"] = "0";
|
||||
})(FromInclude = FromInclude || (FromInclude = {}));
|
||||
5
tests/ts/my-game/other-name-space/from-include.ts
Normal file
5
tests/ts/my-game/other-name-space/from-include.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum FromInclude {
|
||||
IncludeVal = '0'
|
||||
}
|
||||
24
tests/ts/my-game/other-name-space/table-b.d.ts
vendored
Normal file
24
tests/ts/my-game/other-name-space/table-b.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { TableA, TableAT } from '../../table-a.js';
|
||||
export declare class TableB implements flatbuffers.IUnpackableObject<TableBT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): TableB;
|
||||
static getRootAsTableB(bb: flatbuffers.ByteBuffer, obj?: TableB): TableB;
|
||||
static getSizePrefixedRootAsTableB(bb: flatbuffers.ByteBuffer, obj?: TableB): TableB;
|
||||
a(obj?: TableA): TableA | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startTableB(builder: flatbuffers.Builder): void;
|
||||
static addA(builder: flatbuffers.Builder, aOffset: flatbuffers.Offset): void;
|
||||
static endTableB(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static createTableB(builder: flatbuffers.Builder, aOffset: flatbuffers.Offset): flatbuffers.Offset;
|
||||
serialize(): Uint8Array;
|
||||
static deserialize(buffer: Uint8Array): TableB;
|
||||
unpack(): TableBT;
|
||||
unpackTo(_o: TableBT): void;
|
||||
}
|
||||
export declare class TableBT implements flatbuffers.IGeneratedObject {
|
||||
a: TableAT | null;
|
||||
constructor(a?: TableAT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
64
tests/ts/my-game/other-name-space/table-b.js
Normal file
64
tests/ts/my-game/other-name-space/table-b.js
Normal file
@@ -0,0 +1,64 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { TableA } from '../../table-a.js';
|
||||
export class TableB {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsTableB(bb, obj) {
|
||||
return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsTableB(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
a(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableA()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.OtherNameSpace.TableB';
|
||||
}
|
||||
static startTableB(builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static endTableB(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static createTableB(builder, aOffset) {
|
||||
TableB.startTableB(builder);
|
||||
TableB.addA(builder, aOffset);
|
||||
return TableB.endTableB(builder);
|
||||
}
|
||||
serialize() {
|
||||
return this.bb.bytes();
|
||||
}
|
||||
static deserialize(buffer) {
|
||||
return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer));
|
||||
}
|
||||
unpack() {
|
||||
return new TableBT((this.a() !== null ? this.a().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = (this.a() !== null ? this.a().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class TableBT {
|
||||
constructor(a = null) {
|
||||
this.a = a;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = (this.a !== null ? this.a.pack(builder) : 0);
|
||||
return TableB.createTableB(builder, a);
|
||||
}
|
||||
}
|
||||
87
tests/ts/my-game/other-name-space/table-b.ts
Normal file
87
tests/ts/my-game/other-name-space/table-b.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { TableA, TableAT } from '../../table-a.js';
|
||||
|
||||
|
||||
export class TableB implements flatbuffers.IUnpackableObject<TableBT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TableB {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:TableB):TableB {
|
||||
return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:TableB):TableB {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
a(obj?:TableA):TableA|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TableA()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.OtherNameSpace.TableB';
|
||||
}
|
||||
|
||||
static startTableB(builder:flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
|
||||
static endTableB(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTableB(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
TableB.startTableB(builder);
|
||||
TableB.addA(builder, aOffset);
|
||||
return TableB.endTableB(builder);
|
||||
}
|
||||
|
||||
serialize():Uint8Array {
|
||||
return this.bb!.bytes();
|
||||
}
|
||||
|
||||
static deserialize(buffer: Uint8Array):TableB {
|
||||
return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer))
|
||||
}
|
||||
|
||||
unpack(): TableBT {
|
||||
return new TableBT(
|
||||
(this.a() !== null ? this.a()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TableBT): void {
|
||||
_o.a = (this.a() !== null ? this.a()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class TableBT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: TableAT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const a = (this.a !== null ? this.a!.pack(builder) : 0);
|
||||
|
||||
return TableB.createTableB(builder,
|
||||
a
|
||||
);
|
||||
}
|
||||
}
|
||||
18
tests/ts/my-game/other-name-space/unused.d.ts
vendored
Normal file
18
tests/ts/my-game/other-name-space/unused.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class Unused implements flatbuffers.IUnpackableObject<UnusedT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): Unused;
|
||||
a(): number;
|
||||
mutate_a(value: number): boolean;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createUnused(builder: flatbuffers.Builder, a: number): flatbuffers.Offset;
|
||||
unpack(): UnusedT;
|
||||
unpackTo(_o: UnusedT): void;
|
||||
}
|
||||
export declare class UnusedT implements flatbuffers.IGeneratedObject {
|
||||
a: number;
|
||||
constructor(a?: number);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
44
tests/ts/my-game/other-name-space/unused.js
Normal file
44
tests/ts/my-game/other-name-space/unused.js
Normal file
@@ -0,0 +1,44 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export class Unused {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readInt32(this.bb_pos);
|
||||
}
|
||||
mutate_a(value) {
|
||||
this.bb.writeInt32(this.bb_pos + 0, value);
|
||||
return true;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.OtherNameSpace.Unused';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 4;
|
||||
}
|
||||
static createUnused(builder, a) {
|
||||
builder.prep(4, 4);
|
||||
builder.writeInt32(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new UnusedT(this.a());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
}
|
||||
}
|
||||
export class UnusedT {
|
||||
constructor(a = 0) {
|
||||
this.a = a;
|
||||
}
|
||||
pack(builder) {
|
||||
return Unused.createUnused(builder, this.a);
|
||||
}
|
||||
}
|
||||
63
tests/ts/my-game/other-name-space/unused.ts
Normal file
63
tests/ts/my-game/other-name-space/unused.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
|
||||
export class Unused implements flatbuffers.IUnpackableObject<UnusedT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Unused {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():number {
|
||||
return this.bb!.readInt32(this.bb_pos);
|
||||
}
|
||||
|
||||
mutate_a(value:number):boolean {
|
||||
this.bb!.writeInt32(this.bb_pos + 0, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.OtherNameSpace.Unused';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 4;
|
||||
}
|
||||
|
||||
static createUnused(builder:flatbuffers.Builder, a: number):flatbuffers.Offset {
|
||||
builder.prep(4, 4);
|
||||
builder.writeInt32(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): UnusedT {
|
||||
return new UnusedT(
|
||||
this.a()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: UnusedT): void {
|
||||
_o.a = this.a();
|
||||
}
|
||||
}
|
||||
|
||||
export class UnusedT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return Unused.createUnused(builder,
|
||||
this.a
|
||||
);
|
||||
}
|
||||
}
|
||||
2
tests/ts/no_import_ext/optional-scalars.d.ts
vendored
Normal file
2
tests/ts/no_import_ext/optional-scalars.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { OptionalByte } from './optional-scalars/optional-byte';
|
||||
export { ScalarStuff } from './optional-scalars/scalar-stuff';
|
||||
5
tests/ts/no_import_ext/optional-scalars/optional-byte.d.ts
vendored
Normal file
5
tests/ts/no_import_ext/optional-scalars/optional-byte.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare enum OptionalByte {
|
||||
None = 0,
|
||||
One = 1,
|
||||
Two = 2
|
||||
}
|
||||
88
tests/ts/no_import_ext/optional-scalars/scalar-stuff.d.ts
vendored
Normal file
88
tests/ts/no_import_ext/optional-scalars/scalar-stuff.d.ts
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { OptionalByte } from '../optional-scalars/optional-byte';
|
||||
export declare class ScalarStuff {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ScalarStuff;
|
||||
static getRootAsScalarStuff(bb: flatbuffers.ByteBuffer, obj?: ScalarStuff): ScalarStuff;
|
||||
static getSizePrefixedRootAsScalarStuff(bb: flatbuffers.ByteBuffer, obj?: ScalarStuff): ScalarStuff;
|
||||
static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
|
||||
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;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startScalarStuff(builder: flatbuffers.Builder): void;
|
||||
static addJustI8(builder: flatbuffers.Builder, justI8: number): void;
|
||||
static addMaybeI8(builder: flatbuffers.Builder, maybeI8: number): void;
|
||||
static addDefaultI8(builder: flatbuffers.Builder, defaultI8: number): void;
|
||||
static addJustU8(builder: flatbuffers.Builder, justU8: number): void;
|
||||
static addMaybeU8(builder: flatbuffers.Builder, maybeU8: number): void;
|
||||
static addDefaultU8(builder: flatbuffers.Builder, defaultU8: number): void;
|
||||
static addJustI16(builder: flatbuffers.Builder, justI16: number): void;
|
||||
static addMaybeI16(builder: flatbuffers.Builder, maybeI16: number): void;
|
||||
static addDefaultI16(builder: flatbuffers.Builder, defaultI16: number): void;
|
||||
static addJustU16(builder: flatbuffers.Builder, justU16: number): void;
|
||||
static addMaybeU16(builder: flatbuffers.Builder, maybeU16: number): void;
|
||||
static addDefaultU16(builder: flatbuffers.Builder, defaultU16: number): void;
|
||||
static addJustI32(builder: flatbuffers.Builder, justI32: number): void;
|
||||
static addMaybeI32(builder: flatbuffers.Builder, maybeI32: number): void;
|
||||
static addDefaultI32(builder: flatbuffers.Builder, defaultI32: number): void;
|
||||
static addJustU32(builder: flatbuffers.Builder, justU32: number): void;
|
||||
static addMaybeU32(builder: flatbuffers.Builder, maybeU32: number): void;
|
||||
static addDefaultU32(builder: flatbuffers.Builder, defaultU32: number): void;
|
||||
static addJustI64(builder: flatbuffers.Builder, justI64: bigint): void;
|
||||
static addMaybeI64(builder: flatbuffers.Builder, maybeI64: bigint): void;
|
||||
static addDefaultI64(builder: flatbuffers.Builder, defaultI64: bigint): void;
|
||||
static addJustU64(builder: flatbuffers.Builder, justU64: bigint): void;
|
||||
static addMaybeU64(builder: flatbuffers.Builder, maybeU64: bigint): void;
|
||||
static addDefaultU64(builder: flatbuffers.Builder, defaultU64: bigint): void;
|
||||
static addJustF32(builder: flatbuffers.Builder, justF32: number): void;
|
||||
static addMaybeF32(builder: flatbuffers.Builder, maybeF32: number): void;
|
||||
static addDefaultF32(builder: flatbuffers.Builder, defaultF32: number): void;
|
||||
static addJustF64(builder: flatbuffers.Builder, justF64: number): void;
|
||||
static addMaybeF64(builder: flatbuffers.Builder, maybeF64: number): void;
|
||||
static addDefaultF64(builder: flatbuffers.Builder, defaultF64: number): void;
|
||||
static addJustBool(builder: flatbuffers.Builder, justBool: boolean): void;
|
||||
static addMaybeBool(builder: flatbuffers.Builder, maybeBool: boolean): void;
|
||||
static addDefaultBool(builder: flatbuffers.Builder, defaultBool: boolean): void;
|
||||
static addJustEnum(builder: flatbuffers.Builder, justEnum: OptionalByte): void;
|
||||
static addMaybeEnum(builder: flatbuffers.Builder, maybeEnum: OptionalByte): void;
|
||||
static addDefaultEnum(builder: flatbuffers.Builder, defaultEnum: OptionalByte): void;
|
||||
static endScalarStuff(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static finishScalarStuffBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
static finishSizePrefixedScalarStuffBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
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;
|
||||
}
|
||||
1
tests/ts/no_import_ext/optional_scalars.d.ts
vendored
Normal file
1
tests/ts/no_import_ext/optional_scalars.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * as optional_scalars from './optional-scalars.js';
|
||||
@@ -1 +1,3 @@
|
||||
export { OptionalByte } from './optional-scalars/optional-byte';
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as optional_scalars_1 from './optional-scalars.js';
|
||||
export { optional_scalars_1 as optional_scalars };
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
export { OptionalByte } from './optional-scalars/optional-byte';
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export * as optional_scalars from './optional-scalars.js';
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
export { OptionalByte } from './optional-scalars/optional-byte';
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export * as optional_scalars from './optional-scalars.js';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user