···44# paths because the flake.nix is written in a way such that top-level members
55# (`weaver-cli` and `weaver-server`) are built as different derivations which avoid being
66# rebuilt if the other package's sources change.
77-members = ["crates/*", "crates/weaver-server", "crates/weaver-server"]
77+members = ["crates/*"]
8899#default-members = ["crates/weaver-cli"]
1010···42424343jacquard = { git = "https://tangled.org/@nonbinary.computer/jacquard", default-features = false, features = ["derive", "api_bluesky"] }
4444jacquard-api = { git = "https://tangled.org/@nonbinary.computer/jacquard" }
4545+jacquard-common = { git = "https://tangled.org/@nonbinary.computer/jacquard" }
4546jacquard-axum = { git = "https://tangled.org/@nonbinary.computer/jacquard" }
46474748[profile]
···1515 "type": "string",
1616 "description": "Reference (AT-URI) to post record. This is the anchor post.",
1717 "format": "at-uri"
1818- },
1919- "prioritizeFollowedUsers": {
2020- "type": "boolean",
2121- "description": "Whether to prioritize posts from followed users. It only has effect when the user is authenticated.",
2222- "default": false
2318 }
2419 }
2520 },
···3535 "minimum": 0,
3636 "maximum": 100
3737 },
3838- "prioritizeFollowedUsers": {
3939- "type": "boolean",
4040- "description": "Whether to prioritize posts from followed users. It only has effect when the user is authenticated.",
4141- "default": false
4242- },
4338 "sort": {
4439 "type": "string",
4540 "description": "Sorting for the thread replies.",
···11+use jacquard::{
22+ CowStr, IntoStatic, XrpcRequest,
33+ types::{
44+ did::Did,
55+ nsid::Nsid,
66+ string::{RecordKey, Rkey},
77+ },
88+};
99+use serde::{Deserialize, Serialize};
1010+1111+const DEFAULT_CURSOR_LIMIT: u64 = 16;
1212+const DEFAULT_CURSOR_LIMIT_MAX: u64 = 100;
1313+1414+fn get_default_cursor_limit() -> u64 {
1515+ DEFAULT_CURSOR_LIMIT
1616+}
1717+1818+#[derive(Clone, Deserialize, Serialize, XrpcRequest, IntoStatic)]
1919+#[xrpc(
2020+ nsid = "blue.microcosm.links.getBacklinks",
2121+ method = Query,
2222+ output = GetBacklinksResponse,
2323+)]
2424+pub struct GetBacklinksQuery<'a> {
2525+ /// The link target
2626+ ///
2727+ /// can be an AT-URI, plain DID, or regular URI
2828+ subject: jacquard::types::uri::Uri<'a>,
2929+ /// Filter links only from this link source
3030+ ///
3131+ /// eg.: `app.bsky.feed.like:subject.uri`
3232+ source: CowStr<'a>,
3333+ #[serde(borrow)]
3434+ cursor: Option<CowStr<'a>>,
3535+ /// Filter links only from these DIDs
3636+ ///
3737+ /// include multiple times to filter by multiple source DIDs
3838+ #[serde(default)]
3939+ did: Vec<Did<'a>>,
4040+ /// Set the max number of links to return per page of results
4141+ #[serde(default = "get_default_cursor_limit")]
4242+ limit: u64,
4343+ // TODO: allow reverse (er, forward) order as well
4444+}
4545+#[derive(Deserialize, Serialize, IntoStatic)]
4646+pub struct GetBacklinksResponse<'a> {
4747+ total: u64,
4848+ #[serde(borrow)]
4949+ records: Vec<RecordId<'a>>,
5050+ cursor: Option<CowStr<'a>>,
5151+}
5252+5353+#[derive(Debug, PartialEq, Serialize, Deserialize, IntoStatic)]
5454+pub struct RecordId<'a> {
5555+ #[serde(borrow)]
5656+ pub did: Did<'a>,
5757+ pub collection: Nsid<'a>,
5858+ pub rkey: RecordKey<Rkey<'a>>,
5959+}
6060+6161+impl RecordId<'_> {
6262+ pub fn did(&self) -> Did<'_> {
6363+ self.did.clone()
6464+ }
6565+ pub fn collection(&self) -> Nsid<'_> {
6666+ self.collection.clone()
6767+ }
6868+ pub fn rkey(&self) -> RecordKey<Rkey<'_>> {
6969+ self.rkey.clone()
7070+ }
7171+}
+1
crates/weaver-common/src/lib.rs
···11//! Weaver common library - thin wrapper around jacquard with notebook-specific conveniences
2233+pub mod constellation;
34pub mod error;
45pub mod view;
56