diff --git a/components/credential-config/src/lib.rs b/components/credential-config/src/lib.rs index 0a5777e..ff3b7f2 100644 --- a/components/credential-config/src/lib.rs +++ b/components/credential-config/src/lib.rs @@ -48,6 +48,7 @@ fn config_err_map(err: store::Error) -> Error { wit_bindgen::generate!({ path: "../wit", world: "credential-config", + features: ["clocks-timezone"], generate_all }); diff --git a/components/filesystem-credential-admin/src/lib.rs b/components/filesystem-credential-admin/src/lib.rs index 35d35f0..6923ef8 100644 --- a/components/filesystem-credential-admin/src/lib.rs +++ b/components/filesystem-credential-admin/src/lib.rs @@ -45,6 +45,7 @@ impl Guest for FilesystemCredentialAdmin { wit_bindgen::generate!({ path: "../wit", world: "filesystem-credential-admin", + features: ["clocks-timezone"], generate_all }); diff --git a/components/filesystem-credential-store/src/lib.rs b/components/filesystem-credential-store/src/lib.rs index db703c4..19e0eaf 100644 --- a/components/filesystem-credential-store/src/lib.rs +++ b/components/filesystem-credential-store/src/lib.rs @@ -41,6 +41,7 @@ impl Guest for FilesystemCredentialStore { wit_bindgen::generate!({ path: "../wit", world: "filesystem-credential-store", + features: ["clocks-timezone"], generate_all }); diff --git a/components/filesystem-lifecycle/src/lib.rs b/components/filesystem-lifecycle/src/lib.rs index 6dbe1ff..847eecd 100644 --- a/components/filesystem-lifecycle/src/lib.rs +++ b/components/filesystem-lifecycle/src/lib.rs @@ -179,6 +179,7 @@ impl Lifecycle for FilesystemService { wit_bindgen::generate!({ path: "../wit", world: "filesystem-lifecycle", + features: ["clocks-timezone"], generate_all }); diff --git a/components/keyvalue-credential-admin/src/lib.rs b/components/keyvalue-credential-admin/src/lib.rs index 02a7208..15c7fb2 100644 --- a/components/keyvalue-credential-admin/src/lib.rs +++ b/components/keyvalue-credential-admin/src/lib.rs @@ -63,6 +63,7 @@ impl Guest for KeyvalueCredentialAdmin { wit_bindgen::generate!({ path: "../wit", world: "keyvalue-credential-admin", + features: ["clocks-timezone"], generate_all }); diff --git a/components/keyvalue-credential-store/src/lib.rs b/components/keyvalue-credential-store/src/lib.rs index b8dda5c..2e06f8d 100644 --- a/components/keyvalue-credential-store/src/lib.rs +++ b/components/keyvalue-credential-store/src/lib.rs @@ -64,6 +64,7 @@ impl Guest for KeyvalueCredentialStore { wit_bindgen::generate!({ path: "../wit", world: "keyvalue-credential-store", + features: ["clocks-timezone"], generate_all }); diff --git a/components/lifecycle-host-cli/src/lib.rs b/components/lifecycle-host-cli/src/lib.rs index 7ba03df..40b95ff 100644 --- a/components/lifecycle-host-cli/src/lib.rs +++ b/components/lifecycle-host-cli/src/lib.rs @@ -336,6 +336,7 @@ impl UuidIds { wit_bindgen::generate!({ path: "../wit", world: "lifecycle-host-cli", + features: ["clocks-timezone"], generate_all }); diff --git a/components/lifecycle-host-http/src/lib.rs b/components/lifecycle-host-http/src/lib.rs index 76a46ca..eee57ea 100644 --- a/components/lifecycle-host-http/src/lib.rs +++ b/components/lifecycle-host-http/src/lib.rs @@ -210,6 +210,7 @@ fn get_params(query: &querystring::QueryParams, key: &str) -> Option wit_bindgen::generate!({ path: "../wit", world: "lifecycle-host-http", + features: ["clocks-timezone"], generate_all }); diff --git a/components/valkey-lifecycle/src/lib.rs b/components/valkey-lifecycle/src/lib.rs index 68acff7..728b70d 100644 --- a/components/valkey-lifecycle/src/lib.rs +++ b/components/valkey-lifecycle/src/lib.rs @@ -249,6 +249,7 @@ impl From for Error { wit_bindgen::generate!({ path: "../wit", world: "valkey-lifecycle", + features: ["clocks-timezone"], generate_all }); diff --git a/components/webhook-credential-admin/src/lib.rs b/components/webhook-credential-admin/src/lib.rs index 8b98695..75be6f4 100644 --- a/components/webhook-credential-admin/src/lib.rs +++ b/components/webhook-credential-admin/src/lib.rs @@ -105,6 +105,7 @@ impl Guest for WebhookCredentialAdmin { wit_bindgen::generate!({ path: "../wit", world: "webhook-credential-admin", + features: ["clocks-timezone"], generate_all }); diff --git a/components/webhook-credential-store/src/lib.rs b/components/webhook-credential-store/src/lib.rs index 42900d3..2e8c257 100644 --- a/components/webhook-credential-store/src/lib.rs +++ b/components/webhook-credential-store/src/lib.rs @@ -105,6 +105,7 @@ impl Guest for WebhookCredentialStore { wit_bindgen::generate!({ path: "../wit", world: "webhook-credential-store", + features: ["clocks-timezone"], generate_all }); diff --git a/components/wit/deps/componentized-config/package.wit b/components/wit/deps/componentized-config/package.wit index 1f5c014..4d02f71 100644 --- a/components/wit/deps/componentized-config/package.wit +++ b/components/wit/deps/componentized-config/package.wit @@ -7,7 +7,7 @@ interface factory { } world adapter { - export wasi:config/store@0.2.0-draft; + export wasi:config/store@0.2.0-rc.1; } world config-factory { export factory; diff --git a/components/wit/deps/componentized-services/package.wit b/components/wit/deps/componentized-services/package.wit index 0215f57..c90c7fd 100644 --- a/components/wit/deps/componentized-services/package.wit +++ b/components/wit/deps/componentized-services/package.wit @@ -94,25 +94,25 @@ interface lifecycle { world service-lifecycle { import types; import credential-admin; - import wasi:io/poll@0.2.3; - import wasi:clocks/monotonic-clock@0.2.3; - import wasi:clocks/wall-clock@0.2.3; - import wasi:config/store@0.2.0-draft; - import wasi:io/error@0.2.3; - import wasi:io/streams@0.2.3; - import wasi:filesystem/types@0.2.3; - import wasi:filesystem/preopens@0.2.3; + import wasi:io/poll@0.2.6; + import wasi:clocks/monotonic-clock@0.2.6; + import wasi:clocks/wall-clock@0.2.6; + import wasi:config/store@0.2.0-rc.1; + import wasi:io/error@0.2.6; + import wasi:io/streams@0.2.6; + import wasi:filesystem/types@0.2.6; + import wasi:filesystem/preopens@0.2.6; import wasi:logging/logging@0.1.0-draft; - import wasi:random/random@0.2.3; - import wasi:random/insecure@0.2.3; - import wasi:random/insecure-seed@0.2.3; - import wasi:sockets/network@0.2.3; - import wasi:sockets/instance-network@0.2.3; - import wasi:sockets/udp@0.2.3; - import wasi:sockets/udp-create-socket@0.2.3; - import wasi:sockets/tcp@0.2.3; - import wasi:sockets/tcp-create-socket@0.2.3; - import wasi:sockets/ip-name-lookup@0.2.3; + import wasi:random/random@0.2.6; + import wasi:random/insecure@0.2.6; + import wasi:random/insecure-seed@0.2.6; + import wasi:sockets/network@0.2.6; + import wasi:sockets/instance-network@0.2.6; + import wasi:sockets/udp@0.2.6; + import wasi:sockets/udp-create-socket@0.2.6; + import wasi:sockets/tcp@0.2.6; + import wasi:sockets/tcp-create-socket@0.2.6; + import wasi:sockets/ip-name-lookup@0.2.6; export lifecycle; } diff --git a/components/wit/deps/wasi-cli-0.2.3/package.wit b/components/wit/deps/wasi-cli-0.2.6/package.wit similarity index 71% rename from components/wit/deps/wasi-cli-0.2.3/package.wit rename to components/wit/deps/wasi-cli-0.2.6/package.wit index b86dfec..d7a3ca4 100644 --- a/components/wit/deps/wasi-cli-0.2.3/package.wit +++ b/components/wit/deps/wasi-cli-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:cli@0.2.3; +package wasi:cli@0.2.6; @since(version = 0.2.0) interface environment { @@ -28,6 +28,17 @@ interface exit { /// Exit the current instance and any linked instances. @since(version = 0.2.0) exit: func(status: result); + + /// Exit the current instance and any linked instances, reporting the + /// specified status code to the host. + /// + /// The meaning of the code depends on the context, with 0 usually meaning + /// "success", and other values indicating various types of failure. + /// + /// This function does not return; the effect is analogous to a trap, but + /// without the connotation that something bad has happened. + @unstable(feature = cli-exit-with-code) + exit-with-code: func(status-code: u8); } @since(version = 0.2.0) @@ -40,7 +51,7 @@ interface run { @since(version = 0.2.0) interface stdin { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream}; + use wasi:io/streams@0.2.6.{input-stream}; @since(version = 0.2.0) get-stdin: func() -> input-stream; @@ -49,7 +60,7 @@ interface stdin { @since(version = 0.2.0) interface stdout { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{output-stream}; + use wasi:io/streams@0.2.6.{output-stream}; @since(version = 0.2.0) get-stdout: func() -> output-stream; @@ -58,7 +69,7 @@ interface stdout { @since(version = 0.2.0) interface stderr { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{output-stream}; + use wasi:io/streams@0.2.6.{output-stream}; @since(version = 0.2.0) get-stderr: func() -> output-stream; @@ -134,11 +145,11 @@ world imports { @since(version = 0.2.0) import exit; @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) import stdin; @since(version = 0.2.0) @@ -156,33 +167,35 @@ world imports { @since(version = 0.2.0) import terminal-stderr; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; + @unstable(feature = clocks-timezone) + import wasi:clocks/timezone@0.2.6; @since(version = 0.2.0) - import wasi:filesystem/types@0.2.3; + import wasi:filesystem/types@0.2.6; @since(version = 0.2.0) - import wasi:filesystem/preopens@0.2.3; + import wasi:filesystem/preopens@0.2.6; @since(version = 0.2.0) - import wasi:sockets/network@0.2.3; + import wasi:sockets/network@0.2.6; @since(version = 0.2.0) - import wasi:sockets/instance-network@0.2.3; + import wasi:sockets/instance-network@0.2.6; @since(version = 0.2.0) - import wasi:sockets/udp@0.2.3; + import wasi:sockets/udp@0.2.6; @since(version = 0.2.0) - import wasi:sockets/udp-create-socket@0.2.3; + import wasi:sockets/udp-create-socket@0.2.6; @since(version = 0.2.0) - import wasi:sockets/tcp@0.2.3; + import wasi:sockets/tcp@0.2.6; @since(version = 0.2.0) - import wasi:sockets/tcp-create-socket@0.2.3; + import wasi:sockets/tcp-create-socket@0.2.6; @since(version = 0.2.0) - import wasi:sockets/ip-name-lookup@0.2.3; + import wasi:sockets/ip-name-lookup@0.2.6; @since(version = 0.2.0) - import wasi:random/random@0.2.3; + import wasi:random/random@0.2.6; @since(version = 0.2.0) - import wasi:random/insecure@0.2.3; + import wasi:random/insecure@0.2.6; @since(version = 0.2.0) - import wasi:random/insecure-seed@0.2.3; + import wasi:random/insecure-seed@0.2.6; } @since(version = 0.2.0) world command { @@ -191,11 +204,11 @@ world command { @since(version = 0.2.0) import exit; @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) import stdin; @since(version = 0.2.0) @@ -213,33 +226,35 @@ world command { @since(version = 0.2.0) import terminal-stderr; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; + @unstable(feature = clocks-timezone) + import wasi:clocks/timezone@0.2.6; @since(version = 0.2.0) - import wasi:filesystem/types@0.2.3; + import wasi:filesystem/types@0.2.6; @since(version = 0.2.0) - import wasi:filesystem/preopens@0.2.3; + import wasi:filesystem/preopens@0.2.6; @since(version = 0.2.0) - import wasi:sockets/network@0.2.3; + import wasi:sockets/network@0.2.6; @since(version = 0.2.0) - import wasi:sockets/instance-network@0.2.3; + import wasi:sockets/instance-network@0.2.6; @since(version = 0.2.0) - import wasi:sockets/udp@0.2.3; + import wasi:sockets/udp@0.2.6; @since(version = 0.2.0) - import wasi:sockets/udp-create-socket@0.2.3; + import wasi:sockets/udp-create-socket@0.2.6; @since(version = 0.2.0) - import wasi:sockets/tcp@0.2.3; + import wasi:sockets/tcp@0.2.6; @since(version = 0.2.0) - import wasi:sockets/tcp-create-socket@0.2.3; + import wasi:sockets/tcp-create-socket@0.2.6; @since(version = 0.2.0) - import wasi:sockets/ip-name-lookup@0.2.3; + import wasi:sockets/ip-name-lookup@0.2.6; @since(version = 0.2.0) - import wasi:random/random@0.2.3; + import wasi:random/random@0.2.6; @since(version = 0.2.0) - import wasi:random/insecure@0.2.3; + import wasi:random/insecure@0.2.6; @since(version = 0.2.0) - import wasi:random/insecure-seed@0.2.3; + import wasi:random/insecure-seed@0.2.6; @since(version = 0.2.0) export run; diff --git a/wit/deps/wasi-clocks-0.2.3/package.wit b/components/wit/deps/wasi-clocks-0.2.6/package.wit similarity index 60% rename from wit/deps/wasi-clocks-0.2.3/package.wit rename to components/wit/deps/wasi-clocks-0.2.6/package.wit index a78edc8..d638f1a 100644 --- a/wit/deps/wasi-clocks-0.2.3/package.wit +++ b/components/wit/deps/wasi-clocks-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:clocks@0.2.3; +package wasi:clocks@0.2.6; /// WASI Monotonic Clock is a clock API intended to let users measure elapsed /// time. @@ -11,7 +11,7 @@ package wasi:clocks@0.2.3; @since(version = 0.2.0) interface monotonic-clock { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; /// An instant in time, in nanoseconds. An instant is relative to an /// unspecified initial value, and can only be compared to instances from @@ -92,12 +92,66 @@ interface wall-clock { resolution: func() -> datetime; } +@unstable(feature = clocks-timezone) +interface timezone { + @unstable(feature = clocks-timezone) + use wall-clock.{datetime}; + + /// Information useful for displaying the timezone of a specific `datetime`. + /// + /// This information may vary within a single `timezone` to reflect daylight + /// saving time adjustments. + @unstable(feature = clocks-timezone) + record timezone-display { + /// The number of seconds difference between UTC time and the local + /// time of the timezone. + /// + /// The returned value will always be less than 86400 which is the + /// number of seconds in a day (24*60*60). + /// + /// In implementations that do not expose an actual time zone, this + /// should return 0. + utc-offset: s32, + /// The abbreviated name of the timezone to display to a user. The name + /// `UTC` indicates Coordinated Universal Time. Otherwise, this should + /// reference local standards for the name of the time zone. + /// + /// In implementations that do not expose an actual time zone, this + /// should be the string `UTC`. + /// + /// In time zones that do not have an applicable name, a formatted + /// representation of the UTC offset may be returned, such as `-04:00`. + name: string, + /// Whether daylight saving time is active. + /// + /// In implementations that do not expose an actual time zone, this + /// should return false. + in-daylight-saving-time: bool, + } + + /// Return information needed to display the given `datetime`. This includes + /// the UTC offset, the time zone name, and a flag indicating whether + /// daylight saving time is active. + /// + /// If the timezone cannot be determined for the given `datetime`, return a + /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight + /// saving time. + @unstable(feature = clocks-timezone) + display: func(when: datetime) -> timezone-display; + + /// The same as `display`, but only return the UTC offset. + @unstable(feature = clocks-timezone) + utc-offset: func(when: datetime) -> s32; +} + @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) import monotonic-clock; @since(version = 0.2.0) import wall-clock; + @unstable(feature = clocks-timezone) + import timezone; } diff --git a/wit/deps/wasi-config-0.2.0-draft/package.wit b/components/wit/deps/wasi-config-0.2.0-rc.1/package.wit similarity index 97% rename from wit/deps/wasi-config-0.2.0-draft/package.wit rename to components/wit/deps/wasi-config-0.2.0-rc.1/package.wit index a4cdf94..d8950ee 100644 --- a/wit/deps/wasi-config-0.2.0-draft/package.wit +++ b/components/wit/deps/wasi-config-0.2.0-rc.1/package.wit @@ -1,4 +1,4 @@ -package wasi:config@0.2.0-draft; +package wasi:config@0.2.0-rc.1; interface store { /// An error type that encapsulates the different errors that can occur fetching configuration values. diff --git a/wit/deps/wasi-filesystem-0.2.3/package.wit b/components/wit/deps/wasi-filesystem-0.2.6/package.wit similarity index 96% rename from wit/deps/wasi-filesystem-0.2.3/package.wit rename to components/wit/deps/wasi-filesystem-0.2.6/package.wit index b990c87..9f4a828 100644 --- a/wit/deps/wasi-filesystem-0.2.3/package.wit +++ b/components/wit/deps/wasi-filesystem-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:filesystem@0.2.3; +package wasi:filesystem@0.2.6; /// WASI filesystem is a filesystem API primarily intended to let users run WASI /// programs that access their files on their existing filesystems, without @@ -27,9 +27,9 @@ package wasi:filesystem@0.2.3; @since(version = 0.2.0) interface types { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream, error}; + use wasi:io/streams@0.2.6.{input-stream, output-stream, error}; @since(version = 0.2.0) - use wasi:clocks/wall-clock@0.2.3.{datetime}; + use wasi:clocks/wall-clock@0.2.6.{datetime}; /// File size or length of a region within a file. @since(version = 0.2.0) @@ -446,6 +446,10 @@ interface types { set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; /// Create a hard link. /// + /// Fails with `error-code::no-entry` if the old path does not exist, + /// with `error-code::exist` if the new path already exists, and + /// `error-code::not-permitted` if the old path is not a file. + /// /// Note: This is similar to `linkat` in POSIX. @since(version = 0.2.0) link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; @@ -516,12 +520,12 @@ interface types { /// /// Implementations are encouraged to provide the following properties: /// - /// - If the file is not modified or replaced, the computed hash value should - /// usually not change. - /// - If the object is modified or replaced, the computed hash value should - /// usually change. - /// - The inputs to the hash should not be easily computable from the - /// computed hash. + /// - If the file is not modified or replaced, the computed hash value should + /// usually not change. + /// - If the object is modified or replaced, the computed hash value should + /// usually change. + /// - The inputs to the hash should not be easily computable from the + /// computed hash. /// /// However, none of these is required. @since(version = 0.2.0) @@ -569,13 +573,13 @@ interface preopens { @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; @since(version = 0.2.0) import types; @since(version = 0.2.0) diff --git a/components/wit/deps/wasi-http-0.2.3/package.wit b/components/wit/deps/wasi-http-0.2.6/package.wit similarity index 94% rename from components/wit/deps/wasi-http-0.2.3/package.wit rename to components/wit/deps/wasi-http-0.2.6/package.wit index 932f089..eb1b25f 100644 --- a/components/wit/deps/wasi-http-0.2.3/package.wit +++ b/components/wit/deps/wasi-http-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:http@0.2.3; +package wasi:http@0.2.6; /// This interface defines all of the types and methods for implementing /// HTTP Requests and Responses, both incoming and outgoing, as well as @@ -6,13 +6,13 @@ package wasi:http@0.2.3; @since(version = 0.2.0) interface types { @since(version = 0.2.0) - use wasi:clocks/monotonic-clock@0.2.3.{duration}; + use wasi:clocks/monotonic-clock@0.2.6.{duration}; @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream}; + use wasi:io/streams@0.2.6.{input-stream, output-stream}; @since(version = 0.2.0) - use wasi:io/error@0.2.3.{error as io-error}; + use wasi:io/error@0.2.6.{error as io-error}; @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; /// This type corresponds to HTTP standard Methods. @since(version = 0.2.0) @@ -59,7 +59,7 @@ interface types { } /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// + /// @since(version = 0.2.0) variant error-code { DNS-timeout, @@ -156,7 +156,7 @@ interface types { /// A `fields` may be mutable or immutable. A `fields` created using the /// constructor, `from-list`, or `clone` will be mutable, but a `fields` /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be + /// `incoming-request.headers`, `outgoing-request.headers`) might be /// immutable. In an immutable fields, the `set`, `append`, and `delete` /// operations will fail with `header-error.immutable`. @since(version = 0.2.0) @@ -389,6 +389,18 @@ interface types { /// other argument to `incoming-handler.handle`. @since(version = 0.2.0) resource response-outparam { + /// Send an HTTP 1xx response. + /// + /// Unlike `response-outparam.set`, this does not consume the + /// `response-outparam`, allowing the guest to send an arbitrary number of + /// informational responses before sending the final response using + /// `response-outparam.set`. + /// + /// This will return an `HTTP-protocol-error` if `status` is not in the + /// range [100-199], or an `internal-error` if the implementation does not + /// support informational responses. + @unstable(feature = informational-outbound-responses) + send-informational: func(status: u16, headers: headers) -> result<_, error-code>; /// Set the value of the `response-outparam` to either send a response, /// or indicate an error. /// @@ -665,23 +677,23 @@ interface outgoing-handler { @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; @since(version = 0.2.0) - import wasi:random/random@0.2.3; + import wasi:random/random@0.2.6; @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:cli/stdout@0.2.3; + import wasi:cli/stdout@0.2.6; @since(version = 0.2.0) - import wasi:cli/stderr@0.2.3; + import wasi:cli/stderr@0.2.6; @since(version = 0.2.0) - import wasi:cli/stdin@0.2.3; + import wasi:cli/stdin@0.2.6; @since(version = 0.2.0) import types; @since(version = 0.2.0) @@ -694,23 +706,23 @@ world imports { @since(version = 0.2.0) world proxy { @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; @since(version = 0.2.0) - import wasi:random/random@0.2.3; + import wasi:random/random@0.2.6; @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:cli/stdout@0.2.3; + import wasi:cli/stdout@0.2.6; @since(version = 0.2.0) - import wasi:cli/stderr@0.2.3; + import wasi:cli/stderr@0.2.6; @since(version = 0.2.0) - import wasi:cli/stdin@0.2.3; + import wasi:cli/stdin@0.2.6; @since(version = 0.2.0) import types; @since(version = 0.2.0) diff --git a/components/wit/deps/wasi-io-0.2.3/package.wit b/components/wit/deps/wasi-io-0.2.6/package.wit similarity index 98% rename from components/wit/deps/wasi-io-0.2.3/package.wit rename to components/wit/deps/wasi-io-0.2.6/package.wit index adcf1f4..c66abac 100644 --- a/components/wit/deps/wasi-io-0.2.3/package.wit +++ b/components/wit/deps/wasi-io-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:io@0.2.3; +package wasi:io@0.2.6; interface poll { resource pollable { diff --git a/components/wit/deps/wasi-random-0.2.3/package.wit b/components/wit/deps/wasi-random-0.2.6/package.wit similarity index 99% rename from components/wit/deps/wasi-random-0.2.3/package.wit rename to components/wit/deps/wasi-random-0.2.6/package.wit index 5a67748..73edf5b 100644 --- a/components/wit/deps/wasi-random-0.2.3/package.wit +++ b/components/wit/deps/wasi-random-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:random@0.2.3; +package wasi:random@0.2.6; /// The insecure-seed interface for seeding hash-map DoS resistance. /// diff --git a/components/wit/deps/wasi-sockets-0.2.3/package.wit b/components/wit/deps/wasi-sockets-0.2.6/package.wit similarity index 96% rename from components/wit/deps/wasi-sockets-0.2.3/package.wit rename to components/wit/deps/wasi-sockets-0.2.6/package.wit index 42af96a..db6d1a2 100644 --- a/components/wit/deps/wasi-sockets-0.2.3/package.wit +++ b/components/wit/deps/wasi-sockets-0.2.6/package.wit @@ -1,7 +1,10 @@ -package wasi:sockets@0.2.3; +package wasi:sockets@0.2.6; @since(version = 0.2.0) interface network { + @unstable(feature = network-error-code) + use wasi:io/error@0.2.6.{error}; + /// An opaque resource that represents access to (a subset of) the network. /// This enables context-based security for networking. /// There is no need for this to map 1:1 to a physical network interface. @@ -128,6 +131,19 @@ interface network { ipv4(ipv4-socket-address), ipv6(ipv6-socket-address), } + + /// Attempts to extract a network-related `error-code` from the stream + /// `error` provided. + /// + /// Stream operations which return `stream-error::last-operation-failed` + /// have a payload with more information about the operation that failed. + /// This payload can be passed through to this function to see if there's + /// network-related information about the error to return. + /// + /// Note that this function is fallible because not all stream-related + /// errors are network-related errors. + @unstable(feature = network-error-code) + network-error-code: func(err: borrow) -> option; } /// This interface provides a value-export of the default network handle.. @@ -144,7 +160,7 @@ interface instance-network { @since(version = 0.2.0) interface ip-name-lookup { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) use network.{network, error-code, ip-address}; @@ -200,11 +216,11 @@ interface ip-name-lookup { @since(version = 0.2.0) interface tcp { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream}; + use wasi:io/streams@0.2.6.{input-stream, output-stream}; @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) - use wasi:clocks/monotonic-clock@0.2.3.{duration}; + use wasi:clocks/monotonic-clock@0.2.6.{duration}; @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; @@ -542,11 +558,11 @@ interface tcp { /// Initiate a graceful shutdown. /// /// - `receive`: The socket is not expecting to receive any data from - /// the peer. The `input-stream` associated with this socket will be - /// closed. Any data still in the receive queue at time of calling - /// this method will be discarded. + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. /// - `send`: The socket has no more data to send to the peer. The `output-stream` - /// associated with this socket will be closed and a FIN packet will be sent. + /// associated with this socket will be closed and a FIN packet will be sent. /// - `both`: Same effect as `receive` & `send` combined. /// /// This function is idempotent; shutting down a direction more than once @@ -601,7 +617,7 @@ interface tcp-create-socket { @since(version = 0.2.0) interface udp { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; @@ -685,10 +701,10 @@ interface udp { /// The POSIX equivalent in pseudo-code is: /// ```text /// if (was previously connected) { - /// connect(s, AF_UNSPEC) + /// connect(s, AF_UNSPEC) /// } /// if (remote_address is Some) { - /// connect(s, remote_address) + /// connect(s, remote_address) /// } /// ``` /// @@ -908,22 +924,22 @@ interface udp-create-socket { @since(version = 0.2.0) world imports { + @since(version = 0.2.0) + import wasi:io/error@0.2.6; @since(version = 0.2.0) import network; @since(version = 0.2.0) import instance-network; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) import udp; @since(version = 0.2.0) import udp-create-socket; @since(version = 0.2.0) - import wasi:io/error@0.2.3; - @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) import tcp; @since(version = 0.2.0) diff --git a/components/wit/world.wit b/components/wit/world.wit index 43d91ef..dd5f27a 100644 --- a/components/wit/world.wit +++ b/components/wit/world.wit @@ -10,26 +10,26 @@ world valkey-lifecycle { } world credential-config { - export wasi:config/store@0.2.0-draft; + export wasi:config/store@0.2.0-rc.1; import componentized:services/credential-store; - include wasi:config/imports@0.2.0-draft; + include wasi:config/imports@0.2.0-rc.1; } // lifecycle hosts world lifecycle-host-cli { - export wasi:cli/run@0.2.3; + export wasi:cli/run@0.2.6; import componentized:services/lifecycle; include wasi:logging/imports@0.1.0-draft; - include wasi:cli/imports@0.2.3; + include wasi:cli/imports@0.2.6; } world lifecycle-host-http { import componentized:services/lifecycle; - export wasi:http/incoming-handler@0.2.3; + export wasi:http/incoming-handler@0.2.6; include wasi:logging/imports@0.1.0-draft; } @@ -39,41 +39,41 @@ world lifecycle-host-http { world filesystem-credential-store { export componentized:services/credential-store; - include wasi:config/imports@0.2.0-draft; - include wasi:filesystem/imports@0.2.3; + include wasi:config/imports@0.2.0-rc.1; + include wasi:filesystem/imports@0.2.6; } world filesystem-credential-admin { export componentized:services/credential-admin; - include wasi:config/imports@0.2.0-draft; - include wasi:filesystem/imports@0.2.3; + include wasi:config/imports@0.2.0-rc.1; + include wasi:filesystem/imports@0.2.6; } world keyvalue-credential-store { export componentized:services/credential-store; - include wasi:config/imports@0.2.0-draft; + include wasi:config/imports@0.2.0-rc.1; include wasi:keyvalue/imports@0.2.0-draft2; } world keyvalue-credential-admin { export componentized:services/credential-admin; - include wasi:config/imports@0.2.0-draft; + include wasi:config/imports@0.2.0-rc.1; include wasi:keyvalue/imports@0.2.0-draft2; } world webhook-credential-admin { export componentized:services/credential-admin; - include wasi:http/imports@0.2.3; - include wasi:config/imports@0.2.0-draft; + include wasi:http/imports@0.2.6; + include wasi:config/imports@0.2.0-rc.1; include wasi:logging/imports@0.1.0-draft; } world webhook-credential-store { export componentized:services/credential-store; - include wasi:http/imports@0.2.3; - include wasi:config/imports@0.2.0-draft; + include wasi:http/imports@0.2.6; + include wasi:config/imports@0.2.0-rc.1; include wasi:logging/imports@0.1.0-draft; } diff --git a/components/wkg.lock b/components/wkg.lock index 5f35bc5..be123a0 100644 --- a/components/wkg.lock +++ b/components/wkg.lock @@ -7,36 +7,45 @@ name = "wasi:cli" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:8f97d837e1f856a225422869d5c34752204d1befb5a04d0cd80541aec17a20c1" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:fdbe84136b3dd46d94305ef37f24f3cf04a70cc2026dca2592ac2ec0c9de15c7" [[packages]] name = "wasi:clocks" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:3bbed4e582d6209cf281cfe94e51d64fd0c9507635c5e1c68795f493b6cdada9" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:569984cc45d3f5a362a3b2897aabbaa3cc4184a6113bfcbbf03c1bd7fc20338c" + +[[packages]] +name = "wasi:config" +registry = "wasi.dev" + +[[packages.versions]] +requirement = "=0.2.0-rc.1" +version = "0.2.0-rc.1" +digest = "sha256:1b7f1b0fd07bb4cede16c6a6ec8852815dfb924639a78735fc7bdffdc164485d" [[packages]] name = "wasi:filesystem" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:a8e65d5b946d9c374ae6832ca6f90316e9b51e6f2a8d9691032cd91e25fe221f" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:7b735005e020ee3d727d995c05849c59bbf084b51a054013c0f0796c571e1ab0" [[packages]] name = "wasi:http" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:e526c1586efc94cd148e33725139be05c4bb58ba20466d348282bd8dc3999f1d" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:26a636620af0485dfcfc9a0563a0606564eedcf3fcabda031ab4d4ec0e505ff1" [[packages]] name = "wasi:logging" @@ -52,15 +61,15 @@ name = "wasi:random" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:90bff11fae5e2df9196ee89cd00d374792dce8afadf5c4c761a834ed760588e3" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:14ea24097cbe19ae2c79c6ffead72f70c4aed65bb68ef40ed8eca6e08383dc1b" [[packages]] name = "wasi:sockets" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:dcbe3e55d025d3b3a7ee959c4f74119be0d7d85d1289d4ac6d29a4a37b4d47d7" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:f3e112b5a7926758b82cfc884b5febfce8b924cda766dbdc1f4f60893f59b301" diff --git a/components/wkg.toml b/components/wkg.toml index cc95d37..5200433 100644 --- a/components/wkg.toml +++ b/components/wkg.toml @@ -2,5 +2,4 @@ "componentized:services" = { path = "../wit" } "componentized:config" = { path = "../wit-overrides/componentized-config" } "componentized:valkey" = { path = "../wit-overrides/componentized-valkey" } -"wasi:config" = { path = "../wit-overrides/wasi-config" } "wasi:keyvalue" = { path = "../wit-overrides/wasi-keyvalue" } diff --git a/demo.sh b/demo.sh index 6eafaad..9db373d 100755 --- a/demo.sh +++ b/demo.sh @@ -4,9 +4,10 @@ set -o errexit set -o pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +WASMTIME=${WASMTIME:-wasmtime} componentized_services() { - wasmtime run -Sconfig -Sinherit-network \ + ${WASMTIME} run -Sconfig -Sinherit-network \ -Sconfig-var=path=services \ -Sconfig-var=binding-id="${binding_id}" \ --dir "${SCRIPT_DIR:-.}/tests/testdata"::/ \ diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 230ba8a..798c4ad 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.89" +channel = "1.91" targets = [ "wasm32-unknown-unknown", "wasm32-wasip2" ] diff --git a/test.sh b/test.sh index 449a6de..0fb2c2e 100755 --- a/test.sh +++ b/test.sh @@ -4,6 +4,7 @@ set -o errexit set -o pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +WASMTIME=${WASMTIME:-wasmtime} store_type="${store_type:-filesystem}" service_type="${service_type:-${store_type}}" @@ -13,7 +14,7 @@ if [ -z ${SKIP_BUILD+x} ]; then fi componentized_services() { - wasmtime run -Sconfig -Sinherit-network \ + ${WASMTIME} run -Sconfig -Sinherit-network \ -Sconfig-var=path=services \ --env log_context_kv2fs \ -Sconfig-var=binding-id="${binding_id}" \ diff --git a/tests/ops.wac b/tests/ops.wac index 076bbce..cdfd643 100644 --- a/tests/ops.wac +++ b/tests/ops.wac @@ -13,8 +13,8 @@ let filesystem-client = new componentized:filesystem-client { ... }; let filesystem-ops = new componentized:filesystem-ops { - "wasi:filesystem/preopens@0.2.3": filesystem-client.preopens, - "wasi:filesystem/types@0.2.3": filesystem-client.types, + "wasi:filesystem/preopens@0.2.6": filesystem-client.preopens, + "wasi:filesystem/types@0.2.6": filesystem-client.types, ... }; diff --git a/tests/wit/deps/componentized-config/package.wit b/tests/wit/deps/componentized-config/package.wit index 1f5c014..4d02f71 100644 --- a/tests/wit/deps/componentized-config/package.wit +++ b/tests/wit/deps/componentized-config/package.wit @@ -7,7 +7,7 @@ interface factory { } world adapter { - export wasi:config/store@0.2.0-draft; + export wasi:config/store@0.2.0-rc.1; } world config-factory { export factory; diff --git a/tests/wit/deps/componentized-services/package.wit b/tests/wit/deps/componentized-services/package.wit index 0215f57..c90c7fd 100644 --- a/tests/wit/deps/componentized-services/package.wit +++ b/tests/wit/deps/componentized-services/package.wit @@ -94,25 +94,25 @@ interface lifecycle { world service-lifecycle { import types; import credential-admin; - import wasi:io/poll@0.2.3; - import wasi:clocks/monotonic-clock@0.2.3; - import wasi:clocks/wall-clock@0.2.3; - import wasi:config/store@0.2.0-draft; - import wasi:io/error@0.2.3; - import wasi:io/streams@0.2.3; - import wasi:filesystem/types@0.2.3; - import wasi:filesystem/preopens@0.2.3; + import wasi:io/poll@0.2.6; + import wasi:clocks/monotonic-clock@0.2.6; + import wasi:clocks/wall-clock@0.2.6; + import wasi:config/store@0.2.0-rc.1; + import wasi:io/error@0.2.6; + import wasi:io/streams@0.2.6; + import wasi:filesystem/types@0.2.6; + import wasi:filesystem/preopens@0.2.6; import wasi:logging/logging@0.1.0-draft; - import wasi:random/random@0.2.3; - import wasi:random/insecure@0.2.3; - import wasi:random/insecure-seed@0.2.3; - import wasi:sockets/network@0.2.3; - import wasi:sockets/instance-network@0.2.3; - import wasi:sockets/udp@0.2.3; - import wasi:sockets/udp-create-socket@0.2.3; - import wasi:sockets/tcp@0.2.3; - import wasi:sockets/tcp-create-socket@0.2.3; - import wasi:sockets/ip-name-lookup@0.2.3; + import wasi:random/random@0.2.6; + import wasi:random/insecure@0.2.6; + import wasi:random/insecure-seed@0.2.6; + import wasi:sockets/network@0.2.6; + import wasi:sockets/instance-network@0.2.6; + import wasi:sockets/udp@0.2.6; + import wasi:sockets/udp-create-socket@0.2.6; + import wasi:sockets/tcp@0.2.6; + import wasi:sockets/tcp-create-socket@0.2.6; + import wasi:sockets/ip-name-lookup@0.2.6; export lifecycle; } diff --git a/components/wit/deps/wasi-clocks-0.2.3/package.wit b/tests/wit/deps/wasi-clocks-0.2.6/package.wit similarity index 60% rename from components/wit/deps/wasi-clocks-0.2.3/package.wit rename to tests/wit/deps/wasi-clocks-0.2.6/package.wit index a78edc8..d638f1a 100644 --- a/components/wit/deps/wasi-clocks-0.2.3/package.wit +++ b/tests/wit/deps/wasi-clocks-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:clocks@0.2.3; +package wasi:clocks@0.2.6; /// WASI Monotonic Clock is a clock API intended to let users measure elapsed /// time. @@ -11,7 +11,7 @@ package wasi:clocks@0.2.3; @since(version = 0.2.0) interface monotonic-clock { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; /// An instant in time, in nanoseconds. An instant is relative to an /// unspecified initial value, and can only be compared to instances from @@ -92,12 +92,66 @@ interface wall-clock { resolution: func() -> datetime; } +@unstable(feature = clocks-timezone) +interface timezone { + @unstable(feature = clocks-timezone) + use wall-clock.{datetime}; + + /// Information useful for displaying the timezone of a specific `datetime`. + /// + /// This information may vary within a single `timezone` to reflect daylight + /// saving time adjustments. + @unstable(feature = clocks-timezone) + record timezone-display { + /// The number of seconds difference between UTC time and the local + /// time of the timezone. + /// + /// The returned value will always be less than 86400 which is the + /// number of seconds in a day (24*60*60). + /// + /// In implementations that do not expose an actual time zone, this + /// should return 0. + utc-offset: s32, + /// The abbreviated name of the timezone to display to a user. The name + /// `UTC` indicates Coordinated Universal Time. Otherwise, this should + /// reference local standards for the name of the time zone. + /// + /// In implementations that do not expose an actual time zone, this + /// should be the string `UTC`. + /// + /// In time zones that do not have an applicable name, a formatted + /// representation of the UTC offset may be returned, such as `-04:00`. + name: string, + /// Whether daylight saving time is active. + /// + /// In implementations that do not expose an actual time zone, this + /// should return false. + in-daylight-saving-time: bool, + } + + /// Return information needed to display the given `datetime`. This includes + /// the UTC offset, the time zone name, and a flag indicating whether + /// daylight saving time is active. + /// + /// If the timezone cannot be determined for the given `datetime`, return a + /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight + /// saving time. + @unstable(feature = clocks-timezone) + display: func(when: datetime) -> timezone-display; + + /// The same as `display`, but only return the UTC offset. + @unstable(feature = clocks-timezone) + utc-offset: func(when: datetime) -> s32; +} + @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) import monotonic-clock; @since(version = 0.2.0) import wall-clock; + @unstable(feature = clocks-timezone) + import timezone; } diff --git a/tests/wit/deps/wasi-config-0.2.0-draft/package.wit b/tests/wit/deps/wasi-config-0.2.0-rc.1/package.wit similarity index 97% rename from tests/wit/deps/wasi-config-0.2.0-draft/package.wit rename to tests/wit/deps/wasi-config-0.2.0-rc.1/package.wit index a4cdf94..d8950ee 100644 --- a/tests/wit/deps/wasi-config-0.2.0-draft/package.wit +++ b/tests/wit/deps/wasi-config-0.2.0-rc.1/package.wit @@ -1,4 +1,4 @@ -package wasi:config@0.2.0-draft; +package wasi:config@0.2.0-rc.1; interface store { /// An error type that encapsulates the different errors that can occur fetching configuration values. diff --git a/tests/wit/deps/wasi-filesystem-0.2.3/package.wit b/tests/wit/deps/wasi-filesystem-0.2.6/package.wit similarity index 96% rename from tests/wit/deps/wasi-filesystem-0.2.3/package.wit rename to tests/wit/deps/wasi-filesystem-0.2.6/package.wit index b990c87..9f4a828 100644 --- a/tests/wit/deps/wasi-filesystem-0.2.3/package.wit +++ b/tests/wit/deps/wasi-filesystem-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:filesystem@0.2.3; +package wasi:filesystem@0.2.6; /// WASI filesystem is a filesystem API primarily intended to let users run WASI /// programs that access their files on their existing filesystems, without @@ -27,9 +27,9 @@ package wasi:filesystem@0.2.3; @since(version = 0.2.0) interface types { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream, error}; + use wasi:io/streams@0.2.6.{input-stream, output-stream, error}; @since(version = 0.2.0) - use wasi:clocks/wall-clock@0.2.3.{datetime}; + use wasi:clocks/wall-clock@0.2.6.{datetime}; /// File size or length of a region within a file. @since(version = 0.2.0) @@ -446,6 +446,10 @@ interface types { set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; /// Create a hard link. /// + /// Fails with `error-code::no-entry` if the old path does not exist, + /// with `error-code::exist` if the new path already exists, and + /// `error-code::not-permitted` if the old path is not a file. + /// /// Note: This is similar to `linkat` in POSIX. @since(version = 0.2.0) link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; @@ -516,12 +520,12 @@ interface types { /// /// Implementations are encouraged to provide the following properties: /// - /// - If the file is not modified or replaced, the computed hash value should - /// usually not change. - /// - If the object is modified or replaced, the computed hash value should - /// usually change. - /// - The inputs to the hash should not be easily computable from the - /// computed hash. + /// - If the file is not modified or replaced, the computed hash value should + /// usually not change. + /// - If the object is modified or replaced, the computed hash value should + /// usually change. + /// - The inputs to the hash should not be easily computable from the + /// computed hash. /// /// However, none of these is required. @since(version = 0.2.0) @@ -569,13 +573,13 @@ interface preopens { @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; @since(version = 0.2.0) import types; @since(version = 0.2.0) diff --git a/wit/deps/wasi-io-0.2.3/package.wit b/tests/wit/deps/wasi-io-0.2.6/package.wit similarity index 98% rename from wit/deps/wasi-io-0.2.3/package.wit rename to tests/wit/deps/wasi-io-0.2.6/package.wit index adcf1f4..c66abac 100644 --- a/wit/deps/wasi-io-0.2.3/package.wit +++ b/tests/wit/deps/wasi-io-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:io@0.2.3; +package wasi:io@0.2.6; interface poll { resource pollable { diff --git a/wit/deps/wasi-random-0.2.3/package.wit b/tests/wit/deps/wasi-random-0.2.6/package.wit similarity index 99% rename from wit/deps/wasi-random-0.2.3/package.wit rename to tests/wit/deps/wasi-random-0.2.6/package.wit index 5a67748..73edf5b 100644 --- a/wit/deps/wasi-random-0.2.3/package.wit +++ b/tests/wit/deps/wasi-random-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:random@0.2.3; +package wasi:random@0.2.6; /// The insecure-seed interface for seeding hash-map DoS resistance. /// diff --git a/tests/wit/deps/wasi-sockets-0.2.3/package.wit b/tests/wit/deps/wasi-sockets-0.2.6/package.wit similarity index 96% rename from tests/wit/deps/wasi-sockets-0.2.3/package.wit rename to tests/wit/deps/wasi-sockets-0.2.6/package.wit index 42af96a..db6d1a2 100644 --- a/tests/wit/deps/wasi-sockets-0.2.3/package.wit +++ b/tests/wit/deps/wasi-sockets-0.2.6/package.wit @@ -1,7 +1,10 @@ -package wasi:sockets@0.2.3; +package wasi:sockets@0.2.6; @since(version = 0.2.0) interface network { + @unstable(feature = network-error-code) + use wasi:io/error@0.2.6.{error}; + /// An opaque resource that represents access to (a subset of) the network. /// This enables context-based security for networking. /// There is no need for this to map 1:1 to a physical network interface. @@ -128,6 +131,19 @@ interface network { ipv4(ipv4-socket-address), ipv6(ipv6-socket-address), } + + /// Attempts to extract a network-related `error-code` from the stream + /// `error` provided. + /// + /// Stream operations which return `stream-error::last-operation-failed` + /// have a payload with more information about the operation that failed. + /// This payload can be passed through to this function to see if there's + /// network-related information about the error to return. + /// + /// Note that this function is fallible because not all stream-related + /// errors are network-related errors. + @unstable(feature = network-error-code) + network-error-code: func(err: borrow) -> option; } /// This interface provides a value-export of the default network handle.. @@ -144,7 +160,7 @@ interface instance-network { @since(version = 0.2.0) interface ip-name-lookup { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) use network.{network, error-code, ip-address}; @@ -200,11 +216,11 @@ interface ip-name-lookup { @since(version = 0.2.0) interface tcp { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream}; + use wasi:io/streams@0.2.6.{input-stream, output-stream}; @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) - use wasi:clocks/monotonic-clock@0.2.3.{duration}; + use wasi:clocks/monotonic-clock@0.2.6.{duration}; @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; @@ -542,11 +558,11 @@ interface tcp { /// Initiate a graceful shutdown. /// /// - `receive`: The socket is not expecting to receive any data from - /// the peer. The `input-stream` associated with this socket will be - /// closed. Any data still in the receive queue at time of calling - /// this method will be discarded. + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. /// - `send`: The socket has no more data to send to the peer. The `output-stream` - /// associated with this socket will be closed and a FIN packet will be sent. + /// associated with this socket will be closed and a FIN packet will be sent. /// - `both`: Same effect as `receive` & `send` combined. /// /// This function is idempotent; shutting down a direction more than once @@ -601,7 +617,7 @@ interface tcp-create-socket { @since(version = 0.2.0) interface udp { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; @@ -685,10 +701,10 @@ interface udp { /// The POSIX equivalent in pseudo-code is: /// ```text /// if (was previously connected) { - /// connect(s, AF_UNSPEC) + /// connect(s, AF_UNSPEC) /// } /// if (remote_address is Some) { - /// connect(s, remote_address) + /// connect(s, remote_address) /// } /// ``` /// @@ -908,22 +924,22 @@ interface udp-create-socket { @since(version = 0.2.0) world imports { + @since(version = 0.2.0) + import wasi:io/error@0.2.6; @since(version = 0.2.0) import network; @since(version = 0.2.0) import instance-network; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) import udp; @since(version = 0.2.0) import udp-create-socket; @since(version = 0.2.0) - import wasi:io/error@0.2.3; - @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) import tcp; @since(version = 0.2.0) diff --git a/tests/wit/world.wit b/tests/wit/world.wit index cb737a2..9015617 100644 --- a/tests/wit/world.wit +++ b/tests/wit/world.wit @@ -18,7 +18,7 @@ world stub-client { export greeter: interface { greet: func(name: string) -> result; } - include wasi:config/imports@0.2.0-draft; + include wasi:config/imports@0.2.0-rc.1; include wasi:logging/imports@0.1.0-draft; } @@ -31,8 +31,8 @@ world cli { import ops; import componentized:config/factory; - include wasi:random/imports@0.2.3; - //include wasi:cli/command@0.2.3; + include wasi:random/imports@0.2.6; + //include wasi:cli/command@0.2.6; } world lifecycle-router { @@ -81,14 +81,14 @@ world ops-router { move: func(from-path: string, to-path: string) -> result<_, error>; delete: func(path: string) -> result<_, error>; } - include wasi:config/imports@0.2.0-draft; + include wasi:config/imports@0.2.0-rc.1; export ops; } world filesystem-ops { - import wasi:filesystem/preopens@0.2.3; - import wasi:filesystem/types@0.2.3; + import wasi:filesystem/preopens@0.2.6; + import wasi:filesystem/types@0.2.6; export ops; } diff --git a/tests/wkg.lock b/tests/wkg.lock index 4c58ae2..c00b2a7 100644 --- a/tests/wkg.lock +++ b/tests/wkg.lock @@ -7,18 +7,27 @@ name = "wasi:clocks" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:3bbed4e582d6209cf281cfe94e51d64fd0c9507635c5e1c68795f493b6cdada9" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:569984cc45d3f5a362a3b2897aabbaa3cc4184a6113bfcbbf03c1bd7fc20338c" + +[[packages]] +name = "wasi:config" +registry = "wasi.dev" + +[[packages.versions]] +requirement = "=0.2.0-rc.1" +version = "0.2.0-rc.1" +digest = "sha256:1b7f1b0fd07bb4cede16c6a6ec8852815dfb924639a78735fc7bdffdc164485d" [[packages]] name = "wasi:filesystem" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:a8e65d5b946d9c374ae6832ca6f90316e9b51e6f2a8d9691032cd91e25fe221f" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:7b735005e020ee3d727d995c05849c59bbf084b51a054013c0f0796c571e1ab0" [[packages]] name = "wasi:logging" @@ -34,15 +43,15 @@ name = "wasi:random" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:90bff11fae5e2df9196ee89cd00d374792dce8afadf5c4c761a834ed760588e3" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:14ea24097cbe19ae2c79c6ffead72f70c4aed65bb68ef40ed8eca6e08383dc1b" [[packages]] name = "wasi:sockets" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:dcbe3e55d025d3b3a7ee959c4f74119be0d7d85d1289d4ac6d29a4a37b4d47d7" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:f3e112b5a7926758b82cfc884b5febfce8b924cda766dbdc1f4f60893f59b301" diff --git a/tests/wkg.toml b/tests/wkg.toml index cc95d37..5200433 100644 --- a/tests/wkg.toml +++ b/tests/wkg.toml @@ -2,5 +2,4 @@ "componentized:services" = { path = "../wit" } "componentized:config" = { path = "../wit-overrides/componentized-config" } "componentized:valkey" = { path = "../wit-overrides/componentized-valkey" } -"wasi:config" = { path = "../wit-overrides/wasi-config" } "wasi:keyvalue" = { path = "../wit-overrides/wasi-keyvalue" } diff --git a/update-deps.sh b/update-deps.sh index 9045db0..3b5ff30 100755 --- a/update-deps.sh +++ b/update-deps.sh @@ -10,15 +10,15 @@ DEPS_DIR="${SCRIPT_DIR}/lib/deps" rm -rf "${DEPS_DIR}" mkdir -p "${DEPS_DIR}" -wkg oci pull ghcr.io/componentized/logging/levels:v0.1.0 -o "${DEPS_DIR}/logging-levels.wasm" -wkg oci pull ghcr.io/componentized/logging/to-stdout:v0.1.0 -o "${DEPS_DIR}/logging-to-stdout.wasm" +wkg oci pull ghcr.io/componentized/logging/levels:v0.2.1 -o "${DEPS_DIR}/logging-levels.wasm" +wkg oci pull ghcr.io/componentized/logging/to-stdout:v0.2.1 -o "${DEPS_DIR}/logging-to-stdout.wasm" wac plug "${DEPS_DIR}/logging-levels.wasm" --plug "${DEPS_DIR}/logging-to-stdout.wasm" -o "${DEPS_DIR}/logger.wasm" static-config -o "${DEPS_DIR}/app-config.wasm" -p logging.env.prefix=log_context_ -wkg oci pull ghcr.io/componentized/filesystem/chroot:v0.1.0 -o "${DEPS_DIR}/filesystem-chroot.wasm" -wkg oci pull ghcr.io/componentized/cli/stdout-to-stderr:v0.1.0 -o "${DEPS_DIR}/stdout-to-stderr.wasm" -wkg oci pull ghcr.io/componentized/valkey/valkey-client:v0.1.1 -o "${DEPS_DIR}/valkey-client.wasm" -wkg oci pull ghcr.io/componentized/static-config/factory:v0.1.0 -o "${DEPS_DIR}/static-config-factory.wasm" +wkg oci pull ghcr.io/componentized/filesystem/chroot:v0.2.1 -o "${DEPS_DIR}/filesystem-chroot.wasm" +wkg oci pull ghcr.io/componentized/cli/stdout-to-stderr:v0.1.1 -o "${DEPS_DIR}/stdout-to-stderr.wasm" +wkg oci pull ghcr.io/componentized/valkey/valkey-client:v0.2.1 -o "${DEPS_DIR}/valkey-client.wasm" +wkg oci pull ghcr.io/componentized/static-config/factory:v0.2.0 -o "${DEPS_DIR}/static-config-factory.wasm" wkg wit fetch (cd components && wkg wit fetch) diff --git a/wit-overrides/componentized-config/package.wit b/wit-overrides/componentized-config/package.wit index 1f5c014..4d02f71 100644 --- a/wit-overrides/componentized-config/package.wit +++ b/wit-overrides/componentized-config/package.wit @@ -7,7 +7,7 @@ interface factory { } world adapter { - export wasi:config/store@0.2.0-draft; + export wasi:config/store@0.2.0-rc.1; } world config-factory { export factory; diff --git a/wit-overrides/wasi-config/store.wit b/wit-overrides/wasi-config/store.wit deleted file mode 100644 index 794379a..0000000 --- a/wit-overrides/wasi-config/store.wit +++ /dev/null @@ -1,30 +0,0 @@ -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`. 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, 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>, error>; -} diff --git a/wit-overrides/wasi-config/world.wit b/wit-overrides/wasi-config/world.wit deleted file mode 100644 index f92f080..0000000 --- a/wit-overrides/wasi-config/world.wit +++ /dev/null @@ -1,6 +0,0 @@ -package wasi:config@0.2.0-draft; - -world imports { - /// The interface for wasi:config/store - import store; -} \ No newline at end of file diff --git a/tests/wit/deps/wasi-clocks-0.2.3/package.wit b/wit/deps/wasi-clocks-0.2.6/package.wit similarity index 60% rename from tests/wit/deps/wasi-clocks-0.2.3/package.wit rename to wit/deps/wasi-clocks-0.2.6/package.wit index a78edc8..d638f1a 100644 --- a/tests/wit/deps/wasi-clocks-0.2.3/package.wit +++ b/wit/deps/wasi-clocks-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:clocks@0.2.3; +package wasi:clocks@0.2.6; /// WASI Monotonic Clock is a clock API intended to let users measure elapsed /// time. @@ -11,7 +11,7 @@ package wasi:clocks@0.2.3; @since(version = 0.2.0) interface monotonic-clock { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; /// An instant in time, in nanoseconds. An instant is relative to an /// unspecified initial value, and can only be compared to instances from @@ -92,12 +92,66 @@ interface wall-clock { resolution: func() -> datetime; } +@unstable(feature = clocks-timezone) +interface timezone { + @unstable(feature = clocks-timezone) + use wall-clock.{datetime}; + + /// Information useful for displaying the timezone of a specific `datetime`. + /// + /// This information may vary within a single `timezone` to reflect daylight + /// saving time adjustments. + @unstable(feature = clocks-timezone) + record timezone-display { + /// The number of seconds difference between UTC time and the local + /// time of the timezone. + /// + /// The returned value will always be less than 86400 which is the + /// number of seconds in a day (24*60*60). + /// + /// In implementations that do not expose an actual time zone, this + /// should return 0. + utc-offset: s32, + /// The abbreviated name of the timezone to display to a user. The name + /// `UTC` indicates Coordinated Universal Time. Otherwise, this should + /// reference local standards for the name of the time zone. + /// + /// In implementations that do not expose an actual time zone, this + /// should be the string `UTC`. + /// + /// In time zones that do not have an applicable name, a formatted + /// representation of the UTC offset may be returned, such as `-04:00`. + name: string, + /// Whether daylight saving time is active. + /// + /// In implementations that do not expose an actual time zone, this + /// should return false. + in-daylight-saving-time: bool, + } + + /// Return information needed to display the given `datetime`. This includes + /// the UTC offset, the time zone name, and a flag indicating whether + /// daylight saving time is active. + /// + /// If the timezone cannot be determined for the given `datetime`, return a + /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight + /// saving time. + @unstable(feature = clocks-timezone) + display: func(when: datetime) -> timezone-display; + + /// The same as `display`, but only return the UTC offset. + @unstable(feature = clocks-timezone) + utc-offset: func(when: datetime) -> s32; +} + @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) import monotonic-clock; @since(version = 0.2.0) import wall-clock; + @unstable(feature = clocks-timezone) + import timezone; } diff --git a/components/wit/deps/wasi-config-0.2.0-draft/package.wit b/wit/deps/wasi-config-0.2.0-rc.1/package.wit similarity index 97% rename from components/wit/deps/wasi-config-0.2.0-draft/package.wit rename to wit/deps/wasi-config-0.2.0-rc.1/package.wit index a4cdf94..d8950ee 100644 --- a/components/wit/deps/wasi-config-0.2.0-draft/package.wit +++ b/wit/deps/wasi-config-0.2.0-rc.1/package.wit @@ -1,4 +1,4 @@ -package wasi:config@0.2.0-draft; +package wasi:config@0.2.0-rc.1; interface store { /// An error type that encapsulates the different errors that can occur fetching configuration values. diff --git a/components/wit/deps/wasi-filesystem-0.2.3/package.wit b/wit/deps/wasi-filesystem-0.2.6/package.wit similarity index 96% rename from components/wit/deps/wasi-filesystem-0.2.3/package.wit rename to wit/deps/wasi-filesystem-0.2.6/package.wit index b990c87..9f4a828 100644 --- a/components/wit/deps/wasi-filesystem-0.2.3/package.wit +++ b/wit/deps/wasi-filesystem-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:filesystem@0.2.3; +package wasi:filesystem@0.2.6; /// WASI filesystem is a filesystem API primarily intended to let users run WASI /// programs that access their files on their existing filesystems, without @@ -27,9 +27,9 @@ package wasi:filesystem@0.2.3; @since(version = 0.2.0) interface types { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream, error}; + use wasi:io/streams@0.2.6.{input-stream, output-stream, error}; @since(version = 0.2.0) - use wasi:clocks/wall-clock@0.2.3.{datetime}; + use wasi:clocks/wall-clock@0.2.6.{datetime}; /// File size or length of a region within a file. @since(version = 0.2.0) @@ -446,6 +446,10 @@ interface types { set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; /// Create a hard link. /// + /// Fails with `error-code::no-entry` if the old path does not exist, + /// with `error-code::exist` if the new path already exists, and + /// `error-code::not-permitted` if the old path is not a file. + /// /// Note: This is similar to `linkat` in POSIX. @since(version = 0.2.0) link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; @@ -516,12 +520,12 @@ interface types { /// /// Implementations are encouraged to provide the following properties: /// - /// - If the file is not modified or replaced, the computed hash value should - /// usually not change. - /// - If the object is modified or replaced, the computed hash value should - /// usually change. - /// - The inputs to the hash should not be easily computable from the - /// computed hash. + /// - If the file is not modified or replaced, the computed hash value should + /// usually not change. + /// - If the object is modified or replaced, the computed hash value should + /// usually change. + /// - The inputs to the hash should not be easily computable from the + /// computed hash. /// /// However, none of these is required. @since(version = 0.2.0) @@ -569,13 +573,13 @@ interface preopens { @since(version = 0.2.0) world imports { @since(version = 0.2.0) - import wasi:io/error@0.2.3; + import wasi:io/error@0.2.6; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:clocks/wall-clock@0.2.3; + import wasi:clocks/wall-clock@0.2.6; @since(version = 0.2.0) import types; @since(version = 0.2.0) diff --git a/tests/wit/deps/wasi-io-0.2.3/package.wit b/wit/deps/wasi-io-0.2.6/package.wit similarity index 98% rename from tests/wit/deps/wasi-io-0.2.3/package.wit rename to wit/deps/wasi-io-0.2.6/package.wit index adcf1f4..c66abac 100644 --- a/tests/wit/deps/wasi-io-0.2.3/package.wit +++ b/wit/deps/wasi-io-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:io@0.2.3; +package wasi:io@0.2.6; interface poll { resource pollable { diff --git a/tests/wit/deps/wasi-random-0.2.3/package.wit b/wit/deps/wasi-random-0.2.6/package.wit similarity index 99% rename from tests/wit/deps/wasi-random-0.2.3/package.wit rename to wit/deps/wasi-random-0.2.6/package.wit index 5a67748..73edf5b 100644 --- a/tests/wit/deps/wasi-random-0.2.3/package.wit +++ b/wit/deps/wasi-random-0.2.6/package.wit @@ -1,4 +1,4 @@ -package wasi:random@0.2.3; +package wasi:random@0.2.6; /// The insecure-seed interface for seeding hash-map DoS resistance. /// diff --git a/wit/deps/wasi-sockets-0.2.3/package.wit b/wit/deps/wasi-sockets-0.2.6/package.wit similarity index 96% rename from wit/deps/wasi-sockets-0.2.3/package.wit rename to wit/deps/wasi-sockets-0.2.6/package.wit index 42af96a..db6d1a2 100644 --- a/wit/deps/wasi-sockets-0.2.3/package.wit +++ b/wit/deps/wasi-sockets-0.2.6/package.wit @@ -1,7 +1,10 @@ -package wasi:sockets@0.2.3; +package wasi:sockets@0.2.6; @since(version = 0.2.0) interface network { + @unstable(feature = network-error-code) + use wasi:io/error@0.2.6.{error}; + /// An opaque resource that represents access to (a subset of) the network. /// This enables context-based security for networking. /// There is no need for this to map 1:1 to a physical network interface. @@ -128,6 +131,19 @@ interface network { ipv4(ipv4-socket-address), ipv6(ipv6-socket-address), } + + /// Attempts to extract a network-related `error-code` from the stream + /// `error` provided. + /// + /// Stream operations which return `stream-error::last-operation-failed` + /// have a payload with more information about the operation that failed. + /// This payload can be passed through to this function to see if there's + /// network-related information about the error to return. + /// + /// Note that this function is fallible because not all stream-related + /// errors are network-related errors. + @unstable(feature = network-error-code) + network-error-code: func(err: borrow) -> option; } /// This interface provides a value-export of the default network handle.. @@ -144,7 +160,7 @@ interface instance-network { @since(version = 0.2.0) interface ip-name-lookup { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) use network.{network, error-code, ip-address}; @@ -200,11 +216,11 @@ interface ip-name-lookup { @since(version = 0.2.0) interface tcp { @since(version = 0.2.0) - use wasi:io/streams@0.2.3.{input-stream, output-stream}; + use wasi:io/streams@0.2.6.{input-stream, output-stream}; @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) - use wasi:clocks/monotonic-clock@0.2.3.{duration}; + use wasi:clocks/monotonic-clock@0.2.6.{duration}; @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; @@ -542,11 +558,11 @@ interface tcp { /// Initiate a graceful shutdown. /// /// - `receive`: The socket is not expecting to receive any data from - /// the peer. The `input-stream` associated with this socket will be - /// closed. Any data still in the receive queue at time of calling - /// this method will be discarded. + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. /// - `send`: The socket has no more data to send to the peer. The `output-stream` - /// associated with this socket will be closed and a FIN packet will be sent. + /// associated with this socket will be closed and a FIN packet will be sent. /// - `both`: Same effect as `receive` & `send` combined. /// /// This function is idempotent; shutting down a direction more than once @@ -601,7 +617,7 @@ interface tcp-create-socket { @since(version = 0.2.0) interface udp { @since(version = 0.2.0) - use wasi:io/poll@0.2.3.{pollable}; + use wasi:io/poll@0.2.6.{pollable}; @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; @@ -685,10 +701,10 @@ interface udp { /// The POSIX equivalent in pseudo-code is: /// ```text /// if (was previously connected) { - /// connect(s, AF_UNSPEC) + /// connect(s, AF_UNSPEC) /// } /// if (remote_address is Some) { - /// connect(s, remote_address) + /// connect(s, remote_address) /// } /// ``` /// @@ -908,22 +924,22 @@ interface udp-create-socket { @since(version = 0.2.0) world imports { + @since(version = 0.2.0) + import wasi:io/error@0.2.6; @since(version = 0.2.0) import network; @since(version = 0.2.0) import instance-network; @since(version = 0.2.0) - import wasi:io/poll@0.2.3; + import wasi:io/poll@0.2.6; @since(version = 0.2.0) import udp; @since(version = 0.2.0) import udp-create-socket; @since(version = 0.2.0) - import wasi:io/error@0.2.3; - @since(version = 0.2.0) - import wasi:io/streams@0.2.3; + import wasi:io/streams@0.2.6; @since(version = 0.2.0) - import wasi:clocks/monotonic-clock@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; @since(version = 0.2.0) import tcp; @since(version = 0.2.0) diff --git a/wit/overrides/wasi-config/store.wit b/wit/overrides/wasi-config/store.wit deleted file mode 100644 index 794379a..0000000 --- a/wit/overrides/wasi-config/store.wit +++ /dev/null @@ -1,30 +0,0 @@ -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`. 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, 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>, error>; -} diff --git a/wit/overrides/wasi-config/world.wit b/wit/overrides/wasi-config/world.wit deleted file mode 100644 index f92f080..0000000 --- a/wit/overrides/wasi-config/world.wit +++ /dev/null @@ -1,6 +0,0 @@ -package wasi:config@0.2.0-draft; - -world imports { - /// The interface for wasi:config/store - import store; -} \ No newline at end of file diff --git a/wit/world.wit b/wit/world.wit index 92800d4..d0a64dd 100644 --- a/wit/world.wit +++ b/wit/world.wit @@ -4,22 +4,22 @@ world service-lifecycle { export lifecycle; import credential-admin; - import wasi:clocks/monotonic-clock@0.2.3; - import wasi:clocks/wall-clock@0.2.3; - import wasi:config/store@0.2.0-draft; - import wasi:filesystem/types@0.2.3; - import wasi:filesystem/preopens@0.2.3; + import wasi:clocks/monotonic-clock@0.2.6; + import wasi:clocks/wall-clock@0.2.6; + import wasi:config/store@0.2.0-rc.1; + import wasi:filesystem/types@0.2.6; + import wasi:filesystem/preopens@0.2.6; import wasi:logging/logging@0.1.0-draft; - import wasi:random/random@0.2.3; - import wasi:random/insecure@0.2.3; - import wasi:random/insecure-seed@0.2.3; - import wasi:sockets/network@0.2.3; - import wasi:sockets/instance-network@0.2.3; - import wasi:sockets/udp@0.2.3; - import wasi:sockets/udp-create-socket@0.2.3; - import wasi:sockets/tcp@0.2.3; - import wasi:sockets/tcp-create-socket@0.2.3; - import wasi:sockets/ip-name-lookup@0.2.3; + import wasi:random/random@0.2.6; + import wasi:random/insecure@0.2.6; + import wasi:random/insecure-seed@0.2.6; + import wasi:sockets/network@0.2.6; + import wasi:sockets/instance-network@0.2.6; + import wasi:sockets/udp@0.2.6; + import wasi:sockets/udp-create-socket@0.2.6; + import wasi:sockets/tcp@0.2.6; + import wasi:sockets/tcp-create-socket@0.2.6; + import wasi:sockets/ip-name-lookup@0.2.6; } world imports { diff --git a/wkg.lock b/wkg.lock index 4c58ae2..c00b2a7 100644 --- a/wkg.lock +++ b/wkg.lock @@ -7,18 +7,27 @@ name = "wasi:clocks" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:3bbed4e582d6209cf281cfe94e51d64fd0c9507635c5e1c68795f493b6cdada9" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:569984cc45d3f5a362a3b2897aabbaa3cc4184a6113bfcbbf03c1bd7fc20338c" + +[[packages]] +name = "wasi:config" +registry = "wasi.dev" + +[[packages.versions]] +requirement = "=0.2.0-rc.1" +version = "0.2.0-rc.1" +digest = "sha256:1b7f1b0fd07bb4cede16c6a6ec8852815dfb924639a78735fc7bdffdc164485d" [[packages]] name = "wasi:filesystem" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:a8e65d5b946d9c374ae6832ca6f90316e9b51e6f2a8d9691032cd91e25fe221f" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:7b735005e020ee3d727d995c05849c59bbf084b51a054013c0f0796c571e1ab0" [[packages]] name = "wasi:logging" @@ -34,15 +43,15 @@ name = "wasi:random" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:90bff11fae5e2df9196ee89cd00d374792dce8afadf5c4c761a834ed760588e3" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:14ea24097cbe19ae2c79c6ffead72f70c4aed65bb68ef40ed8eca6e08383dc1b" [[packages]] name = "wasi:sockets" registry = "wasi.dev" [[packages.versions]] -requirement = "=0.2.3" -version = "0.2.3" -digest = "sha256:dcbe3e55d025d3b3a7ee959c4f74119be0d7d85d1289d4ac6d29a4a37b4d47d7" +requirement = "=0.2.6" +version = "0.2.6" +digest = "sha256:f3e112b5a7926758b82cfc884b5febfce8b924cda766dbdc1f4f60893f59b301" diff --git a/wkg.toml b/wkg.toml index 3bd6ee8..300aded 100644 --- a/wkg.toml +++ b/wkg.toml @@ -1,2 +1 @@ [overrides] -"wasi:config" = { path = "./wit-overrides/wasi-config" }