Setup for TypeScript type gen for WASM using Tsify

- Includes breaking changes to the WASM API surface, since it now accepts objects instead of stringified JSON.
This commit is contained in:
Brandon Vandegrift
2023-08-16 10:25:09 -04:00
parent 65826b219b
commit 1b20037053
22 changed files with 323 additions and 109 deletions
+14 -1
View File
@@ -105,9 +105,21 @@ macro_rules! apibail_already_initialized {
}
#[derive(
ThisError, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize, JsonSchema,
ThisError,
Clone,
Debug,
PartialOrd,
PartialEq,
Eq,
Ord,
Serialize,
Deserialize,
JsonSchema,
Tsify,
TsifyAsync,
)]
#[serde(tag = "kind")]
#[tsify(into_wasm_abi)]
pub enum VeilidAPIError {
#[error("Not initialized")]
NotInitialized,
@@ -213,6 +225,7 @@ impl VeilidAPIError {
}
}
#[declare]
pub type VeilidAPIResult<T> = Result<T, VeilidAPIError>;
impl From<std::io::Error> for VeilidAPIError {