{ "lexicon": 1, "id": "sh.tangled.query.enrichResponse", "defs": { "main": { "type": "procedure", "description": "Run an XRPC query and hydrate its response with a data sidecar: typed payloads for every did / at-uri / strong-ref found in the response.", "input": { "encoding": "application/json", "schema": { "type": "object", "required": ["xrpc", "enrich"], "properties": { "xrpc": { "type": "string", "format": "nsid", "description": "NSID of the inner query to run, e.g. sh.tangled.repo.listRepos." }, "params": { "type": "unknown", "description": "Parameters for the inner query, exactly as it declares them." }, "enrich": { "type": "array", "items": { "type": "ref", "ref": "#linkDescriptor" }, "description": "Payloads to compute for each found reference." }, "viewer": { "type": "string", "format": "did", "description": "DID whose own relation to each reference is looked up for viewer payloads. Required when any descriptor requests one." } } } }, "output": { "encoding": "application/json", "schema": { "type": "object", "required": ["output", "data"], "properties": { "output": { "type": "unknown", "description": "The inner query's response, unmodified." }, "data": { "type": "unknown", "description": "Reference (did or at-uri) -> link source -> payload type nsid -> payload. References no descriptor applies to are absent." } } } }, "errors": [ { "name": "UnknownQuery", "description": "The xrpc parameter does not name a query this server can execute" }, { "name": "InvalidTargetPath", "description": "A targets entry is not a valid record path" }, { "name": "InvalidLinkDescriptor", "description": "An enrich entry names an unknown payload type, collection, or path" } ] }, "linkDescriptor": { "type": "object", "required": ["source", "type"], "description": "One sidecar payload, computed from the records at a link source whose reference equals the found reference.", "properties": { "source": { "type": "string", "description": "Collection whose records are linked, a colon, then an index-backed path (subject or .repo)." }, "type": { "type": "string", "knownValues": [ "sh.tangled.query.enrichResponse#count", "sh.tangled.query.enrichResponse#distinctAuthors", "sh.tangled.query.enrichResponse#viewer", "com.bad-example.identity.miniDoc" ], "description": "NSID of the payload type to produce, which also defines the payload's shape. Results land at data[ref][source][type]." }, "targets": { "type": "array", "items": { "type": "string" }, "description": "Record paths into the inner response selecting references for this payload. All references are considered when omitted." } } } } }