A better Rust ATProto crate

couple things were failing on wasm. need to do further changes to jacquard-identity cache imo

Orual 50dd180c d29f164b

Changed files
+11 -10
crates
jacquard
jacquard-common
src
types
jacquard-identity
+1 -2
crates/jacquard-common/Cargo.toml
··· 62 62 63 63 [target.'cfg(target_family = "wasm")'.dependencies] 64 64 getrandom = { version = "0.3.4", features = ["wasm_js"] } 65 - 66 - [target.'cfg(target_arch = "wasm32")'.dependencies] 65 + chrono = { workspace = true, features = ["wasmbind"] } 67 66 getrandom_02 = { package = "getrandom", version = "0.2", features = ["js"] } 68 67 69 68 [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+1 -5
crates/jacquard-common/src/types/tid.rs
··· 2 2 use smol_str::{SmolStr, SmolStrBuilder}; 3 3 use std::fmt; 4 4 use std::sync::LazyLock; 5 - use std::time::SystemTime; 6 5 use std::{ops::Deref, str::FromStr}; 7 6 8 7 use crate::CowStr; ··· 306 305 307 306 /// Generate the next TID, optionally ensuring it's after the given TID 308 307 pub fn next(&mut self, prev: Option<Tid>) -> Tid { 309 - let now = SystemTime::now() 310 - .duration_since(SystemTime::UNIX_EPOCH) 311 - .expect("timestamp in micros since UNIX epoch") 312 - .as_micros() as u64; 308 + let now = chrono::Utc::now().timestamp_micros() as u64; 313 309 // mask to 53 bits 314 310 let now = now & 0x001FFFFFFFFFFFFF; 315 311 if now > self.last_timestamp {
+1 -1
crates/jacquard-identity/Cargo.toml
··· 37 37 urlencoding.workspace = true 38 38 tracing = { workspace = true, optional = true } 39 39 n0-future = { workspace = true, optional = true } 40 - moka = { workspace = true, features = ["future"], optional = true } 41 40 42 41 [target.'cfg(not(target_family = "wasm"))'.dependencies] 42 + moka = { workspace = true, features = ["future"], optional = true } 43 43 hickory-resolver = { optional = true, version = "0.24", default-features = false, features = ["system-config", "tokio-runtime"]} 44 44 tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } 45 45
+8 -2
crates/jacquard/Cargo.toml
··· 36 36 "jacquard-oauth/tracing", 37 37 "jacquard-identity/tracing", 38 38 ] 39 - dns = ["jacquard-identity/dns", "jacquard-identity/cache"] 39 + dns = ["jacquard-identity/dns", ] 40 40 streaming = [ 41 41 "jacquard-common/websocket", 42 42 "jacquard-oauth/streaming", ··· 46 46 ] 47 47 websocket = ["jacquard-common/websocket"] 48 48 zstd = ["jacquard-common/zstd"] 49 + 50 + 49 51 50 52 [[example]] 51 53 name = "oauth_timeline" ··· 133 135 jacquard-derive = { version = "0.8", path = "../jacquard-derive", optional = true } 134 136 jacquard-identity = { version = "0.8", path = "../jacquard-identity" } 135 137 138 + 139 + 136 140 #bon.workspace = true 137 141 trait-variant.workspace = true 138 142 bytes.workspace = true ··· 152 156 tracing = { workspace = true, optional = true } 153 157 n0-future = { workspace = true, optional = true } 154 158 155 - [target.'cfg(not(target_arch = "wasm32"))'.dependencies] 159 + 160 + [target.'cfg(not(target_family = "wasm"))'.dependencies] 161 + jacquard-identity = { version = "0.8", path = "../jacquard-identity", features = ["cache"] } 156 162 reqwest = { workspace = true, features = [ 157 163 "http2", 158 164 "system-proxy",