#[cfg(target_arch = "wasm32")]
use super::into_js_error;
use super::{
abi_fingerprint_impl, abi_version_impl, browser_operator_snapshot_impl, fetch_request_impl,
runtime_close_impl, runtime_create_impl, scope_close_impl, scope_enter_impl, task_cancel_impl,
task_join_impl, task_spawn_impl, websocket_cancel_impl, websocket_close_impl,
websocket_open_impl, websocket_recv_impl, websocket_send_impl,
};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::{JsValue, prelude::wasm_bindgen};
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = runtime_create))]
#[cfg(target_arch = "wasm32")]
pub fn runtime_create(consumer_version_json: Option<String>) -> Result<String, JsValue> {
runtime_create_impl(consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn runtime_create(consumer_version_json: Option<String>) -> Result<String, String> {
runtime_create_impl(consumer_version_json)
}
#[cfg_attr(
target_arch = "wasm32",
wasm_bindgen(js_name = browser_operator_snapshot)
)]
#[cfg(target_arch = "wasm32")]
pub fn browser_operator_snapshot() -> Result<String, JsValue> {
browser_operator_snapshot_impl().map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn browser_operator_snapshot() -> Result<String, String> {
browser_operator_snapshot_impl()
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = runtime_close))]
#[cfg(target_arch = "wasm32")]
pub fn runtime_close(
handle_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
runtime_close_impl(handle_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn runtime_close(
handle_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
runtime_close_impl(handle_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = scope_enter))]
#[cfg(target_arch = "wasm32")]
pub fn scope_enter(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
scope_enter_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn scope_enter(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
scope_enter_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = scope_close))]
#[cfg(target_arch = "wasm32")]
pub fn scope_close(
handle_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
scope_close_impl(handle_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn scope_close(
handle_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
scope_close_impl(handle_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = task_spawn))]
#[cfg(target_arch = "wasm32")]
pub fn task_spawn(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
task_spawn_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn task_spawn(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
task_spawn_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = task_join))]
#[cfg(target_arch = "wasm32")]
pub fn task_join(
handle_json: String,
outcome_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
task_join_impl(handle_json, outcome_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn task_join(
handle_json: String,
outcome_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
task_join_impl(handle_json, outcome_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = task_cancel))]
#[cfg(target_arch = "wasm32")]
pub fn task_cancel(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
task_cancel_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn task_cancel(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
task_cancel_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = fetch_request))]
#[cfg(target_arch = "wasm32")]
pub fn fetch_request(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
fetch_request_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn fetch_request(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
fetch_request_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = websocket_open))]
#[cfg(target_arch = "wasm32")]
pub fn websocket_open(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
websocket_open_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn websocket_open(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
websocket_open_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = websocket_send))]
#[cfg(target_arch = "wasm32")]
pub fn websocket_send(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
websocket_send_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn websocket_send(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
websocket_send_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = websocket_recv))]
#[cfg(target_arch = "wasm32")]
pub fn websocket_recv(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
websocket_recv_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn websocket_recv(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
websocket_recv_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = websocket_close))]
#[cfg(target_arch = "wasm32")]
pub fn websocket_close(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
websocket_close_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn websocket_close(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
websocket_close_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = websocket_cancel))]
#[cfg(target_arch = "wasm32")]
pub fn websocket_cancel(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, JsValue> {
websocket_cancel_impl(request_json, consumer_version_json).map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn websocket_cancel(
request_json: String,
consumer_version_json: Option<String>,
) -> Result<String, String> {
websocket_cancel_impl(request_json, consumer_version_json)
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = abi_version))]
#[cfg(target_arch = "wasm32")]
pub fn abi_version() -> Result<String, JsValue> {
abi_version_impl().map_err(into_js_error)
}
#[cfg(not(target_arch = "wasm32"))]
pub fn abi_version() -> Result<String, String> {
abi_version_impl()
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = abi_fingerprint))]
#[cfg(target_arch = "wasm32")]
#[must_use]
pub fn abi_fingerprint() -> u64 {
abi_fingerprint_impl()
}
#[cfg(not(target_arch = "wasm32"))]
#[must_use]
pub const fn abi_fingerprint() -> u64 {
abi_fingerprint_impl()
}