space-data-module-sdk 0.7.0 → 0.8.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 (67) hide show
  1. package/README.md +16 -23
  2. package/bin/space-data-module.js +5 -3
  3. package/package.json +2 -2
  4. package/schemas/spacedatastandards/PLG.fbs +191 -0
  5. package/src/AGENTS.md +1 -1
  6. package/src/bundle/AGENTS.md +6 -5
  7. package/src/bundle/codec.js +163 -48
  8. package/src/bundle/constants.js +1 -1
  9. package/src/bundle/wasm.js +53 -32
  10. package/src/compiler/compileModule.js +9 -1
  11. package/src/compliance/index.js +4 -0
  12. package/src/compliance/pluginCompliance.js +158 -2
  13. package/src/embeddedManifest.js +25 -5
  14. package/src/generated/orbpro/invoke/plugin-invoke-request.js +2 -2
  15. package/src/generated/orbpro/invoke/plugin-invoke-response.js +2 -2
  16. package/src/generated/orbpro/stream/flat-buffer-type-ref.js +2 -2
  17. package/src/generated/orbpro/stream/typed-arena-buffer.js +2 -2
  18. package/src/generated/spacedatastandards/plg/entry-function.js +86 -0
  19. package/src/generated/spacedatastandards/plg/entry-function.ts +119 -0
  20. package/src/generated/spacedatastandards/plg/index.js +16 -0
  21. package/src/generated/spacedatastandards/plg/index.ts +11 -0
  22. package/src/generated/spacedatastandards/plg/plg.js +657 -0
  23. package/src/generated/spacedatastandards/plg/plg.ts +924 -0
  24. package/src/generated/spacedatastandards/plg/plugin-capability.js +66 -0
  25. package/src/generated/spacedatastandards/plg/plugin-capability.ts +84 -0
  26. package/src/generated/spacedatastandards/plg/plugin-category.js +15 -0
  27. package/src/generated/spacedatastandards/plg/plugin-category.ts +53 -0
  28. package/src/generated/spacedatastandards/plg/plugin-dependency.js +63 -0
  29. package/src/generated/spacedatastandards/plg/plugin-dependency.ts +86 -0
  30. package/src/generated/spacedatastandards/plg/publication-state.js +9 -0
  31. package/src/generated/spacedatastandards/plg/publication-state.ts +23 -0
  32. package/src/generated/spacedatastandards/plg/purchase-tier.js +9 -0
  33. package/src/generated/spacedatastandards/plg/purchase-tier.ts +23 -0
  34. package/src/index.d.ts +1 -1
  35. package/src/invoke/codec.js +1 -1
  36. package/src/manifest/browser.js +7 -0
  37. package/src/manifest/index.js +7 -0
  38. package/src/manifest/legacyToPlg.js +249 -0
  39. package/src/manifest/plgCodec.js +826 -0
  40. package/src/standards/sharedCatalog.js +132 -0
  41. package/src/transport/records.js +34 -3
  42. package/src/vendor/flatbuffers/LICENSE +202 -0
  43. package/src/vendor/flatbuffers/builder.js +534 -0
  44. package/src/vendor/flatbuffers/byte-buffer.js +253 -0
  45. package/src/vendor/flatbuffers/constants.js +4 -0
  46. package/src/vendor/flatbuffers/encoding.js +5 -0
  47. package/src/vendor/flatbuffers/flatbuffers.js +5 -0
  48. package/src/vendor/flatbuffers/utils.js +4 -0
  49. package/schemas/ModuleBundle.fbs +0 -108
  50. package/src/generated/orbpro/module/canonicalization-rule.d.ts +0 -48
  51. package/src/generated/orbpro/module/canonicalization-rule.js +0 -95
  52. package/src/generated/orbpro/module/canonicalization-rule.ts +0 -142
  53. package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +0 -11
  54. package/src/generated/orbpro/module/module-bundle-entry-role.js +0 -14
  55. package/src/generated/orbpro/module/module-bundle-entry-role.ts +0 -15
  56. package/src/generated/orbpro/module/module-bundle-entry.d.ts +0 -97
  57. package/src/generated/orbpro/module/module-bundle-entry.js +0 -219
  58. package/src/generated/orbpro/module/module-bundle-entry.ts +0 -287
  59. package/src/generated/orbpro/module/module-bundle.d.ts +0 -86
  60. package/src/generated/orbpro/module/module-bundle.js +0 -213
  61. package/src/generated/orbpro/module/module-bundle.ts +0 -277
  62. package/src/generated/orbpro/module/module-payload-encoding.d.ts +0 -9
  63. package/src/generated/orbpro/module/module-payload-encoding.js +0 -12
  64. package/src/generated/orbpro/module/module-payload-encoding.ts +0 -13
  65. package/src/generated/orbpro/module.d.ts +0 -5
  66. package/src/generated/orbpro/module.js +0 -7
  67. package/src/generated/orbpro/module.ts +0 -9
