@ignex/nova 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +313 -0
  3. package/docs/architecture.md +146 -0
  4. package/docs/publishing.md +119 -0
  5. package/docs/wire-format.md +170 -0
  6. package/index.ts +61 -0
  7. package/package.json +89 -0
  8. package/prebuilds/linux-x64/libignex_ffi.so +0 -0
  9. package/public/client.ts +23 -0
  10. package/public/nats.ts +19 -0
  11. package/public/server.ts +35 -0
  12. package/rust/Cargo.toml +19 -0
  13. package/rust/src/ffi.rs +135 -0
  14. package/rust/src/generated/backend.rs +2817 -0
  15. package/rust/src/generated/mod.rs +2 -0
  16. package/rust/src/lib.rs +9 -0
  17. package/rust/src/transcode/generated.rs +1352 -0
  18. package/rust/src/transcode/mod.rs +2 -0
  19. package/src/bridge/nats.ts +269 -0
  20. package/src/bridge/subjects.ts +30 -0
  21. package/src/core/auth.ts +56 -0
  22. package/src/core/backpressure.ts +39 -0
  23. package/src/core/client-heartbeat.ts +27 -0
  24. package/src/core/client-reconnect.ts +35 -0
  25. package/src/core/client-state.ts +76 -0
  26. package/src/core/client-wire.ts +72 -0
  27. package/src/core/client.ts +176 -0
  28. package/src/core/groups.ts +52 -0
  29. package/src/core/int64-guard.ts +44 -0
  30. package/src/core/metrics.ts +105 -0
  31. package/src/core/outbound.ts +76 -0
  32. package/src/core/replay.ts +31 -0
  33. package/src/core/ring.ts +85 -0
  34. package/src/core/rooms.ts +44 -0
  35. package/src/core/routing.ts +94 -0
  36. package/src/core/server.ts +294 -0
  37. package/src/core/state.ts +179 -0
  38. package/src/generated/direct-ser.ts +495 -0
  39. package/src/generated/fbs/backend.fbs +139 -0
  40. package/src/generated/registry.ts +341 -0
  41. package/src/generated/rust/backend_generated.rs +2817 -0
  42. package/src/generated/ts/backend.ts +25 -0
  43. package/src/generated/ts/big-val.ts +106 -0
  44. package/src/generated/ts/complex.ts +303 -0
  45. package/src/generated/ts/customer.ts +137 -0
  46. package/src/generated/ts/hello.ts +123 -0
  47. package/src/generated/ts/join-group.ts +78 -0
  48. package/src/generated/ts/leave-group.ts +78 -0
  49. package/src/generated/ts/order-billing.ts +137 -0
  50. package/src/generated/ts/order-line.ts +144 -0
  51. package/src/generated/ts/order.ts +236 -0
  52. package/src/generated/ts/ping.ts +74 -0
  53. package/src/generated/ts/pong.ts +74 -0
  54. package/src/generated/ts/portfolio-position.ts +120 -0
  55. package/src/generated/ts/portfolio-snapshot.ts +170 -0
  56. package/src/generated/ts/quote.ts +148 -0
  57. package/src/generated/ts/side.ts +8 -0
  58. package/src/generated/ts/snapshot-request.ts +78 -0
  59. package/src/generated/ts/subscribe.ts +78 -0
  60. package/src/generated/ts/tags.ts +9 -0
  61. package/src/generated/ts/trade.ts +135 -0
  62. package/src/generated/ts/unsubscribe.ts +78 -0
  63. package/src/generated/ts/welcome.ts +112 -0
  64. package/src/generated/ts-ser.ts +465 -0
  65. package/src/generated/wire-registry.json +20 -0
  66. package/src/native/codec.ts +35 -0
  67. package/src/native/ffi.ts +214 -0
  68. package/src/native/loader.ts +55 -0
  69. package/src/schema/index.ts +217 -0
  70. package/src/server.ts +87 -0
  71. package/src/transport/byte-buffer-pool.ts +63 -0
  72. package/src/transport/scratch.ts +48 -0
  73. package/src/transport/stats.ts +44 -0
  74. package/src/transport/transport.ts +106 -0
