@cosmonic-labs/openapi2mcp 0.10.0 → 0.10.2
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/dist/interfaces/wasi-cli-environment.d.ts +1 -1
- package/dist/interfaces/wasi-cli-exit.d.ts +1 -1
- package/dist/interfaces/wasi-cli-stderr.d.ts +1 -1
- package/dist/interfaces/wasi-cli-stdin.d.ts +1 -1
- package/dist/interfaces/wasi-cli-stdout.d.ts +1 -1
- package/dist/interfaces/wasi-cli-terminal-input.d.ts +1 -1
- package/dist/interfaces/wasi-cli-terminal-output.d.ts +1 -1
- package/dist/interfaces/wasi-cli-terminal-stderr.d.ts +1 -1
- package/dist/interfaces/wasi-cli-terminal-stdin.d.ts +1 -1
- package/dist/interfaces/wasi-cli-terminal-stdout.d.ts +1 -1
- package/dist/interfaces/wasi-clocks-monotonic-clock.d.ts +4 -0
- package/dist/interfaces/wasi-clocks-wall-clock.d.ts +1 -1
- package/dist/interfaces/wasi-filesystem-preopens.d.ts +1 -1
- package/dist/interfaces/wasi-filesystem-types.d.ts +1 -1
- package/dist/interfaces/wasi-io-error.d.ts +1 -1
- package/dist/interfaces/wasi-io-poll.d.ts +2 -1
- package/dist/interfaces/wasi-io-streams.d.ts +2 -2
- package/dist/interfaces/wasi-random-insecure-seed.d.ts +1 -1
- package/dist/openapi2mcp.core.wasm +0 -0
- package/dist/openapi2mcp.d.ts +18 -17
- package/dist/openapi2mcp.js +655 -359
- package/node_modules/@bytecodealliance/preview2-shim/LICENSE +220 -0
- package/node_modules/@bytecodealliance/preview2-shim/README.md +113 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/cli.js +135 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/clocks.js +39 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/config.js +9 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/environment.js +29 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/filesystem.js +485 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/http.js +707 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/index.js +9 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/io.js +262 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/random.js +56 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/browser/sockets.js +88 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/common/instantiation.js +253 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/calls.js +128 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/worker-http.js +206 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/worker-io.js +468 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/worker-socket-tcp.js +331 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/worker-socket-udp.js +587 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/worker-sockets.js +364 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/io/worker-thread.js +1051 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/cli.js +109 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/clocks.js +67 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/filesystem.js +829 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/http.js +764 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/index.js +9 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/io.js +1 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/random.js +49 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/nodejs/sockets.js +565 -0
- package/node_modules/@bytecodealliance/preview2-shim/lib/synckit/index.js +127 -0
- package/node_modules/@bytecodealliance/preview2-shim/package.json +65 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/cli.d.ts +11 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/clocks.d.ts +2 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/filesystem.d.ts +29 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/http.d.ts +3 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/index.d.ts +6 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/instantiation.d.ts +199 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-environment.d.ts +21 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-exit.d.ts +6 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-run.d.ts +5 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-stderr.d.ts +3 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-stdin.d.ts +3 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-stdout.d.ts +3 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-terminal-input.d.ts +8 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-terminal-output.d.ts +8 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-terminal-stderr.d.ts +7 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-terminal-stdin.d.ts +7 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-cli-terminal-stdout.d.ts +7 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-clocks-monotonic-clock.d.ts +34 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-clocks-wall-clock.d.ts +30 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-filesystem-preopens.d.ts +6 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-filesystem-types.d.ts +669 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-http-incoming-handler.d.ts +16 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-http-outgoing-handler.d.ts +18 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-http-types.d.ts +748 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-io-error.d.ts +18 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-io-poll.d.ts +44 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-io-streams.d.ts +243 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-random-insecure-seed.d.ts +21 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-random-insecure.d.ts +19 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-random-random.d.ts +23 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-instance-network.d.ts +6 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-ip-name-lookup.d.ts +58 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-network.d.ts +164 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-tcp-create-socket.d.ts +28 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-tcp.d.ts +359 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-udp-create-socket.d.ts +28 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/interfaces/wasi-sockets-udp.d.ts +301 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/io.d.ts +3 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/random.d.ts +3 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/sockets.d.ts +7 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/wasi-cli-command.d.ts +29 -0
- package/node_modules/@bytecodealliance/preview2-shim/types/wasi-http-proxy.d.ts +13 -0
- package/package.json +9 -6
- package/patches/@bytecodealliance+preview2-shim+0.18.0.patch +13 -0
|
@@ -0,0 +1,748 @@
|
|
|
1
|
+
/** @module Interface wasi:http/types@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Attempts to extract a http-related `error` from the wasi:io `error`
|
|
4
|
+
* provided.
|
|
5
|
+
*
|
|
6
|
+
* Stream operations which return
|
|
7
|
+
* `wasi:io/stream/stream-error::last-operation-failed` have a payload of
|
|
8
|
+
* type `wasi:io/error/error` with more information about the operation
|
|
9
|
+
* that failed. This payload can be passed through to this function to see
|
|
10
|
+
* if there's http-related information about the error to return.
|
|
11
|
+
*
|
|
12
|
+
* Note that this function is fallible because not all io-errors are
|
|
13
|
+
* http-related errors.
|
|
14
|
+
*/
|
|
15
|
+
export function httpErrorCode(err: IoError): ErrorCode | undefined;
|
|
16
|
+
export type Duration = import('./wasi-clocks-monotonic-clock.js').Duration;
|
|
17
|
+
export type InputStream = import('./wasi-io-streams.js').InputStream;
|
|
18
|
+
export type OutputStream = import('./wasi-io-streams.js').OutputStream;
|
|
19
|
+
export type IoError = import('./wasi-io-error.js').Error;
|
|
20
|
+
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
21
|
+
/**
|
|
22
|
+
* This type corresponds to HTTP standard Methods.
|
|
23
|
+
*/
|
|
24
|
+
export type Method = MethodGet | MethodHead | MethodPost | MethodPut | MethodDelete | MethodConnect | MethodOptions | MethodTrace | MethodPatch | MethodOther;
|
|
25
|
+
export interface MethodGet {
|
|
26
|
+
tag: 'get',
|
|
27
|
+
}
|
|
28
|
+
export interface MethodHead {
|
|
29
|
+
tag: 'head',
|
|
30
|
+
}
|
|
31
|
+
export interface MethodPost {
|
|
32
|
+
tag: 'post',
|
|
33
|
+
}
|
|
34
|
+
export interface MethodPut {
|
|
35
|
+
tag: 'put',
|
|
36
|
+
}
|
|
37
|
+
export interface MethodDelete {
|
|
38
|
+
tag: 'delete',
|
|
39
|
+
}
|
|
40
|
+
export interface MethodConnect {
|
|
41
|
+
tag: 'connect',
|
|
42
|
+
}
|
|
43
|
+
export interface MethodOptions {
|
|
44
|
+
tag: 'options',
|
|
45
|
+
}
|
|
46
|
+
export interface MethodTrace {
|
|
47
|
+
tag: 'trace',
|
|
48
|
+
}
|
|
49
|
+
export interface MethodPatch {
|
|
50
|
+
tag: 'patch',
|
|
51
|
+
}
|
|
52
|
+
export interface MethodOther {
|
|
53
|
+
tag: 'other',
|
|
54
|
+
val: string,
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* This type corresponds to HTTP standard Related Schemes.
|
|
58
|
+
*/
|
|
59
|
+
export type Scheme = SchemeHttp | SchemeHttps | SchemeOther;
|
|
60
|
+
export interface SchemeHttp {
|
|
61
|
+
tag: 'HTTP',
|
|
62
|
+
}
|
|
63
|
+
export interface SchemeHttps {
|
|
64
|
+
tag: 'HTTPS',
|
|
65
|
+
}
|
|
66
|
+
export interface SchemeOther {
|
|
67
|
+
tag: 'other',
|
|
68
|
+
val: string,
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Defines the case payload type for `DNS-error` above:
|
|
72
|
+
*/
|
|
73
|
+
export interface DnsErrorPayload {
|
|
74
|
+
rcode?: string,
|
|
75
|
+
infoCode?: number,
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Defines the case payload type for `TLS-alert-received` above:
|
|
79
|
+
*/
|
|
80
|
+
export interface TlsAlertReceivedPayload {
|
|
81
|
+
alertId?: number,
|
|
82
|
+
alertMessage?: string,
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
|
|
86
|
+
*/
|
|
87
|
+
export interface FieldSizePayload {
|
|
88
|
+
fieldName?: string,
|
|
89
|
+
fieldSize?: number,
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* These cases are inspired by the IANA HTTP Proxy Error Types:
|
|
93
|
+
* <https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types>
|
|
94
|
+
*/
|
|
95
|
+
export type ErrorCode = ErrorCodeDnsTimeout | ErrorCodeDnsError | ErrorCodeDestinationNotFound | ErrorCodeDestinationUnavailable | ErrorCodeDestinationIpProhibited | ErrorCodeDestinationIpUnroutable | ErrorCodeConnectionRefused | ErrorCodeConnectionTerminated | ErrorCodeConnectionTimeout | ErrorCodeConnectionReadTimeout | ErrorCodeConnectionWriteTimeout | ErrorCodeConnectionLimitReached | ErrorCodeTlsProtocolError | ErrorCodeTlsCertificateError | ErrorCodeTlsAlertReceived | ErrorCodeHttpRequestDenied | ErrorCodeHttpRequestLengthRequired | ErrorCodeHttpRequestBodySize | ErrorCodeHttpRequestMethodInvalid | ErrorCodeHttpRequestUriInvalid | ErrorCodeHttpRequestUriTooLong | ErrorCodeHttpRequestHeaderSectionSize | ErrorCodeHttpRequestHeaderSize | ErrorCodeHttpRequestTrailerSectionSize | ErrorCodeHttpRequestTrailerSize | ErrorCodeHttpResponseIncomplete | ErrorCodeHttpResponseHeaderSectionSize | ErrorCodeHttpResponseHeaderSize | ErrorCodeHttpResponseBodySize | ErrorCodeHttpResponseTrailerSectionSize | ErrorCodeHttpResponseTrailerSize | ErrorCodeHttpResponseTransferCoding | ErrorCodeHttpResponseContentCoding | ErrorCodeHttpResponseTimeout | ErrorCodeHttpUpgradeFailed | ErrorCodeHttpProtocolError | ErrorCodeLoopDetected | ErrorCodeConfigurationError | ErrorCodeInternalError;
|
|
96
|
+
export interface ErrorCodeDnsTimeout {
|
|
97
|
+
tag: 'DNS-timeout',
|
|
98
|
+
}
|
|
99
|
+
export interface ErrorCodeDnsError {
|
|
100
|
+
tag: 'DNS-error',
|
|
101
|
+
val: DnsErrorPayload,
|
|
102
|
+
}
|
|
103
|
+
export interface ErrorCodeDestinationNotFound {
|
|
104
|
+
tag: 'destination-not-found',
|
|
105
|
+
}
|
|
106
|
+
export interface ErrorCodeDestinationUnavailable {
|
|
107
|
+
tag: 'destination-unavailable',
|
|
108
|
+
}
|
|
109
|
+
export interface ErrorCodeDestinationIpProhibited {
|
|
110
|
+
tag: 'destination-IP-prohibited',
|
|
111
|
+
}
|
|
112
|
+
export interface ErrorCodeDestinationIpUnroutable {
|
|
113
|
+
tag: 'destination-IP-unroutable',
|
|
114
|
+
}
|
|
115
|
+
export interface ErrorCodeConnectionRefused {
|
|
116
|
+
tag: 'connection-refused',
|
|
117
|
+
}
|
|
118
|
+
export interface ErrorCodeConnectionTerminated {
|
|
119
|
+
tag: 'connection-terminated',
|
|
120
|
+
}
|
|
121
|
+
export interface ErrorCodeConnectionTimeout {
|
|
122
|
+
tag: 'connection-timeout',
|
|
123
|
+
}
|
|
124
|
+
export interface ErrorCodeConnectionReadTimeout {
|
|
125
|
+
tag: 'connection-read-timeout',
|
|
126
|
+
}
|
|
127
|
+
export interface ErrorCodeConnectionWriteTimeout {
|
|
128
|
+
tag: 'connection-write-timeout',
|
|
129
|
+
}
|
|
130
|
+
export interface ErrorCodeConnectionLimitReached {
|
|
131
|
+
tag: 'connection-limit-reached',
|
|
132
|
+
}
|
|
133
|
+
export interface ErrorCodeTlsProtocolError {
|
|
134
|
+
tag: 'TLS-protocol-error',
|
|
135
|
+
}
|
|
136
|
+
export interface ErrorCodeTlsCertificateError {
|
|
137
|
+
tag: 'TLS-certificate-error',
|
|
138
|
+
}
|
|
139
|
+
export interface ErrorCodeTlsAlertReceived {
|
|
140
|
+
tag: 'TLS-alert-received',
|
|
141
|
+
val: TlsAlertReceivedPayload,
|
|
142
|
+
}
|
|
143
|
+
export interface ErrorCodeHttpRequestDenied {
|
|
144
|
+
tag: 'HTTP-request-denied',
|
|
145
|
+
}
|
|
146
|
+
export interface ErrorCodeHttpRequestLengthRequired {
|
|
147
|
+
tag: 'HTTP-request-length-required',
|
|
148
|
+
}
|
|
149
|
+
export interface ErrorCodeHttpRequestBodySize {
|
|
150
|
+
tag: 'HTTP-request-body-size',
|
|
151
|
+
val: bigint | undefined,
|
|
152
|
+
}
|
|
153
|
+
export interface ErrorCodeHttpRequestMethodInvalid {
|
|
154
|
+
tag: 'HTTP-request-method-invalid',
|
|
155
|
+
}
|
|
156
|
+
export interface ErrorCodeHttpRequestUriInvalid {
|
|
157
|
+
tag: 'HTTP-request-URI-invalid',
|
|
158
|
+
}
|
|
159
|
+
export interface ErrorCodeHttpRequestUriTooLong {
|
|
160
|
+
tag: 'HTTP-request-URI-too-long',
|
|
161
|
+
}
|
|
162
|
+
export interface ErrorCodeHttpRequestHeaderSectionSize {
|
|
163
|
+
tag: 'HTTP-request-header-section-size',
|
|
164
|
+
val: number | undefined,
|
|
165
|
+
}
|
|
166
|
+
export interface ErrorCodeHttpRequestHeaderSize {
|
|
167
|
+
tag: 'HTTP-request-header-size',
|
|
168
|
+
val: FieldSizePayload | undefined,
|
|
169
|
+
}
|
|
170
|
+
export interface ErrorCodeHttpRequestTrailerSectionSize {
|
|
171
|
+
tag: 'HTTP-request-trailer-section-size',
|
|
172
|
+
val: number | undefined,
|
|
173
|
+
}
|
|
174
|
+
export interface ErrorCodeHttpRequestTrailerSize {
|
|
175
|
+
tag: 'HTTP-request-trailer-size',
|
|
176
|
+
val: FieldSizePayload,
|
|
177
|
+
}
|
|
178
|
+
export interface ErrorCodeHttpResponseIncomplete {
|
|
179
|
+
tag: 'HTTP-response-incomplete',
|
|
180
|
+
}
|
|
181
|
+
export interface ErrorCodeHttpResponseHeaderSectionSize {
|
|
182
|
+
tag: 'HTTP-response-header-section-size',
|
|
183
|
+
val: number | undefined,
|
|
184
|
+
}
|
|
185
|
+
export interface ErrorCodeHttpResponseHeaderSize {
|
|
186
|
+
tag: 'HTTP-response-header-size',
|
|
187
|
+
val: FieldSizePayload,
|
|
188
|
+
}
|
|
189
|
+
export interface ErrorCodeHttpResponseBodySize {
|
|
190
|
+
tag: 'HTTP-response-body-size',
|
|
191
|
+
val: bigint | undefined,
|
|
192
|
+
}
|
|
193
|
+
export interface ErrorCodeHttpResponseTrailerSectionSize {
|
|
194
|
+
tag: 'HTTP-response-trailer-section-size',
|
|
195
|
+
val: number | undefined,
|
|
196
|
+
}
|
|
197
|
+
export interface ErrorCodeHttpResponseTrailerSize {
|
|
198
|
+
tag: 'HTTP-response-trailer-size',
|
|
199
|
+
val: FieldSizePayload,
|
|
200
|
+
}
|
|
201
|
+
export interface ErrorCodeHttpResponseTransferCoding {
|
|
202
|
+
tag: 'HTTP-response-transfer-coding',
|
|
203
|
+
val: string | undefined,
|
|
204
|
+
}
|
|
205
|
+
export interface ErrorCodeHttpResponseContentCoding {
|
|
206
|
+
tag: 'HTTP-response-content-coding',
|
|
207
|
+
val: string | undefined,
|
|
208
|
+
}
|
|
209
|
+
export interface ErrorCodeHttpResponseTimeout {
|
|
210
|
+
tag: 'HTTP-response-timeout',
|
|
211
|
+
}
|
|
212
|
+
export interface ErrorCodeHttpUpgradeFailed {
|
|
213
|
+
tag: 'HTTP-upgrade-failed',
|
|
214
|
+
}
|
|
215
|
+
export interface ErrorCodeHttpProtocolError {
|
|
216
|
+
tag: 'HTTP-protocol-error',
|
|
217
|
+
}
|
|
218
|
+
export interface ErrorCodeLoopDetected {
|
|
219
|
+
tag: 'loop-detected',
|
|
220
|
+
}
|
|
221
|
+
export interface ErrorCodeConfigurationError {
|
|
222
|
+
tag: 'configuration-error',
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* This is a catch-all error for anything that doesn't fit cleanly into a
|
|
226
|
+
* more specific case. It also includes an optional string for an
|
|
227
|
+
* unstructured description of the error. Users should not depend on the
|
|
228
|
+
* string for diagnosing errors, as it's not required to be consistent
|
|
229
|
+
* between implementations.
|
|
230
|
+
*/
|
|
231
|
+
export interface ErrorCodeInternalError {
|
|
232
|
+
tag: 'internal-error',
|
|
233
|
+
val: string | undefined,
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* This type enumerates the different kinds of errors that may occur when
|
|
237
|
+
* setting or appending to a `fields` resource.
|
|
238
|
+
*/
|
|
239
|
+
export type HeaderError = HeaderErrorInvalidSyntax | HeaderErrorForbidden | HeaderErrorImmutable;
|
|
240
|
+
/**
|
|
241
|
+
* This error indicates that a `field-name` or `field-value` was
|
|
242
|
+
* syntactically invalid when used with an operation that sets headers in a
|
|
243
|
+
* `fields`.
|
|
244
|
+
*/
|
|
245
|
+
export interface HeaderErrorInvalidSyntax {
|
|
246
|
+
tag: 'invalid-syntax',
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* This error indicates that a forbidden `field-name` was used when trying
|
|
250
|
+
* to set a header in a `fields`.
|
|
251
|
+
*/
|
|
252
|
+
export interface HeaderErrorForbidden {
|
|
253
|
+
tag: 'forbidden',
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* This error indicates that the operation on the `fields` was not
|
|
257
|
+
* permitted because the fields are immutable.
|
|
258
|
+
*/
|
|
259
|
+
export interface HeaderErrorImmutable {
|
|
260
|
+
tag: 'immutable',
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Field keys are always strings.
|
|
264
|
+
*
|
|
265
|
+
* Field keys should always be treated as case insensitive by the `fields`
|
|
266
|
+
* resource for the purposes of equality checking.
|
|
267
|
+
*
|
|
268
|
+
* # Deprecation
|
|
269
|
+
*
|
|
270
|
+
* This type has been deprecated in favor of the `field-name` type.
|
|
271
|
+
*/
|
|
272
|
+
export type FieldKey = string;
|
|
273
|
+
/**
|
|
274
|
+
* Field names are always strings.
|
|
275
|
+
*
|
|
276
|
+
* Field names should always be treated as case insensitive by the `fields`
|
|
277
|
+
* resource for the purposes of equality checking.
|
|
278
|
+
*/
|
|
279
|
+
export type FieldName = FieldKey;
|
|
280
|
+
/**
|
|
281
|
+
* Field values should always be ASCII strings. However, in
|
|
282
|
+
* reality, HTTP implementations often have to interpret malformed values,
|
|
283
|
+
* so they are provided as a list of bytes.
|
|
284
|
+
*/
|
|
285
|
+
export type FieldValue = Uint8Array;
|
|
286
|
+
/**
|
|
287
|
+
* Headers is an alias for Fields.
|
|
288
|
+
*/
|
|
289
|
+
export type Headers = Fields;
|
|
290
|
+
/**
|
|
291
|
+
* Trailers is an alias for Fields.
|
|
292
|
+
*/
|
|
293
|
+
export type Trailers = Fields;
|
|
294
|
+
/**
|
|
295
|
+
* This type corresponds to the HTTP standard Status Code.
|
|
296
|
+
*/
|
|
297
|
+
export type StatusCode = number;
|
|
298
|
+
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
|
|
299
|
+
|
|
300
|
+
export class Fields {
|
|
301
|
+
/**
|
|
302
|
+
* Construct an empty HTTP Fields.
|
|
303
|
+
*
|
|
304
|
+
* The resulting `fields` is mutable.
|
|
305
|
+
*/
|
|
306
|
+
constructor()
|
|
307
|
+
/**
|
|
308
|
+
* Construct an HTTP Fields.
|
|
309
|
+
*
|
|
310
|
+
* The resulting `fields` is mutable.
|
|
311
|
+
*
|
|
312
|
+
* The list represents each name-value pair in the Fields. Names
|
|
313
|
+
* which have multiple values are represented by multiple entries in this
|
|
314
|
+
* list with the same name.
|
|
315
|
+
*
|
|
316
|
+
* The tuple is a pair of the field name, represented as a string, and
|
|
317
|
+
* Value, represented as a list of bytes.
|
|
318
|
+
*
|
|
319
|
+
* An error result will be returned if any `field-name` or `field-value` is
|
|
320
|
+
* syntactically invalid, or if a field is forbidden.
|
|
321
|
+
*/
|
|
322
|
+
static fromList(entries: Array<[FieldName, FieldValue]>): Fields;
|
|
323
|
+
/**
|
|
324
|
+
* Get all of the values corresponding to a name. If the name is not present
|
|
325
|
+
* in this `fields` or is syntactically invalid, an empty list is returned.
|
|
326
|
+
* However, if the name is present but empty, this is represented by a list
|
|
327
|
+
* with one or more empty field-values present.
|
|
328
|
+
*/
|
|
329
|
+
get(name: FieldName): Array<FieldValue>;
|
|
330
|
+
/**
|
|
331
|
+
* Returns `true` when the name is present in this `fields`. If the name is
|
|
332
|
+
* syntactically invalid, `false` is returned.
|
|
333
|
+
*/
|
|
334
|
+
has(name: FieldName): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Set all of the values for a name. Clears any existing values for that
|
|
337
|
+
* name, if they have been set.
|
|
338
|
+
*
|
|
339
|
+
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
340
|
+
*
|
|
341
|
+
* Fails with `header-error.invalid-syntax` if the `field-name` or any of
|
|
342
|
+
* the `field-value`s are syntactically invalid.
|
|
343
|
+
*/
|
|
344
|
+
set(name: FieldName, value: Array<FieldValue>): void;
|
|
345
|
+
/**
|
|
346
|
+
* Delete all values for a name. Does nothing if no values for the name
|
|
347
|
+
* exist.
|
|
348
|
+
*
|
|
349
|
+
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
350
|
+
*
|
|
351
|
+
* Fails with `header-error.invalid-syntax` if the `field-name` is
|
|
352
|
+
* syntactically invalid.
|
|
353
|
+
*/
|
|
354
|
+
'delete'(name: FieldName): void;
|
|
355
|
+
/**
|
|
356
|
+
* Append a value for a name. Does not change or delete any existing
|
|
357
|
+
* values for that name.
|
|
358
|
+
*
|
|
359
|
+
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
360
|
+
*
|
|
361
|
+
* Fails with `header-error.invalid-syntax` if the `field-name` or
|
|
362
|
+
* `field-value` are syntactically invalid.
|
|
363
|
+
*/
|
|
364
|
+
append(name: FieldName, value: FieldValue): void;
|
|
365
|
+
/**
|
|
366
|
+
* Retrieve the full set of names and values in the Fields. Like the
|
|
367
|
+
* constructor, the list represents each name-value pair.
|
|
368
|
+
*
|
|
369
|
+
* The outer list represents each name-value pair in the Fields. Names
|
|
370
|
+
* which have multiple values are represented by multiple entries in this
|
|
371
|
+
* list with the same name.
|
|
372
|
+
*
|
|
373
|
+
* The names and values are always returned in the original casing and in
|
|
374
|
+
* the order in which they will be serialized for transport.
|
|
375
|
+
*/
|
|
376
|
+
entries(): Array<[FieldName, FieldValue]>;
|
|
377
|
+
/**
|
|
378
|
+
* Make a deep copy of the Fields. Equivalent in behavior to calling the
|
|
379
|
+
* `fields` constructor on the return value of `entries`. The resulting
|
|
380
|
+
* `fields` is mutable.
|
|
381
|
+
*/
|
|
382
|
+
clone(): Fields;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export class FutureIncomingResponse {
|
|
386
|
+
/**
|
|
387
|
+
* This type does not have a public constructor.
|
|
388
|
+
*/
|
|
389
|
+
private constructor();
|
|
390
|
+
/**
|
|
391
|
+
* Returns a pollable which becomes ready when either the Response has
|
|
392
|
+
* been received, or an error has occurred. When this pollable is ready,
|
|
393
|
+
* the `get` method will return `some`.
|
|
394
|
+
*/
|
|
395
|
+
subscribe(): Pollable;
|
|
396
|
+
/**
|
|
397
|
+
* Returns the incoming HTTP Response, or an error, once one is ready.
|
|
398
|
+
*
|
|
399
|
+
* The outer `option` represents future readiness. Users can wait on this
|
|
400
|
+
* `option` to become `some` using the `subscribe` method.
|
|
401
|
+
*
|
|
402
|
+
* The outer `result` is used to retrieve the response or error at most
|
|
403
|
+
* once. It will be success on the first call in which the outer option
|
|
404
|
+
* is `some`, and error on subsequent calls.
|
|
405
|
+
*
|
|
406
|
+
* The inner `result` represents that either the incoming HTTP Response
|
|
407
|
+
* status and headers have received successfully, or that an error
|
|
408
|
+
* occurred. Errors may also occur while consuming the response body,
|
|
409
|
+
* but those will be reported by the `incoming-body` and its
|
|
410
|
+
* `output-stream` child.
|
|
411
|
+
*/
|
|
412
|
+
get(): Result<Result<IncomingResponse, ErrorCode>, void> | undefined;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export class FutureTrailers {
|
|
416
|
+
/**
|
|
417
|
+
* This type does not have a public constructor.
|
|
418
|
+
*/
|
|
419
|
+
private constructor();
|
|
420
|
+
/**
|
|
421
|
+
* Returns a pollable which becomes ready when either the trailers have
|
|
422
|
+
* been received, or an error has occurred. When this pollable is ready,
|
|
423
|
+
* the `get` method will return `some`.
|
|
424
|
+
*/
|
|
425
|
+
subscribe(): Pollable;
|
|
426
|
+
/**
|
|
427
|
+
* Returns the contents of the trailers, or an error which occurred,
|
|
428
|
+
* once the future is ready.
|
|
429
|
+
*
|
|
430
|
+
* The outer `option` represents future readiness. Users can wait on this
|
|
431
|
+
* `option` to become `some` using the `subscribe` method.
|
|
432
|
+
*
|
|
433
|
+
* The outer `result` is used to retrieve the trailers or error at most
|
|
434
|
+
* once. It will be success on the first call in which the outer option
|
|
435
|
+
* is `some`, and error on subsequent calls.
|
|
436
|
+
*
|
|
437
|
+
* The inner `result` represents that either the HTTP Request or Response
|
|
438
|
+
* body, as well as any trailers, were received successfully, or that an
|
|
439
|
+
* error occurred receiving them. The optional `trailers` indicates whether
|
|
440
|
+
* or not trailers were present in the body.
|
|
441
|
+
*
|
|
442
|
+
* When some `trailers` are returned by this method, the `trailers`
|
|
443
|
+
* resource is immutable, and a child. Use of the `set`, `append`, or
|
|
444
|
+
* `delete` methods will return an error, and the resource must be
|
|
445
|
+
* dropped before the parent `future-trailers` is dropped.
|
|
446
|
+
*/
|
|
447
|
+
get(): Result<Result<Trailers | undefined, ErrorCode>, void> | undefined;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export class IncomingBody {
|
|
451
|
+
/**
|
|
452
|
+
* This type does not have a public constructor.
|
|
453
|
+
*/
|
|
454
|
+
private constructor();
|
|
455
|
+
/**
|
|
456
|
+
* Returns the contents of the body, as a stream of bytes.
|
|
457
|
+
*
|
|
458
|
+
* Returns success on first call: the stream representing the contents
|
|
459
|
+
* can be retrieved at most once. Subsequent calls will return error.
|
|
460
|
+
*
|
|
461
|
+
* The returned `input-stream` resource is a child: it must be dropped
|
|
462
|
+
* before the parent `incoming-body` is dropped, or consumed by
|
|
463
|
+
* `incoming-body.finish`.
|
|
464
|
+
*
|
|
465
|
+
* This invariant ensures that the implementation can determine whether
|
|
466
|
+
* the user is consuming the contents of the body, waiting on the
|
|
467
|
+
* `future-trailers` to be ready, or neither. This allows for network
|
|
468
|
+
* backpressure is to be applied when the user is consuming the body,
|
|
469
|
+
* and for that backpressure to not inhibit delivery of the trailers if
|
|
470
|
+
* the user does not read the entire body.
|
|
471
|
+
*/
|
|
472
|
+
stream(): InputStream;
|
|
473
|
+
/**
|
|
474
|
+
* Takes ownership of `incoming-body`, and returns a `future-trailers`.
|
|
475
|
+
* This function will trap if the `input-stream` child is still alive.
|
|
476
|
+
*/
|
|
477
|
+
static finish(this_: IncomingBody): FutureTrailers;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export class IncomingRequest {
|
|
481
|
+
/**
|
|
482
|
+
* This type does not have a public constructor.
|
|
483
|
+
*/
|
|
484
|
+
private constructor();
|
|
485
|
+
/**
|
|
486
|
+
* Returns the method of the incoming request.
|
|
487
|
+
*/
|
|
488
|
+
method(): Method;
|
|
489
|
+
/**
|
|
490
|
+
* Returns the path with query parameters from the request, as a string.
|
|
491
|
+
*/
|
|
492
|
+
pathWithQuery(): string | undefined;
|
|
493
|
+
/**
|
|
494
|
+
* Returns the protocol scheme from the request.
|
|
495
|
+
*/
|
|
496
|
+
scheme(): Scheme | undefined;
|
|
497
|
+
/**
|
|
498
|
+
* Returns the authority of the Request's target URI, if present.
|
|
499
|
+
*/
|
|
500
|
+
authority(): string | undefined;
|
|
501
|
+
/**
|
|
502
|
+
* Get the `headers` associated with the request.
|
|
503
|
+
*
|
|
504
|
+
* The returned `headers` resource is immutable: `set`, `append`, and
|
|
505
|
+
* `delete` operations will fail with `header-error.immutable`.
|
|
506
|
+
*
|
|
507
|
+
* The `headers` returned are a child resource: it must be dropped before
|
|
508
|
+
* the parent `incoming-request` is dropped. Dropping this
|
|
509
|
+
* `incoming-request` before all children are dropped will trap.
|
|
510
|
+
*/
|
|
511
|
+
headers(): Headers;
|
|
512
|
+
/**
|
|
513
|
+
* Gives the `incoming-body` associated with this request. Will only
|
|
514
|
+
* return success at most once, and subsequent calls will return error.
|
|
515
|
+
*/
|
|
516
|
+
consume(): IncomingBody;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export class IncomingResponse {
|
|
520
|
+
/**
|
|
521
|
+
* This type does not have a public constructor.
|
|
522
|
+
*/
|
|
523
|
+
private constructor();
|
|
524
|
+
/**
|
|
525
|
+
* Returns the status code from the incoming response.
|
|
526
|
+
*/
|
|
527
|
+
status(): StatusCode;
|
|
528
|
+
/**
|
|
529
|
+
* Returns the headers from the incoming response.
|
|
530
|
+
*
|
|
531
|
+
* The returned `headers` resource is immutable: `set`, `append`, and
|
|
532
|
+
* `delete` operations will fail with `header-error.immutable`.
|
|
533
|
+
*
|
|
534
|
+
* This headers resource is a child: it must be dropped before the parent
|
|
535
|
+
* `incoming-response` is dropped.
|
|
536
|
+
*/
|
|
537
|
+
headers(): Headers;
|
|
538
|
+
/**
|
|
539
|
+
* Returns the incoming body. May be called at most once. Returns error
|
|
540
|
+
* if called additional times.
|
|
541
|
+
*/
|
|
542
|
+
consume(): IncomingBody;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export class OutgoingBody {
|
|
546
|
+
/**
|
|
547
|
+
* This type does not have a public constructor.
|
|
548
|
+
*/
|
|
549
|
+
private constructor();
|
|
550
|
+
/**
|
|
551
|
+
* Returns a stream for writing the body contents.
|
|
552
|
+
*
|
|
553
|
+
* The returned `output-stream` is a child resource: it must be dropped
|
|
554
|
+
* before the parent `outgoing-body` resource is dropped (or finished),
|
|
555
|
+
* otherwise the `outgoing-body` drop or `finish` will trap.
|
|
556
|
+
*
|
|
557
|
+
* Returns success on the first call: the `output-stream` resource for
|
|
558
|
+
* this `outgoing-body` may be retrieved at most once. Subsequent calls
|
|
559
|
+
* will return error.
|
|
560
|
+
*/
|
|
561
|
+
write(): OutputStream;
|
|
562
|
+
/**
|
|
563
|
+
* Finalize an outgoing body, optionally providing trailers. This must be
|
|
564
|
+
* called to signal that the response is complete. If the `outgoing-body`
|
|
565
|
+
* is dropped without calling `outgoing-body.finalize`, the implementation
|
|
566
|
+
* should treat the body as corrupted.
|
|
567
|
+
*
|
|
568
|
+
* Fails if the body's `outgoing-request` or `outgoing-response` was
|
|
569
|
+
* constructed with a Content-Length header, and the contents written
|
|
570
|
+
* to the body (via `write`) does not match the value given in the
|
|
571
|
+
* Content-Length.
|
|
572
|
+
*/
|
|
573
|
+
static finish(this_: OutgoingBody, trailers: Trailers | undefined): void;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export class OutgoingRequest {
|
|
577
|
+
/**
|
|
578
|
+
* Construct a new `outgoing-request` with a default `method` of `GET`, and
|
|
579
|
+
* `none` values for `path-with-query`, `scheme`, and `authority`.
|
|
580
|
+
*
|
|
581
|
+
* * `headers` is the HTTP Headers for the Request.
|
|
582
|
+
*
|
|
583
|
+
* It is possible to construct, or manipulate with the accessor functions
|
|
584
|
+
* below, an `outgoing-request` with an invalid combination of `scheme`
|
|
585
|
+
* and `authority`, or `headers` which are not permitted to be sent.
|
|
586
|
+
* It is the obligation of the `outgoing-handler.handle` implementation
|
|
587
|
+
* to reject invalid constructions of `outgoing-request`.
|
|
588
|
+
*/
|
|
589
|
+
constructor(headers: Headers)
|
|
590
|
+
/**
|
|
591
|
+
* Returns the resource corresponding to the outgoing Body for this
|
|
592
|
+
* Request.
|
|
593
|
+
*
|
|
594
|
+
* Returns success on the first call: the `outgoing-body` resource for
|
|
595
|
+
* this `outgoing-request` can be retrieved at most once. Subsequent
|
|
596
|
+
* calls will return error.
|
|
597
|
+
*/
|
|
598
|
+
body(): OutgoingBody;
|
|
599
|
+
/**
|
|
600
|
+
* Get the Method for the Request.
|
|
601
|
+
*/
|
|
602
|
+
method(): Method;
|
|
603
|
+
/**
|
|
604
|
+
* Set the Method for the Request. Fails if the string present in a
|
|
605
|
+
* `method.other` argument is not a syntactically valid method.
|
|
606
|
+
*/
|
|
607
|
+
setMethod(method: Method): void;
|
|
608
|
+
/**
|
|
609
|
+
* Get the combination of the HTTP Path and Query for the Request.
|
|
610
|
+
* When `none`, this represents an empty Path and empty Query.
|
|
611
|
+
*/
|
|
612
|
+
pathWithQuery(): string | undefined;
|
|
613
|
+
/**
|
|
614
|
+
* Set the combination of the HTTP Path and Query for the Request.
|
|
615
|
+
* When `none`, this represents an empty Path and empty Query. Fails is the
|
|
616
|
+
* string given is not a syntactically valid path and query uri component.
|
|
617
|
+
*/
|
|
618
|
+
setPathWithQuery(pathWithQuery: string | undefined): void;
|
|
619
|
+
/**
|
|
620
|
+
* Get the HTTP Related Scheme for the Request. When `none`, the
|
|
621
|
+
* implementation may choose an appropriate default scheme.
|
|
622
|
+
*/
|
|
623
|
+
scheme(): Scheme | undefined;
|
|
624
|
+
/**
|
|
625
|
+
* Set the HTTP Related Scheme for the Request. When `none`, the
|
|
626
|
+
* implementation may choose an appropriate default scheme. Fails if the
|
|
627
|
+
* string given is not a syntactically valid uri scheme.
|
|
628
|
+
*/
|
|
629
|
+
setScheme(scheme: Scheme | undefined): void;
|
|
630
|
+
/**
|
|
631
|
+
* Get the authority of the Request's target URI. A value of `none` may be used
|
|
632
|
+
* with Related Schemes which do not require an authority. The HTTP and
|
|
633
|
+
* HTTPS schemes always require an authority.
|
|
634
|
+
*/
|
|
635
|
+
authority(): string | undefined;
|
|
636
|
+
/**
|
|
637
|
+
* Set the authority of the Request's target URI. A value of `none` may be used
|
|
638
|
+
* with Related Schemes which do not require an authority. The HTTP and
|
|
639
|
+
* HTTPS schemes always require an authority. Fails if the string given is
|
|
640
|
+
* not a syntactically valid URI authority.
|
|
641
|
+
*/
|
|
642
|
+
setAuthority(authority: string | undefined): void;
|
|
643
|
+
/**
|
|
644
|
+
* Get the headers associated with the Request.
|
|
645
|
+
*
|
|
646
|
+
* The returned `headers` resource is immutable: `set`, `append`, and
|
|
647
|
+
* `delete` operations will fail with `header-error.immutable`.
|
|
648
|
+
*
|
|
649
|
+
* This headers resource is a child: it must be dropped before the parent
|
|
650
|
+
* `outgoing-request` is dropped, or its ownership is transferred to
|
|
651
|
+
* another component by e.g. `outgoing-handler.handle`.
|
|
652
|
+
*/
|
|
653
|
+
headers(): Headers;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export class OutgoingResponse {
|
|
657
|
+
/**
|
|
658
|
+
* Construct an `outgoing-response`, with a default `status-code` of `200`.
|
|
659
|
+
* If a different `status-code` is needed, it must be set via the
|
|
660
|
+
* `set-status-code` method.
|
|
661
|
+
*
|
|
662
|
+
* * `headers` is the HTTP Headers for the Response.
|
|
663
|
+
*/
|
|
664
|
+
constructor(headers: Headers)
|
|
665
|
+
/**
|
|
666
|
+
* Get the HTTP Status Code for the Response.
|
|
667
|
+
*/
|
|
668
|
+
statusCode(): StatusCode;
|
|
669
|
+
/**
|
|
670
|
+
* Set the HTTP Status Code for the Response. Fails if the status-code
|
|
671
|
+
* given is not a valid http status code.
|
|
672
|
+
*/
|
|
673
|
+
setStatusCode(statusCode: StatusCode): void;
|
|
674
|
+
/**
|
|
675
|
+
* Get the headers associated with the Request.
|
|
676
|
+
*
|
|
677
|
+
* The returned `headers` resource is immutable: `set`, `append`, and
|
|
678
|
+
* `delete` operations will fail with `header-error.immutable`.
|
|
679
|
+
*
|
|
680
|
+
* This headers resource is a child: it must be dropped before the parent
|
|
681
|
+
* `outgoing-request` is dropped, or its ownership is transferred to
|
|
682
|
+
* another component by e.g. `outgoing-handler.handle`.
|
|
683
|
+
*/
|
|
684
|
+
headers(): Headers;
|
|
685
|
+
/**
|
|
686
|
+
* Returns the resource corresponding to the outgoing Body for this Response.
|
|
687
|
+
*
|
|
688
|
+
* Returns success on the first call: the `outgoing-body` resource for
|
|
689
|
+
* this `outgoing-response` can be retrieved at most once. Subsequent
|
|
690
|
+
* calls will return error.
|
|
691
|
+
*/
|
|
692
|
+
body(): OutgoingBody;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export class RequestOptions {
|
|
696
|
+
/**
|
|
697
|
+
* Construct a default `request-options` value.
|
|
698
|
+
*/
|
|
699
|
+
constructor()
|
|
700
|
+
/**
|
|
701
|
+
* The timeout for the initial connect to the HTTP Server.
|
|
702
|
+
*/
|
|
703
|
+
connectTimeout(): Duration | undefined;
|
|
704
|
+
/**
|
|
705
|
+
* Set the timeout for the initial connect to the HTTP Server. An error
|
|
706
|
+
* return value indicates that this timeout is not supported.
|
|
707
|
+
*/
|
|
708
|
+
setConnectTimeout(duration: Duration | undefined): void;
|
|
709
|
+
/**
|
|
710
|
+
* The timeout for receiving the first byte of the Response body.
|
|
711
|
+
*/
|
|
712
|
+
firstByteTimeout(): Duration | undefined;
|
|
713
|
+
/**
|
|
714
|
+
* Set the timeout for receiving the first byte of the Response body. An
|
|
715
|
+
* error return value indicates that this timeout is not supported.
|
|
716
|
+
*/
|
|
717
|
+
setFirstByteTimeout(duration: Duration | undefined): void;
|
|
718
|
+
/**
|
|
719
|
+
* The timeout for receiving subsequent chunks of bytes in the Response
|
|
720
|
+
* body stream.
|
|
721
|
+
*/
|
|
722
|
+
betweenBytesTimeout(): Duration | undefined;
|
|
723
|
+
/**
|
|
724
|
+
* Set the timeout for receiving subsequent chunks of bytes in the Response
|
|
725
|
+
* body stream. An error return value indicates that this timeout is not
|
|
726
|
+
* supported.
|
|
727
|
+
*/
|
|
728
|
+
setBetweenBytesTimeout(duration: Duration | undefined): void;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export class ResponseOutparam {
|
|
732
|
+
/**
|
|
733
|
+
* This type does not have a public constructor.
|
|
734
|
+
*/
|
|
735
|
+
private constructor();
|
|
736
|
+
/**
|
|
737
|
+
* Set the value of the `response-outparam` to either send a response,
|
|
738
|
+
* or indicate an error.
|
|
739
|
+
*
|
|
740
|
+
* This method consumes the `response-outparam` to ensure that it is
|
|
741
|
+
* called at most once. If it is never called, the implementation
|
|
742
|
+
* will respond with an error.
|
|
743
|
+
*
|
|
744
|
+
* The user may provide an `error` to `response` to allow the
|
|
745
|
+
* implementation determine how to respond with an HTTP error response.
|
|
746
|
+
*/
|
|
747
|
+
static set(param: ResponseOutparam, response: Result<OutgoingResponse, ErrorCode>): void;
|
|
748
|
+
}
|