Skip to content

Commit

Permalink
release(wasip2): v0.2.2 (#621)
Browse files Browse the repository at this point in the history
Signed-off-by: Bailey Hayes <behayes2@gmail.com>
  • Loading branch information
ricochet authored Oct 3, 2024
1 parent 4feaf73 commit 8777909
Show file tree
Hide file tree
Showing 40 changed files with 123 additions and 145 deletions.
14 changes: 7 additions & 7 deletions wasip2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ WASI Preview 2 contains the following APIs:

| Proposal | Versions |
| ------------------ | -------- |
| [wasi-io] | 0.2.1 |
| [wasi-clocks] | 0.2.1 |
| [wasi-random] | 0.2.1 |
| [wasi-filesystem] | 0.2.1 |
| [wasi-sockets] | 0.2.1 |
| [wasi-cli] | 0.2.1 |
| [wasi-http] | 0.2.1 |
| [wasi-io] | 0.2.2 |
| [wasi-clocks] | 0.2.2 |
| [wasi-random] | 0.2.2 |
| [wasi-filesystem] | 0.2.2 |
| [wasi-sockets] | 0.2.2 |
| [wasi-cli] | 0.2.2 |
| [wasi-http] | 0.2.2 |

[wasi-io]: https://github.com/WebAssembly/wasi-io
[wasi-clocks]: https://github.com/WebAssembly/wasi-clocks
Expand Down
2 changes: 1 addition & 1 deletion wasip2/cli/command.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:cli@0.2.1;
package wasi:cli@0.2.2;

@since(version = 0.2.0)
world command {
Expand Down
12 changes: 6 additions & 6 deletions wasip2/cli/imports.wit
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package wasi:cli@0.2.1;
package wasi:cli@0.2.2;

@since(version = 0.2.0)
world imports {
@since(version = 0.2.0)
include wasi:clocks/imports@0.2.1;
include wasi:clocks/imports@0.2.2;
@since(version = 0.2.0)
include wasi:filesystem/imports@0.2.1;
include wasi:filesystem/imports@0.2.2;
@since(version = 0.2.0)
include wasi:sockets/imports@0.2.1;
include wasi:sockets/imports@0.2.2;
@since(version = 0.2.0)
include wasi:random/imports@0.2.1;
include wasi:random/imports@0.2.2;
@since(version = 0.2.0)
include wasi:io/imports@0.2.1;
include wasi:io/imports@0.2.2;

@since(version = 0.2.0)
import environment;
Expand Down
6 changes: 3 additions & 3 deletions wasip2/cli/stdio.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@since(version = 0.2.0)
interface stdin {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{input-stream};
use wasi:io/streams@0.2.2.{input-stream};

@since(version = 0.2.0)
get-stdin: func() -> input-stream;
Expand All @@ -10,7 +10,7 @@ interface stdin {
@since(version = 0.2.0)
interface stdout {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{output-stream};
use wasi:io/streams@0.2.2.{output-stream};

@since(version = 0.2.0)
get-stdout: func() -> output-stream;
Expand All @@ -19,7 +19,7 @@ interface stdout {
@since(version = 0.2.0)
interface stderr {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{output-stream};
use wasi:io/streams@0.2.2.{output-stream};

@since(version = 0.2.0)
get-stderr: func() -> output-stream;
Expand Down
3 changes: 0 additions & 3 deletions wasip2/cli/wit.lock

This file was deleted.

8 changes: 0 additions & 8 deletions wasip2/cli/wit.toml

This file was deleted.

4 changes: 2 additions & 2 deletions wasip2/clocks/monotonic-clock.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
///
Expand All @@ -10,7 +10,7 @@ package wasi:clocks@0.2.1;
@since(version = 0.2.0)
interface monotonic-clock {
@since(version = 0.2.0)
use wasi:io/poll@0.2.1.{pollable};
use wasi:io/poll@0.2.2.{pollable};

/// An instant in time, in nanoseconds. An instant is relative to an
/// unspecified initial value, and can only be compared to instances from
Expand Down
2 changes: 1 addition & 1 deletion wasip2/clocks/timezone.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;

@unstable(feature = clocks-timezone)
interface timezone {
Expand Down
2 changes: 1 addition & 1 deletion wasip2/clocks/wall-clock.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;
/// WASI Wall Clock is a clock API intended to let users query the current
/// time. The name "wall" makes an analogy to a "clock on the wall", which
/// is not necessarily monotonic as it may be reset.
Expand Down
3 changes: 0 additions & 3 deletions wasip2/clocks/wit.lock

This file was deleted.

4 changes: 0 additions & 4 deletions wasip2/clocks/wit.toml

This file was deleted.

2 changes: 1 addition & 1 deletion wasip2/clocks/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;

@since(version = 0.2.0)
world imports {
Expand Down
2 changes: 1 addition & 1 deletion wasip2/filesystem/preopens.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:filesystem@0.2.1;
package wasi:filesystem@0.2.2;

@since(version = 0.2.0)
interface preopens {
Expand Down
12 changes: 3 additions & 9 deletions wasip2/filesystem/types.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:filesystem@0.2.1;
package wasi:filesystem@0.2.2;
/// WASI filesystem is a filesystem API primarily intended to let users run WASI
/// programs that access their files on their existing filesystems, without
/// significant overhead.
Expand Down Expand Up @@ -26,9 +26,9 @@ package wasi:filesystem@0.2.1;
@since(version = 0.2.0)
interface types {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{input-stream, output-stream, error};
use wasi:io/streams@0.2.2.{input-stream, output-stream, error};
@since(version = 0.2.0)
use wasi:clocks/wall-clock@0.2.1.{datetime};
use wasi:clocks/wall-clock@0.2.2.{datetime};

/// File size or length of a region within a file.
@since(version = 0.2.0)
Expand Down Expand Up @@ -523,12 +523,6 @@ interface types {

/// Open a file or directory.
///
/// The returned descriptor is not guaranteed to be the lowest-numbered
/// descriptor not currently open/ it is randomized to prevent applications
/// from depending on making assumptions about indexes, since this is
/// error-prone in multi-threaded contexts. The returned descriptor is
/// guaranteed to be less than 2**31.
///
/// If `flags` contains `descriptor-flags::mutate-directory`, and the base
/// descriptor doesn't have `descriptor-flags::mutate-directory` set,
/// `open-at` fails with `error-code::read-only`.
Expand Down
3 changes: 0 additions & 3 deletions wasip2/filesystem/wit.lock

This file was deleted.

5 changes: 0 additions & 5 deletions wasip2/filesystem/wit.toml

This file was deleted.

2 changes: 1 addition & 1 deletion wasip2/filesystem/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:filesystem@0.2.1;
package wasi:filesystem@0.2.2;

@since(version = 0.2.0)
world imports {
Expand Down
14 changes: 7 additions & 7 deletions wasip2/http/proxy.wit
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package wasi:http@0.2.1;
package wasi:http@0.2.2;

/// The `wasi:http/imports` world imports all the APIs for HTTP proxies.
/// It is intended to be `include`d in other worlds.
@since(version = 0.2.0)
world imports {
/// HTTP proxies have access to time and randomness.
@since(version = 0.2.0)
import wasi:clocks/monotonic-clock@0.2.1;
import wasi:clocks/monotonic-clock@0.2.2;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.1;
import wasi:clocks/wall-clock@0.2.2;
@since(version = 0.2.0)
import wasi:random/random@0.2.1;
import wasi:random/random@0.2.2;

/// Proxies have standard output and error streams which are expected to
/// terminate in a developer-facing console provided by the host.
@since(version = 0.2.0)
import wasi:cli/stdout@0.2.1;
import wasi:cli/stdout@0.2.2;
@since(version = 0.2.0)
import wasi:cli/stderr@0.2.1;
import wasi:cli/stderr@0.2.2;

/// TODO: this is a temporary workaround until component tooling is able to
/// gracefully handle the absence of stdin. Hosts must return an eof stream
/// for this import, which is what wasi-libc + tooling will do automatically
/// when this import is properly removed.
@since(version = 0.2.0)
import wasi:cli/stdin@0.2.1;
import wasi:cli/stdin@0.2.2;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
Expand Down
82 changes: 50 additions & 32 deletions wasip2/http/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
@since(version = 0.2.0)
interface types {
@since(version = 0.2.0)
use wasi:clocks/monotonic-clock@0.2.1.{duration};
use wasi:clocks/monotonic-clock@0.2.2.{duration};
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{input-stream, output-stream};
use wasi:io/streams@0.2.2.{input-stream, output-stream};
@since(version = 0.2.0)
use wasi:io/error@0.2.1.{error as io-error};
use wasi:io/error@0.2.2.{error as io-error};
@since(version = 0.2.0)
use wasi:io/poll@0.2.1.{pollable};
use wasi:io/poll@0.2.2.{pollable};

/// This type corresponds to HTTP standard Methods.
@since(version = 0.2.0)
Expand Down Expand Up @@ -124,12 +124,12 @@ interface types {
/// setting or appending to a `fields` resource.
@since(version = 0.2.0)
variant header-error {
/// This error indicates that a `field-key` or `field-value` was
/// This error indicates that a `field-name` or `field-value` was
/// syntactically invalid when used with an operation that sets headers in a
/// `fields`.
invalid-syntax,

/// This error indicates that a forbidden `field-key` was used when trying
/// This error indicates that a forbidden `field-name` was used when trying
/// to set a header in a `fields`.
forbidden,

Expand All @@ -138,8 +138,23 @@ interface types {
immutable,
}

/// Field names are always strings.
///
/// Field names should always be treated as case insensitive by the `fields`
/// resource for the purposes of equality checking.
@since(version = 0.2.1)
type field-name = field-key;

/// Field keys are always strings.
///
/// Field keys should always be treated as case insensitive by the `fields`
/// resource for the purposes of equality checking.
///
/// # Deprecation
///
/// This type has been deprecated in favor of the `field-name` type.
@since(version = 0.2.0)
@deprecated(version = 0.2.2)
type field-key = string;

/// Field values should always be ASCII strings. However, in
Expand Down Expand Up @@ -171,70 +186,73 @@ interface types {
///
/// The resulting `fields` is mutable.
///
/// The list represents each key-value pair in the Fields. Keys
/// The list represents each name-value pair in the Fields. Names
/// which have multiple values are represented by multiple entries in this
/// list with the same key.
/// list with the same name.
///
/// The tuple is a pair of the field key, represented as a string, and
/// The tuple is a pair of the field name, represented as a string, and
/// Value, represented as a list of bytes.
///
/// An error result will be returned if any `field-key` or `field-value` is
/// An error result will be returned if any `field-name` or `field-value` is
/// syntactically invalid, or if a field is forbidden.
@since(version = 0.2.0)
from-list: static func(
entries: list<tuple<field-key,field-value>>
entries: list<tuple<field-name,field-value>>
) -> result<fields, header-error>;

/// Get all of the values corresponding to a key. If the key is not present
/// Get all of the values corresponding to a name. If the name is not present
/// in this `fields` or is syntactically invalid, an empty list is returned.
/// However, if the key is present but empty, this is represented by a list
/// However, if the name is present but empty, this is represented by a list
/// with one or more empty field-values present.
@since(version = 0.2.0)
get: func(name: field-key) -> list<field-value>;
get: func(name: field-name) -> list<field-value>;

/// Returns `true` when the key is present in this `fields`. If the key is
/// Returns `true` when the name is present in this `fields`. If the name is
/// syntactically invalid, `false` is returned.
@since(version = 0.2.0)
has: func(name: field-key) -> bool;
has: func(name: field-name) -> bool;

/// Set all of the values for a key. Clears any existing values for that
/// key, if they have been set.
/// Set all of the values for a name. Clears any existing values for that
/// name, if they have been set.
///
/// Fails with `header-error.immutable` if the `fields` are immutable.
///
/// Fails with `header-error.invalid-syntax` if the `field-key` or any of
/// Fails with `header-error.invalid-syntax` if the `field-name` or any of
/// the `field-value`s are syntactically invalid.
@since(version = 0.2.0)
set: func(name: field-key, value: list<field-value>) -> result<_, header-error>;
set: func(name: field-name, value: list<field-value>) -> result<_, header-error>;

/// Delete all values for a key. Does nothing if no values for the key
/// Delete all values for a name. Does nothing if no values for the name
/// exist.
///
/// Fails with `header-error.immutable` if the `fields` are immutable.
///
/// Fails with `header-error.invalid-syntax` if the `field-key` is
/// Fails with `header-error.invalid-syntax` if the `field-name` is
/// syntactically invalid.
@since(version = 0.2.0)
delete: func(name: field-key) -> result<_, header-error>;
delete: func(name: field-name) -> result<_, header-error>;

/// Append a value for a key. Does not change or delete any existing
/// values for that key.
/// Append a value for a name. Does not change or delete any existing
/// values for that name.
///
/// Fails with `header-error.immutable` if the `fields` are immutable.
///
/// Fails with `header-error.invalid-syntax` if the `field-key` or
/// Fails with `header-error.invalid-syntax` if the `field-name` or
/// `field-value` are syntactically invalid.
@since(version = 0.2.0)
append: func(name: field-key, value: field-value) -> result<_, header-error>;
append: func(name: field-name, value: field-value) -> result<_, header-error>;

/// Retrieve the full set of keys and values in the Fields. Like the
/// constructor, the list represents each key-value pair.
/// Retrieve the full set of names and values in the Fields. Like the
/// constructor, the list represents each name-value pair.
///
/// The outer list represents each key-value pair in the Fields. Keys
/// The outer list represents each name-value pair in the Fields. Names
/// which have multiple values are represented by multiple entries in this
/// list with the same key.
/// list with the same name.
///
/// The names and values are always returned in the original casing and in
/// the order in which they will be serialized for transport.
@since(version = 0.2.0)
entries: func() -> list<tuple<field-key,field-value>>;
entries: func() -> list<tuple<field-name,field-value>>;

/// Make a deep copy of the Fields. Equivalent in behavior to calling the
/// `fields` constructor on the return value of `entries`. The resulting
Expand Down
3 changes: 0 additions & 3 deletions wasip2/http/wit.lock

This file was deleted.

9 changes: 0 additions & 9 deletions wasip2/http/wit.toml

This file was deleted.

Loading

0 comments on commit 8777909

Please sign in to comment.