//! GENERATED FILE — DO NOT EDIT. //! Source: packages/core-contracts/schemas/*.schema.json (run `pnpm gen`) #![allow(clippy::all, rustdoc::all, dead_code, unused_imports)] #![allow(clippy::needless_lifetimes)] #![allow(clippy::match_single_binding)] #![allow(clippy::clone_on_copy)] #[doc = "`Actor`"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct Actor { pub id: Id, pub kind: ActorKind, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub name: ::std::option::Option, } #[doc = "Who performed an action. Humans and agents share one actor model so the policy engine treats them uniformly."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum ActorKind { #[serde(rename = "human")] Human, #[serde(rename = "agent")] Agent, #[serde(rename = "system")] System, } impl ::std::fmt::Display for ActorKind { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Human => f.write_str("human"), Self::Agent => f.write_str("agent"), Self::System => f.write_str("system"), } } } impl ::std::str::FromStr for ActorKind { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "human" => Ok(Self::Human), "agent" => Ok(Self::Agent), "system" => Ok(Self::System), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for ActorKind { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ActorKind { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`ActorName`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ActorName(::std::string::String); impl ::std::ops::Deref for ActorName { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ActorName) -> Self { value.0 } } impl ::std::str::FromStr for ActorName { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200usize { return Err("longer than 200 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ActorName { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ActorName { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ActorName { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "One top-level block of a markdown body in the store's index (RFC-0014 §3). Written by the store only: a client's values are replaced on every write. `by`, `via` and `at` say who last changed the block's content, through which channel and when; they are absent for content written before the index existed."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct BodyBlock { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub at: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub by: ::std::option::Option, #[doc = "SHA-256 (hex) of the block's markdown without trailing whitespace."] pub hash: BodyBlockHash, #[doc = "Stable across writes that keep the block's content or its place among unchanged blocks."] pub id: BodyBlockId, #[doc = "The channel of that change."] #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub via: ::std::option::Option, } #[doc = "SHA-256 (hex) of the block's markdown without trailing whitespace."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct BodyBlockHash(::std::string::String); impl ::std::ops::Deref for BodyBlockHash { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: BodyBlockHash) -> Self { value.0 } } impl ::std::str::FromStr for BodyBlockHash { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[0-9a-f]{64}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[0-9a-f]{64}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for BodyBlockHash { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for BodyBlockHash { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for BodyBlockHash { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Stable across writes that keep the block's content or its place among unchanged blocks."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct BodyBlockId(::std::string::String); impl ::std::ops::Deref for BodyBlockId { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: BodyBlockId) -> Self { value.0 } } impl ::std::str::FromStr for BodyBlockId { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^blk_[0-9A-Za-z]{8,24}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^blk_[0-9A-Za-z]{8,24}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for BodyBlockId { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for BodyBlockId { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for BodyBlockId { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "The channel of that change."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum BodyBlockVia { #[serde(rename = "studio")] Studio, #[serde(rename = "mcp")] Mcp, #[serde(rename = "api")] Api, #[serde(rename = "import")] Import, #[serde(rename = "ai-command")] AiCommand, #[serde(rename = "proposal")] Proposal, } impl ::std::fmt::Display for BodyBlockVia { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Studio => f.write_str("studio"), Self::Mcp => f.write_str("mcp"), Self::Api => f.write_str("api"), Self::Import => f.write_str("import"), Self::AiCommand => f.write_str("ai-command"), Self::Proposal => f.write_str("proposal"), } } } impl ::std::str::FromStr for BodyBlockVia { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "studio" => Ok(Self::Studio), "mcp" => Ok(Self::Mcp), "api" => Ok(Self::Api), "import" => Ok(Self::Import), "ai-command" => Ok(Self::AiCommand), "proposal" => Ok(Self::Proposal), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for BodyBlockVia { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for BodyBlockVia { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "A markdown body's block index, in body order (RFC-0014 §3). Absent means not indexed (yet, or an HTML body), never empty."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct BodyBlocks(pub ::std::vec::Vec); impl ::std::ops::Deref for BodyBlocks { type Target = ::std::vec::Vec; fn deref(&self) -> &::std::vec::Vec { &self.0 } } impl ::std::convert::From for ::std::vec::Vec { fn from(value: BodyBlocks) -> Self { value.0 } } impl ::std::convert::From<::std::vec::Vec> for BodyBlocks { fn from(value: ::std::vec::Vec) -> Self { Self(value) } } #[doc = "The markdown dialect a body follows (RFC-0014 §1): 1 = Cloudhal Markdown v1 (CommonMark + GFM + `asset:` + directives; raw HTML escaped). Set by the store on markdown bodies."] #[derive(:: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct BodyProfile(i64); impl ::std::ops::Deref for BodyProfile { type Target = i64; fn deref(&self) -> &i64 { &self.0 } } impl ::std::convert::From for i64 { fn from(value: BodyProfile) -> Self { value.0 } } impl ::std::convert::TryFrom for BodyProfile { type Error = self::error::ConversionError; fn try_from(value: i64) -> ::std::result::Result { if ![1_i64].contains(&value) { Err("invalid value".into()) } else { Ok(Self(value)) } } } impl<'de> ::serde::Deserialize<'de> for BodyProfile { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { Self::try_from(::deserialize(deserializer)?) .map_err(|e| ::custom(e.to_string())) } } #[doc = "`ComponentSectionType`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ComponentSectionType(::std::string::String); impl ::std::ops::Deref for ComponentSectionType { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ComponentSectionType) -> Self { value.0 } } impl ::std::str::FromStr for ComponentSectionType { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-z][a-z0-9-]{1,40}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][a-z0-9-]{1,40}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ComponentSectionType { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ComponentSectionType { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ComponentSectionType { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ContentListSectionFilter(::std::string::String); impl ::std::ops::Deref for ContentListSectionFilter { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ContentListSectionFilter) -> Self { value.0 } } impl ::std::str::FromStr for ContentListSectionFilter { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 512usize { return Err("longer than 512 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ContentListSectionFilter { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ContentListSectionFilter { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ContentListSectionFilter { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`ContentListSectionSort`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum ContentListSectionSort { #[serde(rename = "newest")] Newest, #[serde(rename = "oldest")] Oldest, #[serde(rename = "title")] Title, } impl ::std::fmt::Display for ContentListSectionSort { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Newest => f.write_str("newest"), Self::Oldest => f.write_str("oldest"), Self::Title => f.write_str("title"), } } } impl ::std::str::FromStr for ContentListSectionSort { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "newest" => Ok(Self::Newest), "oldest" => Ok(Self::Oldest), "title" => Ok(Self::Title), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for ContentListSectionSort { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ContentListSectionSort { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "RFC-0042: one condition on a typed field of the listed collection. `value` is read by the field's type: a number, YYYY-MM-DD, an RFC 3339 instant, true/false, an option value, or `now`. `values` only with `in`."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct FieldCondition { #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] pub field: FieldConditionField, pub op: FieldConditionOp, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub value: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub values: ::std::option::Option<::std::vec::Vec>, } #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldConditionField(::std::string::String); impl ::std::ops::Deref for FieldConditionField { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldConditionField) -> Self { value.0 } } impl ::std::str::FromStr for FieldConditionField { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z][A-Za-z0-9]{0,39}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][A-Za-z0-9]{0,39}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldConditionField { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionField { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldConditionField { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`FieldConditionOp`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum FieldConditionOp { #[serde(rename = "eq")] Eq, #[serde(rename = "ne")] Ne, #[serde(rename = "lt")] Lt, #[serde(rename = "lte")] Lte, #[serde(rename = "gt")] Gt, #[serde(rename = "gte")] Gte, #[serde(rename = "in")] In, #[serde(rename = "set")] Set, #[serde(rename = "unset")] Unset, } impl ::std::fmt::Display for FieldConditionOp { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Eq => f.write_str("eq"), Self::Ne => f.write_str("ne"), Self::Lt => f.write_str("lt"), Self::Lte => f.write_str("lte"), Self::Gt => f.write_str("gt"), Self::Gte => f.write_str("gte"), Self::In => f.write_str("in"), Self::Set => f.write_str("set"), Self::Unset => f.write_str("unset"), } } } impl ::std::str::FromStr for FieldConditionOp { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "eq" => Ok(Self::Eq), "ne" => Ok(Self::Ne), "lt" => Ok(Self::Lt), "lte" => Ok(Self::Lte), "gt" => Ok(Self::Gt), "gte" => Ok(Self::Gte), "in" => Ok(Self::In), "set" => Ok(Self::Set), "unset" => Ok(Self::Unset), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for FieldConditionOp { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionOp { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`FieldConditionValue`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldConditionValue(::std::string::String); impl ::std::ops::Deref for FieldConditionValue { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldConditionValue) -> Self { value.0 } } impl ::std::str::FromStr for FieldConditionValue { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 100usize { return Err("longer than 100 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldConditionValue { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionValue { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldConditionValue { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`FieldConditionValuesItem`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldConditionValuesItem(::std::string::String); impl ::std::ops::Deref for FieldConditionValuesItem { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldConditionValuesItem) -> Self { value.0 } } impl ::std::str::FromStr for FieldConditionValuesItem { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 100usize { return Err("longer than 100 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldConditionValuesItem { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionValuesItem { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldConditionValuesItem { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct FieldOrder { pub direction: FieldOrderDirection, #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] pub field: FieldOrderField, } #[doc = "`FieldOrderDirection`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum FieldOrderDirection { #[serde(rename = "asc")] Asc, #[serde(rename = "desc")] Desc, } impl ::std::fmt::Display for FieldOrderDirection { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Asc => f.write_str("asc"), Self::Desc => f.write_str("desc"), } } } impl ::std::str::FromStr for FieldOrderDirection { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "asc" => Ok(Self::Asc), "desc" => Ok(Self::Desc), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for FieldOrderDirection { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldOrderDirection { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldOrderField(::std::string::String); impl ::std::ops::Deref for FieldOrderField { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldOrderField) -> Self { value.0 } } impl ::std::str::FromStr for FieldOrderField { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z][A-Za-z0-9]{0,39}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][A-Za-z0-9]{0,39}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldOrderField { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldOrderField { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldOrderField { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`HeroSectionHeading`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct HeroSectionHeading(::std::string::String); impl ::std::ops::Deref for HeroSectionHeading { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: HeroSectionHeading) -> Self { value.0 } } impl ::std::str::FromStr for HeroSectionHeading { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 300usize { return Err("longer than 300 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for HeroSectionHeading { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for HeroSectionHeading { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for HeroSectionHeading { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`HeroSectionSubheading`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct HeroSectionSubheading(::std::string::String); impl ::std::ops::Deref for HeroSectionSubheading { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: HeroSectionSubheading) -> Self { value.0 } } impl ::std::str::FromStr for HeroSectionSubheading { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 1000usize { return Err("longer than 1000 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for HeroSectionSubheading { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for HeroSectionSubheading { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for HeroSectionSubheading { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Prefixed, URL-safe identifier, e.g. site_01HZX8K3Q9. The prefix names the entity kind; agents and the MCP server pass these as opaque handles."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct Id(::std::string::String); impl ::std::ops::Deref for Id { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: Id) -> Self { value.0 } } impl ::std::str::FromStr for Id { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 48usize { return Err("longer than 48 characters".into()); } if value.chars().count() < 8usize { return Err("shorter than 8 characters".into()); } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z]+_[A-Za-z0-9]{6,32}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z]+_[A-Za-z0-9]{6,32}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for Id { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for Id { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for Id { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Reference to an image. With `assetId` the image is an Asset node (RFC-0004): the store writes its media URL into `src`, and its size into `width` and `height`, as a fallback for readers that do not resolve assets. Without it, `src` is a relative path or an absolute URL, as before."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct ImageRef { pub alt: ImageRefAlt, #[doc = "The Asset node shown (RFC-0004). Renderers that know assets resolve it and ignore `src`."] #[serde( rename = "assetId", skip_serializing_if = "::std::option::Option::is_none" )] pub asset_id: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub height: ::std::option::Option<::std::num::NonZeroU64>, pub src: ImageRefSrc, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub width: ::std::option::Option<::std::num::NonZeroU64>, } #[doc = "`ImageRefAlt`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ImageRefAlt(::std::string::String); impl ::std::ops::Deref for ImageRefAlt { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ImageRefAlt) -> Self { value.0 } } impl ::std::str::FromStr for ImageRefAlt { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 500usize { return Err("longer than 500 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ImageRefAlt { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ImageRefAlt { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ImageRefAlt { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`ImageRefSrc`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ImageRefSrc(::std::string::String); impl ::std::ops::Deref for ImageRefSrc { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ImageRefSrc) -> Self { value.0 } } impl ::std::str::FromStr for ImageRefSrc { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 2048usize { return Err("longer than 2048 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ImageRefSrc { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ImageRefSrc { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ImageRefSrc { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`ImageSectionCaption`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ImageSectionCaption(::std::string::String); impl ::std::ops::Deref for ImageSectionCaption { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ImageSectionCaption) -> Self { value.0 } } impl ::std::str::FromStr for ImageSectionCaption { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 1000usize { return Err("longer than 1000 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ImageSectionCaption { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ImageSectionCaption { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ImageSectionCaption { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`Link`"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct Link { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub external: ::std::option::Option, pub href: LinkHref, pub label: LinkLabel, } #[doc = "`LinkHref`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct LinkHref(::std::string::String); impl ::std::ops::Deref for LinkHref { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: LinkHref) -> Self { value.0 } } impl ::std::str::FromStr for LinkHref { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 2048usize { return Err("longer than 2048 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for LinkHref { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for LinkHref { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for LinkHref { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`LinkLabel`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct LinkLabel(::std::string::String); impl ::std::ops::Deref for LinkLabel { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: LinkLabel) -> Self { value.0 } } impl ::std::str::FromStr for LinkLabel { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200usize { return Err("longer than 200 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for LinkLabel { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for LinkLabel { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for LinkLabel { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`RichTextSectionBody`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct RichTextSectionBody(::std::string::String); impl ::std::ops::Deref for RichTextSectionBody { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: RichTextSectionBody) -> Self { value.0 } } impl ::std::str::FromStr for RichTextSectionBody { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200000usize { return Err("longer than 200000 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for RichTextSectionBody { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for RichTextSectionBody { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for RichTextSectionBody { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`RichTextSectionFormat`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum RichTextSectionFormat { #[serde(rename = "markdown")] Markdown, #[serde(rename = "html")] Html, } impl ::std::fmt::Display for RichTextSectionFormat { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Markdown => f.write_str("markdown"), Self::Html => f.write_str("html"), } } } impl ::std::str::FromStr for RichTextSectionFormat { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "markdown" => Ok(Self::Markdown), "html" => Ok(Self::Html), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for RichTextSectionFormat { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for RichTextSectionFormat { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "A block inside a page, discriminated by `kind`. Variants are written inline (not via $ref) and `kind` is a single-value string enum so that TypeScript gets a literal union and Rust gets a serde internally-tagged enum."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(tag = "kind", deny_unknown_fields)] pub enum Section { #[doc = "HeroSection"] #[serde(rename = "hero")] Hero { #[serde(skip_serializing_if = "::std::option::Option::is_none")] cta: ::std::option::Option, heading: HeroSectionHeading, id: Id, #[serde(skip_serializing_if = "::std::option::Option::is_none")] image: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] subheading: ::std::option::Option, }, #[doc = "RichTextSection"] #[serde(rename = "richText")] RichText { #[serde(skip_serializing_if = "::std::option::Option::is_none")] blocks: ::std::option::Option, body: RichTextSectionBody, format: RichTextSectionFormat, id: Id, #[serde(skip_serializing_if = "::std::option::Option::is_none")] profile: ::std::option::Option, }, #[doc = "ImageSection"] #[serde(rename = "image")] Image { #[serde(skip_serializing_if = "::std::option::Option::is_none")] caption: ::std::option::Option, id: Id, image: ImageRef, }, #[doc = "ContentListSection\n\nRenders the newest entries of a content collection (e.g. blog posts)."] #[serde(rename = "contentList")] ContentList { collection: Slug, #[doc = "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'."] #[serde(skip_serializing_if = "::std::option::Option::is_none")] filter: ::std::option::Option, id: Id, limit: ::std::num::NonZeroU64, #[serde( rename = "orderBy", skip_serializing_if = "::std::option::Option::is_none" )] order_by: ::std::option::Option, sort: ContentListSectionSort, #[doc = "RFC-0042: conditions on the collection's list fields, ANDed."] #[serde( rename = "where", default, skip_serializing_if = "::std::vec::Vec::is_empty" )] where_: ::std::vec::Vec, }, #[doc = "ComponentSection\n\nA typed block from the block registry (RFC-0015): `type` names a registered block type (one global namespace of English names), `props` follow that type's props schema, which the store validates."] #[serde(rename = "component")] Component { id: Id, #[doc = "Validated against the type's props schema by the store, not by this contract."] props: ::serde_json::Map<::std::string::String, ::serde_json::Value>, #[serde(rename = "type")] type_: ComponentSectionType, }, #[doc = "SurfaceSection\n\nA generative UI surface (RFC-0020): a flat list of catalog components with a `root`, plus a data model their props may bind to. Written and streamed by agents as data, never code; the store checks the tree, the catalog and the limits."] #[serde(rename = "surface")] Surface { #[doc = "The catalog the surface was written for: `@` (RFC-0018 manifest)."] catalog: SurfaceSectionCatalog, components: ::std::vec::Vec, #[doc = "The surface's data model: JSON its components bind to with `{path}` (at most 64 KB serialized; the store enforces the size)."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] data: ::serde_json::Map<::std::string::String, ::serde_json::Value>, id: Id, }, } #[doc = "Lower-case URL segment."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct Slug(::std::string::String); impl ::std::ops::Deref for Slug { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: Slug) -> Self { value.0 } } impl ::std::str::FromStr for Slug { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 128usize { return Err("longer than 128 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z0-9]+(?:-[a-z0-9]+)*$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z0-9]+(?:-[a-z0-9]+)*$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for Slug { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for Slug { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for Slug { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "One element of a generative UI surface (RFC-0020 §1), in a flat list: `component` names a catalog entry (a PascalCase built-in primitive such as `Stack`, or a registry block type such as `callout`), `children` refer to other ids of the same surface, and `props` follow the entry's schema, which the store checks. Field names follow A2UI v0.9."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct SurfaceComponent { #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] pub children: ::std::vec::Vec, pub component: SurfaceComponentComponent, pub id: SurfaceComponentId, #[doc = "Motion presets for this component (RFC-0024 §2): `reveal`, `hover`, `speed`, `delay`, `stagger`, `replay` and later `scroll`, `loop`; enums and clamped numbers only, validated by the store against the catalog. The renderer turns them into CSS; agents never write CSS."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub motion: ::serde_json::Map<::std::string::String, ::serde_json::Value>, #[doc = "Literal values, `{path}` bindings into the surface's data, or `{call}` named functions; validated by the store against the catalog, not by this contract."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub props: ::serde_json::Map<::std::string::String, ::serde_json::Value>, #[doc = "A visibility condition over the surface's data (`eq`, `ne`, `gt`, `lt`, `and`, `or`, `not`); validated by the store."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub visible: ::serde_json::Map<::std::string::String, ::serde_json::Value>, } #[doc = "`SurfaceComponentComponent`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SurfaceComponentComponent(::std::string::String); impl ::std::ops::Deref for SurfaceComponentComponent { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SurfaceComponentComponent) -> Self { value.0 } } impl ::std::str::FromStr for SurfaceComponentComponent { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^(?:[A-Z][A-Za-z0-9]{1,40}|[a-z][a-z0-9-]{1,40})$").unwrap() }); if PATTERN.find(value).is_none() { return Err( "doesn't match pattern \"^(?:[A-Z][A-Za-z0-9]{1,40}|[a-z][a-z0-9-]{1,40})$\"" .into(), ); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SurfaceComponentComponent { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SurfaceComponentComponent { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SurfaceComponentComponent { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "A component's id, unique within its surface; `root` is the tree's root (RFC-0020 §1)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SurfaceComponentId(::std::string::String); impl ::std::ops::Deref for SurfaceComponentId { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SurfaceComponentId) -> Self { value.0 } } impl ::std::str::FromStr for SurfaceComponentId { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-z][a-z0-9-]{0,40}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][a-z0-9-]{0,40}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SurfaceComponentId { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SurfaceComponentId { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SurfaceComponentId { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "The catalog the surface was written for: `@` (RFC-0018 manifest)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SurfaceSectionCatalog(::std::string::String); impl ::std::ops::Deref for SurfaceSectionCatalog { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SurfaceSectionCatalog) -> Self { value.0 } } impl ::std::str::FromStr for SurfaceSectionCatalog { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z][a-z0-9-]{0,40}@[0-9]{1,4}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][a-z0-9-]{0,40}@[0-9]{1,4}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SurfaceSectionCatalog { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SurfaceSectionCatalog { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SurfaceSectionCatalog { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "RFC 3339 / ISO 8601 instant in UTC."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct Timestamp(pub ::chrono::DateTime<::chrono::offset::Utc>); impl ::std::ops::Deref for Timestamp { type Target = ::chrono::DateTime<::chrono::offset::Utc>; fn deref(&self) -> &::chrono::DateTime<::chrono::offset::Utc> { &self.0 } } impl ::std::convert::From for ::chrono::DateTime<::chrono::offset::Utc> { fn from(value: Timestamp) -> Self { value.0 } } impl ::std::convert::From<::chrono::DateTime<::chrono::offset::Utc>> for Timestamp { fn from(value: ::chrono::DateTime<::chrono::offset::Utc>) -> Self { Self(value) } } impl ::std::fmt::Display for Timestamp { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { self.0.fmt(f) } } impl ::std::str::FromStr for Timestamp { type Err = <::chrono::DateTime<::chrono::offset::Utc> as ::std::str::FromStr>::Err; fn from_str(value: &str) -> ::std::result::Result { Ok(Self(value.parse()?)) } } impl ::std::convert::TryFrom<&str> for Timestamp { type Error = <::chrono::DateTime<::chrono::offset::Utc> as ::std::str::FromStr>::Err; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom for Timestamp { type Error = <::chrono::DateTime<::chrono::offset::Utc> as ::std::str::FromStr>::Err; fn try_from(value: String) -> ::std::result::Result { value.parse() } } #[doc = " Error types."] pub mod error { #[doc = r" Error from a `TryFrom` or `FromStr` implementation."] pub struct ConversionError(::std::borrow::Cow<'static, str>); impl ::std::error::Error for ConversionError {} impl ::std::fmt::Display for ConversionError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { ::std::fmt::Display::fmt(&self.0, f) } } impl ::std::fmt::Debug for ConversionError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { ::std::fmt::Debug::fmt(&self.0, f) } } impl From<&'static str> for ConversionError { fn from(value: &'static str) -> Self { Self(value.into()) } } impl From for ConversionError { fn from(value: String) -> Self { Self(value.into()) } } }