space-data-module-sdk 0.1.0 → 0.2.0

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 (44) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +174 -83
  3. package/bin/space-data-module.js +24 -0
  4. package/package.json +8 -3
  5. package/schemas/ModuleBundle.fbs +108 -0
  6. package/schemas/PluginManifest.fbs +26 -1
  7. package/src/bundle/codec.js +244 -0
  8. package/src/bundle/constants.js +8 -0
  9. package/src/bundle/index.js +3 -0
  10. package/src/bundle/wasm.js +447 -0
  11. package/src/compiler/compileModule.js +189 -41
  12. package/src/compliance/pluginCompliance.js +334 -0
  13. package/src/generated/orbpro/manifest/capability-kind.d.ts +27 -2
  14. package/src/generated/orbpro/manifest/capability-kind.js +26 -1
  15. package/src/generated/orbpro/manifest/capability-kind.ts +25 -0
  16. package/src/generated/orbpro/module/canonicalization-rule.d.ts +48 -0
  17. package/src/generated/orbpro/module/canonicalization-rule.js +95 -0
  18. package/src/generated/orbpro/module/canonicalization-rule.ts +142 -0
  19. package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +11 -0
  20. package/src/generated/orbpro/module/module-bundle-entry-role.js +14 -0
  21. package/src/generated/orbpro/module/module-bundle-entry-role.ts +15 -0
  22. package/src/generated/orbpro/module/module-bundle-entry.d.ts +97 -0
  23. package/src/generated/orbpro/module/module-bundle-entry.js +219 -0
  24. package/src/generated/orbpro/module/module-bundle-entry.ts +287 -0
  25. package/src/generated/orbpro/module/module-bundle.d.ts +86 -0
  26. package/src/generated/orbpro/module/module-bundle.js +213 -0
  27. package/src/generated/orbpro/module/module-bundle.ts +277 -0
  28. package/src/generated/orbpro/module/module-payload-encoding.d.ts +9 -0
  29. package/src/generated/orbpro/module/module-payload-encoding.js +12 -0
  30. package/src/generated/orbpro/module/module-payload-encoding.ts +13 -0
  31. package/src/generated/orbpro/module.d.ts +5 -0
  32. package/src/generated/orbpro/module.js +7 -0
  33. package/src/generated/orbpro/module.ts +9 -0
  34. package/src/host/abi.js +282 -0
  35. package/src/host/cron.js +247 -0
  36. package/src/host/index.js +3 -0
  37. package/src/host/nodeHost.js +2165 -0
  38. package/src/index.d.ts +880 -0
  39. package/src/index.js +9 -2
  40. package/src/manifest/normalize.js +32 -1
  41. package/src/runtime/constants.js +18 -1
  42. package/src/transport/pki.js +0 -5
  43. package/src/utils/encoding.js +9 -1
  44. package/src/utils/wasmCrypto.js +49 -1
