@bytecodealliance/preview3-shim 0.1.2 → 0.2.0
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/nodejs/cli.d.ts +51 -0
- package/dist/nodejs/cli.js +106 -0
- package/dist/nodejs/clocks.d.ts +55 -0
- package/dist/nodejs/clocks.js +83 -0
- package/dist/nodejs/filesystem/descriptor.d.ts +443 -0
- package/dist/nodejs/filesystem/descriptor.js +1010 -0
- package/dist/nodejs/filesystem/error.d.ts +61 -0
- package/dist/nodejs/filesystem/error.js +86 -0
- package/dist/nodejs/filesystem/utils.d.ts +8 -0
- package/dist/nodejs/filesystem/utils.js +25 -0
- package/dist/nodejs/filesystem.js +2 -0
- package/dist/nodejs/finalization.d.ts +2 -0
- package/{lib → dist}/nodejs/finalization.js +15 -21
- package/dist/nodejs/future.d.ts +98 -0
- package/dist/nodejs/future.js +176 -0
- package/dist/nodejs/http/client.d.ts +22 -0
- package/dist/nodejs/http/client.js +138 -0
- package/dist/nodejs/http/error.d.ts +18 -0
- package/dist/nodejs/http/error.js +62 -0
- package/dist/nodejs/http/fields.d.ts +144 -0
- package/dist/nodejs/http/fields.js +327 -0
- package/dist/nodejs/http/request.d.ts +256 -0
- package/dist/nodejs/http/request.js +606 -0
- package/dist/nodejs/http/response.d.ts +82 -0
- package/dist/nodejs/http/response.js +202 -0
- package/dist/nodejs/http/server.d.ts +13 -0
- package/dist/nodejs/http/server.js +127 -0
- package/dist/nodejs/http.d.ts +19 -0
- package/{lib → dist}/nodejs/http.js +13 -18
- package/dist/nodejs/index.js +8 -0
- package/dist/nodejs/random.d.ts +5 -0
- package/{lib → dist}/nodejs/random.js +2 -8
- package/dist/nodejs/sockets/address.d.ts +78 -0
- package/dist/nodejs/sockets/address.js +120 -0
- package/dist/nodejs/sockets/error.d.ts +83 -0
- package/dist/nodejs/sockets/error.js +120 -0
- package/dist/nodejs/sockets/ip-name-lookup.d.ts +18 -0
- package/dist/nodejs/sockets/ip-name-lookup.js +84 -0
- package/dist/nodejs/sockets/tcp.d.ts +333 -0
- package/dist/nodejs/sockets/tcp.js +723 -0
- package/dist/nodejs/sockets/udp.d.ts +224 -0
- package/dist/nodejs/sockets/udp.js +475 -0
- package/dist/nodejs/sockets.d.ts +11 -0
- package/{lib → dist}/nodejs/sockets.js +2 -5
- package/dist/nodejs/stream.d.ts +161 -0
- package/dist/nodejs/stream.js +388 -0
- package/dist/nodejs/workers/cli-worker.d.ts +1 -0
- package/dist/nodejs/workers/cli-worker.js +41 -0
- package/dist/nodejs/workers/filesystem-worker.d.ts +1 -0
- package/dist/nodejs/workers/filesystem-worker.js +102 -0
- package/dist/nodejs/workers/http-worker.d.ts +1 -0
- package/dist/nodejs/workers/http-worker.js +355 -0
- package/dist/nodejs/workers/resource-worker.d.ts +13 -0
- package/dist/nodejs/workers/resource-worker.js +152 -0
- package/dist/nodejs/workers/tcp-worker.d.ts +2 -0
- package/dist/nodejs/workers/tcp-worker.js +318 -0
- package/dist/nodejs/workers/udp-worker.d.ts +1 -0
- package/dist/nodejs/workers/udp-worker.js +156 -0
- package/package.json +20 -12
- package/types/interfaces/wasi-cli-environment.d.ts +3 -3
- package/types/interfaces/wasi-cli-exit.d.ts +12 -1
- package/types/interfaces/wasi-cli-run.d.ts +1 -1
- package/types/interfaces/wasi-cli-stderr.d.ts +3 -3
- package/types/interfaces/wasi-cli-stdin.d.ts +5 -5
- package/types/interfaces/wasi-cli-stdout.d.ts +3 -3
- package/types/interfaces/wasi-cli-terminal-input.d.ts +1 -1
- package/types/interfaces/wasi-cli-terminal-output.d.ts +1 -1
- package/types/interfaces/wasi-cli-terminal-stderr.d.ts +1 -1
- package/types/interfaces/wasi-cli-terminal-stdin.d.ts +1 -1
- package/types/interfaces/wasi-cli-terminal-stdout.d.ts +1 -1
- package/types/interfaces/wasi-cli-types.d.ts +5 -5
- package/types/interfaces/wasi-clocks-monotonic-clock.d.ts +3 -3
- package/types/interfaces/wasi-clocks-system-clock.d.ts +6 -6
- package/types/interfaces/wasi-clocks-types.d.ts +1 -1
- package/types/interfaces/wasi-filesystem-preopens.d.ts +1 -1
- package/types/interfaces/wasi-filesystem-types.d.ts +74 -74
- package/types/interfaces/wasi-http-client.d.ts +1 -1
- package/types/interfaces/wasi-http-handler.d.ts +1 -1
- package/types/interfaces/wasi-http-types.d.ts +34 -34
- package/types/interfaces/wasi-random-insecure-seed.d.ts +5 -5
- package/types/interfaces/wasi-random-insecure.d.ts +5 -5
- package/types/interfaces/wasi-random-random.d.ts +5 -5
- package/types/interfaces/wasi-sockets-ip-name-lookup.d.ts +11 -11
- package/types/interfaces/wasi-sockets-types.d.ts +121 -121
- package/types/wasi-cli-command.d.ts +23 -23
- package/types/wasi-http-service.d.ts +14 -14
- package/lib/nodejs/cli.js +0 -127
- package/lib/nodejs/clocks.js +0 -98
- package/lib/nodejs/filesystem/descriptor.js +0 -1093
- package/lib/nodejs/filesystem/error.js +0 -92
- package/lib/nodejs/filesystem/utils.js +0 -19
- package/lib/nodejs/future.js +0 -190
- package/lib/nodejs/http/client.js +0 -161
- package/lib/nodejs/http/error.js +0 -71
- package/lib/nodejs/http/fields.js +0 -373
- package/lib/nodejs/http/request.js +0 -691
- package/lib/nodejs/http/response.js +0 -227
- package/lib/nodejs/http/server.js +0 -157
- package/lib/nodejs/sockets/address.js +0 -146
- package/lib/nodejs/sockets/error.js +0 -123
- package/lib/nodejs/sockets/ip-name-lookup.js +0 -93
- package/lib/nodejs/sockets/tcp.js +0 -801
- package/lib/nodejs/sockets/udp.js +0 -516
- package/lib/nodejs/stream.js +0 -437
- package/lib/nodejs/workers/cli-worker.js +0 -49
- package/lib/nodejs/workers/filesystem-worker.js +0 -119
- package/lib/nodejs/workers/http-worker.js +0 -417
- package/lib/nodejs/workers/resource-worker.js +0 -195
- package/lib/nodejs/workers/tcp-worker.js +0 -370
- package/lib/nodejs/workers/udp-worker.js +0 -194
- /package/{lib/nodejs/filesystem.js → dist/nodejs/filesystem.d.ts} +0 -0
- /package/{lib/nodejs/index.js → dist/nodejs/index.d.ts} +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { FutureReader } from "../future.js";
|
|
2
|
+
declare const symbolDispose: symbol;
|
|
3
|
+
export declare class RequestOptions {
|
|
4
|
+
#private;
|
|
5
|
+
/**
|
|
6
|
+
* Construct a default ~RequestOptions~ value.
|
|
7
|
+
* WIT:
|
|
8
|
+
* ```
|
|
9
|
+
* constructor()
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* The timeout for the initial connect to the HTTP Server.
|
|
15
|
+
* WIT:
|
|
16
|
+
* ```
|
|
17
|
+
* connect-timeout: func() -> option<duration>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @returns {?number} Duration in milliseconds, or `null` if not set
|
|
21
|
+
*/
|
|
22
|
+
getConnectTimeout(): any;
|
|
23
|
+
/**
|
|
24
|
+
* Set the timeout for the initial connect to the HTTP Server.
|
|
25
|
+
* WIT:
|
|
26
|
+
* ```
|
|
27
|
+
* set-connect-timeout: func(duration: option<duration>) -> result<_, request-options-error>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param {?bigint} duration Duration in nanoseconds, or `null` to clear
|
|
31
|
+
* @throws {HttpError} with payload.tag 'immutable' if this handle is immutable
|
|
32
|
+
*/
|
|
33
|
+
setConnectTimeout(duration: any): void;
|
|
34
|
+
/**
|
|
35
|
+
* The timeout for receiving the first byte of the Response body.
|
|
36
|
+
* WIT:
|
|
37
|
+
* ```
|
|
38
|
+
* first-byte-timeout: func() -> option<duration>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @returns {?bigint} Duration in nanoseconds, or `null` if not set
|
|
42
|
+
*/
|
|
43
|
+
getFirstByteTimeout(): any;
|
|
44
|
+
/**
|
|
45
|
+
* Set the timeout for receiving the first byte of the Response body.
|
|
46
|
+
* WIT:
|
|
47
|
+
* ```
|
|
48
|
+
* set-first-byte-timeout: func(duration: option<duration>) -> result<_, request-options-error>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param {?bigint} duration Duration in nanoseconds, or `null` to clear
|
|
52
|
+
* @throws {HttpError} with payload.tag 'immutable' if this handle is immutable
|
|
53
|
+
*/
|
|
54
|
+
setFirstByteTimeout(duration: any): void;
|
|
55
|
+
/**
|
|
56
|
+
* The timeout for receiving subsequent chunks of bytes in the Response body.
|
|
57
|
+
* WIT:
|
|
58
|
+
* ```
|
|
59
|
+
* between-bytes-timeout: func() -> option<duration>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @returns {?bigint} Duration in nanoseconds, or `null` if not set
|
|
63
|
+
*/
|
|
64
|
+
getBetweenBytesTimeout(): any;
|
|
65
|
+
/**
|
|
66
|
+
* Set the timeout for receiving subsequent chunks of bytes in the Response body.
|
|
67
|
+
* WIT:
|
|
68
|
+
* ```
|
|
69
|
+
* set-between-bytes-timeout: func(duration: option<duration>) -> result<_, request-options-error>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param {?bigint} duration Duration in nanoseconds, or `null` to clear
|
|
73
|
+
* @throws {HttpError} with payload.tag 'immutable' if this handle is immutable
|
|
74
|
+
*/
|
|
75
|
+
setBetweenBytesTimeout(duration: any): void;
|
|
76
|
+
/**
|
|
77
|
+
* Make a deep copy of the ~RequestOptions~.
|
|
78
|
+
* WIT:
|
|
79
|
+
* ```
|
|
80
|
+
* clone: func() -> request-options
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @returns {RequestOptions} A new mutable copy
|
|
84
|
+
*/
|
|
85
|
+
clone(): RequestOptions;
|
|
86
|
+
/**
|
|
87
|
+
* Mark options as immutable
|
|
88
|
+
*
|
|
89
|
+
* @param {RequestOptions} opts - The RequestOptions instance to mark as immutable
|
|
90
|
+
* @returns {RequestOptions} The same instance, now immutable
|
|
91
|
+
*/
|
|
92
|
+
static _lock(fields: any): any;
|
|
93
|
+
_ensureMutable(): void;
|
|
94
|
+
}
|
|
95
|
+
export declare function _optionsLock(fields: any): any;
|
|
96
|
+
export declare class Request {
|
|
97
|
+
#private;
|
|
98
|
+
[symbolDispose]: () => void;
|
|
99
|
+
constructor(t: any);
|
|
100
|
+
/**
|
|
101
|
+
* Construct a new Request with default values.
|
|
102
|
+
*
|
|
103
|
+
* WIT:
|
|
104
|
+
* ```
|
|
105
|
+
* new: static func(
|
|
106
|
+
* headers: headers,
|
|
107
|
+
* contents: option<stream<u8>>,
|
|
108
|
+
* trailers: future<result<option<trailers>, error-code>>,
|
|
109
|
+
* options: option<request-options>
|
|
110
|
+
* ) -> tuple<request, future<result<_, error-code>>>;
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @param {Fields} headers immutable headers resource
|
|
114
|
+
* @param {?StreamReader|object} contents optional body stream
|
|
115
|
+
* @param {FutureReader|Promise} trailers future for trailers
|
|
116
|
+
* @param {?RequestOptions} options optional RequestOptions
|
|
117
|
+
* @returns {[Request, FutureReader]}
|
|
118
|
+
* @throws {HttpError} with payload.tag 'invalid-argument' for invalid arguments
|
|
119
|
+
*
|
|
120
|
+
*/
|
|
121
|
+
static new(headers: any, contents: any, trailers: any, options: any): [Request, FutureReader];
|
|
122
|
+
/**
|
|
123
|
+
* Get the Method for the Request.
|
|
124
|
+
*
|
|
125
|
+
* WIT:
|
|
126
|
+
* ```
|
|
127
|
+
* method: func() -> method;
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @returns {method}
|
|
131
|
+
*/
|
|
132
|
+
getMethod(): {
|
|
133
|
+
tag: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Set the Method for the Request.
|
|
137
|
+
*
|
|
138
|
+
* WIT:
|
|
139
|
+
* ```
|
|
140
|
+
* set-method: func(method: method) -> result;
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @param {method} method
|
|
144
|
+
* @throws {HttpError} with payload.tag 'invalid-syntax' if method is invalid
|
|
145
|
+
*/
|
|
146
|
+
setMethod(method: any): void;
|
|
147
|
+
/**
|
|
148
|
+
* Get the HTTP Path and Query.
|
|
149
|
+
*
|
|
150
|
+
* WIT:
|
|
151
|
+
* ```
|
|
152
|
+
* path-with-query: func() -> option<string>;
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @returns {?string}
|
|
156
|
+
*/
|
|
157
|
+
getPathWithQuery(): any;
|
|
158
|
+
/**
|
|
159
|
+
* Set the HTTP Path and Query.
|
|
160
|
+
*
|
|
161
|
+
* WIT:
|
|
162
|
+
* ```
|
|
163
|
+
* set-path-with-query: func(path-with-query: option<string>) -> result;
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param {?string} pathWithQuery
|
|
167
|
+
* @throws {HttpError} with payload.tag 'invalid-syntax' if invalid URI component
|
|
168
|
+
*/
|
|
169
|
+
setPathWithQuery(pathWithQuery: any): void;
|
|
170
|
+
/**
|
|
171
|
+
* Get the HTTP Scheme.
|
|
172
|
+
*
|
|
173
|
+
* WIT:
|
|
174
|
+
* ```
|
|
175
|
+
* scheme: func() -> option<scheme>;
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @returns {?scheme}
|
|
179
|
+
*/
|
|
180
|
+
getScheme(): any;
|
|
181
|
+
/**
|
|
182
|
+
* Set the HTTP Scheme.
|
|
183
|
+
*
|
|
184
|
+
* WIT:
|
|
185
|
+
* ```
|
|
186
|
+
* set-scheme: func(scheme: option<scheme>) -> result;
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @param {?scheme} scheme
|
|
190
|
+
* @throws {HttpError} with payload.tag 'invalid-syntax' if invalid scheme
|
|
191
|
+
*/
|
|
192
|
+
setScheme(scheme: any): void;
|
|
193
|
+
/**
|
|
194
|
+
* Get the authority for the target URI.
|
|
195
|
+
*
|
|
196
|
+
* WIT:
|
|
197
|
+
* ```
|
|
198
|
+
* authority: func() -> option<string>;
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @returns {?string}
|
|
202
|
+
*/
|
|
203
|
+
getAuthority(): any;
|
|
204
|
+
/**
|
|
205
|
+
* Set the authority for the target URI.
|
|
206
|
+
*
|
|
207
|
+
* WIT:
|
|
208
|
+
* ```
|
|
209
|
+
* set-authority: func(authority: option<string>) -> result;
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @param {?string} authority
|
|
213
|
+
* @throws {HttpError} with payload.tag 'invalid-syntax' if invalid authority
|
|
214
|
+
*/
|
|
215
|
+
setAuthority(authority: any): void;
|
|
216
|
+
/**
|
|
217
|
+
* Get the associated request-options resource.
|
|
218
|
+
*
|
|
219
|
+
* WIT:
|
|
220
|
+
* ```
|
|
221
|
+
* options: func() -> option<request-options>;
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @returns {?RequestOptions}
|
|
225
|
+
*/
|
|
226
|
+
getOptions(): any;
|
|
227
|
+
/**
|
|
228
|
+
* Get the headers resource (immutable).
|
|
229
|
+
*
|
|
230
|
+
* WIT:
|
|
231
|
+
* ```
|
|
232
|
+
* headers: func() -> headers;
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* @returns {Fields}
|
|
236
|
+
*/
|
|
237
|
+
getHeaders(): any;
|
|
238
|
+
/**
|
|
239
|
+
* Get body stream and trailers future, consuming the resource.
|
|
240
|
+
*
|
|
241
|
+
* WIT:
|
|
242
|
+
* ```
|
|
243
|
+
* consume-body: static func(this: request, res: future<result<_, error-code>>)
|
|
244
|
+
* -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @param {Request} request - The request to consume.
|
|
248
|
+
* @param {FutureReader} res - A future for communicating errors.
|
|
249
|
+
* @returns {[StreamReader, FutureReader]} A tuple of [body stream, trailers future].
|
|
250
|
+
* @throws {HttpError} with payload.tag 'invalid-state' if body already open or consumed.
|
|
251
|
+
*/
|
|
252
|
+
static consumeBody(request: any, res: any): any[];
|
|
253
|
+
_resolve(result: any): void;
|
|
254
|
+
}
|
|
255
|
+
export declare function _schemeToString(scheme: any): any;
|
|
256
|
+
export {};
|