space-data-module-sdk 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +16 -23
  2. package/bin/space-data-module.js +5 -3
  3. package/package.json +2 -2
  4. package/schemas/spacedatastandards/PLG.fbs +191 -0
  5. package/src/AGENTS.md +1 -1
  6. package/src/bundle/AGENTS.md +6 -5
  7. package/src/bundle/codec.js +163 -48
  8. package/src/bundle/constants.js +1 -1
  9. package/src/bundle/wasm.js +53 -32
  10. package/src/compiler/compileModule.js +9 -1
  11. package/src/compliance/index.js +4 -0
  12. package/src/compliance/pluginCompliance.js +158 -2
  13. package/src/embeddedManifest.js +25 -5
  14. package/src/generated/orbpro/invoke/plugin-invoke-request.js +2 -2
  15. package/src/generated/orbpro/invoke/plugin-invoke-response.js +2 -2
  16. package/src/generated/orbpro/stream/flat-buffer-type-ref.js +2 -2
  17. package/src/generated/orbpro/stream/typed-arena-buffer.js +2 -2
  18. package/src/generated/spacedatastandards/plg/entry-function.js +86 -0
  19. package/src/generated/spacedatastandards/plg/entry-function.ts +119 -0
  20. package/src/generated/spacedatastandards/plg/index.js +16 -0
  21. package/src/generated/spacedatastandards/plg/index.ts +11 -0
  22. package/src/generated/spacedatastandards/plg/plg.js +657 -0
  23. package/src/generated/spacedatastandards/plg/plg.ts +924 -0
  24. package/src/generated/spacedatastandards/plg/plugin-capability.js +66 -0
  25. package/src/generated/spacedatastandards/plg/plugin-capability.ts +84 -0
  26. package/src/generated/spacedatastandards/plg/plugin-category.js +15 -0
  27. package/src/generated/spacedatastandards/plg/plugin-category.ts +53 -0
  28. package/src/generated/spacedatastandards/plg/plugin-dependency.js +63 -0
  29. package/src/generated/spacedatastandards/plg/plugin-dependency.ts +86 -0
  30. package/src/generated/spacedatastandards/plg/publication-state.js +9 -0
  31. package/src/generated/spacedatastandards/plg/publication-state.ts +23 -0
  32. package/src/generated/spacedatastandards/plg/purchase-tier.js +9 -0
  33. package/src/generated/spacedatastandards/plg/purchase-tier.ts +23 -0
  34. package/src/index.d.ts +1 -1
  35. package/src/invoke/codec.js +1 -1
  36. package/src/manifest/browser.js +7 -0
  37. package/src/manifest/index.js +7 -0
  38. package/src/manifest/legacyToPlg.js +249 -0
  39. package/src/manifest/plgCodec.js +826 -0
  40. package/src/standards/sharedCatalog.js +132 -0
  41. package/src/transport/records.js +34 -3
  42. package/src/vendor/flatbuffers/LICENSE +202 -0
  43. package/src/vendor/flatbuffers/builder.js +534 -0
  44. package/src/vendor/flatbuffers/byte-buffer.js +253 -0
  45. package/src/vendor/flatbuffers/constants.js +4 -0
  46. package/src/vendor/flatbuffers/encoding.js +5 -0
  47. package/src/vendor/flatbuffers/flatbuffers.js +5 -0
  48. package/src/vendor/flatbuffers/utils.js +4 -0
  49. package/schemas/ModuleBundle.fbs +0 -108
  50. package/src/generated/orbpro/module/canonicalization-rule.d.ts +0 -48
  51. package/src/generated/orbpro/module/canonicalization-rule.js +0 -95
  52. package/src/generated/orbpro/module/canonicalization-rule.ts +0 -142
  53. package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +0 -11
  54. package/src/generated/orbpro/module/module-bundle-entry-role.js +0 -14
  55. package/src/generated/orbpro/module/module-bundle-entry-role.ts +0 -15
  56. package/src/generated/orbpro/module/module-bundle-entry.d.ts +0 -97
  57. package/src/generated/orbpro/module/module-bundle-entry.js +0 -219
  58. package/src/generated/orbpro/module/module-bundle-entry.ts +0 -287
  59. package/src/generated/orbpro/module/module-bundle.d.ts +0 -86
  60. package/src/generated/orbpro/module/module-bundle.js +0 -213
  61. package/src/generated/orbpro/module/module-bundle.ts +0 -277
  62. package/src/generated/orbpro/module/module-payload-encoding.d.ts +0 -9
  63. package/src/generated/orbpro/module/module-payload-encoding.js +0 -12
  64. package/src/generated/orbpro/module/module-payload-encoding.ts +0 -13
  65. package/src/generated/orbpro/module.d.ts +0 -5
  66. package/src/generated/orbpro/module.js +0 -7
  67. package/src/generated/orbpro/module.ts +0 -9
