bulk code format fix (#8707)

This commit is contained in:
Derek Bailey
2025-09-23 21:50:27 -07:00
committed by GitHub
parent 0e047869da
commit caf3b494db
559 changed files with 38871 additions and 31276 deletions

View File

@@ -1,16 +1,18 @@
/* global BigInt */
import assert from 'assert';
import { readFileSync, writeFileSync } from 'fs';
import * as flatbuffers from 'flatbuffers';
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'
import {readFileSync, writeFileSync} from 'fs';
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 () {
BigInt.prototype.toJSON = function() {
return this.toString();
};
function fbObjToObj(fbObj) {
@@ -111,15 +113,26 @@ if (process.argv[2] === 'build') {
const arr = testBuild(null, null);
const parsed = testParse(null, null, Buffer.from(arr));
assert.strictEqual(parsed.a, 'Complex Array Test', 'String Test');
assert.strictEqual(parsed?.cUnderscore?.aUnderscore, 221.13900756835938, 'Float Test');
assert.deepEqual(parsed?.cUnderscore?.bUnderscore, [-700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500, 600, 700], 'Array of signed integers');
assert.strictEqual(parsed?.cUnderscore.d?.[0].dOuter[0].d[1].a, 123000987.9876, 'Float in deep');
assert.deepEqual(parsed?.cUnderscore?.d[0].dOuter?.[0]?.e, {
a: 987654321.9876,
b: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
c: 19,
dUnderscore: '9007199254741000',
}, 'Object in deep');
assert.strictEqual(
parsed?.cUnderscore?.aUnderscore, 221.13900756835938, 'Float Test');
assert.deepEqual(
parsed?.cUnderscore?.bUnderscore,
[
-700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500,
600, 700
],
'Array of signed integers');
assert.strictEqual(
parsed?.cUnderscore.d?.[0].dOuter[0].d[1].a, 123000987.9876,
'Float in deep');
assert.deepEqual(
parsed?.cUnderscore?.d[0].dOuter?.[0]?.e, {
a: 987654321.9876,
b: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
c: 19,
dUnderscore: '9007199254741000',
},
'Object in deep');
assert.deepEqual(parsed?.cUnderscore.g, ['0', '0'], 'Last object');
console.log('Arrays test: completed successfully');

View File

@@ -1,7 +1,7 @@
// Run this using JavaScriptTest.sh
import assert from 'assert'
import fs from 'fs'
import * as flexbuffers from 'flatbuffers/js/flexbuffers.js'
import fs from 'fs'
function main() {
testSingleValueBuffers();
@@ -25,7 +25,8 @@ function testSingleValueBuffers() {
}
function _assert(object, buffer) {
assert.deepStrictEqual(flexbuffers.toObject(new Uint8Array(buffer).buffer), object);
assert.deepStrictEqual(
flexbuffers.toObject(new Uint8Array(buffer).buffer), object);
}
_assert(true, [1, 104, 1]);
_assert(false, [0, 104, 1]);
@@ -40,15 +41,19 @@ function testSingleValueBuffers() {
_assert(4294967295n, [255, 255, 255, 255, 0, 0, 0, 0, 7, 8]);
_assert(9223372036854775807n, [255, 255, 255, 255, 255, 255, 255, 127, 7, 8]);
_assert(-9223372036854775808n, [0, 0, 0, 0, 0, 0, 0, 128, 7, 8]);
_assert(18446744073709551615n, [255, 255, 255, 255, 255, 255, 255, 255, 11, 8]);
_assert(
18446744073709551615n, [255, 255, 255, 255, 255, 255, 255, 255, 11, 8]);
_assert(4.5, [0, 0, 144, 64, 14, 4]);
_assert(0.10000000149011612, [205, 204, 204, 61, 14, 4]);
_assert(0.1, [154, 153, 153, 153, 153, 153, 185, 63, 15, 8]);
_assert(-1025, [255, 251, 5, 2]);
_assert("Maxim", [5, 77, 97, 120, 105, 109, 0, 6, 20, 1]);
_assert("hello 😱", [10, 104, 101, 108, 108, 111, 32, 240, 159, 152, 177, 0, 11, 20, 1]);
_assert({a:12}, [97, 0, 1, 3, 1, 1, 1, 12, 4, 2, 36, 1]);
_assert({"":45, "a": 12}, [0, 97, 0, 2, 4, 4, 2, 1, 2, 45, 12, 4, 4, 4, 36, 1]);
_assert('Maxim', [5, 77, 97, 120, 105, 109, 0, 6, 20, 1]);
_assert(
'hello 😱',
[10, 104, 101, 108, 108, 111, 32, 240, 159, 152, 177, 0, 11, 20, 1]);
_assert({a: 12}, [97, 0, 1, 3, 1, 1, 1, 12, 4, 2, 36, 1]);
_assert(
{'': 45, 'a': 12}, [0, 97, 0, 2, 4, 4, 2, 1, 2, 45, 12, 4, 4, 4, 36, 1]);
}
function testEncode() {
@@ -66,81 +71,87 @@ function testEncode() {
_assert(0.1, [154, 153, 153, 153, 153, 153, 185, 63, 15, 8]);
_assert(0.5, [0, 0, 0, 63, 14, 4]);
_assert(new Uint8Array([1, 2, 3]), [3, 1, 2, 3, 3, 100, 1]);
_assert("Maxim", [5, 77, 97, 120, 105, 109, 0, 6, 20, 1]);
_assert("hello 😱", [10, 104, 101, 108, 108, 111, 32, 240, 159, 152, 177, 0, 11, 20, 1]);
_assert('Maxim', [5, 77, 97, 120, 105, 109, 0, 6, 20, 1]);
_assert(
'hello 😱',
[10, 104, 101, 108, 108, 111, 32, 240, 159, 152, 177, 0, 11, 20, 1]);
_assert([1, 2], [1, 2, 2, 64, 1]);
_assert([-1, 256], [255, 255, 0, 1, 4, 65, 1]);
_assert([-45, 256000], [211, 255, 255, 255, 0, 232, 3, 0, 8, 66, 1]);
_assert([1.1, -256.0], [2, 0, 0, 0, 0, 0, 0, 0, 154, 153, 153, 153, 153, 153, 241, 63, 0, 255, 255, 255, 255, 255, 255, 255, 15, 5, 18, 43, 1]);
_assert([1.1, -256.0], [
2, 0, 0, 0, 0, 0, 0, 0, 154, 153, 153, 153, 153, 153, 241,
63, 0, 255, 255, 255, 255, 255, 255, 255, 15, 5, 18, 43, 1
]);
_assert([1, 2, 4], [1, 2, 4, 3, 76, 1]);
_assert([-1, 256, 4], [255, 255, 0, 1, 4, 0, 6, 77, 1]);
_assert([[61], 64], [1, 61, 2, 2, 64, 44, 4, 4, 40, 1]);
_assert(["foo", "bar", "baz"], [3, 102, 111, 111, 0, 3, 98, 97, 114, 0, 3, 98, 97, 122, 0, 3, 15, 11, 7, 3, 60, 1]);
_assert(["foo", "bar", "baz", "foo", "bar", "baz"], [3, 102, 111, 111, 0, 3, 98, 97, 114, 0, 3, 98, 97, 122, 0, 6, 15, 11, 7, 18, 14, 10, 6, 60, 1]);
_assert(['foo', 'bar', 'baz'], [
3, 102, 111, 111, 0, 3, 98, 97, 114, 0, 3,
98, 97, 122, 0, 3, 15, 11, 7, 3, 60, 1
]);
_assert(['foo', 'bar', 'baz', 'foo', 'bar', 'baz'], [
3, 102, 111, 111, 0, 3, 98, 97, 114, 0, 3, 98, 97,
122, 0, 6, 15, 11, 7, 18, 14, 10, 6, 60, 1
]);
_assert([true, false, true], [3, 1, 0, 1, 3, 144, 1]);
_assert(['foo', 1, -5, 1.3, true], [
3, 102, 111, 111, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
251, 255, 255, 255, 255, 255, 255, 255,
205, 204, 204, 204, 204, 204, 244, 63,
1, 0, 0, 0, 0, 0, 0, 0,
20, 4, 4, 15, 104, 45, 43, 1
3, 102, 111, 111, 0, 0, 0, 0, 5, 0, 0, 0, 0,
0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 251, 255, 255, 255, 255, 255, 255,
255, 205, 204, 204, 204, 204, 204, 244, 63, 1, 0, 0, 0,
0, 0, 0, 0, 20, 4, 4, 15, 104, 45, 43, 1
]);
_assert([1, 3.3, 'max', true, null, false], [
3, 109, 97, 120, 0, 0, 0, 0,
6, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
102, 102, 102, 102, 102, 102, 10, 64,
31, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
4, 15, 20, 104, 0, 104, 54, 43, 1
3, 109, 97, 120, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102,
10, 64, 31, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 4, 15, 20, 104, 0, 104, 54, 43, 1
]);
_assert({"a": 12}, [97, 0, 1, 3, 1, 1, 1, 12, 4, 2, 36, 1]);
_assert({"a": 12, "":45}, [0, 97, 0, 2, 4, 4, 2, 1, 2, 45, 12, 4, 4, 4, 36, 1]);
_assert({'a': 12}, [97, 0, 1, 3, 1, 1, 1, 12, 4, 2, 36, 1]);
_assert(
{'a': 12, '': 45}, [0, 97, 0, 2, 4, 4, 2, 1, 2, 45, 12, 4, 4, 4, 36, 1]);
// JS currently does not support key vector offset sharing
_assert([{'something':12}, {'something': 45}], [
115, 111, 109, 101, 116, 104, 105, 110, 103, 0,
1, 11, 1, 1, 1, 12, 4, 6, 1, 1, 45, 4, 2, 8, 4, 36, 36, 4, 40, 1
_assert([{'something': 12}, {'something': 45}], [
115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 1, 11, 1, 1, 1,
12, 4, 6, 1, 1, 45, 4, 2, 8, 4, 36, 36, 4, 40, 1
]);
}
function testDeduplicationOff() {
let buffer = flexbuffers.encode([{'something':12}, {'something': 45}], 1, true, true, false);
assert.deepStrictEqual(buffer, new Uint8Array([
115, 111, 109, 101, 116, 104, 105, 110, 103,
0, 1, 11, 1, 1, 1, 12, 4, 1,
18, 1, 1, 1, 45, 4, 2, 10, 4,
36, 36, 4, 40, 1
]));
let buffer = flexbuffers.encode(
[{'something': 12}, {'something': 45}], 1, true, true, false);
assert.deepStrictEqual(
buffer, new Uint8Array([
115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 1, 11, 1, 1, 1, 12,
4, 1, 18, 1, 1, 1, 45, 4, 2, 10, 4, 36, 36, 4, 40, 1
]));
buffer = flexbuffers.encode([{'something':12}, {'something': 45}], 1, true, false, false);
assert.deepStrictEqual(buffer, new Uint8Array([
115, 111, 109, 101, 116, 104, 105, 110, 103, 0,
1, 11, 1, 1, 1, 12, 4, 115, 111, 109,
101, 116, 104, 105, 110, 103, 0, 1, 11, 1,
1, 1, 45, 4, 2, 20, 4, 36, 36, 4,
40, 1
]));
buffer = flexbuffers.encode(
[{'something': 12}, {'something': 45}], 1, true, false, false);
assert.deepStrictEqual(
buffer, new Uint8Array([
115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 1, 11, 1, 1,
1, 12, 4, 115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 1,
11, 1, 1, 1, 45, 4, 2, 20, 4, 36, 36, 4, 40, 1
]));
buffer = flexbuffers.encode(['something', 'something', 'dark'], 1, true, false, false);
assert.deepStrictEqual(buffer, new Uint8Array([
9, 115, 111, 109, 101, 116, 104,
105, 110, 103, 0, 4, 100, 97,
114, 107, 0, 3, 17, 18, 8,
3, 60, 1
]));
buffer = flexbuffers.encode(
['something', 'something', 'dark'], 1, true, false, false);
assert.deepStrictEqual(
buffer, new Uint8Array([
9, 115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 4,
100, 97, 114, 107, 0, 3, 17, 18, 8, 3, 60, 1
]));
buffer = flexbuffers.encode(['something', 'something', 'dark'], 1, false, false, false);
assert.deepStrictEqual(buffer, new Uint8Array([
9, 115, 111, 109, 101, 116, 104, 105, 110,
103, 0, 9, 115, 111, 109, 101, 116, 104,
105, 110, 103, 0, 4, 100, 97, 114, 107,
0, 3, 28, 18, 8, 3, 60, 1
]));
buffer = flexbuffers.encode(
['something', 'something', 'dark'], 1, false, false, false);
assert.deepStrictEqual(
buffer, new Uint8Array([
9, 115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 9,
115, 111, 109, 101, 116, 104, 105, 110, 103, 0, 4, 100,
97, 114, 107, 0, 3, 28, 18, 8, 3, 60, 1
]));
}
function testIndirectAdd() {
@@ -171,9 +182,11 @@ function testIndirectAdd() {
_assertUInt([255, 8, 1], 255);
_assertUInt([185, 115, 175, 118, 250, 84, 8, 0, 11, 8], 2345234523452345);
_assertUInt([185, 115, 175, 118, 250, 84, 8, 0, 8, 31, 1], 2345234523452345, true);
_assertUInt(
[185, 115, 175, 118, 250, 84, 8, 0, 8, 31, 1], 2345234523452345, true);
_assertInt([185, 115, 175, 118, 250, 84, 8, 0, 7, 8], 2345234523452345);
_assertInt([185, 115, 175, 118, 250, 84, 8, 0, 8, 27, 1], 2345234523452345, true);
_assertInt(
[185, 115, 175, 118, 250, 84, 8, 0, 8, 27, 1], 2345234523452345, true);
_assertFloat([154, 153, 153, 153, 153, 153, 185, 63, 15, 8], 0.1);
_assertFloat([154, 153, 153, 153, 153, 153, 185, 63, 8, 35, 1], 0.1, true);
@@ -185,9 +198,7 @@ function testIndirectWithCache() {
function _assertInt(buffer, values) {
const builder = flexbuffers.builder();
builder.startVector();
values.forEach(v => {
builder.addInt(v, true, true)
});
values.forEach(v => {builder.addInt(v, true, true)});
builder.end();
const data = builder.finish();
assert.deepStrictEqual(data, new Uint8Array(buffer));
@@ -216,19 +227,25 @@ function testIndirectWithCache() {
}
_assertInt(
[185, 115, 175, 118, 250, 84, 8, 0, 4, 9, 10, 11, 12, 27, 27, 27, 27, 8, 40, 1],
[2345234523452345, 2345234523452345, 2345234523452345, 2345234523452345]
);
[
185, 115, 175, 118, 250, 84, 8, 0, 4, 9,
10, 11, 12, 27, 27, 27, 27, 8, 40, 1
],
[2345234523452345, 2345234523452345, 2345234523452345, 2345234523452345]);
_assertUInt(
[185, 115, 175, 118, 250, 84, 8, 0, 4, 9, 10, 11, 12, 31, 31, 31, 31, 8, 40, 1],
[2345234523452345, 2345234523452345, 2345234523452345, 2345234523452345]
);
[
185, 115, 175, 118, 250, 84, 8, 0, 4, 9,
10, 11, 12, 31, 31, 31, 31, 8, 40, 1
],
[2345234523452345, 2345234523452345, 2345234523452345, 2345234523452345]);
_assertFloat(
[154, 153, 153, 153, 153, 153, 185, 63, 4, 9, 10, 11, 12, 35, 35, 35, 35, 8, 40, 1],
[0.1, 0.1, 0.1, 0.1]
);
[
154, 153, 153, 153, 153, 153, 185, 63, 4, 9,
10, 11, 12, 35, 35, 35, 35, 8, 40, 1
],
[0.1, 0.1, 0.1, 0.1]);
}
function testMapBuilder() {
@@ -240,19 +257,21 @@ function testMapBuilder() {
builder.add(45);
builder.end();
const data = builder.finish();
assert.deepStrictEqual(data, new Uint8Array([97, 0, 0, 2, 2, 5, 2, 1, 2, 45, 12, 4, 4, 4, 36, 1]));
assert.deepStrictEqual(
data,
new Uint8Array([97, 0, 0, 2, 2, 5, 2, 1, 2, 45, 12, 4, 4, 4, 36, 1]));
}
function testRoundTrip() {
const example = {
"age": 35,
"flags": [true, false, true, true],
"weight": 72.5,
"name": "Maxim",
"address": {
"city": "Bla",
"zip": "12345",
"countryCode": "XX",
'age': 35,
'flags': [true, false, true, true],
'weight': 72.5,
'name': 'Maxim',
'address': {
'city': 'Bla',
'zip': '12345',
'countryCode': 'XX',
}
};
@@ -264,19 +283,19 @@ function testRoundTrip() {
_assert(example);
_assert(0x100000001n);
_assert({ test_number: 72.6 })
_assert({test_number: 72.6})
}
function testRoundTripWithBuilder() {
const example = {
"age": 35,
"flags": [true, false, true, true],
"weight": 72.5,
"name": "Maxim",
"address": {
"city": "Bla",
"zip": "12345",
"countryCode": "XX",
'age': 35,
'flags': [true, false, true, true],
'weight': 72.5,
'name': 'Maxim',
'address': {
'city': 'Bla',
'zip': '12345',
'countryCode': 'XX',
}
};
@@ -294,21 +313,21 @@ function testRoundTripWithBuilder() {
builder.add(true);
builder.end();
builder.addKey("weight");
builder.addKey('weight');
builder.add(72.5);
builder.addKey("name");
builder.add("Maxim");
builder.addKey('name');
builder.add('Maxim');
builder.addKey("address");
builder.addKey('address');
builder.startMap();
builder.addKey("city");
builder.add("Bla");
builder.addKey("zip");
builder.add("12345");
builder.addKey("countryCode");
builder.add("XX");
builder.addKey('city');
builder.add('Bla');
builder.addKey('zip');
builder.add('12345');
builder.addKey('countryCode');
builder.add('XX');
builder.end();
builder.end();
@@ -319,12 +338,12 @@ function testRoundTripWithBuilder() {
let root = flexbuffers.toReference(data.buffer);
assert.strictEqual(root.isMap(), true);
assert.strictEqual(root.get("age").numericValue(), 35);
assert.strictEqual(root.get("age").intValue(), 35);
assert.strictEqual(root.get("name").stringValue(), "Maxim");
assert.strictEqual(root.get("weight").floatValue(), 72.5);
assert.strictEqual(root.get("weight").numericValue(), 72.5);
let flags = root.get("flags");
assert.strictEqual(root.get('age').numericValue(), 35);
assert.strictEqual(root.get('age').intValue(), 35);
assert.strictEqual(root.get('name').stringValue(), 'Maxim');
assert.strictEqual(root.get('weight').floatValue(), 72.5);
assert.strictEqual(root.get('weight').numericValue(), 72.5);
let flags = root.get('flags');
assert.strictEqual(flags.isVector(), true);
assert.strictEqual(flags.length(), 4);
assert.strictEqual(flags.get(0).boolValue(), true);
@@ -332,21 +351,22 @@ function testRoundTripWithBuilder() {
assert.strictEqual(flags.get(2).boolValue(), true);
assert.strictEqual(flags.get(3).boolValue(), true);
let address = root.get("address");
let address = root.get('address');
assert.strictEqual(address.isMap(), true);
assert.strictEqual(address.length(), 3);
assert.strictEqual(address.get("city").stringValue(), "Bla");
assert.strictEqual(address.get("zip").stringValue(), "12345");
assert.strictEqual(address.get("countryCode").stringValue(), "XX");
assert.strictEqual(address.get('city').stringValue(), 'Bla');
assert.strictEqual(address.get('zip').stringValue(), '12345');
assert.strictEqual(address.get('countryCode').stringValue(), 'XX');
}
function testGoldBuffer() {
const data = new Uint8Array(fs.readFileSync('../gold_flexbuffer_example.bin')).buffer;
const b1 = flexbuffers.toReference(data).get("bools").get(1);
const data =
new Uint8Array(fs.readFileSync('../gold_flexbuffer_example.bin')).buffer;
const b1 = flexbuffers.toReference(data).get('bools').get(1);
assert.strictEqual(b1.isBool(), true);
assert.strictEqual(b1.boolValue(), false);
const blob = flexbuffers.toReference(data).get("vec").get(3);
const blob = flexbuffers.toReference(data).get('vec').get(3);
assert.strictEqual(blob.isBlob(), true);
assert.deepStrictEqual(blob.blobValue(), new Uint8Array([77]));
@@ -357,23 +377,38 @@ function testGoldBuffer() {
bar: [1, 2, 3],
bar3: [1, 2, 3],
foo: 100,
mymap: {foo:'Fred'},
mymap: {foo: 'Fred'},
vec: [-100, 'Fred', 4, new Uint8Array([77]), false, 4]
});
}
function testBugWhereOffestWereStoredAsIntInsteadOfUInt() {
// Reported in https://github.com/google/flatbuffers/issues/5949#issuecomment-688421193
const object = {'channels_in': 64, 'dilation_height_factor': 1, 'dilation_width_factor': 1, 'fused_activation_function': 1, 'pad_values': 1, 'padding': 0, 'stride_height': 1, 'stride_width': 1};
// Reported in
// https://github.com/google/flatbuffers/issues/5949#issuecomment-688421193
const object = {
'channels_in': 64,
'dilation_height_factor': 1,
'dilation_width_factor': 1,
'fused_activation_function': 1,
'pad_values': 1,
'padding': 0,
'stride_height': 1,
'stride_width': 1
};
let data1 = flexbuffers.encode(object);
const data = [99, 104, 97, 110, 110, 101, 108, 115, 95, 105, 110, 0,
100, 105, 108, 97, 116, 105, 111, 110, 95, 104, 101, 105, 103, 104, 116, 95, 102, 97, 99, 116, 111, 114, 0,
100, 105, 108, 97, 116, 105, 111, 110, 95, 119, 105, 100, 116, 104, 95, 102, 97, 99, 116, 111, 114, 0,
102, 117, 115, 101, 100, 95, 97, 99, 116, 105, 118, 97, 116, 105, 111, 110, 95, 102, 117, 110, 99, 116, 105, 111, 110, 0,
112, 97, 100, 95, 118, 97, 108, 117, 101, 115, 0, 112, 97, 100, 100, 105, 110, 103, 0,
115, 116, 114, 105, 100, 101, 95, 104, 101, 105, 103, 104, 116, 0,
115, 116, 114, 105, 100, 101, 95, 119, 105, 100, 116, 104, 0,
8, 130, 119, 97, 76, 51, 41, 34, 21, 8, 1, 8, 64, 1, 1, 1, 1, 0, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 16, 36, 1];
const data = [
99, 104, 97, 110, 110, 101, 108, 115, 95, 105, 110, 0, 100, 105, 108,
97, 116, 105, 111, 110, 95, 104, 101, 105, 103, 104, 116, 95, 102, 97,
99, 116, 111, 114, 0, 100, 105, 108, 97, 116, 105, 111, 110, 95, 119,
105, 100, 116, 104, 95, 102, 97, 99, 116, 111, 114, 0, 102, 117, 115,
101, 100, 95, 97, 99, 116, 105, 118, 97, 116, 105, 111, 110, 95, 102,
117, 110, 99, 116, 105, 111, 110, 0, 112, 97, 100, 95, 118, 97, 108,
117, 101, 115, 0, 112, 97, 100, 100, 105, 110, 103, 0, 115, 116, 114,
105, 100, 101, 95, 104, 101, 105, 103, 104, 116, 0, 115, 116, 114, 105,
100, 101, 95, 119, 105, 100, 116, 104, 0, 8, 130, 119, 97, 76, 51,
41, 34, 21, 8, 1, 8, 64, 1, 1, 1, 1, 0, 1, 1, 4,
4, 4, 4, 4, 4, 4, 4, 16, 36, 1
];
let object2 = flexbuffers.toObject(new Uint8Array(data).buffer);
let object1 = flexbuffers.toObject(new Uint8Array(data1).buffer);
assert.deepStrictEqual(object, object2);
@@ -382,9 +417,8 @@ function testBugWhereOffestWereStoredAsIntInsteadOfUInt() {
let ref = flexbuffers.toReference(new Uint8Array(data).buffer);
assert.strictEqual(ref.isMap(), true);
assert.strictEqual(ref.length(), 8);
assert.strictEqual(ref.get("channels_in").numericValue(), 64);
assert.strictEqual(ref.get("padding").isNumber(), true);
assert.strictEqual(ref.get('channels_in').numericValue(), 64);
assert.strictEqual(ref.get('padding').isNumber(), true);
}
main();

View File

@@ -1,6 +1,7 @@
import assert from 'assert'
import * as flatbuffers from 'flatbuffers';
import { Foo } from './required-strings/foo.js';
import {Foo} from './required-strings/foo.js';
var builder = new flatbuffers.Builder();
@@ -12,21 +13,17 @@ function main() {
}
function testMissingFirstRequiredString() {
const undefined_string = builder.createString(undefined);
const defined_string = builder.createString('cat');
const undefined_string = builder.createString(undefined);
const defined_string = builder.createString('cat');
assert.throws(() => Foo.createFoo(
builder, undefined_string, defined_string
));
assert.throws(() => Foo.createFoo(builder, undefined_string, defined_string));
}
function testMissingSecondRequiredString() {
const defined_string = builder.createString('cat');
const undefined_string = builder.createString(undefined);
const defined_string = builder.createString('cat');
const undefined_string = builder.createString(undefined);
assert.throws(() => Foo.createFoo(
builder, defined_string, undefined_string
));
assert.throws(() => Foo.createFoo(builder, defined_string, undefined_string));
}
main();

View File

@@ -1,17 +1,16 @@
// Run this using JavaScriptTest.sh
import assert from 'assert'
import fs from 'fs'
import * as flatbuffers from 'flatbuffers'
import fs from 'fs'
import { Monster, MonsterT } from './my-game/example/monster.js'
import { Test, TestT } from './my-game/example/test.js'
import { Stat } from './my-game/example/stat.js'
import { Vec3 } from './my-game/example/vec3.js'
import { Color } from './my-game/example/color.js';
import { Any } from './my-game/example/any.js';
import {Any} from './my-game/example/any.js';
import {Color} from './my-game/example/color.js';
import {Monster, MonsterT} from './my-game/example/monster.js'
import {Stat} from './my-game/example/stat.js'
import {Test, TestT} from './my-game/example/test.js'
import {Vec3} from './my-game/example/vec3.js'
function main() {
// First, let's test reading a FlatBuffer generated by C++ code:
// This file was generated from monsterdata_test.json
var data = new Uint8Array(fs.readFileSync('../monsterdata_test.mon'));
@@ -21,8 +20,8 @@ function main() {
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,
// 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);
@@ -70,15 +69,11 @@ function createMonster(fbb) {
Test.createTest(fbb, 30, 40);
var test4 = fbb.endVector();
var testArrayOfString = Monster.createTestarrayofstringVector(fbb, [
fbb.createString('test1'),
fbb.createString('test2')
]);
var testArrayOfString = Monster.createTestarrayofstringVector(
fbb, [fbb.createString('test1'), fbb.createString('test2')]);
var testVectorOfLongs = Monster.createVectorOfLongsVector(fbb, [
1n,
101010100n
]);
var testVectorOfLongs =
Monster.createVectorOfLongsVector(fbb, [1n, 101010100n]);
Monster.startMonster(fbb);
Monster.addPos(fbb, Vec3.createVec3(fbb, 1, 2, 3, 3, Color.Green, 5, 6));
@@ -102,7 +97,8 @@ function serializeAndTest(fbb) {
// parser may serialize in a slightly different order than the above
// JavaScript code. They are functionally equivalent though.
fs.writeFileSync('monsterdata_javascript_wire.mon', Buffer.from(fbb.asUint8Array()));
fs.writeFileSync(
'monsterdata_javascript_wire.mon', Buffer.from(fbb.asUint8Array()));
// Tests mutation first. This will verify that we did not trample any other
// part of the byte buffer.
@@ -121,7 +117,8 @@ function testMutation(bb) {
assert.strictEqual(monster.hp(), 80);
var manaRes = monster.mutate_mana(10);
assert.strictEqual(manaRes, false); // Field was NOT present, because default value.
assert.strictEqual(
manaRes, false); // Field was NOT present, because default value.
// TODO: There is not the availability to mutate structs or vectors.
}
@@ -137,7 +134,7 @@ function testObjApiPack(fbb) {
function testObjApiUnpack(monster) {
assert.strictEqual(monster.hp, 80);
assert.strictEqual(monster.mana, 150); // default
assert.strictEqual(monster.mana, 150); // default
assert.strictEqual(monster.name, 'MyMonster');
@@ -182,7 +179,7 @@ function testBuffer(bb) {
var monster = Monster.getRootAsMonster(bb);
assert.strictEqual(monster.hp(), 80);
assert.strictEqual(monster.mana(), 150); // default
assert.strictEqual(monster.mana(), 150); // default
assert.strictEqual(monster.name(), 'MyMonster');
@@ -282,7 +279,7 @@ function test64bit() {
stat = mon2.testempty();
assert.strictEqual(stat != null, true);
assert.strictEqual(stat.val() != null, true);
assert.strictEqual(stat.val(), 0n); // default value
assert.strictEqual(stat.val(), 0n); // default value
}
function testUnicode() {
@@ -293,17 +290,26 @@ function testUnicode() {
function testReadingUnicode(bb) {
var monster = Monster.getRootAsMonster(bb);
assert.strictEqual(monster.name(), json.name);
assert.deepEqual(Buffer.from(monster.name(flatbuffers.Encoding.UTF8_BYTES)), Buffer.from(json.name));
assert.strictEqual(monster.testarrayoftablesLength(), json.testarrayoftables.length);
assert.deepEqual(
Buffer.from(monster.name(flatbuffers.Encoding.UTF8_BYTES)),
Buffer.from(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(Buffer.from(value.name(flatbuffers.Encoding.UTF8_BYTES)), Buffer.from(table.name));
assert.deepEqual(
Buffer.from(value.name(flatbuffers.Encoding.UTF8_BYTES)),
Buffer.from(table.name));
});
assert.strictEqual(monster.testarrayofstringLength(), json.testarrayofstring.length);
assert.strictEqual(
monster.testarrayofstringLength(), json.testarrayofstring.length);
json.testarrayofstring.forEach(function(string, i) {
assert.strictEqual(monster.testarrayofstring(i), string);
assert.deepEqual(Buffer.from(monster.testarrayofstring(i, flatbuffers.Encoding.UTF8_BYTES)), Buffer.from(string));
assert.deepEqual(
Buffer.from(
monster.testarrayofstring(i, flatbuffers.Encoding.UTF8_BYTES)),
Buffer.from(string));
});
}
testReadingUnicode(new flatbuffers.ByteBuffer(new Uint8Array(correct)));
@@ -317,10 +323,12 @@ function testUnicode() {
Monster.addName(fbb, name);
return Monster.endMonster(fbb);
});
var testarrayoftablesOffset = Monster.createTestarrayoftablesVector(fbb,
testarrayoftablesOffsets);
var testarrayofstringOffset = Monster.createTestarrayofstringVector(fbb,
json.testarrayofstring.map(function(string) { return fbb.createString(string); }));
var testarrayoftablesOffset =
Monster.createTestarrayoftablesVector(fbb, testarrayoftablesOffsets);
var testarrayofstringOffset = Monster.createTestarrayofstringVector(
fbb, json.testarrayofstring.map(function(string) {
return fbb.createString(string);
}));
Monster.startMonster(fbb);
Monster.addTestarrayofstring(fbb, testarrayofstringOffset);
Monster.addTestarrayoftables(fbb, testarrayoftablesOffset);
@@ -362,19 +370,18 @@ function fieldIndexToOffset(field_id) {
// 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 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 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;
@@ -394,17 +401,39 @@ function fuzzTest1() {
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;
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());
@@ -429,24 +458,46 @@ function fuzzTest1() {
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;
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;
}
}
}
}
function testSharedStrings() {
var shared_string = "Hello world";
var shared_string = 'Hello world';
var builder = new flatbuffers.Builder();
let mainOffset = builder.createSharedString(shared_string);
assert.strictEqual(builder.createSharedString(shared_string), mainOffset);
@@ -463,10 +514,7 @@ function testNullStrings() {
function testVectorOfStructs() {
let monster = new MonsterT();
monster.name = 'testVectorOfStructs';
monster.test4 = [
new TestT(1, 2),
new TestT(3, 4)
];
monster.test4 = [new TestT(1, 2), new TestT(3, 4)];
let builder = new flatbuffers.Builder();
builder.finish(monster.pack(builder));
@@ -482,9 +530,9 @@ function testCreateByteVector() {
const data = Uint8Array.from([1, 2, 3, 4, 5]);
const builder = new flatbuffers.Builder();
const required = builder.createString("required");
const required = builder.createString('required');
const offset = builder.createByteVector(data);
Monster.startMonster(builder);
Monster.addName(builder, required);
Monster.addInventory(builder, offset)

View File

@@ -1,26 +1,27 @@
import assert from 'assert'
import * as flatbuffers from 'flatbuffers'
import {UnionUnderlyingType as Test} from './union_underlying_type_test.js'
function main() {
let a = new Test.AT();
a.a = 1;
let b = new Test.BT();
b.b = "foo";
let c = new Test.CT();
c.c = true;
let d = new Test.DT();
d.testUnionType = Test.ABC.A;
d.testUnion = a;
d.testVectorOfUnionType = [Test.ABC.A, Test.ABC.B, Test.ABC.C];
d.testVectorOfUnion = [a, b, c];
let a = new Test.AT();
a.a = 1;
let b = new Test.BT();
b.b = 'foo';
let c = new Test.CT();
c.c = true;
let d = new Test.DT();
d.testUnionType = Test.ABC.A;
d.testUnion = a;
d.testVectorOfUnionType = [Test.ABC.A, Test.ABC.B, Test.ABC.C];
d.testVectorOfUnion = [a, b, c];
let fbb = new flatbuffers.Builder();
let offset = d.pack(fbb);
fbb.finish(offset);
let fbb = new flatbuffers.Builder();
let offset = d.pack(fbb);
fbb.finish(offset);
let unpacked = Test.D.getRootAsD(fbb.dataBuffer()).unpack();
assert.equal(JSON.stringify(unpacked), JSON.stringify(d));
let unpacked = Test.D.getRootAsD(fbb.dataBuffer()).unpack();
assert.equal(JSON.stringify(unpacked), JSON.stringify(d));
}
main()

View File

@@ -1,17 +1,13 @@
import assert from 'assert'
import * as flatbuffers from 'flatbuffers'
import { Character } from './union_vector/character.js'
import { BookReader, BookReaderT } from './union_vector/book-reader.js'
import { Attacker, AttackerT } from './union_vector/attacker.js'
import { Movie, MovieT } from './union_vector/movie.js'
import {Attacker, AttackerT} from './union_vector/attacker.js'
import {BookReader, BookReaderT} from './union_vector/book-reader.js'
import {Character} from './union_vector/character.js'
import {Movie, MovieT} from './union_vector/movie.js'
var charTypes = [
Character.Belle,
Character.MuLan,
Character.BookFan,
Character.Other
];
var charTypes =
[Character.Belle, Character.MuLan, Character.BookFan, Character.Other];
function testMovieBuf(movie) {
assert.strictEqual(movie.charactersTypeLength(), charTypes.length);
@@ -31,7 +27,7 @@ function testMovieBuf(movie) {
assert.strictEqual(bookReader2.booksRead(), 2);
var other = movie.characters(3, '');
assert.strictEqual(other, "I am other");
assert.strictEqual(other, 'I am other');
}
function testMovieUnpack(movie) {
@@ -55,7 +51,7 @@ function testMovieUnpack(movie) {
assert.strictEqual(bookReader2.booksRead, 2);
var other = movie.characters[3];
assert.strictEqual(other, "I am other");
assert.strictEqual(other, 'I am other');
}
function createMovie(fbb) {
@@ -66,17 +62,12 @@ function createMovie(fbb) {
var charTypesOffset = Movie.createCharactersTypeVector(fbb, charTypes);
var charsOffset = 0;
let otherOffset = fbb.createString("I am other");
let otherOffset = fbb.createString('I am other');
charsOffset = Movie.createCharactersVector(
fbb,
[
BookReader.createBookReader(fbb, 7),
attackerOffset,
BookReader.createBookReader(fbb, 2),
otherOffset
]
);
charsOffset = Movie.createCharactersVector(fbb, [
BookReader.createBookReader(fbb, 7), attackerOffset,
BookReader.createBookReader(fbb, 2), otherOffset
]);
Movie.startMovie(fbb);
Movie.addCharactersType(fbb, charTypesOffset);
@@ -104,7 +95,7 @@ function main() {
Movie.finishMovieBuffer(fbb, movie_to.pack(fbb));
var unpackBuf = new flatbuffers.ByteBuffer(fbb.asUint8Array());
testMovieBuf(Movie.getRootAsMovie(unpackBuf));
console.log('FlatBuffers union vector test: completed successfully');
}

View File

@@ -14,11 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from pathlib import Path
import platform
import shutil
import subprocess
import sys
from pathlib import Path
# Get the path where this script is located so we can invoke the script from
# any directory and have the paths work correctly.
@@ -35,31 +35,37 @@ flatc_exe = Path("flatc.exe" if is_windows else "flatc")
# Find and assert flatc compiler is present.
if root_path in flatc_exe.parents:
flatc_exe = flatc_exe.relative_to(root_path)
flatc_exe = flatc_exe.relative_to(root_path)
flatc_path = Path(root_path, flatc_exe)
assert flatc_path.exists(), "Cannot find the flatc compiler " + str(flatc_path)
def check_call(args, cwd=tests_path):
subprocess.check_call(args, cwd=str(cwd), shell=is_windows)
subprocess.check_call(args, cwd=str(cwd), shell=is_windows)
# 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]
if include:
cmd += ["-I"] + [include]
cmd += [schema] if isinstance(schema, str) else schema
if data:
cmd += [data] if isinstance(data, str) else data
check_call(cmd)
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]
if include:
cmd += ["-I"] + [include]
cmd += [schema] if isinstance(schema, str) else schema
if data:
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)
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)
@@ -67,7 +73,15 @@ shutil.rmtree(Path(tests_path, "node_modules"), ignore_errors=True)
check_call(["npm", "install", "--silent"])
flatc(
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
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",
)
@@ -81,11 +95,21 @@ flatc(
)
flatc(
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
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")
esbuild(
"union_vector/union_vector.ts", "union_vector/union_vector_generated.cjs"
)
flatc(
options=["--ts", "--reflect-names", "--gen-name-strings"],
@@ -93,20 +117,43 @@ flatc(
)
flatc(
options=["--ts", "--reflect-names", "--gen-name-strings", "--ts-no-import-ext"],
options=[
"--ts",
"--reflect-names",
"--gen-name-strings",
"--ts-no-import-ext",
],
schema="../optional_scalars.fbs",
prefix="no_import_ext",
)
flatc(
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
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"
prefix="arrays_test_complex",
)
esbuild(
"arrays_test_complex/my-game/example.ts",
"arrays_test_complex/arrays_test_complex_generated.cjs",
)
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-entry-points", "--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",
@@ -118,8 +165,16 @@ flatc(
esbuild("typescript_keywords.ts", "typescript_keywords_generated.cjs")
flatc(
options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", "--ts-entry-points", "--ts-flat-files"],
schema="../union_underlying_type_test.fbs"
options=[
"--ts",
"--reflect-names",
"--gen-name-strings",
"--gen-mutable",
"--gen-object-api",
"--ts-entry-points",
"--ts-flat-files",
],
schema="../union_underlying_type_test.fbs",
)
flatc(options=["--ts"], schema="../long_namespace.fbs")
@@ -127,7 +182,10 @@ flatc(options=["--ts"], schema="../longer_namespace.fbs")
print("Running TypeScript Compiler...")
check_call(["tsc"])
print("Running TypeScript Compiler in old node resolution mode for no_import_ext...")
print(
"Running TypeScript Compiler in old node resolution mode for"
" no_import_ext..."
)
check_call(["tsc", "-p", "./tsconfig.node.json"])
NODE_CMD = ["node"]

View File

@@ -1,6 +1,6 @@
export { ArrayStruct, ArrayStructT } from './example/array-struct.js';
export { ArrayTable, ArrayTableT } from './example/array-table.js';
export { InnerStruct, InnerStructT } from './example/inner-struct.js';
export { NestedStruct, NestedStructT } from './example/nested-struct.js';
export { OuterStruct, OuterStructT } from './example/outer-struct.js';
export { TestEnum } from './example/test-enum.js';
export {ArrayStruct, ArrayStructT} from './example/array-struct.js';
export {ArrayTable, ArrayTableT} from './example/array-table.js';
export {InnerStruct, InnerStructT} from './example/inner-struct.js';
export {NestedStruct, NestedStructT} from './example/nested-struct.js';
export {OuterStruct, OuterStructT} from './example/outer-struct.js';
export {TestEnum} from './example/test-enum.js';

View File

@@ -1,8 +1,9 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { ArrayStruct, ArrayStructT } from './example/array-struct.js';
export { ArrayTable, ArrayTableT } from './example/array-table.js';
export { InnerStruct, InnerStructT } from './example/inner-struct.js';
export { NestedStruct, NestedStructT } from './example/nested-struct.js';
export { OuterStruct, OuterStructT } from './example/outer-struct.js';
export { TestEnum } from './example/test-enum.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {ArrayStruct, ArrayStructT} from './example/array-struct.js';
export {ArrayTable, ArrayTableT} from './example/array-table.js';
export {InnerStruct, InnerStructT} from './example/inner-struct.js';
export {NestedStruct, NestedStructT} from './example/nested-struct.js';
export {OuterStruct, OuterStructT} from './example/outer-struct.js';
export {TestEnum} from './example/test-enum.js';

View File

@@ -2,9 +2,9 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { ArrayStruct, ArrayStructT } from './example/array-struct.js';
export { ArrayTable, ArrayTableT } from './example/array-table.js';
export { InnerStruct, InnerStructT } from './example/inner-struct.js';
export { NestedStruct, NestedStructT } from './example/nested-struct.js';
export { OuterStruct, OuterStructT } from './example/outer-struct.js';
export { TestEnum } from './example/test-enum.js';
export {ArrayStruct, ArrayStructT} from './example/array-struct.js';
export {ArrayTable, ArrayTableT} from './example/array-table.js';
export {InnerStruct, InnerStructT} from './example/inner-struct.js';
export {NestedStruct, NestedStructT} from './example/nested-struct.js';
export {OuterStruct, OuterStructT} from './example/outer-struct.js';
export {TestEnum} from './example/test-enum.js';

View File

@@ -1,31 +1,53 @@
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;
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;
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;
}

View File

@@ -1,98 +1,115 @@
// 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';
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;
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));
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
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);
}
aUnderscore() {
return this.bb.readFloat32(this.bb_pos);
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);
}
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);
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);
}
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);
}
}

View File

@@ -4,165 +4,191 @@
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';
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;
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;
}
__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);
}
aUnderscore(): number {
return this.bb!.readFloat32(this.bb_pos);
}
bUnderscore(index: number):number|null {
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);
}
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!);
}
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);
}
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!);
}
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 {
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));
}
static getFullyQualifiedName(): string {
return 'MyGame.Example.ArrayStruct';
}
for (let i = 1; i >= 0; --i) {
const item = f?.[i];
static sizeOf(): number {
return 2656;
}
if (item instanceof OuterStructT) {
item.pack(builder);
continue;
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));
}
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
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),
);
}
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
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);
}
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)[] = []
){}
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
);
}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
return ArrayStruct.createArrayStruct(
builder,
this.aUnderscore,
this.bUnderscore,
this.c,
this.d,
this.e,
this.f,
this.g,
);
}
}