@@ -0,0 +1,213 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3
+ import * as flatbuffers from 'flatbuffers';
4
+ import { CanonicalizationRule } from '../../orbpro/module/canonicalization-rule.js';
5
+ import { ModuleBundleEntry } from '../../orbpro/module/module-bundle-entry.js';
6
+ /**
7
+ * Metadata stored in the required `sds.bundle` custom section.
8
+ */
9
+ export class ModuleBundle {
10
+ bb = null;
11
+ bb_pos = 0;
12
+ __init(i, bb) {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+ static getRootAsModuleBundle(bb, obj) {
18
+ return (obj || new ModuleBundle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19
+ }
20
+ static getSizePrefixedRootAsModuleBundle(bb, obj) {
21
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22
+ return (obj || new ModuleBundle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23
+ }
24
+ static bufferHasIdentifier(bb) {
25
+ return bb.__has_identifier('SMDB');
26
+ }
27
+ /**
28
+ * Bundle schema version.
29
+ */
30
+ bundleVersion() {
31
+ const offset = this.bb.__offset(this.bb_pos, 4);
32
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 1;
33
+ }
34
+ moduleFormat(optionalEncoding) {
35
+ const offset = this.bb.__offset(this.bb_pos, 6);
36
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
37
+ }
38
+ /**
39
+ * Canonicalization rule used to compute module hashes.
40
+ */
41
+ canonicalization(obj) {
42
+ const offset = this.bb.__offset(this.bb_pos, 8);
43
+ return offset ? (obj || new CanonicalizationRule()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
44
+ }
45
+ /**
46
+ * SHA-256 of the wasm module after stripping `sds.*` custom sections.
47
+ */
48
+ canonicalModuleHash(index) {
49
+ const offset = this.bb.__offset(this.bb_pos, 10);
50
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
51
+ }
52
+ canonicalModuleHashLength() {
53
+ const offset = this.bb.__offset(this.bb_pos, 10);
54
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
55
+ }
56
+ canonicalModuleHashArray() {
57
+ const offset = this.bb.__offset(this.bb_pos, 10);
58
+ return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
59
+ }
60
+ /**
61
+ * SHA-256 of the canonical plugin manifest bytes.
62
+ */
63
+ manifestHash(index) {
64
+ const offset = this.bb.__offset(this.bb_pos, 12);
65
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
66
+ }
67
+ manifestHashLength() {
68
+ const offset = this.bb.__offset(this.bb_pos, 12);
69
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
70
+ }
71
+ manifestHashArray() {
72
+ const offset = this.bb.__offset(this.bb_pos, 12);
73
+ return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
74
+ }
75
+ manifestExportSymbol(optionalEncoding) {
76
+ const offset = this.bb.__offset(this.bb_pos, 14);
77
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
78
+ }
79
+ manifestSizeSymbol(optionalEncoding) {
80
+ const offset = this.bb.__offset(this.bb_pos, 16);
81
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
82
+ }
83
+ /**
84
+ * Payloads embedded in the bundle.
85
+ */
86
+ entries(index, obj) {
87
+ const offset = this.bb.__offset(this.bb_pos, 18);
88
+ return offset ? (obj || new ModuleBundleEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
89
+ }
90
+ entriesLength() {
91
+ const offset = this.bb.__offset(this.bb_pos, 18);
92
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
93
+ }
94
+ static startModuleBundle(builder) {
95
+ builder.startObject(8);
96
+ }
97
+ static addBundleVersion(builder, bundleVersion) {
98
+ builder.addFieldInt16(0, bundleVersion, 1);
99
+ }
100
+ static addModuleFormat(builder, moduleFormatOffset) {
101
+ builder.addFieldOffset(1, moduleFormatOffset, 0);
102
+ }
103
+ static addCanonicalization(builder, canonicalizationOffset) {
104
+ builder.addFieldOffset(2, canonicalizationOffset, 0);
105
+ }
106
+ static addCanonicalModuleHash(builder, canonicalModuleHashOffset) {
107
+ builder.addFieldOffset(3, canonicalModuleHashOffset, 0);
108
+ }
109
+ static createCanonicalModuleHashVector(builder, data) {
110
+ builder.startVector(1, data.length, 1);
111
+ for (let i = data.length - 1; i >= 0; i--) {
112
+ builder.addInt8(data[i]);
113
+ }
114
+ return builder.endVector();
115
+ }
116
+ static startCanonicalModuleHashVector(builder, numElems) {
117
+ builder.startVector(1, numElems, 1);
118
+ }
119
+ static addManifestHash(builder, manifestHashOffset) {
120
+ builder.addFieldOffset(4, manifestHashOffset, 0);
121
+ }
122
+ static createManifestHashVector(builder, data) {
123
+ builder.startVector(1, data.length, 1);
124
+ for (let i = data.length - 1; i >= 0; i--) {
125
+ builder.addInt8(data[i]);
126
+ }
127
+ return builder.endVector();
128
+ }
129
+ static startManifestHashVector(builder, numElems) {
130
+ builder.startVector(1, numElems, 1);
131
+ }
132
+ static addManifestExportSymbol(builder, manifestExportSymbolOffset) {
133
+ builder.addFieldOffset(5, manifestExportSymbolOffset, 0);
134
+ }
135
+ static addManifestSizeSymbol(builder, manifestSizeSymbolOffset) {
136
+ builder.addFieldOffset(6, manifestSizeSymbolOffset, 0);
137
+ }
138
+ static addEntries(builder, entriesOffset) {
139
+ builder.addFieldOffset(7, entriesOffset, 0);
140
+ }
141
+ static createEntriesVector(builder, data) {
142
+ builder.startVector(4, data.length, 4);
143
+ for (let i = data.length - 1; i >= 0; i--) {
144
+ builder.addOffset(data[i]);
145
+ }
146
+ return builder.endVector();
147
+ }
148
+ static startEntriesVector(builder, numElems) {
149
+ builder.startVector(4, numElems, 4);
150
+ }
151
+ static endModuleBundle(builder) {
152
+ const offset = builder.endObject();
153
+ return offset;
154
+ }
155
+ static finishModuleBundleBuffer(builder, offset) {
156
+ builder.finish(offset, 'SMDB');
157
+ }
158
+ static finishSizePrefixedModuleBundleBuffer(builder, offset) {
159
+ builder.finish(offset, 'SMDB', true);
160
+ }
161
+ unpack() {
162
+ return new ModuleBundleT(this.bundleVersion(), this.moduleFormat(), (this.canonicalization() !== null ? this.canonicalization().unpack() : null), this.bb.createScalarList(this.canonicalModuleHash.bind(this), this.canonicalModuleHashLength()), this.bb.createScalarList(this.manifestHash.bind(this), this.manifestHashLength()), this.manifestExportSymbol(), this.manifestSizeSymbol(), this.bb.createObjList(this.entries.bind(this), this.entriesLength()));
163
+ }
164
+ unpackTo(_o) {
165
+ _o.bundleVersion = this.bundleVersion();
166
+ _o.moduleFormat = this.moduleFormat();
167
+ _o.canonicalization = (this.canonicalization() !== null ? this.canonicalization().unpack() : null);
168
+ _o.canonicalModuleHash = this.bb.createScalarList(this.canonicalModuleHash.bind(this), this.canonicalModuleHashLength());
169
+ _o.manifestHash = this.bb.createScalarList(this.manifestHash.bind(this), this.manifestHashLength());
170
+ _o.manifestExportSymbol = this.manifestExportSymbol();
171
+ _o.manifestSizeSymbol = this.manifestSizeSymbol();
172
+ _o.entries = this.bb.createObjList(this.entries.bind(this), this.entriesLength());
173
+ }
174
+ }
175
+ export class ModuleBundleT {
176
+ bundleVersion;
177
+ moduleFormat;
178
+ canonicalization;
179
+ canonicalModuleHash;
180
+ manifestHash;
181
+ manifestExportSymbol;
182
+ manifestSizeSymbol;
183
+ entries;
184
+ constructor(bundleVersion = 1, moduleFormat = null, canonicalization = null, canonicalModuleHash = [], manifestHash = [], manifestExportSymbol = null, manifestSizeSymbol = null, entries = []) {
185
+ this.bundleVersion = bundleVersion;
186
+ this.moduleFormat = moduleFormat;
187
+ this.canonicalization = canonicalization;
188
+ this.canonicalModuleHash = canonicalModuleHash;
189
+ this.manifestHash = manifestHash;
190
+ this.manifestExportSymbol = manifestExportSymbol;
191
+ this.manifestSizeSymbol = manifestSizeSymbol;
192
+ this.entries = entries;
193
+ }
194
+ pack(builder) {
195
+ const moduleFormat = (this.moduleFormat !== null ? builder.createString(this.moduleFormat) : 0);
196
+ const canonicalization = (this.canonicalization !== null ? this.canonicalization.pack(builder) : 0);
197
+ const canonicalModuleHash = ModuleBundle.createCanonicalModuleHashVector(builder, this.canonicalModuleHash);
198
+ const manifestHash = ModuleBundle.createManifestHashVector(builder, this.manifestHash);
199
+ const manifestExportSymbol = (this.manifestExportSymbol !== null ? builder.createString(this.manifestExportSymbol) : 0);
200
+ const manifestSizeSymbol = (this.manifestSizeSymbol !== null ? builder.createString(this.manifestSizeSymbol) : 0);
201
+ const entries = ModuleBundle.createEntriesVector(builder, builder.createObjectOffsetList(this.entries));
202
+ ModuleBundle.startModuleBundle(builder);
203
+ ModuleBundle.addBundleVersion(builder, this.bundleVersion);
204
+ ModuleBundle.addModuleFormat(builder, moduleFormat);
205
+ ModuleBundle.addCanonicalization(builder, canonicalization);
206
+ ModuleBundle.addCanonicalModuleHash(builder, canonicalModuleHash);
207
+ ModuleBundle.addManifestHash(builder, manifestHash);
208
+ ModuleBundle.addManifestExportSymbol(builder, manifestExportSymbol);
209
+ ModuleBundle.addManifestSizeSymbol(builder, manifestSizeSymbol);
210
+ ModuleBundle.addEntries(builder, entries);
211
+ return ModuleBundle.endModuleBundle(builder);
212
+ }
213
+ }
@@ -0,0 +1,277 @@
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 { CanonicalizationRule, CanonicalizationRuleT } from '../../orbpro/module/canonicalization-rule.js';
8
+ import { ModuleBundleEntry, ModuleBundleEntryT } from '../../orbpro/module/module-bundle-entry.js';
9
+
10
+
11
+ /**
12
+ * Metadata stored in the required `sds.bundle` custom section.
13
+ */
14
+ export class ModuleBundle implements flatbuffers.IUnpackableObject<ModuleBundleT> {
15
+ bb: flatbuffers.ByteBuffer|null = null;
16
+ bb_pos = 0;
17
+ __init(i:number, bb:flatbuffers.ByteBuffer):ModuleBundle {
18
+ this.bb_pos = i;
19
+ this.bb = bb;
20
+ return this;
21
+ }
22
+
23
+ static getRootAsModuleBundle(bb:flatbuffers.ByteBuffer, obj?:ModuleBundle):ModuleBundle {
24
+ return (obj || new ModuleBundle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ static getSizePrefixedRootAsModuleBundle(bb:flatbuffers.ByteBuffer, obj?:ModuleBundle):ModuleBundle {
28
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
29
+ return (obj || new ModuleBundle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
30
+ }
31
+
32
+ static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
33
+ return bb.__has_identifier('SMDB');
34
+ }
35
+
36
+ /**
37
+ * Bundle schema version.
38
+ */
39
+ bundleVersion():number {
40
+ const offset = this.bb!.__offset(this.bb_pos, 4);
41
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 1;
42
+ }
43
+
44
+ /**
45
+ * Human-readable package format label.
46
+ */
47
+ moduleFormat():string|null
48
+ moduleFormat(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
49
+ moduleFormat(optionalEncoding?:any):string|Uint8Array|null {
50
+ const offset = this.bb!.__offset(this.bb_pos, 6);
51
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
52
+ }
53
+
54
+ /**
55
+ * Canonicalization rule used to compute module hashes.
56
+ */
57
+ canonicalization(obj?:CanonicalizationRule):CanonicalizationRule|null {
58
+ const offset = this.bb!.__offset(this.bb_pos, 8);
59
+ return offset ? (obj || new CanonicalizationRule()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
60
+ }
61
+
62
+ /**
63
+ * SHA-256 of the wasm module after stripping `sds.*` custom sections.
64
+ */
65
+ canonicalModuleHash(index: number):number|null {
66
+ const offset = this.bb!.__offset(this.bb_pos, 10);
67
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
68
+ }
69
+
70
+ canonicalModuleHashLength():number {
71
+ const offset = this.bb!.__offset(this.bb_pos, 10);
72
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
73
+ }
74
+
75
+ canonicalModuleHashArray():Uint8Array|null {
76
+ const offset = this.bb!.__offset(this.bb_pos, 10);
77
+ return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
78
+ }
79
+
80
+ /**
81
+ * SHA-256 of the canonical plugin manifest bytes.
82
+ */
83
+ manifestHash(index: number):number|null {
84
+ const offset = this.bb!.__offset(this.bb_pos, 12);
85
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
86
+ }
87
+
88
+ manifestHashLength():number {
89
+ const offset = this.bb!.__offset(this.bb_pos, 12);
90
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
91
+ }
92
+
93
+ manifestHashArray():Uint8Array|null {
94
+ const offset = this.bb!.__offset(this.bb_pos, 12);
95
+ return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
96
+ }
97
+
98
+ /**
99
+ * Legacy ABI export retained for backward compatibility.
100
+ */
101
+ manifestExportSymbol():string|null
102
+ manifestExportSymbol(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
103
+ manifestExportSymbol(optionalEncoding?:any):string|Uint8Array|null {
104
+ const offset = this.bb!.__offset(this.bb_pos, 14);
105
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
106
+ }
107
+
108
+ /**
109
+ * Legacy ABI export retained for backward compatibility.
110
+ */
111
+ manifestSizeSymbol():string|null
112
+ manifestSizeSymbol(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
113
+ manifestSizeSymbol(optionalEncoding?:any):string|Uint8Array|null {
114
+ const offset = this.bb!.__offset(this.bb_pos, 16);
115
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
116
+ }
117
+
118
+ /**
119
+ * Payloads embedded in the bundle.
120
+ */
121
+ entries(index: number, obj?:ModuleBundleEntry):ModuleBundleEntry|null {
122
+ const offset = this.bb!.__offset(this.bb_pos, 18);
123
+ return offset ? (obj || new ModuleBundleEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
124
+ }
125
+
126
+ entriesLength():number {
127
+ const offset = this.bb!.__offset(this.bb_pos, 18);
128
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
129
+ }
130
+
131
+ static startModuleBundle(builder:flatbuffers.Builder) {
132
+ builder.startObject(8);
133
+ }
134
+
135
+ static addBundleVersion(builder:flatbuffers.Builder, bundleVersion:number) {
136
+ builder.addFieldInt16(0, bundleVersion, 1);
137
+ }
138
+
139
+ static addModuleFormat(builder:flatbuffers.Builder, moduleFormatOffset:flatbuffers.Offset) {
140
+ builder.addFieldOffset(1, moduleFormatOffset, 0);
141
+ }
142
+
143
+ static addCanonicalization(builder:flatbuffers.Builder, canonicalizationOffset:flatbuffers.Offset) {
144
+ builder.addFieldOffset(2, canonicalizationOffset, 0);
145
+ }
146
+
147
+ static addCanonicalModuleHash(builder:flatbuffers.Builder, canonicalModuleHashOffset:flatbuffers.Offset) {
148
+ builder.addFieldOffset(3, canonicalModuleHashOffset, 0);
149
+ }
150
+
151
+ static createCanonicalModuleHashVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
152
+ builder.startVector(1, data.length, 1);
153
+ for (let i = data.length - 1; i >= 0; i--) {
154
+ builder.addInt8(data[i]!);
155
+ }
156
+ return builder.endVector();
157
+ }
158
+
159
+ static startCanonicalModuleHashVector(builder:flatbuffers.Builder, numElems:number) {
160
+ builder.startVector(1, numElems, 1);
161
+ }
162
+
163
+ static addManifestHash(builder:flatbuffers.Builder, manifestHashOffset:flatbuffers.Offset) {
164
+ builder.addFieldOffset(4, manifestHashOffset, 0);
165
+ }
166
+
167
+ static createManifestHashVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
168
+ builder.startVector(1, data.length, 1);
169
+ for (let i = data.length - 1; i >= 0; i--) {
170
+ builder.addInt8(data[i]!);
171
+ }
172
+ return builder.endVector();
173
+ }
174
+
175
+ static startManifestHashVector(builder:flatbuffers.Builder, numElems:number) {
176
+ builder.startVector(1, numElems, 1);
177
+ }
178
+
179
+ static addManifestExportSymbol(builder:flatbuffers.Builder, manifestExportSymbolOffset:flatbuffers.Offset) {
180
+ builder.addFieldOffset(5, manifestExportSymbolOffset, 0);
181
+ }
182
+
183
+ static addManifestSizeSymbol(builder:flatbuffers.Builder, manifestSizeSymbolOffset:flatbuffers.Offset) {
184
+ builder.addFieldOffset(6, manifestSizeSymbolOffset, 0);
185
+ }
186
+
187
+ static addEntries(builder:flatbuffers.Builder, entriesOffset:flatbuffers.Offset) {
188
+ builder.addFieldOffset(7, entriesOffset, 0);
189
+ }
190
+
191
+ static createEntriesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
192
+ builder.startVector(4, data.length, 4);
193
+ for (let i = data.length - 1; i >= 0; i--) {
194
+ builder.addOffset(data[i]!);
195
+ }
196
+ return builder.endVector();
197
+ }
198
+
199
+ static startEntriesVector(builder:flatbuffers.Builder, numElems:number) {
200
+ builder.startVector(4, numElems, 4);
201
+ }
202
+
203
+ static endModuleBundle(builder:flatbuffers.Builder):flatbuffers.Offset {
204
+ const offset = builder.endObject();
205
+ return offset;
206
+ }
207
+
208
+ static finishModuleBundleBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
209
+ builder.finish(offset, 'SMDB');
210
+ }
211
+
212
+ static finishSizePrefixedModuleBundleBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
213
+ builder.finish(offset, 'SMDB', true);
214
+ }
215
+
216
+
217
+ unpack(): ModuleBundleT {
218
+ return new ModuleBundleT(
219
+ this.bundleVersion(),
220
+ this.moduleFormat(),
221
+ (this.canonicalization() !== null ? this.canonicalization()!.unpack() : null),
222
+ this.bb!.createScalarList<number>(this.canonicalModuleHash.bind(this), this.canonicalModuleHashLength()),
223
+ this.bb!.createScalarList<number>(this.manifestHash.bind(this), this.manifestHashLength()),
224
+ this.manifestExportSymbol(),
225
+ this.manifestSizeSymbol(),
226
+ this.bb!.createObjList<ModuleBundleEntry, ModuleBundleEntryT>(this.entries.bind(this), this.entriesLength())
227
+ );
228
+ }
229
+
230
+
231
+ unpackTo(_o: ModuleBundleT): void {
232
+ _o.bundleVersion = this.bundleVersion();
233
+ _o.moduleFormat = this.moduleFormat();
234
+ _o.canonicalization = (this.canonicalization() !== null ? this.canonicalization()!.unpack() : null);
235
+ _o.canonicalModuleHash = this.bb!.createScalarList<number>(this.canonicalModuleHash.bind(this), this.canonicalModuleHashLength());
236
+ _o.manifestHash = this.bb!.createScalarList<number>(this.manifestHash.bind(this), this.manifestHashLength());
237
+ _o.manifestExportSymbol = this.manifestExportSymbol();
238
+ _o.manifestSizeSymbol = this.manifestSizeSymbol();
239
+ _o.entries = this.bb!.createObjList<ModuleBundleEntry, ModuleBundleEntryT>(this.entries.bind(this), this.entriesLength());
240
+ }
241
+ }
242
+
243
+ export class ModuleBundleT implements flatbuffers.IGeneratedObject {
244
+ constructor(
245
+ public bundleVersion: number = 1,
246
+ public moduleFormat: string|Uint8Array|null = null,
247
+ public canonicalization: CanonicalizationRuleT|null = null,
248
+ public canonicalModuleHash: (number)[] = [],
249
+ public manifestHash: (number)[] = [],
250
+ public manifestExportSymbol: string|Uint8Array|null = null,
251
+ public manifestSizeSymbol: string|Uint8Array|null = null,
252
+ public entries: (ModuleBundleEntryT)[] = []
253
+ ){}
254
+
255
+
256
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
257
+ const moduleFormat = (this.moduleFormat !== null ? builder.createString(this.moduleFormat!) : 0);
258
+ const canonicalization = (this.canonicalization !== null ? this.canonicalization!.pack(builder) : 0);
259
+ const canonicalModuleHash = ModuleBundle.createCanonicalModuleHashVector(builder, this.canonicalModuleHash);
260
+ const manifestHash = ModuleBundle.createManifestHashVector(builder, this.manifestHash);
261
+ const manifestExportSymbol = (this.manifestExportSymbol !== null ? builder.createString(this.manifestExportSymbol!) : 0);
262
+ const manifestSizeSymbol = (this.manifestSizeSymbol !== null ? builder.createString(this.manifestSizeSymbol!) : 0);
263
+ const entries = ModuleBundle.createEntriesVector(builder, builder.createObjectOffsetList(this.entries));
264
+
265
+ ModuleBundle.startModuleBundle(builder);
266
+ ModuleBundle.addBundleVersion(builder, this.bundleVersion);
267
+ ModuleBundle.addModuleFormat(builder, moduleFormat);
268
+ ModuleBundle.addCanonicalization(builder, canonicalization);
269
+ ModuleBundle.addCanonicalModuleHash(builder, canonicalModuleHash);
270
+ ModuleBundle.addManifestHash(builder, manifestHash);
271
+ ModuleBundle.addManifestExportSymbol(builder, manifestExportSymbol);
272
+ ModuleBundle.addManifestSizeSymbol(builder, manifestSizeSymbol);
273
+ ModuleBundle.addEntries(builder, entries);
274
+
275
+ return ModuleBundle.endModuleBundle(builder);
276
+ }
277
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Serialization format used by an entry payload.
3
+ */
4
+ export declare enum ModulePayloadEncoding {
5
+ RAW_BYTES = 0,
6
+ FLATBUFFER = 1,
7
+ JSON_UTF8 = 2,
8
+ CBOR = 3
9
+ }
@@ -0,0 +1,12 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3
+ /**
4
+ * Serialization format used by an entry payload.
5
+ */
6
+ export var ModulePayloadEncoding;
7
+ (function (ModulePayloadEncoding) {
8
+ ModulePayloadEncoding[ModulePayloadEncoding["RAW_BYTES"] = 0] = "RAW_BYTES";
9
+ ModulePayloadEncoding[ModulePayloadEncoding["FLATBUFFER"] = 1] = "FLATBUFFER";
10
+ ModulePayloadEncoding[ModulePayloadEncoding["JSON_UTF8"] = 2] = "JSON_UTF8";
11
+ ModulePayloadEncoding[ModulePayloadEncoding["CBOR"] = 3] = "CBOR";
12
+ })(ModulePayloadEncoding || (ModulePayloadEncoding = {}));
@@ -0,0 +1,13 @@
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
+ /**
6
+ * Serialization format used by an entry payload.
7
+ */
8
+ export enum ModulePayloadEncoding {
9
+ RAW_BYTES = 0,
10
+ FLATBUFFER = 1,
11
+ JSON_UTF8 = 2,
12
+ CBOR = 3
13
+ }
@@ -0,0 +1,5 @@
1
+ export { CanonicalizationRule, CanonicalizationRuleT } from './module/canonicalization-rule.js';
2
+ export { ModuleBundle, ModuleBundleT } from './module/module-bundle.js';
3
+ export { ModuleBundleEntry, ModuleBundleEntryT } from './module/module-bundle-entry.js';
4
+ export { ModuleBundleEntryRole } from './module/module-bundle-entry-role.js';
5
+ export { ModulePayloadEncoding } from './module/module-payload-encoding.js';
@@ -0,0 +1,7 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3
+ export { CanonicalizationRule, CanonicalizationRuleT } from './module/canonicalization-rule.js';
4
+ export { ModuleBundle, ModuleBundleT } from './module/module-bundle.js';
5
+ export { ModuleBundleEntry, ModuleBundleEntryT } from './module/module-bundle-entry.js';
6
+ export { ModuleBundleEntryRole } from './module/module-bundle-entry-role.js';
7
+ export { ModulePayloadEncoding } from './module/module-payload-encoding.js';
@@ -0,0 +1,9 @@
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 { CanonicalizationRule, CanonicalizationRuleT } from './module/canonicalization-rule.js';
6
+ export { ModuleBundle, ModuleBundleT } from './module/module-bundle.js';
7
+ export { ModuleBundleEntry, ModuleBundleEntryT } from './module/module-bundle-entry.js';
8
+ export { ModuleBundleEntryRole } from './module/module-bundle-entry-role.js';
9
+ export { ModulePayloadEncoding } from './module/module-payload-encoding.js';