@@ -0,0 +1,534 @@
1
+ import { ByteBuffer } from './byte-buffer.js';
2
+ import { FILE_IDENTIFIER_LENGTH, SIZE_PREFIX_LENGTH, SIZEOF_INT, SIZEOF_SHORT, } from './constants.js';
3
+ export class Builder {
4
+ /**
5
+ * Create a FlatBufferBuilder.
6
+ */
7
+ constructor(opt_initial_size) {
8
+ /** Minimum alignment encountered so far. */
9
+ this.minalign = 1;
10
+ /** The vtable for the current table. */
11
+ this.vtable = null;
12
+ /** The amount of fields we're actually using. */
13
+ this.vtable_in_use = 0;
14
+ /** Whether we are currently serializing a table. */
15
+ this.isNested = false;
16
+ /** Starting offset of the current struct/table. */
17
+ this.object_start = 0;
18
+ /** List of offsets of all vtables. */
19
+ this.vtables = [];
20
+ /** For the current vector being built. */
21
+ this.vector_num_elems = 0;
22
+ /** False omits default values from the serialized data */
23
+ this.force_defaults = false;
24
+ this.string_maps = null;
25
+ this.text_encoder = new TextEncoder();
26
+ let initial_size;
27
+ if (!opt_initial_size) {
28
+ initial_size = 1024;
29
+ }
30
+ else {
31
+ initial_size = opt_initial_size;
32
+ }
33
+ /**
34
+ * @type {ByteBuffer}
35
+ * @private
36
+ */
37
+ this.bb = ByteBuffer.allocate(initial_size);
38
+ this.space = initial_size;
39
+ }
40
+ clear() {
41
+ this.bb.clear();
42
+ this.space = this.bb.capacity();
43
+ this.minalign = 1;
44
+ this.vtable = null;
45
+ this.vtable_in_use = 0;
46
+ this.isNested = false;
47
+ this.object_start = 0;
48
+ this.vtables = [];
49
+ this.vector_num_elems = 0;
50
+ this.force_defaults = false;
51
+ this.string_maps = null;
52
+ }
53
+ /**
54
+ * In order to save space, fields that are set to their default value
55
+ * don't get serialized into the buffer. Forcing defaults provides a
56
+ * way to manually disable this optimization.
57
+ *
58
+ * @param forceDefaults true always serializes default values
59
+ */
60
+ forceDefaults(forceDefaults) {
61
+ this.force_defaults = forceDefaults;
62
+ }
63
+ /**
64
+ * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
65
+ * called finish(). The actual data starts at the ByteBuffer's current position,
66
+ * not necessarily at 0.
67
+ */
68
+ dataBuffer() {
69
+ return this.bb;
70
+ }
71
+ /**
72
+ * Get the bytes representing the FlatBuffer. Only call this after you've
73
+ * called finish().
74
+ */
75
+ asUint8Array() {
76
+ return this.bb
77
+ .bytes()
78
+ .subarray(this.bb.position(), this.bb.position() + this.offset());
79
+ }
80
+ /**
81
+ * Prepare to write an element of `size` after `additional_bytes` have been
82
+ * written, e.g. if you write a string, you need to align such the int length
83
+ * field is aligned to 4 bytes, and the string data follows it directly. If all
84
+ * you need to do is alignment, `additional_bytes` will be 0.
85
+ *
86
+ * @param size This is the of the new element to write
87
+ * @param additional_bytes The padding size
88
+ */
89
+ prep(size, additional_bytes) {
90
+ // Track the biggest thing we've ever aligned to.
91
+ if (size > this.minalign) {
92
+ this.minalign = size;
93
+ }
94
+ // Find the amount of alignment needed such that `size` is properly
95
+ // aligned after `additional_bytes`
96
+ const align_size = (~(this.bb.capacity() - this.space + additional_bytes) + 1) & (size - 1);
97
+ // Reallocate the buffer if needed.
98
+ while (this.space < align_size + size + additional_bytes) {
99
+ const old_buf_size = this.bb.capacity();
100
+ this.bb = Builder.growByteBuffer(this.bb);
101
+ this.space += this.bb.capacity() - old_buf_size;
102
+ }
103
+ this.pad(align_size);
104
+ }
105
+ pad(byte_size) {
106
+ for (let i = 0; i < byte_size; i++) {
107
+ this.bb.writeInt8(--this.space, 0);
108
+ }
109
+ }
110
+ writeInt8(value) {
111
+ this.bb.writeInt8((this.space -= 1), value);
112
+ }
113
+ writeInt16(value) {
114
+ this.bb.writeInt16((this.space -= 2), value);
115
+ }
116
+ writeInt32(value) {
117
+ this.bb.writeInt32((this.space -= 4), value);
118
+ }
119
+ writeInt64(value) {
120
+ this.bb.writeInt64((this.space -= 8), value);
121
+ }
122
+ writeFloat32(value) {
123
+ this.bb.writeFloat32((this.space -= 4), value);
124
+ }
125
+ writeFloat64(value) {
126
+ this.bb.writeFloat64((this.space -= 8), value);
127
+ }
128
+ /**
129
+ * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
130
+ * @param value The `int8` to add the buffer.
131
+ */
132
+ addInt8(value) {
133
+ this.prep(1, 0);
134
+ this.writeInt8(value);
135
+ }
136
+ /**
137
+ * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
138
+ * @param value The `int16` to add the buffer.
139
+ */
140
+ addInt16(value) {
141
+ this.prep(2, 0);
142
+ this.writeInt16(value);
143
+ }
144
+ /**
145
+ * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
146
+ * @param value The `int32` to add the buffer.
147
+ */
148
+ addInt32(value) {
149
+ this.prep(4, 0);
150
+ this.writeInt32(value);
151
+ }
152
+ /**
153
+ * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
154
+ * @param value The `int64` to add the buffer.
155
+ */
156
+ addInt64(value) {
157
+ this.prep(8, 0);
158
+ this.writeInt64(value);
159
+ }
160
+ /**
161
+ * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
162
+ * @param value The `float32` to add the buffer.
163
+ */
164
+ addFloat32(value) {
165
+ this.prep(4, 0);
166
+ this.writeFloat32(value);
167
+ }
168
+ /**
169
+ * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
170
+ * @param value The `float64` to add the buffer.
171
+ */
172
+ addFloat64(value) {
173
+ this.prep(8, 0);
174
+ this.writeFloat64(value);
175
+ }
176
+ addFieldInt8(voffset, value, defaultValue) {
177
+ if (this.force_defaults || value != defaultValue) {
178
+ this.addInt8(value);
179
+ this.slot(voffset);
180
+ }
181
+ }
182
+ addFieldInt16(voffset, value, defaultValue) {
183
+ if (this.force_defaults || value != defaultValue) {
184
+ this.addInt16(value);
185
+ this.slot(voffset);
186
+ }
187
+ }
188
+ addFieldInt32(voffset, value, defaultValue) {
189
+ if (this.force_defaults || value != defaultValue) {
190
+ this.addInt32(value);
191
+ this.slot(voffset);
192
+ }
193
+ }
194
+ addFieldInt64(voffset, value, defaultValue) {
195
+ if (this.force_defaults || value !== defaultValue) {
196
+ this.addInt64(value);
197
+ this.slot(voffset);
198
+ }
199
+ }
200
+ addFieldFloat32(voffset, value, defaultValue) {
201
+ if (this.force_defaults || value != defaultValue) {
202
+ this.addFloat32(value);
203
+ this.slot(voffset);
204
+ }
205
+ }
206
+ addFieldFloat64(voffset, value, defaultValue) {
207
+ if (this.force_defaults || value != defaultValue) {
208
+ this.addFloat64(value);
209
+ this.slot(voffset);
210
+ }
211
+ }
212
+ addFieldOffset(voffset, value, defaultValue) {
213
+ if (this.force_defaults || value != defaultValue) {
214
+ this.addOffset(value);
215
+ this.slot(voffset);
216
+ }
217
+ }
218
+ /**
219
+ * Structs are stored inline, so nothing additional is being added. `d` is always 0.
220
+ */
221
+ addFieldStruct(voffset, value, defaultValue) {
222
+ if (value != defaultValue) {
223
+ this.nested(value);
224
+ this.slot(voffset);
225
+ }
226
+ }
227
+ /**
228
+ * Structures are always stored inline, they need to be created right
229
+ * where they're used. You'll get this assertion failure if you
230
+ * created it elsewhere.
231
+ */
232
+ nested(obj) {
233
+ if (obj != this.offset()) {
234
+ throw new TypeError('FlatBuffers: struct must be serialized inline.');
235
+ }
236
+ }
237
+ /**
238
+ * Should not be creating any other object, string or vector
239
+ * while an object is being constructed
240
+ */
241
+ notNested() {
242
+ if (this.isNested) {
243
+ throw new TypeError('FlatBuffers: object serialization must not be nested.');
244
+ }
245
+ }
246
+ /**
247
+ * Set the current vtable at `voffset` to the current location in the buffer.
248
+ */
249
+ slot(voffset) {
250
+ if (this.vtable !== null)
251
+ this.vtable[voffset] = this.offset();
252
+ }
253
+ /**
254
+ * @returns Offset relative to the end of the buffer.
255
+ */
256
+ offset() {
257
+ return this.bb.capacity() - this.space;
258
+ }
259
+ /**
260
+ * Doubles the size of the backing ByteBuffer and copies the old data towards
261
+ * the end of the new buffer (since we build the buffer backwards).
262
+ *
263
+ * @param bb The current buffer with the existing data
264
+ * @returns A new byte buffer with the old data copied
265
+ * to it. The data is located at the end of the buffer.
266
+ *
267
+ * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
268
+ * it a uint8Array we need to suppress the type check:
269
+ * @suppress {checkTypes}
270
+ */
271
+ static growByteBuffer(bb) {
272
+ const old_buf_size = bb.capacity();
273
+ // Ensure we don't grow beyond what fits in an int.
274
+ if (old_buf_size & 0xc0000000) {
275
+ throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
276
+ }
277
+ const new_buf_size = old_buf_size << 1;
278
+ const nbb = ByteBuffer.allocate(new_buf_size);
279
+ nbb.setPosition(new_buf_size - old_buf_size);
280
+ nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
281
+ return nbb;
282
+ }
283
+ /**
284
+ * Adds on offset, relative to where it will be written.
285
+ *
286
+ * @param offset The offset to add.
287
+ */
288
+ addOffset(offset) {
289
+ this.prep(SIZEOF_INT, 0); // Ensure alignment is already done.
290
+ this.writeInt32(this.offset() - offset + SIZEOF_INT);
291
+ }
292
+ /**
293
+ * Start encoding a new object in the buffer. Users will not usually need to
294
+ * call this directly. The FlatBuffers compiler will generate helper methods
295
+ * that call this method internally.
296
+ */
297
+ startObject(numfields) {
298
+ this.notNested();
299
+ if (this.vtable == null) {
300
+ this.vtable = [];
301
+ }
302
+ this.vtable_in_use = numfields;
303
+ for (let i = 0; i < numfields; i++) {
304
+ this.vtable[i] = 0; // This will push additional elements as needed
305
+ }
306
+ this.isNested = true;
307
+ this.object_start = this.offset();
308
+ }
309
+ /**
310
+ * Finish off writing the object that is under construction.
311
+ *
312
+ * @returns The offset to the object inside `dataBuffer`
313
+ */
314
+ endObject() {
315
+ if (this.vtable == null || !this.isNested) {
316
+ throw new Error('FlatBuffers: endObject called without startObject');
317
+ }
318
+ this.addInt32(0);
319
+ const vtableloc = this.offset();
320
+ // Trim trailing zeroes.
321
+ let i = this.vtable_in_use - 1;
322
+ // eslint-disable-next-line no-empty
323
+ for (; i >= 0 && this.vtable[i] == 0; i--) { }
324
+ const trimmed_size = i + 1;
325
+ // Write out the current vtable.
326
+ for (; i >= 0; i--) {
327
+ // Offset relative to the start of the table.
328
+ this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
329
+ }
330
+ const standard_fields = 2; // The fields below:
331
+ this.addInt16(vtableloc - this.object_start);
332
+ const len = (trimmed_size + standard_fields) * SIZEOF_SHORT;
333
+ this.addInt16(len);
334
+ // Search for an existing vtable that matches the current one.
335
+ let existing_vtable = 0;
336
+ const vt1 = this.space;
337
+ outer_loop: for (i = 0; i < this.vtables.length; i++) {
338
+ const vt2 = this.bb.capacity() - this.vtables[i];
339
+ if (len == this.bb.readInt16(vt2)) {
340
+ for (let j = SIZEOF_SHORT; j < len; j += SIZEOF_SHORT) {
341
+ if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
342
+ continue outer_loop;
343
+ }
344
+ }
345
+ existing_vtable = this.vtables[i];
346
+ break;
347
+ }
348
+ }
349
+ if (existing_vtable) {
350
+ // Found a match:
351
+ // Remove the current vtable.
352
+ this.space = this.bb.capacity() - vtableloc;
353
+ // Point table to existing vtable.
354
+ this.bb.writeInt32(this.space, existing_vtable - vtableloc);
355
+ }
356
+ else {
357
+ // No match:
358
+ // Add the location of the current vtable to the list of vtables.
359
+ this.vtables.push(this.offset());
360
+ // Point table to current vtable.
361
+ this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
362
+ }
363
+ this.isNested = false;
364
+ return vtableloc;
365
+ }
366
+ /**
367
+ * Finalize a buffer, poiting to the given `root_table`.
368
+ */
369
+ finish(root_table, opt_file_identifier, opt_size_prefix) {
370
+ const size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;
371
+ if (opt_file_identifier) {
372
+ const file_identifier = opt_file_identifier;
373
+ this.prep(this.minalign, SIZEOF_INT + FILE_IDENTIFIER_LENGTH + size_prefix);
374
+ if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
375
+ throw new TypeError('FlatBuffers: file identifier must be length ' +
376
+ FILE_IDENTIFIER_LENGTH);
377
+ }
378
+ for (let i = FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
379
+ this.writeInt8(file_identifier.charCodeAt(i));
380
+ }
381
+ }
382
+ this.prep(this.minalign, SIZEOF_INT + size_prefix);
383
+ this.addOffset(root_table);
384
+ if (size_prefix) {
385
+ this.addInt32(this.bb.capacity() - this.space);
386
+ }
387
+ this.bb.setPosition(this.space);
388
+ }
389
+ /**
390
+ * Finalize a size prefixed buffer, pointing to the given `root_table`.
391
+ */
392
+ finishSizePrefixed(root_table, opt_file_identifier) {
393
+ this.finish(root_table, opt_file_identifier, true);
394
+ }
395
+ /**
396
+ * This checks a required field has been set in a given table that has
397
+ * just been constructed.
398
+ */
399
+ requiredField(table, field) {
400
+ const table_start = this.bb.capacity() - table;
401
+ const vtable_start = table_start - this.bb.readInt32(table_start);
402
+ const ok = field < this.bb.readInt16(vtable_start) &&
403
+ this.bb.readInt16(vtable_start + field) != 0;
404
+ // If this fails, the caller will show what field needs to be set.
405
+ if (!ok) {
406
+ throw new TypeError('FlatBuffers: field ' + field + ' must be set');
407
+ }
408
+ }
409
+ /**
410
+ * Start a new array/vector of objects. Users usually will not call
411
+ * this directly. The FlatBuffers compiler will create a start/end
412
+ * method for vector types in generated code.
413
+ *
414
+ * @param elem_size The size of each element in the array
415
+ * @param num_elems The number of elements in the array
416
+ * @param alignment The alignment of the array
417
+ */
418
+ startVector(elem_size, num_elems, alignment) {
419
+ this.notNested();
420
+ this.vector_num_elems = num_elems;
421
+ this.prep(SIZEOF_INT, elem_size * num_elems);
422
+ this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
423
+ }
424
+ /**
425
+ * Finish off the creation of an array and all its elements. The array must be
426
+ * created with `startVector`.
427
+ *
428
+ * @returns The offset at which the newly created array
429
+ * starts.
430
+ */
431
+ endVector() {
432
+ this.writeInt32(this.vector_num_elems);
433
+ return this.offset();
434
+ }
435
+ /**
436
+ * Encode the string `s` in the buffer using UTF-8. If the string passed has
437
+ * already been seen, we return the offset of the already written string
438
+ *
439
+ * @param s The string to encode
440
+ * @return The offset in the buffer where the encoded string starts
441
+ */
442
+ createSharedString(s) {
443
+ if (!s) {
444
+ return 0;
445
+ }
446
+ if (!this.string_maps) {
447
+ this.string_maps = new Map();
448
+ }
449
+ if (this.string_maps.has(s)) {
450
+ return this.string_maps.get(s);
451
+ }
452
+ const offset = this.createString(s);
453
+ this.string_maps.set(s, offset);
454
+ return offset;
455
+ }
456
+ /**
457
+ * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
458
+ * instead of a string, it is assumed to contain valid UTF-8 encoded data.
459
+ *
460
+ * @param s The string to encode
461
+ * @return The offset in the buffer where the encoded string starts
462
+ */
463
+ createString(s) {
464
+ if (s === null || s === undefined) {
465
+ return 0;
466
+ }
467
+ let utf8;
468
+ if (s instanceof Uint8Array) {
469
+ utf8 = s;
470
+ }
471
+ else {
472
+ utf8 = this.text_encoder.encode(s);
473
+ }
474
+ this.addInt8(0);
475
+ this.startVector(1, utf8.length, 1);
476
+ this.bb.setPosition((this.space -= utf8.length));
477
+ this.bb.bytes().set(utf8, this.space);
478
+ return this.endVector();
479
+ }
480
+ /**
481
+ * Create a byte vector.
482
+ *
483
+ * @param v The bytes to add
484
+ * @returns The offset in the buffer where the byte vector starts
485
+ */
486
+ createByteVector(v) {
487
+ if (v === null || v === undefined) {
488
+ return 0;
489
+ }
490
+ this.startVector(1, v.length, 1);
491
+ this.bb.setPosition((this.space -= v.length));
492
+ this.bb.bytes().set(v, this.space);
493
+ return this.endVector();
494
+ }
495
+ /**
496
+ * A helper function to pack an object
497
+ *
498
+ * @returns offset of obj
499
+ */
500
+ createObjectOffset(obj) {
501
+ if (obj === null) {
502
+ return 0;
503
+ }
504
+ if (typeof obj === 'string') {
505
+ return this.createString(obj);
506
+ }
507
+ else {
508
+ return obj.pack(this);
509
+ }
510
+ }
511
+ /**
512
+ * A helper function to pack a list of object
513
+ *
514
+ * @returns list of offsets of each non null object
515
+ */
516
+ createObjectOffsetList(list) {
517
+ const ret = [];
518
+ for (let i = 0; i < list.length; ++i) {
519
+ const val = list[i];
520
+ if (val !== null) {
521
+ ret.push(this.createObjectOffset(val));
522
+ }
523
+ else {
524
+ throw new TypeError('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
525
+ }
526
+ }
527
+ return ret;
528
+ }
529
+ createStructOffsetList(list, startFunc) {
530
+ startFunc(this, list.length);
531
+ this.createObjectOffsetList(list.slice().reverse());
532
+ return this.endVector();
533
+ }
534
+ }