@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @module Interface wasi:http/types@0.3.0
|
|
1
|
+
/** @module Interface wasi:http/types@0.3.0 **/
|
|
2
2
|
export type Duration = import('./wasi-clocks-types.js').Duration;
|
|
3
3
|
/**
|
|
4
4
|
* This type corresponds to HTTP standard Methods.
|
|
@@ -294,7 +294,7 @@ export interface RequestOptionsErrorOther {
|
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
296
|
* Field names are always strings.
|
|
297
|
-
*
|
|
297
|
+
*
|
|
298
298
|
* Field names should always be treated as case insensitive by the `fields`
|
|
299
299
|
* resource for the purposes of equality checking.
|
|
300
300
|
*/
|
|
@@ -322,24 +322,24 @@ export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
|
|
|
322
322
|
export class Fields {
|
|
323
323
|
/**
|
|
324
324
|
* Construct an empty HTTP Fields.
|
|
325
|
-
*
|
|
325
|
+
*
|
|
326
326
|
* The resulting `fields` is mutable.
|
|
327
327
|
*/
|
|
328
328
|
constructor()
|
|
329
329
|
/**
|
|
330
330
|
* Construct an HTTP Fields.
|
|
331
|
-
*
|
|
331
|
+
*
|
|
332
332
|
* The resulting `fields` is mutable.
|
|
333
|
-
*
|
|
333
|
+
*
|
|
334
334
|
* The list represents each name-value pair in the Fields. Names
|
|
335
335
|
* which have multiple values are represented by multiple entries in this
|
|
336
336
|
* list with the same name.
|
|
337
|
-
*
|
|
337
|
+
*
|
|
338
338
|
* The tuple is a pair of the field name, represented as a string, and
|
|
339
339
|
* Value, represented as a list of bytes. In a valid Fields, all names
|
|
340
340
|
* and values are valid UTF-8 strings. However, values are not always
|
|
341
341
|
* well-formed, so they are represented as a raw list of bytes.
|
|
342
|
-
*
|
|
342
|
+
*
|
|
343
343
|
* An error result will be returned if any header or value was
|
|
344
344
|
* syntactically invalid, if a header was forbidden, or if the
|
|
345
345
|
* entries would exceed an implementation size limit.
|
|
@@ -360,9 +360,9 @@ export class Fields {
|
|
|
360
360
|
/**
|
|
361
361
|
* Set all of the values for a name. Clears any existing values for that
|
|
362
362
|
* name, if they have been set.
|
|
363
|
-
*
|
|
363
|
+
*
|
|
364
364
|
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
365
|
-
*
|
|
365
|
+
*
|
|
366
366
|
* Fails with `header-error.size-exceeded` if the name or values would
|
|
367
367
|
* exceed an implementation-defined size limit.
|
|
368
368
|
*/
|
|
@@ -370,25 +370,25 @@ export class Fields {
|
|
|
370
370
|
/**
|
|
371
371
|
* Delete all values for a name. Does nothing if no values for the name
|
|
372
372
|
* exist.
|
|
373
|
-
*
|
|
373
|
+
*
|
|
374
374
|
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
375
375
|
*/
|
|
376
376
|
'delete'(name: FieldName): void;
|
|
377
377
|
/**
|
|
378
378
|
* Delete all values for a name. Does nothing if no values for the name
|
|
379
379
|
* exist.
|
|
380
|
-
*
|
|
380
|
+
*
|
|
381
381
|
* Returns all values previously corresponding to the name, if any.
|
|
382
|
-
*
|
|
382
|
+
*
|
|
383
383
|
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
384
384
|
*/
|
|
385
385
|
getAndDelete(name: FieldName): Array<FieldValue>;
|
|
386
386
|
/**
|
|
387
387
|
* Append a value for a name. Does not change or delete any existing
|
|
388
388
|
* values for that name.
|
|
389
|
-
*
|
|
389
|
+
*
|
|
390
390
|
* Fails with `header-error.immutable` if the `fields` are immutable.
|
|
391
|
-
*
|
|
391
|
+
*
|
|
392
392
|
* Fails with `header-error.size-exceeded` if the value would exceed
|
|
393
393
|
* an implementation-defined size limit.
|
|
394
394
|
*/
|
|
@@ -396,11 +396,11 @@ export class Fields {
|
|
|
396
396
|
/**
|
|
397
397
|
* Retrieve the full set of names and values in the Fields. Like the
|
|
398
398
|
* constructor, the list represents each name-value pair.
|
|
399
|
-
*
|
|
399
|
+
*
|
|
400
400
|
* The outer list represents each name-value pair in the Fields. Names
|
|
401
401
|
* which have multiple values are represented by multiple entries in this
|
|
402
402
|
* list with the same name.
|
|
403
|
-
*
|
|
403
|
+
*
|
|
404
404
|
* The names and values are always returned in the original casing and in
|
|
405
405
|
* the order in which they will be serialized for transport.
|
|
406
406
|
*/
|
|
@@ -421,24 +421,24 @@ export class Request {
|
|
|
421
421
|
/**
|
|
422
422
|
* Construct a new `request` with a default `method` of `GET`, and
|
|
423
423
|
* `none` values for `path-with-query`, `scheme`, and `authority`.
|
|
424
|
-
*
|
|
424
|
+
*
|
|
425
425
|
* `headers` is the HTTP Headers for the Request.
|
|
426
|
-
*
|
|
426
|
+
*
|
|
427
427
|
* `contents` is the optional body content stream with `none`
|
|
428
428
|
* representing a zero-length content stream.
|
|
429
429
|
* Once it is closed, `trailers` future must resolve to a result.
|
|
430
430
|
* If `trailers` resolves to an error, underlying connection
|
|
431
431
|
* will be closed immediately.
|
|
432
|
-
*
|
|
432
|
+
*
|
|
433
433
|
* `options` is optional `request-options` resource to be used
|
|
434
434
|
* if the request is sent over a network connection.
|
|
435
|
-
*
|
|
435
|
+
*
|
|
436
436
|
* It is possible to construct, or manipulate with the accessor functions
|
|
437
437
|
* below, a `request` with an invalid combination of `scheme`
|
|
438
438
|
* and `authority`, or `headers` which are not permitted to be sent.
|
|
439
439
|
* It is the obligation of the `handler.handle` implementation
|
|
440
440
|
* to reject invalid constructions of `request`.
|
|
441
|
-
*
|
|
441
|
+
*
|
|
442
442
|
* The returned future resolves to result of transmission of this request.
|
|
443
443
|
*/
|
|
444
444
|
static 'new'(headers: Headers, contents: ReadableStream<number> | undefined, trailers: Promise<Result<Trailers | undefined, ErrorCode>>, options: RequestOptions | undefined): [Request, Promise<Result<void, ErrorCode>>];
|
|
@@ -488,10 +488,10 @@ export class Request {
|
|
|
488
488
|
setAuthority(authority: string | undefined): void;
|
|
489
489
|
/**
|
|
490
490
|
* Get the `request-options` to be associated with this request
|
|
491
|
-
*
|
|
491
|
+
*
|
|
492
492
|
* The returned `request-options` resource is immutable: `set-*` operations
|
|
493
493
|
* will fail if invoked.
|
|
494
|
-
*
|
|
494
|
+
*
|
|
495
495
|
* This `request-options` resource is a child: it must be dropped before
|
|
496
496
|
* the parent `request` is dropped, or its ownership is transferred to
|
|
497
497
|
* another component by e.g. `handler.handle`.
|
|
@@ -499,22 +499,22 @@ export class Request {
|
|
|
499
499
|
getOptions(): RequestOptions | undefined;
|
|
500
500
|
/**
|
|
501
501
|
* Get the headers associated with the Request.
|
|
502
|
-
*
|
|
502
|
+
*
|
|
503
503
|
* The returned `headers` resource is immutable: `set`, `append`, and
|
|
504
504
|
* `delete` operations will fail with `header-error.immutable`.
|
|
505
505
|
*/
|
|
506
506
|
getHeaders(): Headers;
|
|
507
507
|
/**
|
|
508
508
|
* Get body of the Request.
|
|
509
|
-
*
|
|
509
|
+
*
|
|
510
510
|
* Stream returned by this method represents the contents of the body.
|
|
511
511
|
* Once the stream is reported as closed, callers should await the returned
|
|
512
512
|
* future to determine whether the body was received successfully.
|
|
513
513
|
* The future will only resolve after the stream is reported as closed.
|
|
514
|
-
*
|
|
514
|
+
*
|
|
515
515
|
* This function takes a `res` future as a parameter, which can be used to
|
|
516
516
|
* communicate an error in handling of the request.
|
|
517
|
-
*
|
|
517
|
+
*
|
|
518
518
|
* Note that function will move the `request`, but references to headers or
|
|
519
519
|
* request options acquired from it previously will remain valid.
|
|
520
520
|
*/
|
|
@@ -573,15 +573,15 @@ export class Response {
|
|
|
573
573
|
* Construct a new `response`, with a default `status-code` of `200`.
|
|
574
574
|
* If a different `status-code` is needed, it must be set via the
|
|
575
575
|
* `set-status-code` method.
|
|
576
|
-
*
|
|
576
|
+
*
|
|
577
577
|
* `headers` is the HTTP Headers for the Response.
|
|
578
|
-
*
|
|
578
|
+
*
|
|
579
579
|
* `contents` is the optional body content stream with `none`
|
|
580
580
|
* representing a zero-length content stream.
|
|
581
581
|
* Once it is closed, `trailers` future must resolve to a result.
|
|
582
582
|
* If `trailers` resolves to an error, underlying connection
|
|
583
583
|
* will be closed immediately.
|
|
584
|
-
*
|
|
584
|
+
*
|
|
585
585
|
* The returned future resolves to result of transmission of this response.
|
|
586
586
|
*/
|
|
587
587
|
static 'new'(headers: Headers, contents: ReadableStream<number> | undefined, trailers: Promise<Result<Trailers | undefined, ErrorCode>>): [Response, Promise<Result<void, ErrorCode>>];
|
|
@@ -596,22 +596,22 @@ export class Response {
|
|
|
596
596
|
setStatusCode(statusCode: StatusCode): void;
|
|
597
597
|
/**
|
|
598
598
|
* Get the headers associated with the Response.
|
|
599
|
-
*
|
|
599
|
+
*
|
|
600
600
|
* The returned `headers` resource is immutable: `set`, `append`, and
|
|
601
601
|
* `delete` operations will fail with `header-error.immutable`.
|
|
602
602
|
*/
|
|
603
603
|
getHeaders(): Headers;
|
|
604
604
|
/**
|
|
605
605
|
* Get body of the Response.
|
|
606
|
-
*
|
|
606
|
+
*
|
|
607
607
|
* Stream returned by this method represents the contents of the body.
|
|
608
608
|
* Once the stream is reported as closed, callers should await the returned
|
|
609
609
|
* future to determine whether the body was received successfully.
|
|
610
610
|
* The future will only resolve after the stream is reported as closed.
|
|
611
|
-
*
|
|
611
|
+
*
|
|
612
612
|
* This function takes a `res` future as a parameter, which can be used to
|
|
613
613
|
* communicate an error in handling of the response.
|
|
614
|
-
*
|
|
614
|
+
*
|
|
615
615
|
* Note that function will move the `response`, but references to headers
|
|
616
616
|
* acquired from it previously will remain valid.
|
|
617
617
|
*/
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/** @module Interface wasi:random/insecure-seed@0.3.0
|
|
1
|
+
/** @module Interface wasi:random/insecure-seed@0.3.0 **/
|
|
2
2
|
/**
|
|
3
3
|
* Return a 128-bit value that may contain a pseudo-random value.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* The returned value is not required to be computed from a CSPRNG, and may
|
|
6
6
|
* even be entirely deterministic. Host implementations are encouraged to
|
|
7
7
|
* provide pseudo-random values to any program exposed to
|
|
8
8
|
* attacker-controlled content, to enable DoS protection built into many
|
|
9
9
|
* languages' hash-map implementations.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* This function is intended to only be called once, by a source language
|
|
12
12
|
* to initialize Denial Of Service (DoS) protection in its hash-map
|
|
13
13
|
* implementation.
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* # Expected future evolution
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
* This will likely be changed to a value import, to prevent it from being
|
|
18
18
|
* called multiple times and potentially used for purposes other than DoS
|
|
19
19
|
* protection.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/** @module Interface wasi:random/insecure@0.3.0
|
|
1
|
+
/** @module Interface wasi:random/insecure@0.3.0 **/
|
|
2
2
|
/**
|
|
3
3
|
* Return up to `max-len` insecure pseudo-random bytes.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* This function is not cryptographically secure. Do not use it for
|
|
6
6
|
* anything related to security.
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* There are no requirements on the values of the returned bytes, however
|
|
9
9
|
* implementations are encouraged to return evenly distributed values with
|
|
10
10
|
* a long period.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* Implementations MAY return fewer bytes than requested (a short read).
|
|
13
13
|
* Callers that require exactly `max-len` bytes MUST call this function in
|
|
14
14
|
* a loop until the desired number of bytes has been accumulated.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
export function getInsecureRandomBytes(maxLen: bigint): Uint8Array;
|
|
20
20
|
/**
|
|
21
21
|
* Return an insecure pseudo-random `u64` value.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
23
|
* This function returns the same type of pseudo-random data as
|
|
24
24
|
* `get-insecure-random-bytes`, represented as a `u64`.
|
|
25
25
|
*/
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/** @module Interface wasi:random/random@0.3.0
|
|
1
|
+
/** @module Interface wasi:random/random@0.3.0 **/
|
|
2
2
|
/**
|
|
3
3
|
* Return up to `max-len` cryptographically-secure random or pseudo-random
|
|
4
4
|
* bytes.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* This function must produce data at least as cryptographically secure and
|
|
7
7
|
* fast as an adequately seeded cryptographically-secure pseudo-random
|
|
8
8
|
* number generator (CSPRNG). It must not block, from the perspective of
|
|
9
9
|
* the calling program, under any circumstances, including on the first
|
|
10
10
|
* request and on requests for numbers of bytes. The returned data must
|
|
11
11
|
* always be unpredictable.
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* Implementations MAY return fewer bytes than requested (a short read).
|
|
14
14
|
* Callers that require exactly `max-len` bytes MUST call this function in
|
|
15
15
|
* a loop until the desired number of bytes has been accumulated.
|
|
16
16
|
* Implementations MUST return at least 1 byte when `max-len` is greater
|
|
17
17
|
* than zero. When `max-len` is zero, implementations MUST return an empty
|
|
18
18
|
* list without trapping.
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
20
|
* This function must always return fresh data. Deterministic environments
|
|
21
21
|
* must omit this function, rather than implementing it with deterministic
|
|
22
22
|
* data.
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
export function getRandomBytes(maxLen: bigint): Uint8Array;
|
|
25
25
|
/**
|
|
26
26
|
* Return a cryptographically-secure random or pseudo-random `u64` value.
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
28
|
* This function returns the same type of data as `get-random-bytes`,
|
|
29
29
|
* represented as a `u64`.
|
|
30
30
|
*/
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/** @module Interface wasi:sockets/ip-name-lookup@0.3.0
|
|
1
|
+
/** @module Interface wasi:sockets/ip-name-lookup@0.3.0 **/
|
|
2
2
|
/**
|
|
3
3
|
* Resolve an internet host name to a list of IP addresses.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* Unicode domain names are automatically converted to ASCII using IDNA
|
|
6
6
|
* encoding. If the input is an IP address string, the address is parsed
|
|
7
7
|
* and returned as-is without making any external requests.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* See the wasi-socket proposal README.md for a comparison with getaddrinfo.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* The results are returned in connection order preference.
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* This function never succeeds with 0 results. It either fails or succeeds
|
|
14
14
|
* with at least one address. Additionally, this function never returns
|
|
15
15
|
* IPv4-mapped IPv6 addresses.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
* # References:
|
|
18
18
|
* - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
|
|
19
19
|
* - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
|
|
@@ -28,7 +28,7 @@ export type IpAddress = import('./wasi-sockets-types.js').IpAddress;
|
|
|
28
28
|
export type ErrorCode = ErrorCodeAccessDenied | ErrorCodeInvalidArgument | ErrorCodeNameUnresolvable | ErrorCodeTemporaryResolverFailure | ErrorCodePermanentResolverFailure | ErrorCodeOther;
|
|
29
29
|
/**
|
|
30
30
|
* Access denied.
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
32
|
* POSIX equivalent: EACCES, EPERM
|
|
33
33
|
*/
|
|
34
34
|
export interface ErrorCodeAccessDenied {
|
|
@@ -36,7 +36,7 @@ export interface ErrorCodeAccessDenied {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* `name` is a syntactically invalid domain name or IP address.
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* POSIX equivalent: EINVAL
|
|
41
41
|
*/
|
|
42
42
|
export interface ErrorCodeInvalidArgument {
|
|
@@ -44,7 +44,7 @@ export interface ErrorCodeInvalidArgument {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Name does not exist or has no suitable associated IP addresses.
|
|
47
|
-
*
|
|
47
|
+
*
|
|
48
48
|
* POSIX equivalent: EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY
|
|
49
49
|
*/
|
|
50
50
|
export interface ErrorCodeNameUnresolvable {
|
|
@@ -52,7 +52,7 @@ export interface ErrorCodeNameUnresolvable {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* A temporary failure in name resolution occurred.
|
|
55
|
-
*
|
|
55
|
+
*
|
|
56
56
|
* POSIX equivalent: EAI_AGAIN
|
|
57
57
|
*/
|
|
58
58
|
export interface ErrorCodeTemporaryResolverFailure {
|
|
@@ -60,7 +60,7 @@ export interface ErrorCodeTemporaryResolverFailure {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* A permanent failure in name resolution occurred.
|
|
63
|
-
*
|
|
63
|
+
*
|
|
64
64
|
* POSIX equivalent: EAI_FAIL
|
|
65
65
|
*/
|
|
66
66
|
export interface ErrorCodePermanentResolverFailure {
|