extern crate self as myko;
pub mod cache;
pub mod client;
#[cfg(all(not(target_arch = "wasm32"), feature = "codegen-ts"))]
pub mod codegen;
pub mod codegen_types;
pub mod core;
pub mod entities;
#[cfg(not(target_arch = "wasm32"))]
pub mod operation_index;
pub mod search;
pub mod server;
pub mod store;
pub mod typegen_module;
#[cfg(feature = "codegen-ts")]
pub mod typegen_typescript;
pub mod utils;
pub mod wire;
pub mod prelude;
#[cfg(feature = "bench")]
pub mod bench_entities;
pub const WS_MAX_MESSAGE_SIZE_BYTES: usize = 64 * 1024 * 1024;
pub const WS_MAX_FRAME_SIZE_BYTES: usize = 64 * 1024 * 1024;
#[cfg(not(target_arch = "wasm32"))]
pub use core::saga;
pub use core::{
command, common, graph, item, query, reflection, relationship, report, request, view,
};
pub use erased_serde; pub use futures; pub use hyphae; pub use inventory;
pub use inventory::submit; #[cfg(not(feature = "codegen-ts"))]
pub use myko_macros::TsNoop as TS;
pub use myko_macros::*;
pub use serde; pub use serde_json; pub use tracing; #[cfg(feature = "codegen-ts")]
pub use ts_rs::{self, TS};
pub use wire::event;
#[cfg(all(feature = "codegen-ts", not(target_arch = "wasm32")))]
#[macro_export]
macro_rules! register_typegen_type {
($ty:ty) => {
$crate::inventory::submit! {
$crate::codegen_types::TypegenTypeRegistration {
id: concat!(module_path!(), "::", stringify!($ty)),
type_name: stringify!($ty),
crate_path: module_path!(),
}
}
$crate::inventory::submit! {
$crate::typegen_typescript::TypeExportRegistration {
type_id: concat!(module_path!(), "::", stringify!($ty)),
type_name: stringify!($ty),
rust_type_id: || ::std::any::TypeId::of::<$ty>(),
generated_name: |config| <$ty as $crate::ts_rs::TS>::ident(config),
output_path: || <$ty as $crate::ts_rs::TS>::output_path(),
export_fn: || {
<$ty as $crate::ts_rs::TS>::export_all(&$crate::ts_rs::Config::from_env())
},
}
}
};
($($ty:ty),+ $(,)?) => {
$(
$crate::register_typegen_type!($ty);
)+
};
}
#[cfg(all(
feature = "typegen",
not(feature = "codegen-ts"),
not(target_arch = "wasm32")
))]
#[macro_export]
macro_rules! register_typegen_type {
($ty:ty) => {
$crate::inventory::submit! {
$crate::codegen_types::TypegenTypeRegistration {
id: concat!(module_path!(), "::", stringify!($ty)),
type_name: stringify!($ty),
crate_path: module_path!(),
}
}
};
($($ty:ty),+ $(,)?) => {
$(
$crate::register_typegen_type!($ty);
)+
};
}
#[cfg(any(not(feature = "typegen"), target_arch = "wasm32"))]
#[macro_export]
macro_rules! register_typegen_type {
($($ty:ty),+ $(,)?) => {};
}
#[cfg(all(feature = "codegen-ts", not(target_arch = "wasm32")))]
#[macro_export]
macro_rules! impl_ts_as {
($ty:ty, $typescript:literal) => {
impl $crate::TS for $ty {
type WithoutGenerics = Self;
type OptionInnerType = Self;
fn name(_: &$crate::ts_rs::Config) -> String {
$typescript.to_owned()
}
fn inline(_: &$crate::ts_rs::Config) -> String {
$typescript.to_owned()
}
fn inline_flattened(_: &$crate::ts_rs::Config) -> String {
$typescript.to_owned()
}
}
};
}
#[cfg(any(not(feature = "codegen-ts"), target_arch = "wasm32"))]
#[macro_export]
macro_rules! impl_ts_as {
($ty:ty, $typescript:literal) => {};
}
#[doc(hidden)]
#[cfg(all(feature = "typegen", not(target_arch = "wasm32")))]
#[macro_export]
macro_rules! register_typegen_const {
($name:ident, $variant:ident, $value:expr) => {
$crate::inventory::submit! {
$crate::codegen_types::TypegenConstRegistration {
name: stringify!($name),
value: $crate::codegen_types::TypegenConstValue::$variant($value),
crate_path: module_path!(),
}
}
};
}
#[doc(hidden)]
#[cfg(any(not(feature = "typegen"), target_arch = "wasm32"))]
#[macro_export]
macro_rules! register_typegen_const {
($name:ident, $variant:ident, $value:expr) => {};
}
#[macro_export]
macro_rules! shared_const {
(pub $name:ident : &str = $value:expr) => {
pub const $name: &str = $value;
$crate::register_typegen_const!($name, Str, $value);
};
($name:ident : &str = $value:expr) => {
const $name: &str = $value;
$crate::register_typegen_const!($name, Str, $value);
};
(pub $name:ident : i64 = $value:expr) => {
pub const $name: i64 = $value;
$crate::register_typegen_const!($name, Int, $value);
};
($name:ident : i64 = $value:expr) => {
const $name: i64 = $value;
$crate::register_typegen_const!($name, Int, $value);
};
(pub $name:ident : bool = $value:expr) => {
pub const $name: bool = $value;
$crate::register_typegen_const!($name, Bool, $value);
};
($name:ident : bool = $value:expr) => {
const $name: bool = $value;
$crate::register_typegen_const!($name, Bool, $value);
};
}
#[macro_export]
macro_rules! typegen_group {
($vis:vis $name:ident) => {
$vis struct $name;
impl $crate::codegen_types::TypegenGroup for $name {}
};
}
#[cfg(all(feature = "typegen", not(target_arch = "wasm32")))]
#[macro_export]
macro_rules! register_typegen_group_member {
($group:ty) => {
$crate::inventory::submit! {
$crate::codegen_types::TypegenGroupMemberRegistration {
group_type_id: || ::std::any::TypeId::of::<$group>(),
crate_path: module_path!(),
}
}
};
}
#[cfg(any(not(feature = "typegen"), target_arch = "wasm32"))]
#[macro_export]
macro_rules! register_typegen_group_member {
($group:ty) => {};
}
#[cfg(all(feature = "typegen", not(target_arch = "wasm32")))]
#[macro_export]
macro_rules! mark_framework_typegen_type {
($($ty:ty),+ $(,)?) => {
$(
$crate::inventory::submit! {
$crate::codegen_types::FrameworkTypegenRegistration {
type_id: concat!(module_path!(), "::", stringify!($ty)),
}
}
)+
};
}
#[cfg(any(not(feature = "typegen"), target_arch = "wasm32"))]
#[macro_export]
macro_rules! mark_framework_typegen_type {
($($ty:ty),+ $(,)?) => {};
}
#[cfg(all(feature = "typegen", not(target_arch = "wasm32")))]
#[macro_export]
macro_rules! register_typegen_module {
($id:ident, $build:path) => {
$crate::inventory::submit! {
$crate::codegen_types::TypegenModuleRegistration {
id: stringify!($id),
crate_path: module_path!(),
build: $build,
}
}
};
}
#[cfg(any(not(feature = "typegen"), target_arch = "wasm32"))]
#[macro_export]
macro_rules! register_typegen_module {
($id:ident, $build:path) => {};
}
#[macro_export]
macro_rules! submit_message_event {
($variant:ident, $event:expr) => {
inventory::submit!($crate::wire::MessageEventRegistration {
variant_name: stringify!($variant),
event_value: $event,
});
};
}
#[cfg(test)]
pub(crate) mod test_util {
pub fn scheduler_test_serial() -> std::sync::MutexGuard<'static, ()> {
static LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
LOCK.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
}
}