@@ -0,0 +1,25 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ export { BigVal, BigValT } from './big-val.js';
6
+ export { Complex, ComplexT } from './complex.js';
7
+ export { Customer, CustomerT } from './customer.js';
8
+ export { Hello, HelloT } from './hello.js';
9
+ export { JoinGroup, JoinGroupT } from './join-group.js';
10
+ export { LeaveGroup, LeaveGroupT } from './leave-group.js';
11
+ export { Order, OrderT } from './order.js';
12
+ export { OrderBilling, OrderBillingT } from './order-billing.js';
13
+ export { OrderLine, OrderLineT } from './order-line.js';
14
+ export { Ping, PingT } from './ping.js';
15
+ export { Pong, PongT } from './pong.js';
16
+ export { PortfolioPosition, PortfolioPositionT } from './portfolio-position.js';
17
+ export { PortfolioSnapshot, PortfolioSnapshotT } from './portfolio-snapshot.js';
18
+ export { Quote, QuoteT } from './quote.js';
19
+ export { Side } from './side.js';
20
+ export { SnapshotRequest, SnapshotRequestT } from './snapshot-request.js';
21
+ export { Subscribe, SubscribeT } from './subscribe.js';
22
+ export { Tags } from './tags.js';
23
+ export { Trade, TradeT } from './trade.js';
24
+ export { Unsubscribe, UnsubscribeT } from './unsubscribe.js';
25
+ export { Welcome, WelcomeT } from './welcome.js';
@@ -0,0 +1,106 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class BigVal implements flatbuffers.IUnpackableObject<BigValT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):BigVal {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsBigVal(bb:flatbuffers.ByteBuffer, obj?:BigVal):BigVal {
19
+ return (obj || new BigVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsBigVal(bb:flatbuffers.ByteBuffer, obj?:BigVal):BigVal {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new BigVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ id():string|null
28
+ id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
29
+ id(optionalEncoding?:any):string|Uint8Array|null {
30
+ const offset = this.bb!.__offset(this.bb_pos, 4);
31
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
32
+ }
33
+
34
+ seq():bigint {
35
+ const offset = this.bb!.__offset(this.bb_pos, 6);
36
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
37
+ }
38
+
39
+ when():bigint {
40
+ const offset = this.bb!.__offset(this.bb_pos, 8);
41
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
42
+ }
43
+
44
+ static startBigVal(builder:flatbuffers.Builder) {
45
+ builder.startObject(3);
46
+ }
47
+
48
+ static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
49
+ builder.addFieldOffset(0, idOffset, 0);
50
+ }
51
+
52
+ static addSeq(builder:flatbuffers.Builder, seq:bigint) {
53
+ builder.addFieldInt64(1, seq, BigInt('0'));
54
+ }
55
+
56
+ static addWhen(builder:flatbuffers.Builder, when:bigint) {
57
+ builder.addFieldInt64(2, when, BigInt('0'));
58
+ }
59
+
60
+ static endBigVal(builder:flatbuffers.Builder):flatbuffers.Offset {
61
+ const offset = builder.endObject();
62
+ return offset;
63
+ }
64
+
65
+ static createBigVal(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, seq:bigint, when:bigint):flatbuffers.Offset {
66
+ BigVal.startBigVal(builder);
67
+ BigVal.addId(builder, idOffset);
68
+ BigVal.addSeq(builder, seq);
69
+ BigVal.addWhen(builder, when);
70
+ return BigVal.endBigVal(builder);
71
+ }
72
+
73
+ unpack(): BigValT {
74
+ return new BigValT(
75
+ this.id(),
76
+ this.seq(),
77
+ this.when()
78
+ );
79
+ }
80
+
81
+
82
+ unpackTo(_o: BigValT): void {
83
+ _o.id = this.id();
84
+ _o.seq = this.seq();
85
+ _o.when = this.when();
86
+ }
87
+ }
88
+
89
+ export class BigValT implements flatbuffers.IGeneratedObject {
90
+ constructor(
91
+ public id: string|Uint8Array|null = null,
92
+ public seq: bigint = BigInt('0'),
93
+ public when: bigint = BigInt('0')
94
+ ){}
95
+
96
+
97
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
98
+ const id = (this.id !== null ? builder.createString(this.id!) : 0);
99
+
100
+ return BigVal.createBigVal(builder,
101
+ id,
102
+ this.seq,
103
+ this.when
104
+ );
105
+ }
106
+ }
@@ -0,0 +1,303 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+ import { Tags } from './tags.js';
8
+
9
+
10
+ export class Complex implements flatbuffers.IUnpackableObject<ComplexT> {
11
+ bb: flatbuffers.ByteBuffer|null = null;
12
+ bb_pos = 0;
13
+ __init(i:number, bb:flatbuffers.ByteBuffer):Complex {
14
+ this.bb_pos = i;
15
+ this.bb = bb;
16
+ return this;
17
+ }
18
+
19
+ static getRootAsComplex(bb:flatbuffers.ByteBuffer, obj?:Complex):Complex {
20
+ return (obj || new Complex()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21
+ }
22
+
23
+ static getSizePrefixedRootAsComplex(bb:flatbuffers.ByteBuffer, obj?:Complex):Complex {
24
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25
+ return (obj || new Complex()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26
+ }
27
+
28
+ id():string|null
29
+ id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
30
+ id(optionalEncoding?:any):string|Uint8Array|null {
31
+ const offset = this.bb!.__offset(this.bb_pos, 4);
32
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
33
+ }
34
+
35
+ names(index: number):string
36
+ names(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
37
+ names(index: number,optionalEncoding?:any):string|Uint8Array|null {
38
+ const offset = this.bb!.__offset(this.bb_pos, 6);
39
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
40
+ }
41
+
42
+ namesLength():number {
43
+ const offset = this.bb!.__offset(this.bb_pos, 6);
44
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
45
+ }
46
+
47
+ prices(index: number):number|null {
48
+ const offset = this.bb!.__offset(this.bb_pos, 8);
49
+ return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
50
+ }
51
+
52
+ pricesLength():number {
53
+ const offset = this.bb!.__offset(this.bb_pos, 8);
54
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
55
+ }
56
+
57
+ pricesArray():Float64Array|null {
58
+ const offset = this.bb!.__offset(this.bb_pos, 8);
59
+ 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;
60
+ }
61
+
62
+ counts(index: number):bigint|null {
63
+ const offset = this.bb!.__offset(this.bb_pos, 10);
64
+ return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
65
+ }
66
+
67
+ countsLength():number {
68
+ const offset = this.bb!.__offset(this.bb_pos, 10);
69
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
70
+ }
71
+
72
+ flags(index: number):boolean|null {
73
+ const offset = this.bb!.__offset(this.bb_pos, 12);
74
+ return offset ? !!this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : false;
75
+ }
76
+
77
+ flagsLength():number {
78
+ const offset = this.bb!.__offset(this.bb_pos, 12);
79
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
80
+ }
81
+
82
+ flagsArray():Int8Array|null {
83
+ const offset = this.bb!.__offset(this.bb_pos, 12);
84
+ 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;
85
+ }
86
+
87
+ tags(index: number):Tags|null {
88
+ const offset = this.bb!.__offset(this.bb_pos, 14);
89
+ return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : null;
90
+ }
91
+
92
+ tagsLength():number {
93
+ const offset = this.bb!.__offset(this.bb_pos, 14);
94
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
95
+ }
96
+
97
+ tagsArray():Int32Array|null {
98
+ const offset = this.bb!.__offset(this.bb_pos, 14);
99
+ return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
100
+ }
101
+
102
+ active():boolean {
103
+ const offset = this.bb!.__offset(this.bb_pos, 16);
104
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
105
+ }
106
+
107
+ total():number {
108
+ const offset = this.bb!.__offset(this.bb_pos, 18);
109
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
110
+ }
111
+
112
+ ts():bigint {
113
+ const offset = this.bb!.__offset(this.bb_pos, 20);
114
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
115
+ }
116
+
117
+ static startComplex(builder:flatbuffers.Builder) {
118
+ builder.startObject(9);
119
+ }
120
+
121
+ static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
122
+ builder.addFieldOffset(0, idOffset, 0);
123
+ }
124
+
125
+ static addNames(builder:flatbuffers.Builder, namesOffset:flatbuffers.Offset) {
126
+ builder.addFieldOffset(1, namesOffset, 0);
127
+ }
128
+
129
+ static createNamesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
130
+ builder.startVector(4, data.length, 4);
131
+ for (let i = data.length - 1; i >= 0; i--) {
132
+ builder.addOffset(data[i]!);
133
+ }
134
+ return builder.endVector();
135
+ }
136
+
137
+ static startNamesVector(builder:flatbuffers.Builder, numElems:number) {
138
+ builder.startVector(4, numElems, 4);
139
+ }
140
+
141
+ static addPrices(builder:flatbuffers.Builder, pricesOffset:flatbuffers.Offset) {
142
+ builder.addFieldOffset(2, pricesOffset, 0);
143
+ }
144
+
145
+ static createPricesVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset;
146
+ /**
147
+ * @deprecated This Uint8Array overload will be removed in the future.
148
+ */
149
+ static createPricesVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
150
+ static createPricesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
151
+ builder.startVector(8, data.length, 8);
152
+ for (let i = data.length - 1; i >= 0; i--) {
153
+ builder.addFloat64(data[i]!);
154
+ }
155
+ return builder.endVector();
156
+ }
157
+
158
+ static startPricesVector(builder:flatbuffers.Builder, numElems:number) {
159
+ builder.startVector(8, numElems, 8);
160
+ }
161
+
162
+ static addCounts(builder:flatbuffers.Builder, countsOffset:flatbuffers.Offset) {
163
+ builder.addFieldOffset(3, countsOffset, 0);
164
+ }
165
+
166
+ static createCountsVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
167
+ builder.startVector(8, data.length, 8);
168
+ for (let i = data.length - 1; i >= 0; i--) {
169
+ builder.addInt64(data[i]!);
170
+ }
171
+ return builder.endVector();
172
+ }
173
+
174
+ static startCountsVector(builder:flatbuffers.Builder, numElems:number) {
175
+ builder.startVector(8, numElems, 8);
176
+ }
177
+
178
+ static addFlags(builder:flatbuffers.Builder, flagsOffset:flatbuffers.Offset) {
179
+ builder.addFieldOffset(4, flagsOffset, 0);
180
+ }
181
+
182
+ static createFlagsVector(builder:flatbuffers.Builder, data:boolean[]):flatbuffers.Offset {
183
+ builder.startVector(1, data.length, 1);
184
+ for (let i = data.length - 1; i >= 0; i--) {
185
+ builder.addInt8(+data[i]!);
186
+ }
187
+ return builder.endVector();
188
+ }
189
+
190
+ static startFlagsVector(builder:flatbuffers.Builder, numElems:number) {
191
+ builder.startVector(1, numElems, 1);
192
+ }
193
+
194
+ static addTags(builder:flatbuffers.Builder, tagsOffset:flatbuffers.Offset) {
195
+ builder.addFieldOffset(5, tagsOffset, 0);
196
+ }
197
+
198
+ static createTagsVector(builder:flatbuffers.Builder, data:Tags[]):flatbuffers.Offset {
199
+ builder.startVector(4, data.length, 4);
200
+ for (let i = data.length - 1; i >= 0; i--) {
201
+ builder.addInt32(data[i]!);
202
+ }
203
+ return builder.endVector();
204
+ }
205
+
206
+ static startTagsVector(builder:flatbuffers.Builder, numElems:number) {
207
+ builder.startVector(4, numElems, 4);
208
+ }
209
+
210
+ static addActive(builder:flatbuffers.Builder, active:boolean) {
211
+ builder.addFieldInt8(6, +active, +false);
212
+ }
213
+
214
+ static addTotal(builder:flatbuffers.Builder, total:number) {
215
+ builder.addFieldFloat64(7, total, 0.0);
216
+ }
217
+
218
+ static addTs(builder:flatbuffers.Builder, ts:bigint) {
219
+ builder.addFieldInt64(8, ts, BigInt('0'));
220
+ }
221
+
222
+ static endComplex(builder:flatbuffers.Builder):flatbuffers.Offset {
223
+ const offset = builder.endObject();
224
+ return offset;
225
+ }
226
+
227
+ static createComplex(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, namesOffset:flatbuffers.Offset, pricesOffset:flatbuffers.Offset, countsOffset:flatbuffers.Offset, flagsOffset:flatbuffers.Offset, tagsOffset:flatbuffers.Offset, active:boolean, total:number, ts:bigint):flatbuffers.Offset {
228
+ Complex.startComplex(builder);
229
+ Complex.addId(builder, idOffset);
230
+ Complex.addNames(builder, namesOffset);
231
+ Complex.addPrices(builder, pricesOffset);
232
+ Complex.addCounts(builder, countsOffset);
233
+ Complex.addFlags(builder, flagsOffset);
234
+ Complex.addTags(builder, tagsOffset);
235
+ Complex.addActive(builder, active);
236
+ Complex.addTotal(builder, total);
237
+ Complex.addTs(builder, ts);
238
+ return Complex.endComplex(builder);
239
+ }
240
+
241
+ unpack(): ComplexT {
242
+ return new ComplexT(
243
+ this.id(),
244
+ this.bb!.createScalarList<string>(this.names.bind(this), this.namesLength()),
245
+ this.bb!.createScalarList<number>(this.prices.bind(this), this.pricesLength()),
246
+ this.bb!.createScalarList<bigint>(this.counts.bind(this), this.countsLength()),
247
+ this.bb!.createScalarList<boolean>(this.flags.bind(this), this.flagsLength()),
248
+ this.bb!.createScalarList<Tags>(this.tags.bind(this), this.tagsLength()),
249
+ this.active(),
250
+ this.total(),
251
+ this.ts()
252
+ );
253
+ }
254
+
255
+
256
+ unpackTo(_o: ComplexT): void {
257
+ _o.id = this.id();
258
+ _o.names = this.bb!.createScalarList<string>(this.names.bind(this), this.namesLength());
259
+ _o.prices = this.bb!.createScalarList<number>(this.prices.bind(this), this.pricesLength());
260
+ _o.counts = this.bb!.createScalarList<bigint>(this.counts.bind(this), this.countsLength());
261
+ _o.flags = this.bb!.createScalarList<boolean>(this.flags.bind(this), this.flagsLength());
262
+ _o.tags = this.bb!.createScalarList<Tags>(this.tags.bind(this), this.tagsLength());
263
+ _o.active = this.active();
264
+ _o.total = this.total();
265
+ _o.ts = this.ts();
266
+ }
267
+ }
268
+
269
+ export class ComplexT implements flatbuffers.IGeneratedObject {
270
+ constructor(
271
+ public id: string|Uint8Array|null = null,
272
+ public names: (string)[] = [],
273
+ public prices: (number)[] = [],
274
+ public counts: (bigint)[] = [],
275
+ public flags: (boolean)[] = [],
276
+ public tags: (Tags)[] = [],
277
+ public active: boolean = false,
278
+ public total: number = 0.0,
279
+ public ts: bigint = BigInt('0')
280
+ ){}
281
+
282
+
283
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
284
+ const id = (this.id !== null ? builder.createString(this.id!) : 0);
285
+ const names = Complex.createNamesVector(builder, builder.createObjectOffsetList(this.names));
286
+ const prices = Complex.createPricesVector(builder, this.prices);
287
+ const counts = Complex.createCountsVector(builder, this.counts);
288
+ const flags = Complex.createFlagsVector(builder, this.flags);
289
+ const tags = Complex.createTagsVector(builder, this.tags);
290
+
291
+ return Complex.createComplex(builder,
292
+ id,
293
+ names,
294
+ prices,
295
+ counts,
296
+ flags,
297
+ tags,
298
+ this.active,
299
+ this.total,
300
+ this.ts
301
+ );
302
+ }
303
+ }
@@ -0,0 +1,137 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class Customer implements flatbuffers.IUnpackableObject<CustomerT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):Customer {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsCustomer(bb:flatbuffers.ByteBuffer, obj?:Customer):Customer {
19
+ return (obj || new Customer()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsCustomer(bb:flatbuffers.ByteBuffer, obj?:Customer):Customer {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new Customer()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ id():string|null
28
+ id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
29
+ id(optionalEncoding?:any):string|Uint8Array|null {
30
+ const offset = this.bb!.__offset(this.bb_pos, 4);
31
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
32
+ }
33
+
34
+ name():string|null
35
+ name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
36
+ name(optionalEncoding?:any):string|Uint8Array|null {
37
+ const offset = this.bb!.__offset(this.bb_pos, 6);
38
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
39
+ }
40
+
41
+ vip():boolean {
42
+ const offset = this.bb!.__offset(this.bb_pos, 8);
43
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
44
+ }
45
+
46
+ loyaltyPoints():bigint {
47
+ const offset = this.bb!.__offset(this.bb_pos, 10);
48
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
49
+ }
50
+
51
+ rating():number {
52
+ const offset = this.bb!.__offset(this.bb_pos, 12);
53
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
54
+ }
55
+
56
+ static startCustomer(builder:flatbuffers.Builder) {
57
+ builder.startObject(5);
58
+ }
59
+
60
+ static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
61
+ builder.addFieldOffset(0, idOffset, 0);
62
+ }
63
+
64
+ static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
65
+ builder.addFieldOffset(1, nameOffset, 0);
66
+ }
67
+
68
+ static addVip(builder:flatbuffers.Builder, vip:boolean) {
69
+ builder.addFieldInt8(2, +vip, +false);
70
+ }
71
+
72
+ static addLoyaltyPoints(builder:flatbuffers.Builder, loyaltyPoints:bigint) {
73
+ builder.addFieldInt64(3, loyaltyPoints, BigInt('0'));
74
+ }
75
+
76
+ static addRating(builder:flatbuffers.Builder, rating:number) {
77
+ builder.addFieldFloat64(4, rating, 0.0);
78
+ }
79
+
80
+ static endCustomer(builder:flatbuffers.Builder):flatbuffers.Offset {
81
+ const offset = builder.endObject();
82
+ return offset;
83
+ }
84
+
85
+ static createCustomer(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, nameOffset:flatbuffers.Offset, vip:boolean, loyaltyPoints:bigint, rating:number):flatbuffers.Offset {
86
+ Customer.startCustomer(builder);
87
+ Customer.addId(builder, idOffset);
88
+ Customer.addName(builder, nameOffset);
89
+ Customer.addVip(builder, vip);
90
+ Customer.addLoyaltyPoints(builder, loyaltyPoints);
91
+ Customer.addRating(builder, rating);
92
+ return Customer.endCustomer(builder);
93
+ }
94
+
95
+ unpack(): CustomerT {
96
+ return new CustomerT(
97
+ this.id(),
98
+ this.name(),
99
+ this.vip(),
100
+ this.loyaltyPoints(),
101
+ this.rating()
102
+ );
103
+ }
104
+
105
+
106
+ unpackTo(_o: CustomerT): void {
107
+ _o.id = this.id();
108
+ _o.name = this.name();
109
+ _o.vip = this.vip();
110
+ _o.loyaltyPoints = this.loyaltyPoints();
111
+ _o.rating = this.rating();
112
+ }
113
+ }
114
+
115
+ export class CustomerT implements flatbuffers.IGeneratedObject {
116
+ constructor(
117
+ public id: string|Uint8Array|null = null,
118
+ public name: string|Uint8Array|null = null,
119
+ public vip: boolean = false,
120
+ public loyaltyPoints: bigint = BigInt('0'),
121
+ public rating: number = 0.0
122
+ ){}
123
+
124
+
125
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
126
+ const id = (this.id !== null ? builder.createString(this.id!) : 0);
127
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
128
+
129
+ return Customer.createCustomer(builder,
130
+ id,
131
+ name,
132
+ this.vip,
133
+ this.loyaltyPoints,
134
+ this.rating
135
+ );
136
+ }
137
+ }
@@ -0,0 +1,123 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class Hello implements flatbuffers.IUnpackableObject<HelloT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):Hello {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsHello(bb:flatbuffers.ByteBuffer, obj?:Hello):Hello {
19
+ return (obj || new Hello()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsHello(bb:flatbuffers.ByteBuffer, obj?:Hello):Hello {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new Hello()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ version():bigint {
28
+ const offset = this.bb!.__offset(this.bb_pos, 4);
29
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
30
+ }
31
+
32
+ caps(index: number):string
33
+ caps(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
34
+ caps(index: number,optionalEncoding?:any):string|Uint8Array|null {
35
+ const offset = this.bb!.__offset(this.bb_pos, 6);
36
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
37
+ }
38
+
39
+ capsLength():number {
40
+ const offset = this.bb!.__offset(this.bb_pos, 6);
41
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
42
+ }
43
+
44
+ lastSeq():bigint {
45
+ const offset = this.bb!.__offset(this.bb_pos, 8);
46
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
47
+ }
48
+
49
+ static startHello(builder:flatbuffers.Builder) {
50
+ builder.startObject(3);
51
+ }
52
+
53
+ static addVersion(builder:flatbuffers.Builder, version:bigint) {
54
+ builder.addFieldInt64(0, version, BigInt('0'));
55
+ }
56
+
57
+ static addCaps(builder:flatbuffers.Builder, capsOffset:flatbuffers.Offset) {
58
+ builder.addFieldOffset(1, capsOffset, 0);
59
+ }
60
+
61
+ static createCapsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
62
+ builder.startVector(4, data.length, 4);
63
+ for (let i = data.length - 1; i >= 0; i--) {
64
+ builder.addOffset(data[i]!);
65
+ }
66
+ return builder.endVector();
67
+ }
68
+
69
+ static startCapsVector(builder:flatbuffers.Builder, numElems:number) {
70
+ builder.startVector(4, numElems, 4);
71
+ }
72
+
73
+ static addLastSeq(builder:flatbuffers.Builder, lastSeq:bigint) {
74
+ builder.addFieldInt64(2, lastSeq, BigInt('0'));
75
+ }
76
+
77
+ static endHello(builder:flatbuffers.Builder):flatbuffers.Offset {
78
+ const offset = builder.endObject();
79
+ return offset;
80
+ }
81
+
82
+ static createHello(builder:flatbuffers.Builder, version:bigint, capsOffset:flatbuffers.Offset, lastSeq:bigint):flatbuffers.Offset {
83
+ Hello.startHello(builder);
84
+ Hello.addVersion(builder, version);
85
+ Hello.addCaps(builder, capsOffset);
86
+ Hello.addLastSeq(builder, lastSeq);
87
+ return Hello.endHello(builder);
88
+ }
89
+
90
+ unpack(): HelloT {
91
+ return new HelloT(
92
+ this.version(),
93
+ this.bb!.createScalarList<string>(this.caps.bind(this), this.capsLength()),
94
+ this.lastSeq()
95
+ );
96
+ }
97
+
98
+
99
+ unpackTo(_o: HelloT): void {
100
+ _o.version = this.version();
101
+ _o.caps = this.bb!.createScalarList<string>(this.caps.bind(this), this.capsLength());
102
+ _o.lastSeq = this.lastSeq();
103
+ }
104
+ }
105
+
106
+ export class HelloT implements flatbuffers.IGeneratedObject {
107
+ constructor(
108
+ public version: bigint = BigInt('0'),
109
+ public caps: (string)[] = [],
110
+ public lastSeq: bigint = BigInt('0')
111
+ ){}
112
+
113
+
114
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
115
+ const caps = Hello.createCapsVector(builder, builder.createObjectOffsetList(this.caps));
116
+
117
+ return Hello.createHello(builder,
118
+ this.version,
119
+ caps,
120
+ this.lastSeq
121
+ );
122
+ }
123
+ }