space-data-module-sdk 0.8.27 → 0.9.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.
- package/README.md +5 -4
- package/docs/assembly.js +0 -18
- package/docs/assets/ai-credits/ai-credits.js +116 -0
- package/docs/assets/sdn-chrome/sdn-chrome.css +434 -0
- package/docs/assets/sdn-chrome/sdn-chrome.js +236 -0
- package/docs/browser-wasmedge-isomorphic.html +29 -41
- package/docs/byo-wasm-quickstart.html +29 -41
- package/docs/conformance.html +29 -41
- package/docs/events-abi.html +29 -41
- package/docs/families/analytics.html +29 -41
- package/docs/families/attitude.html +29 -41
- package/docs/families/behavior.html +29 -41
- package/docs/families/breakup.html +29 -41
- package/docs/families/conjunction.html +29 -41
- package/docs/families/data-source.html +29 -41
- package/docs/families/effects.html +29 -41
- package/docs/families/environment.html +29 -41
- package/docs/families/estimation.html +29 -41
- package/docs/families/gnc.html +29 -41
- package/docs/families/maneuver.html +29 -41
- package/docs/families/obstruction.html +29 -41
- package/docs/families/propagator.html +29 -41
- package/docs/families/propulsion.html +29 -41
- package/docs/families/reentry.html +29 -41
- package/docs/families/rf.html +29 -41
- package/docs/families/scheduler.html +29 -41
- package/docs/families/sensor.html +29 -41
- package/docs/families/signature.html +29 -41
- package/docs/flatsql-host-contract.html +29 -41
- package/docs/flatsql-streaming-standard.html +29 -41
- package/docs/gpu-module-abi.html +29 -41
- package/docs/index.html +43 -47
- package/docs/isomorphic-pthreads.html +29 -41
- package/docs/isomorphic-sdn-runtime-plan.html +29 -41
- package/docs/language-runtime-matrix.html +29 -41
- package/docs/media/module-sdk-reel-poster.webp +0 -0
- package/docs/media/module-sdk-reel.mp4 +0 -0
- package/docs/media/module-sdk-reel.webm +0 -0
- package/docs/media/reel/reel.css +53 -0
- package/docs/media/reel/reel.js +272 -0
- package/docs/module-bundle-runtime-plan.html +29 -41
- package/docs/module-publication-standard.html +29 -41
- package/docs/node-red-default-node-parity.html +29 -41
- package/docs/protect-and-sign.html +29 -41
- package/docs/protocol-installation.html +29 -41
- package/docs/publication-submission.html +29 -41
- package/docs/secrets-capability.html +29 -41
- package/docs/styles.css +89 -157
- package/docs/testing-harness.html +29 -41
- package/docs/tri-runtime-parity-gate.html +29 -41
- package/docs/tri-runtime-parity.html +29 -41
- package/package.json +5 -3
- package/schemas/runtime/FlowNotice.fbs +39 -0
- package/schemas/runtime/HostOps.fbs +455 -0
- package/schemas/runtime/HttpRequest.fbs +25 -0
- package/schemas/runtime/HttpResponse.fbs +24 -0
- package/schemas/runtime/IngestRequest.fbs +61 -0
- package/schemas/runtime/IngestResult.fbs +23 -0
- package/schemas/runtime/ModuleConfig.fbs +41 -0
- package/schemas/runtime/RuntimeCommon.fbs +33 -0
- package/schemas/runtime/TimerTick.fbs +18 -0
- package/src/capabilities.js +3 -0
- package/src/compiler/compileModule.js +20 -2
- package/src/generated/runtime/aligned/HostOps_aligned.js +3913 -0
- package/src/generated/runtime/aligned/HostOps_aligned.ts +4605 -0
- package/src/generated/runtime/aligned/HostOps_enums.js +12 -0
- package/src/generated/runtime/aligned/HostOps_enums.ts +6 -0
- package/src/generated/runtime/cpp/FlowNotice_generated.h +367 -0
- package/src/generated/runtime/cpp/HostOps_aligned.h +3540 -0
- package/src/generated/runtime/cpp/HttpRequest_generated.h +317 -0
- package/src/generated/runtime/cpp/HttpResponse_generated.h +315 -0
- package/src/generated/runtime/cpp/IngestRequest_generated.h +829 -0
- package/src/generated/runtime/cpp/IngestResult_generated.h +319 -0
- package/src/generated/runtime/cpp/ModuleConfig_generated.h +604 -0
- package/src/generated/runtime/cpp/RuntimeCommon_generated.h +410 -0
- package/src/generated/runtime/cpp/TimerTick_generated.h +229 -0
- package/src/generated/runtime/sdn/runtime/ArchiveTarget.js +78 -0
- package/src/generated/runtime/sdn/runtime/ArchiveTarget.ts +104 -0
- package/src/generated/runtime/sdn/runtime/ConfigEntry.js +202 -0
- package/src/generated/runtime/sdn/runtime/ConfigEntry.ts +251 -0
- package/src/generated/runtime/sdn/runtime/ConfigTable.js +80 -0
- package/src/generated/runtime/sdn/runtime/ConfigTable.ts +97 -0
- package/src/generated/runtime/sdn/runtime/FlowNotice.js +196 -0
- package/src/generated/runtime/sdn/runtime/FlowNotice.ts +254 -0
- package/src/generated/runtime/sdn/runtime/Header.js +79 -0
- package/src/generated/runtime/sdn/runtime/Header.ts +100 -0
- package/src/generated/runtime/sdn/runtime/HttpRequest.js +216 -0
- package/src/generated/runtime/sdn/runtime/HttpRequest.ts +265 -0
- package/src/generated/runtime/sdn/runtime/HttpResponse.js +216 -0
- package/src/generated/runtime/sdn/runtime/HttpResponse.ts +267 -0
- package/src/generated/runtime/sdn/runtime/IngestRequest.js +121 -0
- package/src/generated/runtime/sdn/runtime/IngestRequest.ts +155 -0
- package/src/generated/runtime/sdn/runtime/IngestResult.js +184 -0
- package/src/generated/runtime/sdn/runtime/IngestResult.ts +235 -0
- package/src/generated/runtime/sdn/runtime/ModuleConfig.js +92 -0
- package/src/generated/runtime/sdn/runtime/ModuleConfig.ts +114 -0
- package/src/generated/runtime/sdn/runtime/Provenance.js +320 -0
- package/src/generated/runtime/sdn/runtime/Provenance.ts +405 -0
- package/src/generated/runtime/sdn/runtime/SourceTags.js +181 -0
- package/src/generated/runtime/sdn/runtime/SourceTags.ts +253 -0
- package/src/generated/runtime/sdn/runtime/TimerTick.js +119 -0
- package/src/generated/runtime/sdn/runtime/TimerTick.ts +148 -0
- package/src/generated/runtime/sdn/runtime/configValueKind.js +12 -0
- package/src/generated/runtime/sdn/runtime/configValueKind.ts +19 -0
- package/src/generated/runtime/sdn/runtime/flowNoticeKind.js +11 -0
- package/src/generated/runtime/sdn/runtime/flowNoticeKind.ts +34 -0
- package/src/generated/runtime/sdn/runtime/reconcileMode.js +9 -0
- package/src/generated/runtime/sdn/runtime/reconcileMode.ts +23 -0
- package/src/generated/runtime/sdn/runtime.js +16 -0
- package/src/generated/runtime/sdn/runtime.ts +17 -0
- package/src/host/abi.js +32 -6
- package/src/host/adapterOperations.js +79 -0
- package/src/host/browserHost.js +65 -2
- package/src/host/cpp/typedHostcall.hpp +252 -0
- package/src/host/hostWorkerBundleSources.js +3 -3
- package/src/host/nodeHost.js +50 -0
- package/src/host/typedDispatch.js +582 -0
- package/src/index.d.ts +25 -2
- package/src/invoke/codec.js +3 -2
- package/src/standards/runtimeContracts.js +596 -0
- package/src/standards/sharedCatalog.js +27 -0
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
* One header of an outbound HTTP exchange. NAME is lower-cased and a FlatBuffers key, so a header vector is
|
|
11
|
+
* sorted and binary-searchable; encoders sort by NAME.
|
|
12
|
+
*/
|
|
13
|
+
export class Header implements flatbuffers.IUnpackableObject<HeaderT> {
|
|
14
|
+
bb: flatbuffers.ByteBuffer|null = null;
|
|
15
|
+
bb_pos = 0;
|
|
16
|
+
__init(i:number, bb:flatbuffers.ByteBuffer):Header {
|
|
17
|
+
this.bb_pos = i;
|
|
18
|
+
this.bb = bb;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static getRootAsHeader(bb:flatbuffers.ByteBuffer, obj?:Header):Header {
|
|
23
|
+
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static getSizePrefixedRootAsHeader(bb:flatbuffers.ByteBuffer, obj?:Header):Header {
|
|
27
|
+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
28
|
+
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
NAME():string
|
|
32
|
+
NAME(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
|
33
|
+
NAME(optionalEncoding?:any):string|Uint8Array {
|
|
34
|
+
const offset = this.bb!.__offset(this.bb_pos, 4);
|
|
35
|
+
return this.bb!.__string(this.bb_pos + offset, optionalEncoding);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
VALUE():string|null
|
|
39
|
+
VALUE(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
|
40
|
+
VALUE(optionalEncoding?:any):string|Uint8Array|null {
|
|
41
|
+
const offset = this.bb!.__offset(this.bb_pos, 6);
|
|
42
|
+
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static startHeader(builder:flatbuffers.Builder) {
|
|
46
|
+
builder.startObject(2);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static addName(builder:flatbuffers.Builder, NAMEOffset:flatbuffers.Offset) {
|
|
50
|
+
builder.addFieldOffset(0, NAMEOffset, 0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static addValue(builder:flatbuffers.Builder, VALUEOffset:flatbuffers.Offset) {
|
|
54
|
+
builder.addFieldOffset(1, VALUEOffset, 0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static endHeader(builder:flatbuffers.Builder):flatbuffers.Offset {
|
|
58
|
+
const offset = builder.endObject();
|
|
59
|
+
builder.requiredField(offset, 4) // NAME
|
|
60
|
+
return offset;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static createHeader(builder:flatbuffers.Builder, NAMEOffset:flatbuffers.Offset, VALUEOffset:flatbuffers.Offset):flatbuffers.Offset {
|
|
64
|
+
Header.startHeader(builder);
|
|
65
|
+
Header.addName(builder, NAMEOffset);
|
|
66
|
+
Header.addValue(builder, VALUEOffset);
|
|
67
|
+
return Header.endHeader(builder);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
unpack(): HeaderT {
|
|
71
|
+
return new HeaderT(
|
|
72
|
+
this.NAME(),
|
|
73
|
+
this.VALUE()
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
unpackTo(_o: HeaderT): void {
|
|
79
|
+
_o.NAME = this.NAME();
|
|
80
|
+
_o.VALUE = this.VALUE();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export class HeaderT implements flatbuffers.IGeneratedObject {
|
|
85
|
+
constructor(
|
|
86
|
+
public NAME: string|Uint8Array|null = null,
|
|
87
|
+
public VALUE: string|Uint8Array|null = null
|
|
88
|
+
){}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
|
92
|
+
const NAME = (this.NAME !== null ? builder.createString(this.NAME!) : 0);
|
|
93
|
+
const VALUE = (this.VALUE !== null ? builder.createString(this.VALUE!) : 0);
|
|
94
|
+
|
|
95
|
+
return Header.createHeader(builder,
|
|
96
|
+
NAME,
|
|
97
|
+
VALUE
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import * as flatbuffers from "flatbuffers";
|
|
5
|
+
import { Header } from "./Header.js";
|
|
6
|
+
class HttpRequest {
|
|
7
|
+
constructor() {
|
|
8
|
+
__publicField(this, "bb", null);
|
|
9
|
+
__publicField(this, "bb_pos", 0);
|
|
10
|
+
}
|
|
11
|
+
__init(i, bb) {
|
|
12
|
+
this.bb_pos = i;
|
|
13
|
+
this.bb = bb;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
static getRootAsHttpRequest(bb, obj) {
|
|
17
|
+
return (obj || new HttpRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
18
|
+
}
|
|
19
|
+
static getSizePrefixedRootAsHttpRequest(bb, obj) {
|
|
20
|
+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
21
|
+
return (obj || new HttpRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
22
|
+
}
|
|
23
|
+
static bufferHasIdentifier(bb) {
|
|
24
|
+
return bb.__has_identifier("HREQ");
|
|
25
|
+
}
|
|
26
|
+
METHOD(optionalEncoding) {
|
|
27
|
+
const offset = this.bb.__offset(this.bb_pos, 4);
|
|
28
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
29
|
+
}
|
|
30
|
+
URL(optionalEncoding) {
|
|
31
|
+
const offset = this.bb.__offset(this.bb_pos, 6);
|
|
32
|
+
return this.bb.__string(this.bb_pos + offset, optionalEncoding);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Request headers, sorted by NAME (e.g. "range": "bytes=0-1023").
|
|
36
|
+
*/
|
|
37
|
+
HEADERS(index, obj) {
|
|
38
|
+
const offset = this.bb.__offset(this.bb_pos, 8);
|
|
39
|
+
return offset ? (obj || new Header()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
40
|
+
}
|
|
41
|
+
headersLength() {
|
|
42
|
+
const offset = this.bb.__offset(this.bb_pos, 8);
|
|
43
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
44
|
+
}
|
|
45
|
+
BODY(index) {
|
|
46
|
+
const offset = this.bb.__offset(this.bb_pos, 10);
|
|
47
|
+
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
|
48
|
+
}
|
|
49
|
+
bodyLength() {
|
|
50
|
+
const offset = this.bb.__offset(this.bb_pos, 10);
|
|
51
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
52
|
+
}
|
|
53
|
+
bodyArray() {
|
|
54
|
+
const offset = this.bb.__offset(this.bb_pos, 10);
|
|
55
|
+
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;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Give up after this many milliseconds; 0 = the host's default.
|
|
59
|
+
*/
|
|
60
|
+
TIMEOUT_MS() {
|
|
61
|
+
const offset = this.bb.__offset(this.bb_pos, 12);
|
|
62
|
+
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Response body budget in bytes: the host errors past it, never truncates; 0 = the host's limit.
|
|
66
|
+
*/
|
|
67
|
+
MAX_BYTES() {
|
|
68
|
+
const offset = this.bb.__offset(this.bb_pos, 14);
|
|
69
|
+
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The module's own state for this request, echoed verbatim in the HttpResponse: one size-prefixed
|
|
73
|
+
* FlatBuffer, identified by its own file identifier (an SDS record such as a $WXF header naming the wanted
|
|
74
|
+
* field, or another runtime type). Never JSON.
|
|
75
|
+
*/
|
|
76
|
+
CONTEXT(index) {
|
|
77
|
+
const offset = this.bb.__offset(this.bb_pos, 16);
|
|
78
|
+
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
|
79
|
+
}
|
|
80
|
+
contextLength() {
|
|
81
|
+
const offset = this.bb.__offset(this.bb_pos, 16);
|
|
82
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
83
|
+
}
|
|
84
|
+
contextArray() {
|
|
85
|
+
const offset = this.bb.__offset(this.bb_pos, 16);
|
|
86
|
+
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;
|
|
87
|
+
}
|
|
88
|
+
static startHttpRequest(builder) {
|
|
89
|
+
builder.startObject(7);
|
|
90
|
+
}
|
|
91
|
+
static addMethod(builder, METHODOffset) {
|
|
92
|
+
builder.addFieldOffset(0, METHODOffset, 0);
|
|
93
|
+
}
|
|
94
|
+
static addUrl(builder, URLOffset) {
|
|
95
|
+
builder.addFieldOffset(1, URLOffset, 0);
|
|
96
|
+
}
|
|
97
|
+
static addHeaders(builder, HEADERSOffset) {
|
|
98
|
+
builder.addFieldOffset(2, HEADERSOffset, 0);
|
|
99
|
+
}
|
|
100
|
+
static createHeadersVector(builder, data) {
|
|
101
|
+
builder.startVector(4, data.length, 4);
|
|
102
|
+
for (let i = data.length - 1; i >= 0; i--) {
|
|
103
|
+
builder.addOffset(data[i]);
|
|
104
|
+
}
|
|
105
|
+
return builder.endVector();
|
|
106
|
+
}
|
|
107
|
+
static startHeadersVector(builder, numElems) {
|
|
108
|
+
builder.startVector(4, numElems, 4);
|
|
109
|
+
}
|
|
110
|
+
static addBody(builder, BODYOffset) {
|
|
111
|
+
builder.addFieldOffset(3, BODYOffset, 0);
|
|
112
|
+
}
|
|
113
|
+
static createBodyVector(builder, data) {
|
|
114
|
+
builder.startVector(1, data.length, 1);
|
|
115
|
+
for (let i = data.length - 1; i >= 0; i--) {
|
|
116
|
+
builder.addInt8(data[i]);
|
|
117
|
+
}
|
|
118
|
+
return builder.endVector();
|
|
119
|
+
}
|
|
120
|
+
static startBodyVector(builder, numElems) {
|
|
121
|
+
builder.startVector(1, numElems, 1);
|
|
122
|
+
}
|
|
123
|
+
static addTimeoutMs(builder, TIMEOUT_MS) {
|
|
124
|
+
builder.addFieldInt32(4, TIMEOUT_MS, 0);
|
|
125
|
+
}
|
|
126
|
+
static addMaxBytes(builder, MAX_BYTES) {
|
|
127
|
+
builder.addFieldInt64(5, MAX_BYTES, BigInt("0"));
|
|
128
|
+
}
|
|
129
|
+
static addContext(builder, CONTEXTOffset) {
|
|
130
|
+
builder.addFieldOffset(6, CONTEXTOffset, 0);
|
|
131
|
+
}
|
|
132
|
+
static createContextVector(builder, data) {
|
|
133
|
+
builder.startVector(1, data.length, 1);
|
|
134
|
+
for (let i = data.length - 1; i >= 0; i--) {
|
|
135
|
+
builder.addInt8(data[i]);
|
|
136
|
+
}
|
|
137
|
+
return builder.endVector();
|
|
138
|
+
}
|
|
139
|
+
static startContextVector(builder, numElems) {
|
|
140
|
+
builder.startVector(1, numElems, 1);
|
|
141
|
+
}
|
|
142
|
+
static endHttpRequest(builder) {
|
|
143
|
+
const offset = builder.endObject();
|
|
144
|
+
builder.requiredField(offset, 6);
|
|
145
|
+
return offset;
|
|
146
|
+
}
|
|
147
|
+
static finishHttpRequestBuffer(builder, offset) {
|
|
148
|
+
builder.finish(offset, "HREQ");
|
|
149
|
+
}
|
|
150
|
+
static finishSizePrefixedHttpRequestBuffer(builder, offset) {
|
|
151
|
+
builder.finish(offset, "HREQ", true);
|
|
152
|
+
}
|
|
153
|
+
static createHttpRequest(builder, METHODOffset, URLOffset, HEADERSOffset, BODYOffset, TIMEOUT_MS, MAX_BYTES, CONTEXTOffset) {
|
|
154
|
+
HttpRequest.startHttpRequest(builder);
|
|
155
|
+
HttpRequest.addMethod(builder, METHODOffset);
|
|
156
|
+
HttpRequest.addUrl(builder, URLOffset);
|
|
157
|
+
HttpRequest.addHeaders(builder, HEADERSOffset);
|
|
158
|
+
HttpRequest.addBody(builder, BODYOffset);
|
|
159
|
+
HttpRequest.addTimeoutMs(builder, TIMEOUT_MS);
|
|
160
|
+
HttpRequest.addMaxBytes(builder, MAX_BYTES);
|
|
161
|
+
HttpRequest.addContext(builder, CONTEXTOffset);
|
|
162
|
+
return HttpRequest.endHttpRequest(builder);
|
|
163
|
+
}
|
|
164
|
+
unpack() {
|
|
165
|
+
return new HttpRequestT(
|
|
166
|
+
this.METHOD(),
|
|
167
|
+
this.URL(),
|
|
168
|
+
this.bb.createObjList(this.HEADERS.bind(this), this.headersLength()),
|
|
169
|
+
this.bb.createScalarList(this.BODY.bind(this), this.bodyLength()),
|
|
170
|
+
this.TIMEOUT_MS(),
|
|
171
|
+
this.MAX_BYTES(),
|
|
172
|
+
this.bb.createScalarList(this.CONTEXT.bind(this), this.contextLength())
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
unpackTo(_o) {
|
|
176
|
+
_o.METHOD = this.METHOD();
|
|
177
|
+
_o.URL = this.URL();
|
|
178
|
+
_o.HEADERS = this.bb.createObjList(this.HEADERS.bind(this), this.headersLength());
|
|
179
|
+
_o.BODY = this.bb.createScalarList(this.BODY.bind(this), this.bodyLength());
|
|
180
|
+
_o.TIMEOUT_MS = this.TIMEOUT_MS();
|
|
181
|
+
_o.MAX_BYTES = this.MAX_BYTES();
|
|
182
|
+
_o.CONTEXT = this.bb.createScalarList(this.CONTEXT.bind(this), this.contextLength());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
class HttpRequestT {
|
|
186
|
+
constructor(METHOD = null, URL = null, HEADERS = [], BODY = [], TIMEOUT_MS = 0, MAX_BYTES = BigInt("0"), CONTEXT = []) {
|
|
187
|
+
__publicField(this, "METHOD", METHOD);
|
|
188
|
+
__publicField(this, "URL", URL);
|
|
189
|
+
__publicField(this, "HEADERS", HEADERS);
|
|
190
|
+
__publicField(this, "BODY", BODY);
|
|
191
|
+
__publicField(this, "TIMEOUT_MS", TIMEOUT_MS);
|
|
192
|
+
__publicField(this, "MAX_BYTES", MAX_BYTES);
|
|
193
|
+
__publicField(this, "CONTEXT", CONTEXT);
|
|
194
|
+
}
|
|
195
|
+
pack(builder) {
|
|
196
|
+
const METHOD = this.METHOD !== null ? builder.createString(this.METHOD) : 0;
|
|
197
|
+
const URL = this.URL !== null ? builder.createString(this.URL) : 0;
|
|
198
|
+
const HEADERS = HttpRequest.createHeadersVector(builder, builder.createObjectOffsetList(this.HEADERS));
|
|
199
|
+
const BODY = HttpRequest.createBodyVector(builder, this.BODY);
|
|
200
|
+
const CONTEXT = HttpRequest.createContextVector(builder, this.CONTEXT);
|
|
201
|
+
return HttpRequest.createHttpRequest(
|
|
202
|
+
builder,
|
|
203
|
+
METHOD,
|
|
204
|
+
URL,
|
|
205
|
+
HEADERS,
|
|
206
|
+
BODY,
|
|
207
|
+
this.TIMEOUT_MS,
|
|
208
|
+
this.MAX_BYTES,
|
|
209
|
+
CONTEXT
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export {
|
|
214
|
+
HttpRequest,
|
|
215
|
+
HttpRequestT
|
|
216
|
+
};
|
|
@@ -0,0 +1,265 @@
|
|
|
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 { Header, HeaderT } from './Header.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An outbound HTTP request a module asks the host to make (the http host connector). Replaces the
|
|
12
|
+
* hostcap/http-request JSON request. The host presents the validators it holds for URL (If-None-Match,
|
|
13
|
+
* If-Modified-Since) unless the module set either itself.
|
|
14
|
+
*/
|
|
15
|
+
export class HttpRequest implements flatbuffers.IUnpackableObject<HttpRequestT> {
|
|
16
|
+
bb: flatbuffers.ByteBuffer|null = null;
|
|
17
|
+
bb_pos = 0;
|
|
18
|
+
__init(i:number, bb:flatbuffers.ByteBuffer):HttpRequest {
|
|
19
|
+
this.bb_pos = i;
|
|
20
|
+
this.bb = bb;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static getRootAsHttpRequest(bb:flatbuffers.ByteBuffer, obj?:HttpRequest):HttpRequest {
|
|
25
|
+
return (obj || new HttpRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static getSizePrefixedRootAsHttpRequest(bb:flatbuffers.ByteBuffer, obj?:HttpRequest):HttpRequest {
|
|
29
|
+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
30
|
+
return (obj || new HttpRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
|
|
34
|
+
return bb.__has_identifier('HREQ');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Verb, upper-case; empty means GET.
|
|
39
|
+
*/
|
|
40
|
+
METHOD():string|null
|
|
41
|
+
METHOD(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
|
42
|
+
METHOD(optionalEncoding?:any):string|Uint8Array|null {
|
|
43
|
+
const offset = this.bb!.__offset(this.bb_pos, 4);
|
|
44
|
+
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
URL():string
|
|
48
|
+
URL(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
|
49
|
+
URL(optionalEncoding?:any):string|Uint8Array {
|
|
50
|
+
const offset = this.bb!.__offset(this.bb_pos, 6);
|
|
51
|
+
return this.bb!.__string(this.bb_pos + offset, optionalEncoding);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Request headers, sorted by NAME (e.g. "range": "bytes=0-1023").
|
|
56
|
+
*/
|
|
57
|
+
HEADERS(index: number, obj?:Header):Header|null {
|
|
58
|
+
const offset = this.bb!.__offset(this.bb_pos, 8);
|
|
59
|
+
return offset ? (obj || new Header()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
headersLength():number {
|
|
63
|
+
const offset = this.bb!.__offset(this.bb_pos, 8);
|
|
64
|
+
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
BODY(index: number):number|null {
|
|
68
|
+
const offset = this.bb!.__offset(this.bb_pos, 10);
|
|
69
|
+
return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
bodyLength():number {
|
|
73
|
+
const offset = this.bb!.__offset(this.bb_pos, 10);
|
|
74
|
+
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
bodyArray():Uint8Array|null {
|
|
78
|
+
const offset = this.bb!.__offset(this.bb_pos, 10);
|
|
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
|
+
/**
|
|
83
|
+
* Give up after this many milliseconds; 0 = the host's default.
|
|
84
|
+
*/
|
|
85
|
+
TIMEOUT_MS():number {
|
|
86
|
+
const offset = this.bb!.__offset(this.bb_pos, 12);
|
|
87
|
+
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Response body budget in bytes: the host errors past it, never truncates; 0 = the host's limit.
|
|
92
|
+
*/
|
|
93
|
+
MAX_BYTES():bigint {
|
|
94
|
+
const offset = this.bb!.__offset(this.bb_pos, 14);
|
|
95
|
+
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The module's own state for this request, echoed verbatim in the HttpResponse: one size-prefixed
|
|
100
|
+
* FlatBuffer, identified by its own file identifier (an SDS record such as a $WXF header naming the wanted
|
|
101
|
+
* field, or another runtime type). Never JSON.
|
|
102
|
+
*/
|
|
103
|
+
CONTEXT(index: number):number|null {
|
|
104
|
+
const offset = this.bb!.__offset(this.bb_pos, 16);
|
|
105
|
+
return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
contextLength():number {
|
|
109
|
+
const offset = this.bb!.__offset(this.bb_pos, 16);
|
|
110
|
+
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
contextArray():Uint8Array|null {
|
|
114
|
+
const offset = this.bb!.__offset(this.bb_pos, 16);
|
|
115
|
+
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;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static startHttpRequest(builder:flatbuffers.Builder) {
|
|
119
|
+
builder.startObject(7);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static addMethod(builder:flatbuffers.Builder, METHODOffset:flatbuffers.Offset) {
|
|
123
|
+
builder.addFieldOffset(0, METHODOffset, 0);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static addUrl(builder:flatbuffers.Builder, URLOffset:flatbuffers.Offset) {
|
|
127
|
+
builder.addFieldOffset(1, URLOffset, 0);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static addHeaders(builder:flatbuffers.Builder, HEADERSOffset:flatbuffers.Offset) {
|
|
131
|
+
builder.addFieldOffset(2, HEADERSOffset, 0);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static createHeadersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
|
135
|
+
builder.startVector(4, data.length, 4);
|
|
136
|
+
for (let i = data.length - 1; i >= 0; i--) {
|
|
137
|
+
builder.addOffset(data[i]!);
|
|
138
|
+
}
|
|
139
|
+
return builder.endVector();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static startHeadersVector(builder:flatbuffers.Builder, numElems:number) {
|
|
143
|
+
builder.startVector(4, numElems, 4);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static addBody(builder:flatbuffers.Builder, BODYOffset:flatbuffers.Offset) {
|
|
147
|
+
builder.addFieldOffset(3, BODYOffset, 0);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static createBodyVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
|
|
151
|
+
builder.startVector(1, data.length, 1);
|
|
152
|
+
for (let i = data.length - 1; i >= 0; i--) {
|
|
153
|
+
builder.addInt8(data[i]!);
|
|
154
|
+
}
|
|
155
|
+
return builder.endVector();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
static startBodyVector(builder:flatbuffers.Builder, numElems:number) {
|
|
159
|
+
builder.startVector(1, numElems, 1);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static addTimeoutMs(builder:flatbuffers.Builder, TIMEOUT_MS:number) {
|
|
163
|
+
builder.addFieldInt32(4, TIMEOUT_MS, 0);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
static addMaxBytes(builder:flatbuffers.Builder, MAX_BYTES:bigint) {
|
|
167
|
+
builder.addFieldInt64(5, MAX_BYTES, BigInt('0'));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static addContext(builder:flatbuffers.Builder, CONTEXTOffset:flatbuffers.Offset) {
|
|
171
|
+
builder.addFieldOffset(6, CONTEXTOffset, 0);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
static createContextVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
|
|
175
|
+
builder.startVector(1, data.length, 1);
|
|
176
|
+
for (let i = data.length - 1; i >= 0; i--) {
|
|
177
|
+
builder.addInt8(data[i]!);
|
|
178
|
+
}
|
|
179
|
+
return builder.endVector();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
static startContextVector(builder:flatbuffers.Builder, numElems:number) {
|
|
183
|
+
builder.startVector(1, numElems, 1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static endHttpRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
|
|
187
|
+
const offset = builder.endObject();
|
|
188
|
+
builder.requiredField(offset, 6) // URL
|
|
189
|
+
return offset;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
static finishHttpRequestBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
|
193
|
+
builder.finish(offset, 'HREQ');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static finishSizePrefixedHttpRequestBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
|
197
|
+
builder.finish(offset, 'HREQ', true);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
static createHttpRequest(builder:flatbuffers.Builder, METHODOffset:flatbuffers.Offset, URLOffset:flatbuffers.Offset, HEADERSOffset:flatbuffers.Offset, BODYOffset:flatbuffers.Offset, TIMEOUT_MS:number, MAX_BYTES:bigint, CONTEXTOffset:flatbuffers.Offset):flatbuffers.Offset {
|
|
201
|
+
HttpRequest.startHttpRequest(builder);
|
|
202
|
+
HttpRequest.addMethod(builder, METHODOffset);
|
|
203
|
+
HttpRequest.addUrl(builder, URLOffset);
|
|
204
|
+
HttpRequest.addHeaders(builder, HEADERSOffset);
|
|
205
|
+
HttpRequest.addBody(builder, BODYOffset);
|
|
206
|
+
HttpRequest.addTimeoutMs(builder, TIMEOUT_MS);
|
|
207
|
+
HttpRequest.addMaxBytes(builder, MAX_BYTES);
|
|
208
|
+
HttpRequest.addContext(builder, CONTEXTOffset);
|
|
209
|
+
return HttpRequest.endHttpRequest(builder);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
unpack(): HttpRequestT {
|
|
213
|
+
return new HttpRequestT(
|
|
214
|
+
this.METHOD(),
|
|
215
|
+
this.URL(),
|
|
216
|
+
this.bb!.createObjList<Header, HeaderT>(this.HEADERS.bind(this), this.headersLength()),
|
|
217
|
+
this.bb!.createScalarList<number>(this.BODY.bind(this), this.bodyLength()),
|
|
218
|
+
this.TIMEOUT_MS(),
|
|
219
|
+
this.MAX_BYTES(),
|
|
220
|
+
this.bb!.createScalarList<number>(this.CONTEXT.bind(this), this.contextLength())
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
unpackTo(_o: HttpRequestT): void {
|
|
226
|
+
_o.METHOD = this.METHOD();
|
|
227
|
+
_o.URL = this.URL();
|
|
228
|
+
_o.HEADERS = this.bb!.createObjList<Header, HeaderT>(this.HEADERS.bind(this), this.headersLength());
|
|
229
|
+
_o.BODY = this.bb!.createScalarList<number>(this.BODY.bind(this), this.bodyLength());
|
|
230
|
+
_o.TIMEOUT_MS = this.TIMEOUT_MS();
|
|
231
|
+
_o.MAX_BYTES = this.MAX_BYTES();
|
|
232
|
+
_o.CONTEXT = this.bb!.createScalarList<number>(this.CONTEXT.bind(this), this.contextLength());
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export class HttpRequestT implements flatbuffers.IGeneratedObject {
|
|
237
|
+
constructor(
|
|
238
|
+
public METHOD: string|Uint8Array|null = null,
|
|
239
|
+
public URL: string|Uint8Array|null = null,
|
|
240
|
+
public HEADERS: (HeaderT)[] = [],
|
|
241
|
+
public BODY: (number)[] = [],
|
|
242
|
+
public TIMEOUT_MS: number = 0,
|
|
243
|
+
public MAX_BYTES: bigint = BigInt('0'),
|
|
244
|
+
public CONTEXT: (number)[] = []
|
|
245
|
+
){}
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
|
249
|
+
const METHOD = (this.METHOD !== null ? builder.createString(this.METHOD!) : 0);
|
|
250
|
+
const URL = (this.URL !== null ? builder.createString(this.URL!) : 0);
|
|
251
|
+
const HEADERS = HttpRequest.createHeadersVector(builder, builder.createObjectOffsetList(this.HEADERS));
|
|
252
|
+
const BODY = HttpRequest.createBodyVector(builder, this.BODY);
|
|
253
|
+
const CONTEXT = HttpRequest.createContextVector(builder, this.CONTEXT);
|
|
254
|
+
|
|
255
|
+
return HttpRequest.createHttpRequest(builder,
|
|
256
|
+
METHOD,
|
|
257
|
+
URL,
|
|
258
|
+
HEADERS,
|
|
259
|
+
BODY,
|
|
260
|
+
this.TIMEOUT_MS,
|
|
261
|
+
this.MAX_BYTES,
|
|
262
|
+
CONTEXT
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|