pub mod actor;
pub mod boundary;
pub mod enrollment;
pub mod feed;
pub mod repo;
pub mod sync;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Source<'a> {
#[serde(borrow)]
pub service: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub subject: crate::zone_stratos::SubjectRef<'a>,
#[serde(borrow)]
pub vary: SourceVary<'a>,
}
pub mod source_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Service;
type Subject;
type Vary;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Service = Unset;
type Subject = Unset;
type Vary = Unset;
}
pub struct SetService<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetService<S> {}
impl<S: State> State for SetService<S> {
type Service = Set<members::service>;
type Subject = S::Subject;
type Vary = S::Vary;
}
pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSubject<S> {}
impl<S: State> State for SetSubject<S> {
type Service = S::Service;
type Subject = Set<members::subject>;
type Vary = S::Vary;
}
pub struct SetVary<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetVary<S> {}
impl<S: State> State for SetVary<S> {
type Service = S::Service;
type Subject = S::Subject;
type Vary = Set<members::vary>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct service(());
pub struct subject(());
pub struct vary(());
}
}
pub struct SourceBuilder<'a, S: source_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<crate::zone_stratos::SubjectRef<'a>>,
::core::option::Option<SourceVary<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Source<'a> {
pub fn new() -> SourceBuilder<'a, source_state::Empty> {
SourceBuilder::new()
}
}
impl<'a> SourceBuilder<'a, source_state::Empty> {
pub fn new() -> Self {
SourceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SourceBuilder<'a, S>
where
S: source_state::State,
S::Service: source_state::IsUnset,
{
pub fn service(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> SourceBuilder<'a, source_state::SetService<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
SourceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SourceBuilder<'a, S>
where
S: source_state::State,
S::Subject: source_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<crate::zone_stratos::SubjectRef<'a>>,
) -> SourceBuilder<'a, source_state::SetSubject<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
SourceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SourceBuilder<'a, S>
where
S: source_state::State,
S::Vary: source_state::IsUnset,
{
pub fn vary(
mut self,
value: impl Into<SourceVary<'a>>,
) -> SourceBuilder<'a, source_state::SetVary<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
SourceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SourceBuilder<'a, S>
where
S: source_state::State,
S::Service: source_state::IsSet,
S::Subject: source_state::IsSet,
S::Vary: source_state::IsSet,
{
pub fn build(self) -> Source<'a> {
Source {
service: self.__unsafe_private_named.0.unwrap(),
subject: self.__unsafe_private_named.1.unwrap(),
vary: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Source<'a> {
Source {
service: self.__unsafe_private_named.0.unwrap(),
subject: self.__unsafe_private_named.1.unwrap(),
vary: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SourceVary<'a> {
Authenticated,
Unauthenticated,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> SourceVary<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Authenticated => "authenticated",
Self::Unauthenticated => "unauthenticated",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for SourceVary<'a> {
fn from(s: &'a str) -> Self {
match s {
"authenticated" => Self::Authenticated,
"unauthenticated" => Self::Unauthenticated,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for SourceVary<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"authenticated" => Self::Authenticated,
"unauthenticated" => Self::Unauthenticated,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for SourceVary<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for SourceVary<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for SourceVary<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for SourceVary<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for SourceVary<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for SourceVary<'_> {
type Output = SourceVary<'static>;
fn into_static(self) -> Self::Output {
match self {
SourceVary::Authenticated => SourceVary::Authenticated,
SourceVary::Unauthenticated => SourceVary::Unauthenticated,
SourceVary::Other(v) => SourceVary::Other(v.into_static()),
}
}
}
fn lexicon_doc_zone_stratos_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("zone.stratos.defs"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("source"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Indicates this record requires hydration from an external service. The stub record on the PDS contains minimal data; full content is fetched from the service endpoint.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("vary"),
::jacquard_common::deps::smol_str::SmolStr::new_static("subject"),
::jacquard_common::deps::smol_str::SmolStr::new_static("service")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"service",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"DID of the hydration service, optionally with fragment identifying the service entry (e.g., 'did:plc:abc123#atproto_pns').",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Did,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"subject",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#subjectRef"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"vary",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Indicates when hydration is needed. 'authenticated' means full content requires viewer authentication.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(128usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("subjectRef"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A strong reference to a record, including its content hash for verification.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("uri"),
::jacquard_common::deps::smol_str::SmolStr::new_static("cid")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"cid",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"CID of the full record content for integrity verification.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Cid,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"uri",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"AT-URI of the record at the hydration service.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Source<'a> {
fn nsid() -> &'static str {
"zone.stratos.defs"
}
fn def_name() -> &'static str {
"source"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_zone_stratos_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.vary;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"vary",
),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct SubjectRef<'a> {
#[serde(borrow)]
pub cid: jacquard_common::types::string::Cid<'a>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
}
pub mod subject_ref_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Uri;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Cid = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
type Cid = S::Cid;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Uri = S::Uri;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct cid(());
}
}
pub struct SubjectRefBuilder<'a, S: subject_ref_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Cid<'a>>,
::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> SubjectRef<'a> {
pub fn new() -> SubjectRefBuilder<'a, subject_ref_state::Empty> {
SubjectRefBuilder::new()
}
}
impl<'a> SubjectRefBuilder<'a, subject_ref_state::Empty> {
pub fn new() -> Self {
SubjectRefBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SubjectRefBuilder<'a, S>
where
S: subject_ref_state::State,
S::Cid: subject_ref_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<jacquard_common::types::string::Cid<'a>>,
) -> SubjectRefBuilder<'a, subject_ref_state::SetCid<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
SubjectRefBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SubjectRefBuilder<'a, S>
where
S: subject_ref_state::State,
S::Uri: subject_ref_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<jacquard_common::types::string::AtUri<'a>>,
) -> SubjectRefBuilder<'a, subject_ref_state::SetUri<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
SubjectRefBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SubjectRefBuilder<'a, S>
where
S: subject_ref_state::State,
S::Uri: subject_ref_state::IsSet,
S::Cid: subject_ref_state::IsSet,
{
pub fn build(self) -> SubjectRef<'a> {
SubjectRef {
cid: self.__unsafe_private_named.0.unwrap(),
uri: self.__unsafe_private_named.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> SubjectRef<'a> {
SubjectRef {
cid: self.__unsafe_private_named.0.unwrap(),
uri: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SubjectRef<'a> {
fn nsid() -> &'static str {
"zone.stratos.defs"
}
fn def_name() -> &'static str {
"subjectRef"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_zone_stratos_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}