@@ -1,14 +0,0 @@
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
- * Logical role for one payload carried in the bundle.
5
- */
6
- export var ModuleBundleEntryRole;
7
- (function (ModuleBundleEntryRole) {
8
- ModuleBundleEntryRole[ModuleBundleEntryRole["MANIFEST"] = 0] = "MANIFEST";
9
- ModuleBundleEntryRole[ModuleBundleEntryRole["AUTHORIZATION"] = 1] = "AUTHORIZATION";
10
- ModuleBundleEntryRole[ModuleBundleEntryRole["SIGNATURE"] = 2] = "SIGNATURE";
11
- ModuleBundleEntryRole[ModuleBundleEntryRole["TRANSPORT"] = 3] = "TRANSPORT";
12
- ModuleBundleEntryRole[ModuleBundleEntryRole["ATTESTATION"] = 4] = "ATTESTATION";
13
- ModuleBundleEntryRole[ModuleBundleEntryRole["AUXILIARY"] = 5] = "AUXILIARY";
14
- })(ModuleBundleEntryRole || (ModuleBundleEntryRole = {}));
@@ -1,15 +0,0 @@
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
- * Logical role for one payload carried in the bundle.
7
- */
8
- export enum ModuleBundleEntryRole {
9
- MANIFEST = 0,
10
- AUTHORIZATION = 1,
11
- SIGNATURE = 2,
12
- TRANSPORT = 3,
13
- ATTESTATION = 4,
14
- AUXILIARY = 5
15
- }
@@ -1,97 +0,0 @@
1
- import * as flatbuffers from 'flatbuffers';
2
- import { ModuleBundleEntryRole } from '../../orbpro/module/module-bundle-entry-role.js';
3
- import { ModulePayloadEncoding } from '../../orbpro/module/module-payload-encoding.js';
4
- import { FlatBufferTypeRef, FlatBufferTypeRefT } from '../../orbpro/stream/flat-buffer-type-ref.js';
5
- /**
6
- * One payload carried inside the bundle.
7
- */
8
- export declare class ModuleBundleEntry implements flatbuffers.IUnpackableObject<ModuleBundleEntryT> {
9
- bb: flatbuffers.ByteBuffer | null;
10
- bb_pos: number;
11
- __init(i: number, bb: flatbuffers.ByteBuffer): ModuleBundleEntry;
12
- static getRootAsModuleBundleEntry(bb: flatbuffers.ByteBuffer, obj?: ModuleBundleEntry): ModuleBundleEntry;
13
- static getSizePrefixedRootAsModuleBundleEntry(bb: flatbuffers.ByteBuffer, obj?: ModuleBundleEntry): ModuleBundleEntry;
14
- /**
15
- * Stable bundle-local identifier.
16
- */
17
- entryId(): string | null;
18
- entryId(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
19
- /**
20
- * High-level semantic role of the payload.
21
- */
22
- role(): ModuleBundleEntryRole;
23
- /**
24
- * Optional logical section name within the bundle, for example
25
- * `sds.authorization`.
26
- */
27
- sectionName(): string | null;
28
- sectionName(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
29
- /**
30
- * SDS/shared-module schema identity when the payload is itself a
31
- * FlatBuffer.
32
- */
33
- typeRef(obj?: FlatBufferTypeRef): FlatBufferTypeRef | null;
34
- /**
35
- * Encoding used for `payload`.
36
- */
37
- payloadEncoding(): ModulePayloadEncoding;
38
- /**
39
- * Optional media type for transitional payloads such as JSON envelopes.
40
- */
41
- mediaType(): string | null;
42
- mediaType(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
43
- /**
44
- * Implementation-defined bit flags for signed/encrypted/compressed state.
45
- */
46
- flags(): number;
47
- /**
48
- * SHA-256 of the payload bytes.
49
- */
50
- sha256(index: number): number | null;
51
- sha256Length(): number;
52
- sha256Array(): Uint8Array | null;
53
- /**
54
- * Embedded payload bytes. For single-file deployment this should be
55
- * populated for every entry.
56
- */
57
- payload(index: number): number | null;
58
- payloadLength(): number;
59
- payloadArray(): Uint8Array | null;
60
- /**
61
- * Human-readable description for tooling and diagnostics.
62
- */
63
- description(): string | null;
64
- description(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
65
- static startModuleBundleEntry(builder: flatbuffers.Builder): void;
66
- static addEntryId(builder: flatbuffers.Builder, entryIdOffset: flatbuffers.Offset): void;
67
- static addRole(builder: flatbuffers.Builder, role: ModuleBundleEntryRole): void;
68
- static addSectionName(builder: flatbuffers.Builder, sectionNameOffset: flatbuffers.Offset): void;
69
- static addTypeRef(builder: flatbuffers.Builder, typeRefOffset: flatbuffers.Offset): void;
70
- static addPayloadEncoding(builder: flatbuffers.Builder, payloadEncoding: ModulePayloadEncoding): void;
71
- static addMediaType(builder: flatbuffers.Builder, mediaTypeOffset: flatbuffers.Offset): void;
72
- static addFlags(builder: flatbuffers.Builder, flags: number): void;
73
- static addSha256(builder: flatbuffers.Builder, sha256Offset: flatbuffers.Offset): void;
74
- static createSha256Vector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
75
- static startSha256Vector(builder: flatbuffers.Builder, numElems: number): void;
76
- static addPayload(builder: flatbuffers.Builder, payloadOffset: flatbuffers.Offset): void;
77
- static createPayloadVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
78
- static startPayloadVector(builder: flatbuffers.Builder, numElems: number): void;
79
- static addDescription(builder: flatbuffers.Builder, descriptionOffset: flatbuffers.Offset): void;
80
- static endModuleBundleEntry(builder: flatbuffers.Builder): flatbuffers.Offset;
81
- unpack(): ModuleBundleEntryT;
82
- unpackTo(_o: ModuleBundleEntryT): void;
83
- }
84
- export declare class ModuleBundleEntryT implements flatbuffers.IGeneratedObject {
85
- entryId: string | Uint8Array | null;
86
- role: ModuleBundleEntryRole;
87
- sectionName: string | Uint8Array | null;
88
- typeRef: FlatBufferTypeRefT | null;
89
- payloadEncoding: ModulePayloadEncoding;
90
- mediaType: string | Uint8Array | null;
91
- flags: number;
92
- sha256: (number)[];
93
- payload: (number)[];
94
- description: string | Uint8Array | null;
95
- constructor(entryId?: string | Uint8Array | null, role?: ModuleBundleEntryRole, sectionName?: string | Uint8Array | null, typeRef?: FlatBufferTypeRefT | null, payloadEncoding?: ModulePayloadEncoding, mediaType?: string | Uint8Array | null, flags?: number, sha256?: (number)[], payload?: (number)[], description?: string | Uint8Array | null);
96
- pack(builder: flatbuffers.Builder): flatbuffers.Offset;
97
- }
@@ -1,219 +0,0 @@
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/mjs/flatbuffers.js";
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
- }
@@ -1,287 +0,0 @@
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
- }