View File

@@ -1,28 +1,48 @@
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;
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;
a: string | Uint8Array | null;
cUnderscore: ArrayStructT | null;
constructor(
a?: string | Uint8Array | null,
cUnderscore?: ArrayStructT | null,
);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,75 +1,88 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import * as flatbuffers from 'flatbuffers';
import { ArrayStruct } from '../../my-game/example/array-struct.js';
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);
}
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);
}
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);
}
}

View File

@@ -4,101 +4,126 @@
import * as flatbuffers from 'flatbuffers';
import { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js';
import {ArrayStruct, ArrayStructT} from '../../my-game/example/array-struct.js';
export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
bb: flatbuffers.ByteBuffer|null = null;
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable {
this.bb_pos = i;
this.bb = bb;
return this;
}
__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 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 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');
}
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;
}
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;
}
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 getFullyQualifiedName(): string {
return 'MyGame.Example.ArrayTable';
}
static startArrayTable(builder:flatbuffers.Builder) {
builder.startObject(2);
}
static startArrayTable(builder: flatbuffers.Builder) {
builder.startObject(2);
}
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, aOffset, 0);
}
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 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 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 finishArrayTableBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset, 'RHUB');
}
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'RHUB', true);
}
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,
);
}
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);
}
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
){}
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;
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,
);
ArrayTable.startArrayTable(builder);
ArrayTable.addA(builder, a);
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
return ArrayTable.endArrayTable(builder);
}
return ArrayTable.endArrayTable(builder);
}
}

