Atproto, move atproto to separate lib. Start converting to workspaces
This commit is contained in:
parent
45acaaa601
commit
6e97eb1899
15 changed files with 246 additions and 966 deletions
1156
Cargo.lock
generated
1156
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
29
Cargo.toml
29
Cargo.toml
|
|
@ -1,26 +1,3 @@
|
|||
[package]
|
||||
name = "rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.98"
|
||||
async-trait = "0.1.88"
|
||||
atrium-api = { version = "0.25.2", default-features = false }
|
||||
axum = { version = "0.8.3", features = ["json"] }
|
||||
axum-macros = "0.5.0"
|
||||
http = "1.3.1"
|
||||
lazy-regex = "3.4.1"
|
||||
regex-macro = "0.3.0"
|
||||
rocketman = "0.2.0"
|
||||
serde = "1.0.219"
|
||||
serde_json = "1.0.140"
|
||||
sqlx = { version = "0.8.5", features = ["postgres", "runtime-tokio"] }
|
||||
tokio = { version = "1.44.2", features = ["macros", "rt-multi-thread"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.19"
|
||||
|
||||
[build-dependencies]
|
||||
esquema-codegen = { git = "https://github.com/fatfingers23/esquema.git", branch = "main" }
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = [ "api", "atproto","db", "ingestor"]
|
||||
|
|
|
|||
8
atproto/Cargo.toml
Normal file
8
atproto/Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "atproto"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
atrium-api = { version = "0.25.3", default-features = false }
|
||||
lazy-regex = "3.4.1"
|
||||
|
|
@ -10,6 +10,8 @@ pub use atrium_api::types::{
|
|||
}
|
||||
};
|
||||
|
||||
pub mod lexicons;
|
||||
|
||||
pub struct Uri {
|
||||
whole: String,
|
||||
// These fields could be useful in the future,
|
||||
|
|
@ -19,12 +21,9 @@ pub struct Uri {
|
|||
// rkey: Option<RecordKey>,
|
||||
}
|
||||
|
||||
impl Uri {
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.whole.as_str()
|
||||
}
|
||||
|
||||
pub fn from_str(uri: String) -> Result<Self, &'static str> {
|
||||
impl FromStr for Uri {
|
||||
type Err = &'static str;
|
||||
fn from_str(uri: &str) -> Result<Self, Self::Err> {
|
||||
if uri.len() > 8000 {
|
||||
return Err("Uri too long")
|
||||
}
|
||||
|
|
@ -33,7 +32,7 @@ impl Uri {
|
|||
whole, unchecked_authority, unchecked_collection, unchecked_rkey
|
||||
)) = regex_captures!(
|
||||
r"/^at:\/\/([\w\.\-_~:]+)(?:\/([\w\.\-_~:]+)(?:)\/([\w\.\-_~:]+))?$/i",
|
||||
&uri,
|
||||
uri,
|
||||
) else {
|
||||
return Err("Invalid Uri");
|
||||
};
|
||||
|
|
@ -53,3 +52,9 @@ impl Uri {
|
|||
}
|
||||
}
|
||||
|
||||
impl Uri {
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.whole.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue