space-data-module-sdk 0.1.0 → 0.2.5

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 (136) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +236 -73
  3. package/bin/space-data-module.js +24 -0
  4. package/package.json +16 -4
  5. package/schemas/ModuleBundle.fbs +108 -0
  6. package/schemas/PluginInvokeRequest.fbs +18 -0
  7. package/schemas/PluginInvokeResponse.fbs +30 -0
  8. package/schemas/PluginManifest.fbs +33 -1
  9. package/schemas/TypedArenaBuffer.fbs +23 -2
  10. package/src/bundle/codec.js +268 -0
  11. package/src/bundle/constants.js +8 -0
  12. package/src/bundle/index.js +3 -0
  13. package/src/bundle/wasm.js +447 -0
  14. package/src/compiler/compileModule.js +353 -37
  15. package/src/compiler/emceptionNode.js +217 -0
  16. package/src/compiler/flatcSupport.js +66 -0
  17. package/src/compiler/invokeGlue.js +884 -0
  18. package/src/compliance/pluginCompliance.js +575 -1
  19. package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts +51 -0
  20. package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts.map +1 -0
  21. package/src/generated/orbpro/invoke/plugin-invoke-request.js +131 -0
  22. package/src/generated/orbpro/invoke/plugin-invoke-request.js.map +1 -0
  23. package/src/generated/orbpro/invoke/plugin-invoke-request.ts +173 -0
  24. package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts +76 -0
  25. package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts.map +1 -0
  26. package/src/generated/orbpro/invoke/plugin-invoke-response.js +184 -0
  27. package/src/generated/orbpro/invoke/plugin-invoke-response.js.map +1 -0
  28. package/src/generated/orbpro/invoke/plugin-invoke-response.ts +243 -0
  29. package/src/generated/orbpro/invoke.d.ts +3 -0
  30. package/src/generated/orbpro/invoke.d.ts.map +1 -0
  31. package/src/generated/orbpro/invoke.js +5 -0
  32. package/src/generated/orbpro/invoke.js.map +1 -0
  33. package/src/generated/orbpro/invoke.ts +6 -0
  34. package/src/generated/orbpro/manifest/accepted-type-set.d.ts +4 -4
  35. package/src/generated/orbpro/manifest/accepted-type-set.d.ts.map +1 -1
  36. package/src/generated/orbpro/manifest/accepted-type-set.js +18 -11
  37. package/src/generated/orbpro/manifest/accepted-type-set.js.map +1 -1
  38. package/src/generated/orbpro/manifest/build-artifact.d.ts +1 -1
  39. package/src/generated/orbpro/manifest/build-artifact.d.ts.map +1 -1
  40. package/src/generated/orbpro/manifest/build-artifact.js +28 -15
  41. package/src/generated/orbpro/manifest/build-artifact.js.map +1 -1
  42. package/src/generated/orbpro/manifest/capability-kind.d.ts +26 -1
  43. package/src/generated/orbpro/manifest/capability-kind.d.ts.map +1 -1
  44. package/src/generated/orbpro/manifest/capability-kind.js +25 -0
  45. package/src/generated/orbpro/manifest/capability-kind.js.map +1 -1
  46. package/src/generated/orbpro/manifest/capability-kind.ts +25 -0
  47. package/src/generated/orbpro/manifest/drain-policy.d.ts.map +1 -1
  48. package/src/generated/orbpro/manifest/drain-policy.js.map +1 -1
  49. package/src/generated/orbpro/manifest/host-capability.d.ts +2 -2
  50. package/src/generated/orbpro/manifest/host-capability.d.ts.map +1 -1
  51. package/src/generated/orbpro/manifest/host-capability.js +19 -11
  52. package/src/generated/orbpro/manifest/host-capability.js.map +1 -1
  53. package/src/generated/orbpro/manifest/invoke-surface.d.ts +8 -0
  54. package/src/generated/orbpro/manifest/invoke-surface.d.ts.map +1 -0
  55. package/src/generated/orbpro/manifest/invoke-surface.js +11 -0
  56. package/src/generated/orbpro/manifest/invoke-surface.js.map +1 -0
  57. package/src/generated/orbpro/manifest/invoke-surface.ts +11 -0
  58. package/src/generated/orbpro/manifest/method-manifest.d.ts +6 -6
  59. package/src/generated/orbpro/manifest/method-manifest.d.ts.map +1 -1
  60. package/src/generated/orbpro/manifest/method-manifest.js +33 -16
  61. package/src/generated/orbpro/manifest/method-manifest.js.map +1 -1
  62. package/src/generated/orbpro/manifest/plugin-family.d.ts.map +1 -1
  63. package/src/generated/orbpro/manifest/plugin-family.js.map +1 -1
  64. package/src/generated/orbpro/manifest/plugin-manifest.d.ts +10 -2
  65. package/src/generated/orbpro/manifest/plugin-manifest.d.ts.map +1 -1
  66. package/src/generated/orbpro/manifest/plugin-manifest.js +48 -9
  67. package/src/generated/orbpro/manifest/plugin-manifest.js.map +1 -1
  68. package/src/generated/orbpro/manifest/plugin-manifest.ts +322 -491
  69. package/src/generated/orbpro/manifest/port-manifest.d.ts +4 -4
  70. package/src/generated/orbpro/manifest/port-manifest.d.ts.map +1 -1
  71. package/src/generated/orbpro/manifest/port-manifest.js +26 -13
  72. package/src/generated/orbpro/manifest/port-manifest.js.map +1 -1
  73. package/src/generated/orbpro/manifest/protocol-spec.d.ts +1 -1
  74. package/src/generated/orbpro/manifest/protocol-spec.d.ts.map +1 -1
  75. package/src/generated/orbpro/manifest/protocol-spec.js +28 -15
  76. package/src/generated/orbpro/manifest/protocol-spec.js.map +1 -1
  77. package/src/generated/orbpro/manifest/timer-spec.d.ts +1 -1
  78. package/src/generated/orbpro/manifest/timer-spec.d.ts.map +1 -1
  79. package/src/generated/orbpro/manifest/timer-spec.js +27 -16
  80. package/src/generated/orbpro/manifest/timer-spec.js.map +1 -1
  81. package/src/generated/orbpro/manifest.d.ts +13 -0
  82. package/src/generated/orbpro/manifest.d.ts.map +1 -0
  83. package/src/generated/orbpro/manifest.js +1 -0
  84. package/src/generated/orbpro/manifest.js.map +1 -0
  85. package/src/generated/orbpro/manifest.ts +16 -0
  86. package/src/generated/orbpro/module/canonicalization-rule.d.ts +48 -0
  87. package/src/generated/orbpro/module/canonicalization-rule.js +95 -0
  88. package/src/generated/orbpro/module/canonicalization-rule.ts +142 -0
  89. package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +11 -0
  90. package/src/generated/orbpro/module/module-bundle-entry-role.js +14 -0
  91. package/src/generated/orbpro/module/module-bundle-entry-role.ts +15 -0
  92. package/src/generated/orbpro/module/module-bundle-entry.d.ts +97 -0
  93. package/src/generated/orbpro/module/module-bundle-entry.js +219 -0
  94. package/src/generated/orbpro/module/module-bundle-entry.ts +287 -0
  95. package/src/generated/orbpro/module/module-bundle.d.ts +86 -0
  96. package/src/generated/orbpro/module/module-bundle.js +213 -0
  97. package/src/generated/orbpro/module/module-bundle.ts +277 -0
  98. package/src/generated/orbpro/module/module-payload-encoding.d.ts +9 -0
  99. package/src/generated/orbpro/module/module-payload-encoding.js +12 -0
  100. package/src/generated/orbpro/module/module-payload-encoding.ts +13 -0
  101. package/src/generated/orbpro/module.d.ts +5 -0
  102. package/src/generated/orbpro/module.js +7 -0
  103. package/src/generated/orbpro/module.ts +9 -0
  104. package/src/generated/orbpro/stream/buffer-mutability.d.ts.map +1 -1
  105. package/src/generated/orbpro/stream/buffer-mutability.js.map +1 -1
  106. package/src/generated/orbpro/stream/buffer-ownership.d.ts.map +1 -1
  107. package/src/generated/orbpro/stream/buffer-ownership.js.map +1 -1
  108. package/src/generated/orbpro/stream/flat-buffer-type-ref.d.ts +22 -5
  109. package/src/generated/orbpro/stream/flat-buffer-type-ref.d.ts.map +1 -1
  110. package/src/generated/orbpro/stream/flat-buffer-type-ref.js +107 -17
  111. package/src/generated/orbpro/stream/flat-buffer-type-ref.js.map +1 -1
  112. package/src/generated/orbpro/stream/flat-buffer-type-ref.ts +126 -2
  113. package/src/generated/orbpro/stream/payload-wire-format.d.ts +8 -0
  114. package/src/generated/orbpro/stream/payload-wire-format.d.ts.map +1 -0
  115. package/src/generated/orbpro/stream/payload-wire-format.js +11 -0
  116. package/src/generated/orbpro/stream/payload-wire-format.js.map +1 -0
  117. package/src/generated/orbpro/stream/payload-wire-format.ts +11 -0
  118. package/src/generated/orbpro/stream/typed-arena-buffer.d.ts +4 -4
  119. package/src/generated/orbpro/stream/typed-arena-buffer.d.ts.map +1 -1
  120. package/src/generated/orbpro/stream/typed-arena-buffer.js +42 -24
  121. package/src/generated/orbpro/stream/typed-arena-buffer.js.map +1 -1
  122. package/src/host/abi.js +282 -0
  123. package/src/host/cron.js +247 -0
  124. package/src/host/index.js +3 -0
  125. package/src/host/nodeHost.js +2165 -0
  126. package/src/index.d.ts +958 -0
  127. package/src/index.js +12 -2
  128. package/src/invoke/codec.js +278 -0
  129. package/src/invoke/index.js +9 -0
  130. package/src/manifest/codec.js +10 -2
  131. package/src/manifest/index.js +5 -2
  132. package/src/manifest/normalize.js +90 -1
  133. package/src/runtime/constants.js +29 -0
  134. package/src/transport/pki.js +0 -5
  135. package/src/utils/encoding.js +9 -1
  136. package/src/utils/wasmCrypto.js +49 -1
@@ -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
+ }
@@ -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
+ }