View File

@@ -1,23 +1,31 @@
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 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;
a: number;
b: number[];
c: number;
dUnderscore: bigint;
constructor(a?: number, b?: number[], c?: number, dUnderscore?: bigint);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,61 +1,64 @@
// 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();
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);
}
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);
}
}

View File

@@ -4,90 +4,93 @@
import * as flatbuffers from 'flatbuffers';
export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
bb: flatbuffers.ByteBuffer|null = null;
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));
__init(i: number, bb: flatbuffers.ByteBuffer): InnerStruct {
this.bb_pos = i;
this.bb = bb;
return this;
}
builder.writeFloat64(a);
return builder.offset();
}
a(): number {
return this.bb!.readFloat64(this.bb_pos);
}
b(index: number): number | null {
return this.bb!.readUint8(this.bb_pos + 8 + index);
}
unpack(): InnerStructT {
return new InnerStructT(
this.a(),
this.bb!.createScalarList<number>(this.b.bind(this), 13),
this.c(),
this.dUnderscore()
);
}
c(): number {
return this.bb!.readInt8(this.bb_pos + 21);
}
dUnderscore(): bigint {
return this.bb!.readInt64(this.bb_pos + 24);
}
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();
}
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')
){}
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
);
}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
return InnerStruct.createInnerStruct(
builder,
this.a,
this.b,
this.c,
this.dUnderscore,
);
}
}

