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,219 @@
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 { ModuleBundleEntryRole } from '../../orbpro/module/module-bundle-entry-role.js';
5
+ import { ModulePayloadEncoding } from '../../orbpro/module/module-payload-encoding.js';
6
+ import { FlatBufferTypeRef } from '../../orbpro/stream/flat-buffer-type-ref.js';
7
+ /**
8
+ * One payload carried inside the bundle.
9
+ */
10
+ export class ModuleBundleEntry {
11
+ bb = null;
12
+ bb_pos = 0;
13
+ __init(i, bb) {
14
+ this.bb_pos = i;
15
+ this.bb = bb;
16
+ return this;
17
+ }
18
+ static getRootAsModuleBundleEntry(bb, obj) {
19
+ return (obj || new ModuleBundleEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+ static getSizePrefixedRootAsModuleBundleEntry(bb, obj) {
22
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
23
+ return (obj || new ModuleBundleEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
24
+ }
25
+ entryId(optionalEncoding) {
26
+ const offset = this.bb.__offset(this.bb_pos, 4);
27
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
28
+ }
29
+ /**
30
+ * High-level semantic role of the payload.
31
+ */
32
+ role() {
33
+ const offset = this.bb.__offset(this.bb_pos, 6);
34
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : ModuleBundleEntryRole.AUXILIARY;
35
+ }
36
+ sectionName(optionalEncoding) {
37
+ const offset = this.bb.__offset(this.bb_pos, 8);
38
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
39
+ }
40
+ /**
41
+ * SDS/shared-module schema identity when the payload is itself a
42
+ * FlatBuffer.
43
+ */
44
+ typeRef(obj) {
45
+ const offset = this.bb.__offset(this.bb_pos, 10);
46
+ return offset ? (obj || new FlatBufferTypeRef()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
47
+ }
48
+ /**
49
+ * Encoding used for `payload`.
50
+ */
51
+ payloadEncoding() {
52
+ const offset = this.bb.__offset(this.bb_pos, 12);
53
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : ModulePayloadEncoding.RAW_BYTES;
54
+ }
55
+ mediaType(optionalEncoding) {
56
+ const offset = this.bb.__offset(this.bb_pos, 14);
57
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
58
+ }
59
+ /**
60
+ * Implementation-defined bit flags for signed/encrypted/compressed state.
61
+ */
62
+ flags() {
63
+ const offset = this.bb.__offset(this.bb_pos, 16);
64
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
65
+ }
66
+ /**
67
+ * SHA-256 of the payload bytes.
68
+ */
69
+ sha256(index) {
70
+ const offset = this.bb.__offset(this.bb_pos, 18);
71
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
72
+ }
73
+ sha256Length() {
74
+ const offset = this.bb.__offset(this.bb_pos, 18);
75
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
76
+ }
77
+ sha256Array() {
78
+ const offset = this.bb.__offset(this.bb_pos, 18);
79
+ 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;
80
+ }
81
+ /**
82
+ * Embedded payload bytes. For single-file deployment this should be
83
+ * populated for every entry.
84
+ */
85
+ payload(index) {
86
+ const offset = this.bb.__offset(this.bb_pos, 20);
87
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
88
+ }
89
+ payloadLength() {
90
+ const offset = this.bb.__offset(this.bb_pos, 20);
91
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
92
+ }
93
+ payloadArray() {
94
+ const offset = this.bb.__offset(this.bb_pos, 20);
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
+ description(optionalEncoding) {
98
+ const offset = this.bb.__offset(this.bb_pos, 22);
99
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
100
+ }
101
+ static startModuleBundleEntry(builder) {
102
+ builder.startObject(10);
103
+ }
104
+ static addEntryId(builder, entryIdOffset) {
105
+ builder.addFieldOffset(0, entryIdOffset, 0);
106
+ }
107
+ static addRole(builder, role) {
108
+ builder.addFieldInt8(1, role, ModuleBundleEntryRole.AUXILIARY);
109
+ }
110
+ static addSectionName(builder, sectionNameOffset) {
111
+ builder.addFieldOffset(2, sectionNameOffset, 0);
112
+ }
113
+ static addTypeRef(builder, typeRefOffset) {
114
+ builder.addFieldOffset(3, typeRefOffset, 0);
115
+ }
116
+ static addPayloadEncoding(builder, payloadEncoding) {
117
+ builder.addFieldInt8(4, payloadEncoding, ModulePayloadEncoding.RAW_BYTES);
118
+ }
119
+ static addMediaType(builder, mediaTypeOffset) {
120
+ builder.addFieldOffset(5, mediaTypeOffset, 0);
121
+ }
122
+ static addFlags(builder, flags) {
123
+ builder.addFieldInt32(6, flags, 0);
124
+ }
125
+ static addSha256(builder, sha256Offset) {
126
+ builder.addFieldOffset(7, sha256Offset, 0);
127
+ }
128
+ static createSha256Vector(builder, data) {
129
+ builder.startVector(1, data.length, 1);
130
+ for (let i = data.length - 1; i >= 0; i--) {
131
+ builder.addInt8(data[i]);
132
+ }
133
+ return builder.endVector();
134
+ }
135
+ static startSha256Vector(builder, numElems) {
136
+ builder.startVector(1, numElems, 1);
137
+ }
138
+ static addPayload(builder, payloadOffset) {
139
+ builder.addFieldOffset(8, payloadOffset, 0);
140
+ }
141
+ static createPayloadVector(builder, data) {
142
+ builder.startVector(1, data.length, 1);
143
+ for (let i = data.length - 1; i >= 0; i--) {
144
+ builder.addInt8(data[i]);
145
+ }
146
+ return builder.endVector();
147
+ }
148
+ static startPayloadVector(builder, numElems) {
149
+ builder.startVector(1, numElems, 1);
150
+ }
151
+ static addDescription(builder, descriptionOffset) {
152
+ builder.addFieldOffset(9, descriptionOffset, 0);
153
+ }
154
+ static endModuleBundleEntry(builder) {
155
+ const offset = builder.endObject();
156
+ builder.requiredField(offset, 4); // entry_id
157
+ return offset;
158
+ }
159
+ unpack() {
160
+ return new ModuleBundleEntryT(this.entryId(), this.role(), this.sectionName(), (this.typeRef() !== null ? this.typeRef().unpack() : null), this.payloadEncoding(), this.mediaType(), this.flags(), this.bb.createScalarList(this.sha256.bind(this), this.sha256Length()), this.bb.createScalarList(this.payload.bind(this), this.payloadLength()), this.description());
161
+ }
162
+ unpackTo(_o) {
163
+ _o.entryId = this.entryId();
164
+ _o.role = this.role();
165
+ _o.sectionName = this.sectionName();
166
+ _o.typeRef = (this.typeRef() !== null ? this.typeRef().unpack() : null);
167
+ _o.payloadEncoding = this.payloadEncoding();
168
+ _o.mediaType = this.mediaType();
169
+ _o.flags = this.flags();
170
+ _o.sha256 = this.bb.createScalarList(this.sha256.bind(this), this.sha256Length());
171
+ _o.payload = this.bb.createScalarList(this.payload.bind(this), this.payloadLength());
172
+ _o.description = this.description();
173
+ }
174
+ }
175
+ export class ModuleBundleEntryT {
176
+ entryId;
177
+ role;
178
+ sectionName;
179
+ typeRef;
180
+ payloadEncoding;
181
+ mediaType;
182
+ flags;
183
+ sha256;
184
+ payload;
185
+ description;
186
+ constructor(entryId = null, role = ModuleBundleEntryRole.AUXILIARY, sectionName = null, typeRef = null, payloadEncoding = ModulePayloadEncoding.RAW_BYTES, mediaType = null, flags = 0, sha256 = [], payload = [], description = null) {
187
+ this.entryId = entryId;
188
+ this.role = role;
189
+ this.sectionName = sectionName;
190
+ this.typeRef = typeRef;
191
+ this.payloadEncoding = payloadEncoding;
192
+ this.mediaType = mediaType;
193
+ this.flags = flags;
194
+ this.sha256 = sha256;
195
+ this.payload = payload;
196
+ this.description = description;
197
+ }
198
+ pack(builder) {
199
+ const entryId = (this.entryId !== null ? builder.createString(this.entryId) : 0);
200
+ const sectionName = (this.sectionName !== null ? builder.createString(this.sectionName) : 0);
201
+ const typeRef = (this.typeRef !== null ? this.typeRef.pack(builder) : 0);
202
+ const mediaType = (this.mediaType !== null ? builder.createString(this.mediaType) : 0);
203
+ const sha256 = ModuleBundleEntry.createSha256Vector(builder, this.sha256);
204
+ const payload = ModuleBundleEntry.createPayloadVector(builder, this.payload);
205
+ const description = (this.description !== null ? builder.createString(this.description) : 0);
206
+ ModuleBundleEntry.startModuleBundleEntry(builder);
207
+ ModuleBundleEntry.addEntryId(builder, entryId);
208
+ ModuleBundleEntry.addRole(builder, this.role);
209
+ ModuleBundleEntry.addSectionName(builder, sectionName);
210
+ ModuleBundleEntry.addTypeRef(builder, typeRef);
211
+ ModuleBundleEntry.addPayloadEncoding(builder, this.payloadEncoding);
212
+ ModuleBundleEntry.addMediaType(builder, mediaType);
213
+ ModuleBundleEntry.addFlags(builder, this.flags);
214
+ ModuleBundleEntry.addSha256(builder, sha256);
215
+ ModuleBundleEntry.addPayload(builder, payload);
216
+ ModuleBundleEntry.addDescription(builder, description);
217
+ return ModuleBundleEntry.endModuleBundleEntry(builder);
218
+ }
219
+ }
@@ -0,0 +1,287 @@
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 { ModuleBundleEntryRole } from '../../orbpro/module/module-bundle-entry-role.js';
8
+ import { ModulePayloadEncoding } from '../../orbpro/module/module-payload-encoding.js';
9
+ import { FlatBufferTypeRef, FlatBufferTypeRefT } from '../../orbpro/stream/flat-buffer-type-ref.js';
10
+
11
+
12
+ /**
13
+ * One payload carried inside the bundle.
14
+ */
15
+ export class ModuleBundleEntry implements flatbuffers.IUnpackableObject<ModuleBundleEntryT> {
16
+ bb: flatbuffers.ByteBuffer|null = null;
17
+ bb_pos = 0;
18
+ __init(i:number, bb:flatbuffers.ByteBuffer):ModuleBundleEntry {
19
+ this.bb_pos = i;
20
+ this.bb = bb;
21
+ return this;
22
+ }
23
+
24
+ static getRootAsModuleBundleEntry(bb:flatbuffers.ByteBuffer, obj?:ModuleBundleEntry):ModuleBundleEntry {
25
+ return (obj || new ModuleBundleEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26
+ }
27
+
28
+ static getSizePrefixedRootAsModuleBundleEntry(bb:flatbuffers.ByteBuffer, obj?:ModuleBundleEntry):ModuleBundleEntry {
29
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
30
+ return (obj || new ModuleBundleEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
31
+ }
32
+
33
+ /**
34
+ * Stable bundle-local identifier.
35
+ */
36
+ entryId():string|null
37
+ entryId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
38
+ entryId(optionalEncoding?:any):string|Uint8Array|null {
39
+ const offset = this.bb!.__offset(this.bb_pos, 4);
40
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
41
+ }
42
+
43
+ /**
44
+ * High-level semantic role of the payload.
45
+ */
46
+ role():ModuleBundleEntryRole {
47
+ const offset = this.bb!.__offset(this.bb_pos, 6);
48
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : ModuleBundleEntryRole.AUXILIARY;
49
+ }
50
+
51
+ /**
52
+ * Optional logical section name within the bundle, for example
53
+ * `sds.authorization`.
54
+ */
55
+ sectionName():string|null
56
+ sectionName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
57
+ sectionName(optionalEncoding?:any):string|Uint8Array|null {
58
+ const offset = this.bb!.__offset(this.bb_pos, 8);
59
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
60
+ }
61
+
62
+ /**
63
+ * SDS/shared-module schema identity when the payload is itself a
64
+ * FlatBuffer.
65
+ */
66
+ typeRef(obj?:FlatBufferTypeRef):FlatBufferTypeRef|null {
67
+ const offset = this.bb!.__offset(this.bb_pos, 10);
68
+ return offset ? (obj || new FlatBufferTypeRef()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
69
+ }
70
+
71
+ /**
72
+ * Encoding used for `payload`.
73
+ */
74
+ payloadEncoding():ModulePayloadEncoding {
75
+ const offset = this.bb!.__offset(this.bb_pos, 12);
76
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : ModulePayloadEncoding.RAW_BYTES;
77
+ }
78
+
79
+ /**
80
+ * Optional media type for transitional payloads such as JSON envelopes.
81
+ */
82
+ mediaType():string|null
83
+ mediaType(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
84
+ mediaType(optionalEncoding?:any):string|Uint8Array|null {
85
+ const offset = this.bb!.__offset(this.bb_pos, 14);
86
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
87
+ }
88
+
89
+ /**
90
+ * Implementation-defined bit flags for signed/encrypted/compressed state.
91
+ */
92
+ flags():number {
93
+ const offset = this.bb!.__offset(this.bb_pos, 16);
94
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
95
+ }
96
+
97
+ /**
98
+ * SHA-256 of the payload bytes.
99
+ */
100
+ sha256(index: number):number|null {
101
+ const offset = this.bb!.__offset(this.bb_pos, 18);
102
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
103
+ }
104
+
105
+ sha256Length():number {
106
+ const offset = this.bb!.__offset(this.bb_pos, 18);
107
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
108
+ }
109
+
110
+ sha256Array():Uint8Array|null {
111
+ const offset = this.bb!.__offset(this.bb_pos, 18);
112
+ 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;
113
+ }
114
+
115
+ /**
116
+ * Embedded payload bytes. For single-file deployment this should be
117
+ * populated for every entry.
118
+ */
119
+ payload(index: number):number|null {
120
+ const offset = this.bb!.__offset(this.bb_pos, 20);
121
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
122
+ }
123
+
124
+ payloadLength():number {
125
+ const offset = this.bb!.__offset(this.bb_pos, 20);
126
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
127
+ }
128
+
129
+ payloadArray():Uint8Array|null {
130
+ const offset = this.bb!.__offset(this.bb_pos, 20);
131
+ 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;
132
+ }
133
+
134
+ /**
135
+ * Human-readable description for tooling and diagnostics.
136
+ */
137
+ description():string|null
138
+ description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
139
+ description(optionalEncoding?:any):string|Uint8Array|null {
140
+ const offset = this.bb!.__offset(this.bb_pos, 22);
141
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
142
+ }
143
+
144
+ static startModuleBundleEntry(builder:flatbuffers.Builder) {
145
+ builder.startObject(10);
146
+ }
147
+
148
+ static addEntryId(builder:flatbuffers.Builder, entryIdOffset:flatbuffers.Offset) {
149
+ builder.addFieldOffset(0, entryIdOffset, 0);
150
+ }
151
+
152
+ static addRole(builder:flatbuffers.Builder, role:ModuleBundleEntryRole) {
153
+ builder.addFieldInt8(1, role, ModuleBundleEntryRole.AUXILIARY);
154
+ }
155
+
156
+ static addSectionName(builder:flatbuffers.Builder, sectionNameOffset:flatbuffers.Offset) {
157
+ builder.addFieldOffset(2, sectionNameOffset, 0);
158
+ }
159
+
160
+ static addTypeRef(builder:flatbuffers.Builder, typeRefOffset:flatbuffers.Offset) {
161
+ builder.addFieldOffset(3, typeRefOffset, 0);
162
+ }
163
+
164
+ static addPayloadEncoding(builder:flatbuffers.Builder, payloadEncoding:ModulePayloadEncoding) {
165
+ builder.addFieldInt8(4, payloadEncoding, ModulePayloadEncoding.RAW_BYTES);
166
+ }
167
+
168
+ static addMediaType(builder:flatbuffers.Builder, mediaTypeOffset:flatbuffers.Offset) {
169
+ builder.addFieldOffset(5, mediaTypeOffset, 0);
170
+ }
171
+
172
+ static addFlags(builder:flatbuffers.Builder, flags:number) {
173
+ builder.addFieldInt32(6, flags, 0);
174
+ }
175
+
176
+ static addSha256(builder:flatbuffers.Builder, sha256Offset:flatbuffers.Offset) {
177
+ builder.addFieldOffset(7, sha256Offset, 0);
178
+ }
179
+
180
+ static createSha256Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
181
+ builder.startVector(1, data.length, 1);
182
+ for (let i = data.length - 1; i >= 0; i--) {
183
+ builder.addInt8(data[i]!);
184
+ }
185
+ return builder.endVector();
186
+ }
187
+
188
+ static startSha256Vector(builder:flatbuffers.Builder, numElems:number) {
189
+ builder.startVector(1, numElems, 1);
190
+ }
191
+
192
+ static addPayload(builder:flatbuffers.Builder, payloadOffset:flatbuffers.Offset) {
193
+ builder.addFieldOffset(8, payloadOffset, 0);
194
+ }
195
+
196
+ static createPayloadVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
197
+ builder.startVector(1, data.length, 1);
198
+ for (let i = data.length - 1; i >= 0; i--) {
199
+ builder.addInt8(data[i]!);
200
+ }
201
+ return builder.endVector();
202
+ }
203
+
204
+ static startPayloadVector(builder:flatbuffers.Builder, numElems:number) {
205
+ builder.startVector(1, numElems, 1);
206
+ }
207
+
208
+ static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) {
209
+ builder.addFieldOffset(9, descriptionOffset, 0);
210
+ }
211
+
212
+ static endModuleBundleEntry(builder:flatbuffers.Builder):flatbuffers.Offset {
213
+ const offset = builder.endObject();
214
+ builder.requiredField(offset, 4) // entry_id
215
+ return offset;
216
+ }
217
+
218
+
219
+ unpack(): ModuleBundleEntryT {
220
+ return new ModuleBundleEntryT(
221
+ this.entryId(),
222
+ this.role(),
223
+ this.sectionName(),
224
+ (this.typeRef() !== null ? this.typeRef()!.unpack() : null),
225
+ this.payloadEncoding(),
226
+ this.mediaType(),
227
+ this.flags(),
228
+ this.bb!.createScalarList<number>(this.sha256.bind(this), this.sha256Length()),
229
+ this.bb!.createScalarList<number>(this.payload.bind(this), this.payloadLength()),
230
+ this.description()
231
+ );
232
+ }
233
+
234
+
235
+ unpackTo(_o: ModuleBundleEntryT): void {
236
+ _o.entryId = this.entryId();
237
+ _o.role = this.role();
238
+ _o.sectionName = this.sectionName();
239
+ _o.typeRef = (this.typeRef() !== null ? this.typeRef()!.unpack() : null);
240
+ _o.payloadEncoding = this.payloadEncoding();
241
+ _o.mediaType = this.mediaType();
242
+ _o.flags = this.flags();
243
+ _o.sha256 = this.bb!.createScalarList<number>(this.sha256.bind(this), this.sha256Length());
244
+ _o.payload = this.bb!.createScalarList<number>(this.payload.bind(this), this.payloadLength());
245
+ _o.description = this.description();
246
+ }
247
+ }
248
+
249
+ export class ModuleBundleEntryT implements flatbuffers.IGeneratedObject {
250
+ constructor(
251
+ public entryId: string|Uint8Array|null = null,
252
+ public role: ModuleBundleEntryRole = ModuleBundleEntryRole.AUXILIARY,
253
+ public sectionName: string|Uint8Array|null = null,
254
+ public typeRef: FlatBufferTypeRefT|null = null,
255
+ public payloadEncoding: ModulePayloadEncoding = ModulePayloadEncoding.RAW_BYTES,
256
+ public mediaType: string|Uint8Array|null = null,
257
+ public flags: number = 0,
258
+ public sha256: (number)[] = [],
259
+ public payload: (number)[] = [],
260
+ public description: string|Uint8Array|null = null
261
+ ){}
262
+
263
+
264
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
265
+ const entryId = (this.entryId !== null ? builder.createString(this.entryId!) : 0);
266
+ const sectionName = (this.sectionName !== null ? builder.createString(this.sectionName!) : 0);
267
+ const typeRef = (this.typeRef !== null ? this.typeRef!.pack(builder) : 0);
268
+ const mediaType = (this.mediaType !== null ? builder.createString(this.mediaType!) : 0);
269
+ const sha256 = ModuleBundleEntry.createSha256Vector(builder, this.sha256);
270
+ const payload = ModuleBundleEntry.createPayloadVector(builder, this.payload);
271
+ const description = (this.description !== null ? builder.createString(this.description!) : 0);
272
+
273
+ ModuleBundleEntry.startModuleBundleEntry(builder);
274
+ ModuleBundleEntry.addEntryId(builder, entryId);
275
+ ModuleBundleEntry.addRole(builder, this.role);
276
+ ModuleBundleEntry.addSectionName(builder, sectionName);
277
+ ModuleBundleEntry.addTypeRef(builder, typeRef);
278
+ ModuleBundleEntry.addPayloadEncoding(builder, this.payloadEncoding);
279
+ ModuleBundleEntry.addMediaType(builder, mediaType);
280
+ ModuleBundleEntry.addFlags(builder, this.flags);
281
+ ModuleBundleEntry.addSha256(builder, sha256);
282
+ ModuleBundleEntry.addPayload(builder, payload);
283
+ ModuleBundleEntry.addDescription(builder, description);
284
+
285
+ return ModuleBundleEntry.endModuleBundleEntry(builder);
286
+ }
287
+ }
@@ -0,0 +1,86 @@
1
+ import * as flatbuffers from 'flatbuffers';
2
+ import { CanonicalizationRule, CanonicalizationRuleT } from '../../orbpro/module/canonicalization-rule.js';
3
+ import { ModuleBundleEntry, ModuleBundleEntryT } from '../../orbpro/module/module-bundle-entry.js';
4
+ /**
5
+ * Metadata stored in the required `sds.bundle` custom section.
6
+ */
7
+ export declare class ModuleBundle implements flatbuffers.IUnpackableObject<ModuleBundleT> {
8
+ bb: flatbuffers.ByteBuffer | null;
9
+ bb_pos: number;
10
+ __init(i: number, bb: flatbuffers.ByteBuffer): ModuleBundle;
11
+ static getRootAsModuleBundle(bb: flatbuffers.ByteBuffer, obj?: ModuleBundle): ModuleBundle;
12
+ static getSizePrefixedRootAsModuleBundle(bb: flatbuffers.ByteBuffer, obj?: ModuleBundle): ModuleBundle;
13
+ static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
14
+ /**
15
+ * Bundle schema version.
16
+ */
17
+ bundleVersion(): number;
18
+ /**
19
+ * Human-readable package format label.
20
+ */
21
+ moduleFormat(): string | null;
22
+ moduleFormat(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
23
+ /**
24
+ * Canonicalization rule used to compute module hashes.
25
+ */
26
+ canonicalization(obj?: CanonicalizationRule): CanonicalizationRule | null;
27
+ /**
28
+ * SHA-256 of the wasm module after stripping `sds.*` custom sections.
29
+ */
30
+ canonicalModuleHash(index: number): number | null;
31
+ canonicalModuleHashLength(): number;
32
+ canonicalModuleHashArray(): Uint8Array | null;
33
+ /**
34
+ * SHA-256 of the canonical plugin manifest bytes.
35
+ */
36
+ manifestHash(index: number): number | null;
37
+ manifestHashLength(): number;
38
+ manifestHashArray(): Uint8Array | null;
39
+ /**
40
+ * Legacy ABI export retained for backward compatibility.
41
+ */
42
+ manifestExportSymbol(): string | null;
43
+ manifestExportSymbol(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
44
+ /**
45
+ * Legacy ABI export retained for backward compatibility.
46
+ */
47
+ manifestSizeSymbol(): string | null;
48
+ manifestSizeSymbol(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
49
+ /**
50
+ * Payloads embedded in the bundle.
51
+ */
52
+ entries(index: number, obj?: ModuleBundleEntry): ModuleBundleEntry | null;
53
+ entriesLength(): number;
54
+ static startModuleBundle(builder: flatbuffers.Builder): void;
55
+ static addBundleVersion(builder: flatbuffers.Builder, bundleVersion: number): void;
56
+ static addModuleFormat(builder: flatbuffers.Builder, moduleFormatOffset: flatbuffers.Offset): void;
57
+ static addCanonicalization(builder: flatbuffers.Builder, canonicalizationOffset: flatbuffers.Offset): void;
58
+ static addCanonicalModuleHash(builder: flatbuffers.Builder, canonicalModuleHashOffset: flatbuffers.Offset): void;
59
+ static createCanonicalModuleHashVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
60
+ static startCanonicalModuleHashVector(builder: flatbuffers.Builder, numElems: number): void;
61
+ static addManifestHash(builder: flatbuffers.Builder, manifestHashOffset: flatbuffers.Offset): void;
62
+ static createManifestHashVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
63
+ static startManifestHashVector(builder: flatbuffers.Builder, numElems: number): void;
64
+ static addManifestExportSymbol(builder: flatbuffers.Builder, manifestExportSymbolOffset: flatbuffers.Offset): void;
65
+ static addManifestSizeSymbol(builder: flatbuffers.Builder, manifestSizeSymbolOffset: flatbuffers.Offset): void;
66
+ static addEntries(builder: flatbuffers.Builder, entriesOffset: flatbuffers.Offset): void;
67
+ static createEntriesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
68
+ static startEntriesVector(builder: flatbuffers.Builder, numElems: number): void;
69
+ static endModuleBundle(builder: flatbuffers.Builder): flatbuffers.Offset;
70
+ static finishModuleBundleBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
71
+ static finishSizePrefixedModuleBundleBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
72
+ unpack(): ModuleBundleT;
73
+ unpackTo(_o: ModuleBundleT): void;
74
+ }
75
+ export declare class ModuleBundleT implements flatbuffers.IGeneratedObject {
76
+ bundleVersion: number;
77
+ moduleFormat: string | Uint8Array | null;
78
+ canonicalization: CanonicalizationRuleT | null;
79
+ canonicalModuleHash: (number)[];
80
+ manifestHash: (number)[];
81
+ manifestExportSymbol: string | Uint8Array | null;
82
+ manifestSizeSymbol: string | Uint8Array | null;
83
+ entries: (ModuleBundleEntryT)[];
84
+ constructor(bundleVersion?: number, moduleFormat?: string | Uint8Array | null, canonicalization?: CanonicalizationRuleT | null, canonicalModuleHash?: (number)[], manifestHash?: (number)[], manifestExportSymbol?: string | Uint8Array | null, manifestSizeSymbol?: string | Uint8Array | null, entries?: (ModuleBundleEntryT)[]);
85
+ pack(builder: flatbuffers.Builder): flatbuffers.Offset;
86
+ }