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,95 @@
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
+ /**
5
+ * Canonicalization rule applied before hashing or signature verification.
6
+ */
7
+ export class CanonicalizationRule {
8
+ bb = null;
9
+ bb_pos = 0;
10
+ __init(i, bb) {
11
+ this.bb_pos = i;
12
+ this.bb = bb;
13
+ return this;
14
+ }
15
+ static getRootAsCanonicalizationRule(bb, obj) {
16
+ return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
17
+ }
18
+ static getSizePrefixedRootAsCanonicalizationRule(bb, obj) {
19
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
20
+ return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21
+ }
22
+ /**
23
+ * Schema version for the canonicalization contract.
24
+ */
25
+ version() {
26
+ const offset = this.bb.__offset(this.bb_pos, 4);
27
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 1;
28
+ }
29
+ strippedCustomSectionPrefix(optionalEncoding) {
30
+ const offset = this.bb.__offset(this.bb_pos, 6);
31
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
32
+ }
33
+ bundleSectionName(optionalEncoding) {
34
+ const offset = this.bb.__offset(this.bb_pos, 8);
35
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
36
+ }
37
+ hashAlgorithm(optionalEncoding) {
38
+ const offset = this.bb.__offset(this.bb_pos, 10);
39
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
40
+ }
41
+ static startCanonicalizationRule(builder) {
42
+ builder.startObject(4);
43
+ }
44
+ static addVersion(builder, version) {
45
+ builder.addFieldInt16(0, version, 1);
46
+ }
47
+ static addStrippedCustomSectionPrefix(builder, strippedCustomSectionPrefixOffset) {
48
+ builder.addFieldOffset(1, strippedCustomSectionPrefixOffset, 0);
49
+ }
50
+ static addBundleSectionName(builder, bundleSectionNameOffset) {
51
+ builder.addFieldOffset(2, bundleSectionNameOffset, 0);
52
+ }
53
+ static addHashAlgorithm(builder, hashAlgorithmOffset) {
54
+ builder.addFieldOffset(3, hashAlgorithmOffset, 0);
55
+ }
56
+ static endCanonicalizationRule(builder) {
57
+ const offset = builder.endObject();
58
+ return offset;
59
+ }
60
+ static createCanonicalizationRule(builder, version, strippedCustomSectionPrefixOffset, bundleSectionNameOffset, hashAlgorithmOffset) {
61
+ CanonicalizationRule.startCanonicalizationRule(builder);
62
+ CanonicalizationRule.addVersion(builder, version);
63
+ CanonicalizationRule.addStrippedCustomSectionPrefix(builder, strippedCustomSectionPrefixOffset);
64
+ CanonicalizationRule.addBundleSectionName(builder, bundleSectionNameOffset);
65
+ CanonicalizationRule.addHashAlgorithm(builder, hashAlgorithmOffset);
66
+ return CanonicalizationRule.endCanonicalizationRule(builder);
67
+ }
68
+ unpack() {
69
+ return new CanonicalizationRuleT(this.version(), this.strippedCustomSectionPrefix(), this.bundleSectionName(), this.hashAlgorithm());
70
+ }
71
+ unpackTo(_o) {
72
+ _o.version = this.version();
73
+ _o.strippedCustomSectionPrefix = this.strippedCustomSectionPrefix();
74
+ _o.bundleSectionName = this.bundleSectionName();
75
+ _o.hashAlgorithm = this.hashAlgorithm();
76
+ }
77
+ }
78
+ export class CanonicalizationRuleT {
79
+ version;
80
+ strippedCustomSectionPrefix;
81
+ bundleSectionName;
82
+ hashAlgorithm;
83
+ constructor(version = 1, strippedCustomSectionPrefix = null, bundleSectionName = null, hashAlgorithm = null) {
84
+ this.version = version;
85
+ this.strippedCustomSectionPrefix = strippedCustomSectionPrefix;
86
+ this.bundleSectionName = bundleSectionName;
87
+ this.hashAlgorithm = hashAlgorithm;
88
+ }
89
+ pack(builder) {
90
+ const strippedCustomSectionPrefix = (this.strippedCustomSectionPrefix !== null ? builder.createString(this.strippedCustomSectionPrefix) : 0);
91
+ const bundleSectionName = (this.bundleSectionName !== null ? builder.createString(this.bundleSectionName) : 0);
92
+ const hashAlgorithm = (this.hashAlgorithm !== null ? builder.createString(this.hashAlgorithm) : 0);
93
+ return CanonicalizationRule.createCanonicalizationRule(builder, this.version, strippedCustomSectionPrefix, bundleSectionName, hashAlgorithm);
94
+ }
95
+ }
@@ -0,0 +1,142 @@
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
+
8
+
9
+ /**
10
+ * Canonicalization rule applied before hashing or signature verification.
11
+ */
12
+ export class CanonicalizationRule implements flatbuffers.IUnpackableObject<CanonicalizationRuleT> {
13
+ bb: flatbuffers.ByteBuffer|null = null;
14
+ bb_pos = 0;
15
+ __init(i:number, bb:flatbuffers.ByteBuffer):CanonicalizationRule {
16
+ this.bb_pos = i;
17
+ this.bb = bb;
18
+ return this;
19
+ }
20
+
21
+ static getRootAsCanonicalizationRule(bb:flatbuffers.ByteBuffer, obj?:CanonicalizationRule):CanonicalizationRule {
22
+ return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23
+ }
24
+
25
+ static getSizePrefixedRootAsCanonicalizationRule(bb:flatbuffers.ByteBuffer, obj?:CanonicalizationRule):CanonicalizationRule {
26
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
27
+ return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
28
+ }
29
+
30
+ /**
31
+ * Schema version for the canonicalization contract.
32
+ */
33
+ version():number {
34
+ const offset = this.bb!.__offset(this.bb_pos, 4);
35
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 1;
36
+ }
37
+
38
+ /**
39
+ * Strip any custom section whose name starts with this prefix before
40
+ * hashing the module for signature verification.
41
+ */
42
+ strippedCustomSectionPrefix():string|null
43
+ strippedCustomSectionPrefix(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
44
+ strippedCustomSectionPrefix(optionalEncoding?:any):string|Uint8Array|null {
45
+ const offset = this.bb!.__offset(this.bb_pos, 6);
46
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
47
+ }
48
+
49
+ /**
50
+ * Name of the required root custom section carrying this bundle.
51
+ */
52
+ bundleSectionName():string|null
53
+ bundleSectionName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
54
+ bundleSectionName(optionalEncoding?:any):string|Uint8Array|null {
55
+ const offset = this.bb!.__offset(this.bb_pos, 8);
56
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
57
+ }
58
+
59
+ /**
60
+ * Hash function identifier, for example `sha256`.
61
+ */
62
+ hashAlgorithm():string|null
63
+ hashAlgorithm(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
64
+ hashAlgorithm(optionalEncoding?:any):string|Uint8Array|null {
65
+ const offset = this.bb!.__offset(this.bb_pos, 10);
66
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
67
+ }
68
+
69
+ static startCanonicalizationRule(builder:flatbuffers.Builder) {
70
+ builder.startObject(4);
71
+ }
72
+
73
+ static addVersion(builder:flatbuffers.Builder, version:number) {
74
+ builder.addFieldInt16(0, version, 1);
75
+ }
76
+
77
+ static addStrippedCustomSectionPrefix(builder:flatbuffers.Builder, strippedCustomSectionPrefixOffset:flatbuffers.Offset) {
78
+ builder.addFieldOffset(1, strippedCustomSectionPrefixOffset, 0);
79
+ }
80
+
81
+ static addBundleSectionName(builder:flatbuffers.Builder, bundleSectionNameOffset:flatbuffers.Offset) {
82
+ builder.addFieldOffset(2, bundleSectionNameOffset, 0);
83
+ }
84
+
85
+ static addHashAlgorithm(builder:flatbuffers.Builder, hashAlgorithmOffset:flatbuffers.Offset) {
86
+ builder.addFieldOffset(3, hashAlgorithmOffset, 0);
87
+ }
88
+
89
+ static endCanonicalizationRule(builder:flatbuffers.Builder):flatbuffers.Offset {
90
+ const offset = builder.endObject();
91
+ return offset;
92
+ }
93
+
94
+ static createCanonicalizationRule(builder:flatbuffers.Builder, version:number, strippedCustomSectionPrefixOffset:flatbuffers.Offset, bundleSectionNameOffset:flatbuffers.Offset, hashAlgorithmOffset:flatbuffers.Offset):flatbuffers.Offset {
95
+ CanonicalizationRule.startCanonicalizationRule(builder);
96
+ CanonicalizationRule.addVersion(builder, version);
97
+ CanonicalizationRule.addStrippedCustomSectionPrefix(builder, strippedCustomSectionPrefixOffset);
98
+ CanonicalizationRule.addBundleSectionName(builder, bundleSectionNameOffset);
99
+ CanonicalizationRule.addHashAlgorithm(builder, hashAlgorithmOffset);
100
+ return CanonicalizationRule.endCanonicalizationRule(builder);
101
+ }
102
+
103
+ unpack(): CanonicalizationRuleT {
104
+ return new CanonicalizationRuleT(
105
+ this.version(),
106
+ this.strippedCustomSectionPrefix(),
107
+ this.bundleSectionName(),
108
+ this.hashAlgorithm()
109
+ );
110
+ }
111
+
112
+
113
+ unpackTo(_o: CanonicalizationRuleT): void {
114
+ _o.version = this.version();
115
+ _o.strippedCustomSectionPrefix = this.strippedCustomSectionPrefix();
116
+ _o.bundleSectionName = this.bundleSectionName();
117
+ _o.hashAlgorithm = this.hashAlgorithm();
118
+ }
119
+ }
120
+
121
+ export class CanonicalizationRuleT implements flatbuffers.IGeneratedObject {
122
+ constructor(
123
+ public version: number = 1,
124
+ public strippedCustomSectionPrefix: string|Uint8Array|null = null,
125
+ public bundleSectionName: string|Uint8Array|null = null,
126
+ public hashAlgorithm: string|Uint8Array|null = null
127
+ ){}
128
+
129
+
130
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
131
+ const strippedCustomSectionPrefix = (this.strippedCustomSectionPrefix !== null ? builder.createString(this.strippedCustomSectionPrefix!) : 0);
132
+ const bundleSectionName = (this.bundleSectionName !== null ? builder.createString(this.bundleSectionName!) : 0);
133
+ const hashAlgorithm = (this.hashAlgorithm !== null ? builder.createString(this.hashAlgorithm!) : 0);
134
+
135
+ return CanonicalizationRule.createCanonicalizationRule(builder,
136
+ this.version,
137
+ strippedCustomSectionPrefix,
138
+ bundleSectionName,
139
+ hashAlgorithm
140
+ );
141
+ }
142
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Logical role for one payload carried in the bundle.
3
+ */
4
+ export declare enum ModuleBundleEntryRole {
5
+ MANIFEST = 0,
6
+ AUTHORIZATION = 1,
7
+ SIGNATURE = 2,
8
+ TRANSPORT = 3,
9
+ ATTESTATION = 4,
10
+ AUXILIARY = 5
11
+ }
@@ -0,0 +1,14 @@
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 = {}));
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,97 @@
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
+ }
@@ -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
+ }