View File

@@ -1,27 +1,42 @@
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;
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;
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;
}

View File

@@ -1,80 +1,93 @@
// 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';
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;
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));
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
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);
}
a(index) {
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
builder.pad(5);
for (let i = 1; i >= 0; --i) {
builder.writeInt8((c_underscore?.[i] ?? 0));
}
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);
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);
}
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);
}
}

View File

@@ -4,134 +4,150 @@
import * as flatbuffers from 'flatbuffers';
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
import { TestEnum } from '../../my-game/example/test-enum.js';
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;
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));
__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);
}
for (let i = 4; i >= 0; --i) {
const item = d_outer?.[i];
b(): TestEnum {
return this.bb!.readInt8(this.bb_pos + 8);
}
if (item instanceof OuterStructT) {
item.pack(builder);
continue;
}
cUnderscore(index: number): TestEnum | null {
return this.bb!.readInt8(this.bb_pos + 9 + index);
}
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
dOuter(index: number, obj?: OuterStruct): OuterStruct | null {
return (obj || new OuterStruct()).__init(
this.bb_pos + 16 + index * 208,
this.bb!,
);
}
builder.pad(5);
for (let i = 1; i >= 0; --i) {
builder.writeInt8((c_underscore?.[i] ?? 0));
e(index: number): bigint | null {
return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
}
builder.writeInt8(b);
for (let i = 1; i >= 0; --i) {
builder.writeInt32((a?.[i] ?? 0));
static getFullyQualifiedName(): string {
return 'MyGame.Example.NestedStruct';
}
return builder.offset();
}
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);
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)
);
}
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];
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);
}
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)[] = []
){}
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
);
}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
return NestedStruct.createNestedStruct(
builder,
this.a,
this.b,
this.cUnderscore,
this.dOuter,
this.e,
);
}
}

