Skip to content

Commit

Permalink
ci: include version in WIT deps
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Feb 5, 2025
1 parent b513b1e commit 7d6a212
Show file tree
Hide file tree
Showing 115 changed files with 3,557 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ci/vendor-wit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ make_vendor() {

for package in $packages; do
IFS='@' read -r repo tag <<< "$package"
mkdir -p $path/$repo
mkdir -p $path/$package
cached_extracted_dir="$cache_dir/$repo-$tag"

if [[ ! -d $cached_extracted_dir ]]; then
Expand All @@ -30,7 +30,7 @@ make_vendor() {
rm -rf $cached_extracted_dir/wit/deps*
fi

cp -r $cached_extracted_dir/wit/* $path/$repo
cp -r $cached_extracted_dir/wit/* $path/$package
done
}

Expand Down
30 changes: 30 additions & 0 deletions crates/wasi-config/wit/deps/config@f4d699b/store.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
interface store {
/// An error type that encapsulates the different errors that can occur fetching configuration values.
variant error {
/// This indicates an error from an "upstream" config source.
/// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue buckets, etc),
/// the error message is a string.
upstream(string),
/// This indicates an error from an I/O operation.
/// As this could be almost _anything_ (such as a file read, network connection, etc),
/// the error message is a string.
/// Depending on how this ends up being consumed,
/// we may consider moving this to use the `wasi:io/error` type instead.
/// For simplicity right now in supporting multiple implementations, it is being left as a string.
io(string),
}

/// Gets a configuration value of type `string` associated with the `key`.
///
/// The value is returned as an `option<string>`. If the key is not found,
/// `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned.
get: func(
/// A string key to fetch
key: string
) -> result<option<string>, error>;

/// Gets a list of configuration key-value pairs of type `string`.
///
/// If an error occurs, an `Err(error)` is returned.
get-all: func() -> result<list<tuple<string, string>>, error>;
}
6 changes: 6 additions & 0 deletions crates/wasi-config/wit/deps/config@f4d699b/world.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package wasi:config@0.2.0-draft;

world imports {
/// The interface for wasi:config/store
import store;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions crates/wasi-http/wit/deps/[email protected]/handler.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/// This interface defines a handler of incoming HTTP Requests. It should
/// be exported by components which can respond to HTTP Requests.
@since(version = 0.2.0)
interface incoming-handler {
@since(version = 0.2.0)
use types.{incoming-request, response-outparam};

/// This function is invoked with an incoming HTTP Request, and a resource
/// `response-outparam` which provides the capability to reply with an HTTP
/// Response. The response is sent by calling the `response-outparam.set`
/// method, which allows execution to continue after the response has been
/// sent. This enables both streaming to the response body, and performing other
/// work.
///
/// The implementor of this function must write a response to the
/// `response-outparam` before returning, or else the caller will respond
/// with an error on its behalf.
@since(version = 0.2.0)
handle: func(
request: incoming-request,
response-out: response-outparam
);
}

/// This interface defines a handler of outgoing HTTP Requests. It should be
/// imported by components which wish to make HTTP Requests.
@since(version = 0.2.0)
interface outgoing-handler {
@since(version = 0.2.0)
use types.{
outgoing-request, request-options, future-incoming-response, error-code
};

/// This function is invoked with an outgoing HTTP Request, and it returns
/// a resource `future-incoming-response` which represents an HTTP Response
/// which may arrive in the future.
///
/// The `options` argument accepts optional parameters for the HTTP
/// protocol's transport layer.
///
/// This function may return an error if the `outgoing-request` is invalid
/// or not allowed to be made. Otherwise, protocol errors are reported
/// through the `future-incoming-response`.
@since(version = 0.2.0)
handle: func(
request: outgoing-request,
options: option<request-options>
) -> result<future-incoming-response, error-code>;
}
50 changes: 50 additions & 0 deletions crates/wasi-http/wit/deps/[email protected]/proxy.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package wasi:http@0.2.3;

/// 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.3;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.3;
@since(version = 0.2.0)
import wasi:random/random@0.2.3;

/// 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.3;
@since(version = 0.2.0)
import wasi:cli/stderr@0.2.3;

/// 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.3;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
@since(version = 0.2.0)
import outgoing-handler;
}

/// The `wasi:http/proxy` world captures a widely-implementable intersection of
/// hosts that includes HTTP forward and reverse proxies. Components targeting
/// this world may concurrently stream in and out any number of incoming and
/// outgoing HTTP requests.
@since(version = 0.2.0)
world proxy {
@since(version = 0.2.0)
include imports;

/// The host delivers incoming HTTP requests to a component by calling the
/// `handle` function of this exported interface. A host may arbitrarily reuse
/// or not reuse component instance when delivering incoming HTTP requests and
/// thus a component must be able to handle 0..N calls to `handle`.
@since(version = 0.2.0)
export incoming-handler;
}
Loading

0 comments on commit 7d6a212

Please sign in to comment.