View File

@@ -1,28 +1,51 @@
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;
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;
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;
}

View File

@@ -1,95 +1,111 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
import {InnerStruct, InnerStructT} from '../../my-game/example/inner-struct.js';
export class OuterStruct {
constructor() {
this.bb = null;
this.bb_pos = 0;
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));
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
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));
}
a() {
return !!this.bb.readInt8(this.bb_pos);
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);
}
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);
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);
}
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);
}
}

View File

@@ -4,151 +4,169 @@
import * as flatbuffers from 'flatbuffers';
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
import {InnerStruct, InnerStructT} from '../../my-game/example/inner-struct.js';
export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
bb: flatbuffers.ByteBuffer|null = null;
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));
__init(i: number, bb: flatbuffers.ByteBuffer): OuterStruct {
this.bb_pos = i;
this.bb = bb;
return this;
}
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));
a(): boolean {
return !!this.bb!.readInt8(this.bb_pos);
}
builder.writeFloat64(e_a);
b(): number {
return this.bb!.readFloat64(this.bb_pos + 8);
}
for (let i = 2; i >= 0; --i) {
const item = d?.[i];
cUnderscore(obj?: InnerStruct): InnerStruct | null {
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
}
if (item instanceof InnerStructT) {
item.pack(builder);
continue;
}
InnerStruct.createInnerStruct(builder,
item?.a,
item?.b,
item?.c,
item?.dUnderscore
d(index: number, obj?: InnerStruct): InnerStruct | null {
return (obj || new InnerStruct()).__init(
this.bb_pos + 48 + index * 32,
this.bb!,
);
}
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));
e(obj?: InnerStruct): InnerStruct | null {
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
}
builder.writeFloat64(c_underscore_a);
builder.writeFloat64(b);
builder.pad(7);
builder.writeInt8(Number(Boolean(a)));
return builder.offset();
}
f(index: number): number | null {
return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
}
static getFullyQualifiedName(): string {
return 'MyGame.Example.OuterStruct';
}
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)
);
}
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);
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);
}
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)[] = []
){}
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
);
}
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,
);
}
}

View File

@@ -1,5 +1,5 @@
export declare enum TestEnum {
A = 0,
B = 1,
C = 2
A = 0,
B = 1,
C = 2,
}

View File

@@ -1,8 +1,9 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var TestEnum;
(function (TestEnum) {
TestEnum[TestEnum["A"] = 0] = "A";
TestEnum[TestEnum["B"] = 1] = "B";
TestEnum[TestEnum["C"] = 2] = "C";
(function(TestEnum) {
TestEnum[TestEnum['A'] = 0] = 'A';
TestEnum[TestEnum['B'] = 1] = 'B';
TestEnum[TestEnum['C'] = 2] = 'C';
})(TestEnum || (TestEnum = {}));

View File

@@ -5,5 +5,5 @@
export enum TestEnum {
A = 0,
B = 1,
C = 2
C = 2,
}

View File

@@ -5,14 +5,15 @@
// We pick lodash here not for any particular reason. It could be any package,
// really. I chose it because it's a relatively simple package.
import assert from 'node:assert/strict'
import _ from 'lodash'
import assert from 'node:assert/strict'
function main() {
console.log(_);
assert.deepStrictEqual(_.defaults({ 'a': 1 }, { 'a': 3, 'b': 2 }), { 'a': 1, 'b': 2 });
assert.deepStrictEqual(_.partition([1, 2, 3, 4], n => n % 2), [[1, 3], [2, 4]]);
assert.deepStrictEqual(
_.defaults({'a': 1}, {'a': 3, 'b': 2}), {'a': 1, 'b': 2});
assert.deepStrictEqual(
_.partition([1, 2, 3, 4], n => n % 2), [[1, 3], [2, 4]]);
}
main();

View File

@@ -2,4 +2,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Person } from './test/person.js';
export {Person} from './test/person.js';

View File

@@ -4,67 +4,86 @@
import * as flatbuffers from 'flatbuffers';
export class Person {
bb: flatbuffers.ByteBuffer|null = null;
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
__init(i: number, bb: flatbuffers.ByteBuffer): Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person {
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
static getSizePrefixedRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(
bb: flatbuffers.ByteBuffer,
obj?: Person,
): Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
name(optionalEncoding?: any): string | Uint8Array | null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
: null;
}
age():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
age(): number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder:flatbuffers.Builder) {
builder.startObject(2);
}
static startPerson(builder: flatbuffers.Builder) {
builder.startObject(2);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder:flatbuffers.Builder, age:number) {
builder.addFieldInt16(1, age, 0);
}
static addAge(builder: flatbuffers.Builder, age: number) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset);
}
static finishPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, undefined, true);
}
static finishSizePrefixedPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset, undefined, true);
}
static createPerson(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, age:number):flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
static createPerson(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
age: number,
): flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
}

View File

@@ -1 +1 @@
export { Abc } from './foobar/abc.js';
export {Abc} from './foobar/abc.js';

View File

@@ -1,3 +1,4 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Abc } from './foobar/abc.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Abc} from './foobar/abc.js';

View File

@@ -2,4 +2,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Abc } from './foobar/abc.js';
export {Abc} from './foobar/abc.js';

View File

@@ -1,3 +1,3 @@
export declare enum Abc {
a = 0
a = 0,
}

View File

@@ -1,6 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var Abc;
(function (Abc) {
Abc[Abc["a"] = 0] = "a";
(function(Abc) {
Abc[Abc['a'] = 0] = 'a';
})(Abc || (Abc = {}));

View File

@@ -3,5 +3,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export enum Abc {
a = 0
a = 0,
}

View File

@@ -1,3 +1,3 @@
export declare enum class_ {
arguments_ = 0
arguments_ = 0,
}

View File

@@ -1,6 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var class_;
(function (class_) {
class_[class_["arguments_"] = 0] = "arguments_";
(function(class_) {
class_[class_['arguments_'] = 0] = 'arguments_';
})(class_ || (class_ = {}));

View File

@@ -3,5 +3,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export enum class_ {
arguments_ = 0
arguments_ = 0,
}

View File

@@ -4,131 +4,135 @@
import * as flatbuffers from 'flatbuffers';
import { Abc } from '../foobar/abc.js';
import { class_ } from '../foobar/class.js';
import {Abc} from '../foobar/abc.js';
import {class_} from '../foobar/class.js';
export class Tab implements flatbuffers.IUnpackableObject<TabT> {
bb: flatbuffers.ByteBuffer|null = null;
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Tab {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsTab(bb:flatbuffers.ByteBuffer, obj?:Tab):Tab {
return (obj || new Tab()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsTab(bb:flatbuffers.ByteBuffer, obj?:Tab):Tab {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Tab()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
abc():Abc {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
}
mutate_abc(value:Abc):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
__init(i: number, bb: flatbuffers.ByteBuffer): Tab {
this.bb_pos = i;
this.bb = bb;
return this;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
arg():class_ {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : class_.arguments_;
}
mutate_arg(value:class_):boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
static getRootAsTab(bb: flatbuffers.ByteBuffer, obj?: Tab): Tab {
return (obj || new Tab()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
static getSizePrefixedRootAsTab(bb: flatbuffers.ByteBuffer, obj?: Tab): Tab {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Tab()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
abc(): Abc {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
}
static getFullyQualifiedName():string {
return 'foobar.Tab';
}
mutate_abc(value: Abc): boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
static startTab(builder:flatbuffers.Builder) {
builder.startObject(3);
}
if (offset === 0) {
return false;
}
static addAbc(builder:flatbuffers.Builder, abc:Abc) {
builder.addFieldInt32(0, abc, Abc.a);
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
static addArg(builder:flatbuffers.Builder, arg:class_) {
builder.addFieldInt32(1, arg, class_.arguments_);
}
arg(): class_ {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset
? this.bb!.readInt32(this.bb_pos + offset)
: class_.arguments_;
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, nameOffset, 0);
}
mutate_arg(value: class_): boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
static endTab(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
if (offset === 0) {
return false;
}
static createTab(builder:flatbuffers.Builder, abc:Abc, arg:class_, nameOffset:flatbuffers.Offset):flatbuffers.Offset {
Tab.startTab(builder);
Tab.addAbc(builder, abc);
Tab.addArg(builder, arg);
Tab.addName(builder, nameOffset);
return Tab.endTab(builder);
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
unpack(): TabT {
return new TabT(
this.abc(),
this.arg(),
this.name()
);
}
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
name(optionalEncoding?: any): string | Uint8Array | null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
: null;
}
static getFullyQualifiedName(): string {
return 'foobar.Tab';
}
unpackTo(_o: TabT): void {
_o.abc = this.abc();
_o.arg = this.arg();
_o.name = this.name();
}
static startTab(builder: flatbuffers.Builder) {
builder.startObject(3);
}
static addAbc(builder: flatbuffers.Builder, abc: Abc) {
builder.addFieldInt32(0, abc, Abc.a);
}
static addArg(builder: flatbuffers.Builder, arg: class_) {
builder.addFieldInt32(1, arg, class_.arguments_);
}
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
builder.addFieldOffset(2, nameOffset, 0);
}
static endTab(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createTab(
builder: flatbuffers.Builder,
abc: Abc,
arg: class_,
nameOffset: flatbuffers.Offset,
): flatbuffers.Offset {
Tab.startTab(builder);
Tab.addAbc(builder, abc);
Tab.addArg(builder, arg);
Tab.addName(builder, nameOffset);
return Tab.endTab(builder);
}
unpack(): TabT {
return new TabT(this.abc(), this.arg(), this.name());
}
unpackTo(_o: TabT): void {
_o.abc = this.abc();
_o.arg = this.arg();
_o.name = this.name();
}
}
export class TabT implements flatbuffers.IGeneratedObject {
constructor(
public abc: Abc = Abc.a,
public arg: class_ = class_.arguments_,
public name: string|Uint8Array|null = null
){}
constructor(
public abc: Abc = Abc.a,
public arg: class_ = class_.arguments_,
public name: string | Uint8Array | null = null,
) {}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
const name = this.name !== null ? builder.createString(this.name!) : 0;
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
return Tab.createTab(builder,
this.abc,
this.arg,
name
);
}
return Tab.createTab(builder, this.abc, this.arg, name);
}
}

View File

@@ -1 +1 @@
export { Person } from './c/person.js';
export {Person} from './c/person.js';

View File

@@ -1,3 +1,4 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Person } from './c/person.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Person} from './c/person.js';

View File

@@ -2,4 +2,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Person } from './c/person.js';
export {Person} from './c/person.js';

View File

@@ -1,18 +1,34 @@
import * as flatbuffers from 'flatbuffers';
export declare class Person {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Person;
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person;
static getSizePrefixedRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person;
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
age(): number;
static startPerson(builder: flatbuffers.Builder): void;
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void;
static addAge(builder: flatbuffers.Builder, age: number): void;
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset;
static finishPersonBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
static finishSizePrefixedPersonBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
static createPerson(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, age: number): flatbuffers.Offset;
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Person;
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person;
static getSizePrefixedRootAsPerson(
bb: flatbuffers.ByteBuffer,
obj?: Person,
): Person;
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
age(): number;
static startPerson(builder: flatbuffers.Builder): void;
static addName(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
): void;
static addAge(builder: flatbuffers.Builder, age: number): void;
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset;
static finishPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
): void;
static finishSizePrefixedPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
): void;
static createPerson(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
age: number,
): flatbuffers.Offset;
}

View File

@@ -1,54 +1,58 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import * as flatbuffers from 'flatbuffers';
export class Person {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb, obj) {
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
age() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder) {
builder.startObject(2);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder, age) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder) {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder, offset) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder, offset) {
builder.finish(offset, undefined, true);
}
static createPerson(builder, nameOffset, age) {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb, obj) {
return (obj || new Person())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) :
null;
}
age() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder) {
builder.startObject(2);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder, age) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder) {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder, offset) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder, offset) {
builder.finish(offset, undefined, true);
}
static createPerson(builder, nameOffset, age) {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
}

View File

@@ -4,67 +4,86 @@
import * as flatbuffers from 'flatbuffers';
export class Person {
bb: flatbuffers.ByteBuffer|null = null;
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
__init(i: number, bb: flatbuffers.ByteBuffer): Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person {
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
static getSizePrefixedRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(
bb: flatbuffers.ByteBuffer,
obj?: Person,
): Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
name(optionalEncoding?: any): string | Uint8Array | null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
: null;
}
age():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
age(): number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder:flatbuffers.Builder) {
builder.startObject(2);
}
static startPerson(builder: flatbuffers.Builder) {
builder.startObject(2);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder:flatbuffers.Builder, age:number) {
builder.addFieldInt16(1, age, 0);
}
static addAge(builder: flatbuffers.Builder, age: number) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset);
}
static finishPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, undefined, true);
}
static finishSizePrefixedPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset, undefined, true);
}
static createPerson(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, age:number):flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
static createPerson(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
age: number,
): flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
}

View File

@@ -1,2 +1,2 @@
export { TableA, TableAT } from './table-a.js';
export * as MyGame from './my-game.js';
export {TableA, TableAT} from './table-a.js';

View File

@@ -1,4 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { TableA, TableAT } from './table-a.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export * as MyGame from './my-game.js';
export {TableA, TableAT} from './table-a.js';

View File

@@ -1,4 +1,7 @@
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';
export * as Example from './my-game/example.js';
export * as Example2 from './my-game/example2.js';
export {
InParentNamespace,
InParentNamespaceT,
} from './my-game/in-parent-namespace.js';
export * as OtherNameSpace from './my-game/other-name-space.js';

View File

@@ -1,6 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export * as Example from './my-game/example.js';
export * as Example2 from './my-game/example2.js';
export {InParentNamespace, InParentNamespaceT} from './my-game/in-parent-namespace.js';
export * as OtherNameSpace from './my-game/other-name-space.js';

View File

@@ -1,16 +1,25 @@
export { Ability, AbilityT } 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, MonsterT } from './example/monster.js';
export { Race } from './example/race.js';
export { Referrable, ReferrableT } from './example/referrable.js';
export { Stat, StatT } from './example/stat.js';
export { StructOfStructs, StructOfStructsT } from './example/struct-of-structs.js';
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './example/struct-of-structs-of-structs.js';
export { Test, TestT } from './example/test.js';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './example/test-simple-table-with-enum.js';
export { TypeAliases, TypeAliasesT } from './example/type-aliases.js';
export { Vec3, Vec3T } from './example/vec3.js';
export {Ability, AbilityT} from './example/ability.js';
export {AnyAmbiguousAliases} from './example/any-ambiguous-aliases.js';
export {AnyUniqueAliases} from './example/any-unique-aliases.js';
export {Any} from './example/any.js';
export {Color} from './example/color.js';
export {LongEnum} from './example/long-enum.js';
export {Monster, MonsterT} from './example/monster.js';
export {Race} from './example/race.js';
export {Referrable, ReferrableT} from './example/referrable.js';
export {Stat, StatT} from './example/stat.js';
export {
StructOfStructsOfStructs,
StructOfStructsOfStructsT,
} from './example/struct-of-structs-of-structs.js';
export {
StructOfStructs,
StructOfStructsT,
} from './example/struct-of-structs.js';
export {
TestSimpleTableWithEnum,
TestSimpleTableWithEnumT,
} from './example/test-simple-table-with-enum.js';
export {Test, TestT} from './example/test.js';
export {TypeAliases, TypeAliasesT} from './example/type-aliases.js';
export {Vec3, Vec3T} from './example/vec3.js';

View File

@@ -1,18 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Ability, AbilityT } 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, MonsterT } from './example/monster.js';
export { Race } from './example/race.js';
export { Referrable, ReferrableT } from './example/referrable.js';
export { Stat, StatT } from './example/stat.js';
export { StructOfStructs, StructOfStructsT } from './example/struct-of-structs.js';
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './example/struct-of-structs-of-structs.js';
export { Test, TestT } from './example/test.js';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './example/test-simple-table-with-enum.js';
export { TypeAliases, TypeAliasesT } from './example/type-aliases.js';
export { Vec3, Vec3T } from './example/vec3.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Ability, AbilityT} from './example/ability.js';
export {AnyAmbiguousAliases} from './example/any-ambiguous-aliases.js';
export {AnyUniqueAliases} from './example/any-unique-aliases.js';
export {Any} from './example/any.js';
export {Color} from './example/color.js';
export {LongEnum} from './example/long-enum.js';
export {Monster, MonsterT} from './example/monster.js';
export {Race} from './example/race.js';
export {Referrable, ReferrableT} from './example/referrable.js';
export {Stat, StatT} from './example/stat.js';
export {StructOfStructsOfStructs, StructOfStructsOfStructsT} from './example/struct-of-structs-of-structs.js';
export {StructOfStructs, StructOfStructsT} from './example/struct-of-structs.js';
export {TestSimpleTableWithEnum, TestSimpleTableWithEnumT} from './example/test-simple-table-with-enum.js';
export {Test, TestT} from './example/test.js';
export {TypeAliases, TypeAliasesT} from './example/type-aliases.js';
export {Vec3, Vec3T} from './example/vec3.js';

View File

@@ -1,21 +1,27 @@
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 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;
id: number;
distance: number;
constructor(id?: number, distance?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,9 +1,16 @@
import { Monster } from '../../my-game/example/monster.js';
import {Monster} from '../../my-game/example/monster.js';
export declare enum AnyAmbiguousAliases {
NONE = 0,
M1 = 1,
M2 = 2,
M3 = 3
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;
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;

View File

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

View File

@@ -1,11 +1,23 @@
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';
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export declare enum AnyUniqueAliases {
NONE = 0,
M = 1,
TS = 2,
M2 = 3
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;
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;

View File

@@ -1,30 +1,42 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
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';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export var AnyUniqueAliases;
(function (AnyUniqueAliases) {
AnyUniqueAliases[AnyUniqueAliases["NONE"] = 0] = "NONE";
AnyUniqueAliases[AnyUniqueAliases["M"] = 1] = "M";
AnyUniqueAliases[AnyUniqueAliases["TS"] = 2] = "TS";
AnyUniqueAliases[AnyUniqueAliases["M2"] = 3] = "M2";
(function(AnyUniqueAliases) {
AnyUniqueAliases[AnyUniqueAliases['NONE'] = 0] = 'NONE';
AnyUniqueAliases[AnyUniqueAliases['M'] = 1] = 'M';
AnyUniqueAliases[AnyUniqueAliases['TS'] = 2] = 'TS';
AnyUniqueAliases[AnyUniqueAliases['M2'] = 3] = 'M2';
})(AnyUniqueAliases || (AnyUniqueAliases = {}));
export function unionToAnyUniqueAliases(type, accessor) {
switch (AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(new Monster());
case 'TS': return accessor(new TestSimpleTableWithEnum());
case 'M2': return accessor(new MyGame_Example2_Monster());
default: return null;
}
switch (AnyUniqueAliases[type]) {
case 'NONE':
return null;
case 'M':
return accessor(new Monster());
case 'TS':
return accessor(new TestSimpleTableWithEnum());
case 'M2':
return accessor(new MyGame_Example2_Monster());
default:
return null;
}
}
export function unionListToAnyUniqueAliases(type, accessor, index) {
switch (AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(index, new Monster());
case 'TS': return accessor(index, new TestSimpleTableWithEnum());
case 'M2': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
switch (AnyUniqueAliases[type]) {
case 'NONE':
return null;
case 'M':
return accessor(index, new Monster());
case 'TS':
return accessor(index, new TestSimpleTableWithEnum());
case 'M2':
return accessor(index, new MyGame_Example2_Monster());
default:
return null;
}
}

View File

@@ -1,11 +1,23 @@
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';
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export declare enum Any {
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
MyGame_Example2_Monster = 3
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;
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;

View File

@@ -1,30 +1,42 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
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';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export var Any;
(function (Any) {
Any[Any["NONE"] = 0] = "NONE";
Any[Any["Monster"] = 1] = "Monster";
Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum";
Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster";
(function(Any) {
Any[Any['NONE'] = 0] = 'NONE';
Any[Any['Monster'] = 1] = 'Monster';
Any[Any['TestSimpleTableWithEnum'] = 2] = 'TestSimpleTableWithEnum';
Any[Any['MyGame_Example2_Monster'] = 3] = 'MyGame_Example2_Monster';
})(Any || (Any = {}));
export function unionToAny(type, accessor) {
switch (Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(new Monster());
case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster());
default: return null;
}
switch (Any[type]) {
case 'NONE':
return null;
case 'Monster':
return accessor(new Monster());
case 'TestSimpleTableWithEnum':
return accessor(new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster':
return accessor(new MyGame_Example2_Monster());
default:
return null;
}
}
export function unionListToAny(type, accessor, index) {
switch (Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(index, new Monster());
case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
switch (Any[type]) {
case 'NONE':
return null;
case 'Monster':
return accessor(index, new Monster());
case 'TestSimpleTableWithEnum':
return accessor(index, new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster':
return accessor(index, new MyGame_Example2_Monster());
default:
return null;
}
}

View File

@@ -2,14 +2,14 @@
* 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
Red = 1,
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Green = 2,
/**
* \brief color Blue (1u << 3)
*/
Blue = 8,
}

View File

@@ -1,18 +1,19 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
/**
* Composite components of Monster color.
*/
export var Color;
(function (Color) {
Color[Color["Red"] = 1] = "Red";
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Color[Color["Green"] = 2] = "Green";
/**
* \brief color Blue (1u << 3)
*/
Color[Color["Blue"] = 8] = "Blue";
(function(Color) {
Color[Color['Red'] = 1] = 'Red';
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Color[Color['Green'] = 2] = 'Green';
/**
* \brief color Blue (1u << 3)
*/
Color[Color['Blue'] = 8] = 'Blue';
})(Color || (Color = {}));

View File

@@ -1,5 +1,5 @@
export declare enum LongEnum {
LongOne = "2",
LongTwo = "4",
LongBig = "1099511627776"
LongOne = '2',
LongTwo = '4',
LongBig = '1099511627776',
}

View File

@@ -1,8 +1,9 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var LongEnum;
(function (LongEnum) {
LongEnum["LongOne"] = "2";
LongEnum["LongTwo"] = "4";
LongEnum["LongBig"] = "1099511627776";
(function(LongEnum) {
LongEnum['LongOne'] = '2';
LongEnum['LongTwo'] = '4';
LongEnum['LongBig'] = '1099511627776';
})(LongEnum || (LongEnum = {}));

View File

@@ -1,325 +1,674 @@
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';
import {Ability, AbilityT} from '../../my-game/example/ability.js';
import {AnyAmbiguousAliases} from '../../my-game/example/any-ambiguous-aliases.js';
import {AnyUniqueAliases} from '../../my-game/example/any-unique-aliases.js';
import {Any} from '../../my-game/example/any.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 {TestSimpleTableWithEnumT} from '../../my-game/example/test-simple-table-with-enum.js';
import {Test, TestT} from '../../my-game/example/test.js';
import {Vec3, Vec3T} from '../../my-game/example/vec3.js';
import {MonsterT as MyGame_Example2_MonsterT} from '../../my-game/example2/monster.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 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;
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;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
export declare enum Race {
None = -1,
Human = 0,
Dwarf = 1,
Elf = 2
None = -1,
Human = 0,
Dwarf = 1,
Elf = 2,
}

View File

@@ -1,9 +1,10 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var Race;
(function (Race) {
Race[Race["None"] = -1] = "None";
Race[Race["Human"] = 0] = "Human";
Race[Race["Dwarf"] = 1] = "Dwarf";
Race[Race["Elf"] = 2] = "Elf";
(function(Race) {
Race[Race['None'] = -1] = 'None';
Race[Race['Human'] = 0] = 'Human';
Race[Race['Dwarf'] = 1] = 'Dwarf';
Race[Race['Elf'] = 2] = 'Elf';
})(Race || (Race = {}));

View File

@@ -1,24 +1,35 @@
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 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;
id: bigint;
constructor(id?: bigint);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,32 +1,43 @@
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;
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;
id: string | Uint8Array | null;
val: bigint;
count: number;
constructor(id?: string | Uint8Array | null, val?: bigint, count?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,18 +1,33 @@
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;
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;
export declare class StructOfStructsOfStructsT
implements flatbuffers.IGeneratedObject
{
a: StructOfStructsT | null;
constructor(a?: StructOfStructsT | null);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,51 +1,56 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { StructOfStructs } from '../../my-game/example/struct-of-structs.js';
import {StructOfStructs} from '../../my-game/example/struct-of-structs.js';
export class StructOfStructsOfStructs {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructsOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructsOfStructs(builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance) {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsOfStructsT((this.a() !== null ? this.a().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructsOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructsOfStructs(
builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance) {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsOfStructsT(
(this.a() !== null ? this.a().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
}
}
export class StructOfStructsOfStructsT {
constructor(a = null) {
this.a = a;
}
pack(builder) {
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));
}
constructor(a = null) {
this.a = a;
}
pack(builder) {
return StructOfStructsOfStructs.createStructOfStructsOfStructs(
builder, (this.a?.a?.id ?? 0), (this.a?.a?.distance ?? 0),
(this.a?.b?.a ?? 0), (this.a?.b?.b ?? 0), (this.a?.c?.id ?? 0),
(this.a?.c?.distance ?? 0));
}
}

View File

@@ -1,23 +1,33 @@
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;
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;
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;
}

View File

@@ -1,61 +1,67 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Ability } from '../../my-game/example/ability.js';
import { Test } from '../../my-game/example/test.js';
import {Ability} from '../../my-game/example/ability.js';
import {Test} from '../../my-game/example/test.js';
export class StructOfStructs {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new Ability()).__init(this.bb_pos, this.bb);
}
b(obj) {
return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
}
c(obj) {
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructs(builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(c_distance);
builder.writeInt32(c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b_b);
builder.writeInt16(b_a);
builder.prep(4, 8);
builder.writeInt32(a_distance);
builder.writeInt32(a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsT((this.a() !== null ? this.a().unpack() : null), (this.b() !== null ? this.b().unpack() : null), (this.c() !== null ? this.c().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
_o.b = (this.b() !== null ? this.b().unpack() : null);
_o.c = (this.c() !== null ? this.c().unpack() : null);
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new Ability()).__init(this.bb_pos, this.bb);
}
b(obj) {
return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
}
c(obj) {
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructs(
builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(c_distance);
builder.writeInt32(c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b_b);
builder.writeInt16(b_a);
builder.prep(4, 8);
builder.writeInt32(a_distance);
builder.writeInt32(a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsT(
(this.a() !== null ? this.a().unpack() : null),
(this.b() !== null ? this.b().unpack() : null),
(this.c() !== null ? this.c().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
_o.b = (this.b() !== null ? this.b().unpack() : null);
_o.c = (this.c() !== null ? this.c().unpack() : null);
}
}
export class StructOfStructsT {
constructor(a = null, b = null, c = null) {
this.a = a;
this.b = b;
this.c = c;
}
pack(builder) {
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));
}
constructor(a = null, b = null, c = null) {
this.a = a;
this.b = b;
this.c = c;
}
pack(builder) {
return StructOfStructs.createStructOfStructs(
builder, (this.a?.id ?? 0), (this.a?.distance ?? 0), (this.b?.a ?? 0),
(this.b?.b ?? 0), (this.c?.id ?? 0), (this.c?.distance ?? 0));
}
}

View File

@@ -1,25 +1,40 @@
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;
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;
export declare class TestSimpleTableWithEnumT
implements flatbuffers.IGeneratedObject
{
color: Color;
constructor(color?: Color);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,21 +1,25 @@
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;
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;
a: number;
b: number;
constructor(a?: number, b?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,82 +1,135 @@
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 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;
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;
}

View File

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

View File

@@ -1,34 +1,50 @@
import * as flatbuffers from 'flatbuffers';
import { Color } from '../../my-game/example/color.js';
import { Test, TestT } from '../../my-game/example/test.js';
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;
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;
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;
}

View File

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

View File

@@ -1 +1 @@
export { Monster, MonsterT } from './example2/monster.js';
export {Monster, MonsterT} from './example2/monster.js';

View File

@@ -1,3 +1,4 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { Monster, MonsterT } from './example2/monster.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Monster, MonsterT} from './example2/monster.js';

View File

@@ -1,20 +1,25 @@
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 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;
constructor();
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,20 +1,32 @@
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 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;
export declare class InParentNamespaceT
implements flatbuffers.IGeneratedObject
{
constructor();
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

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

View File

@@ -1,3 +1,3 @@
export { FromInclude } from './other-name-space/from-include.js';
export { TableB, TableBT } from './other-name-space/table-b.js';
export { Unused, UnusedT } from './other-name-space/unused.js';
export {FromInclude} from './other-name-space/from-include.js';
export {TableB, TableBT} from './other-name-space/table-b.js';
export {Unused, UnusedT} from './other-name-space/unused.js';

View File

@@ -1,5 +1,6 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export { FromInclude } from './other-name-space/from-include.js';
export { TableB, TableBT } from './other-name-space/table-b.js';
export { Unused, UnusedT } from './other-name-space/unused.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {FromInclude} from './other-name-space/from-include.js';
export {TableB, TableBT} from './other-name-space/table-b.js';
export {Unused, UnusedT} from './other-name-space/unused.js';

View File

@@ -1,3 +1,3 @@
export declare enum FromInclude {
IncludeVal = "0"
IncludeVal = '0',
}

View File

@@ -1,6 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var FromInclude;
(function (FromInclude) {
FromInclude["IncludeVal"] = "0";
(function(FromInclude) {
FromInclude['IncludeVal'] = '0';
})(FromInclude || (FromInclude = {}));

View File

@@ -3,5 +3,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export enum FromInclude {
IncludeVal = '0'
IncludeVal = '0',
}

View File

@@ -1,24 +1,30 @@
import * as flatbuffers from 'flatbuffers';
import { TableA, TableAT } from '../../table-a.js';
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;
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;
a: TableAT | null;
constructor(a?: TableAT | null);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,65 +1,73 @@
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import * as flatbuffers from 'flatbuffers';
import { TableA } from '../../table-a.js';
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);
}
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);
}
constructor(a = null) {
this.a = a;
}
pack(builder) {
const a = (this.a !== null ? this.a.pack(builder) : 0);
return TableB.createTableB(builder, a);
}
}

View File

@@ -4,86 +4,94 @@
import * as flatbuffers from 'flatbuffers';
import { TableA, TableAT } from '../../table-a.js';
import {TableA, TableAT} from '../../table-a.js';
export class TableB implements flatbuffers.IUnpackableObject<TableBT> {
bb: flatbuffers.ByteBuffer|null = null;
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):TableB {
this.bb_pos = i;
this.bb = bb;
return this;
}
__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 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);
}
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;
}
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 getFullyQualifiedName(): string {
return 'MyGame.OtherNameSpace.TableB';
}
static startTableB(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static startTableB(builder: flatbuffers.Builder) {
builder.startObject(1);
}
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, aOffset, 0);
}
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 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);
}
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();
}
serialize(): Uint8Array {
return this.bb!.bytes();
}
static deserialize(buffer: Uint8Array):TableB {
return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer))
}
static deserialize(buffer: Uint8Array): TableB {
return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer));
}
unpack(): TableBT {
return new TableBT(
(this.a() !== null ? this.a()!.unpack() : null)
);
}
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);
}
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
){}
constructor(public a: TableAT | null = null) {}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
const a = this.a !== null ? this.a!.pack(builder) : 0;
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const a = (this.a !== null ? this.a!.pack(builder) : 0);
return TableB.createTableB(builder,
a
);
}
return TableB.createTableB(builder, a);
}
}

View File

@@ -1,18 +1,21 @@
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;
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;
a: number;
constructor(a?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

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