Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions lexicons/blue/microcosm/identity/resolveMiniDoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"id": "blue.microcosm.identity.resolveMiniDoc",
"defs": {
"main": {
"type": "query",
"description": "Slingshot: like com.atproto.identity.resolveIdentity but instead of the full didDoc it returns an atproto-relevant subset",
"parameters": {
"type": "params",
"required": ["identifier"],
"properties": {
"identifier": {
"type": "string",
"format": "at-identifier",
"description": "handle or DID to resolve"
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did", "handle", "pds", "signing_key"],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "DID, bi-directionally verified if a handle was provided in the query"
},
"handle": {
"type": "string",
"format": "handle",
"description": "the validated handle of the account or 'handle.invalid' if the handle did not bi-directionally match the DID document"
},
"pds": {
"type": "string",
"format": "uri",
"description": "the identity's PDS URL"
},
"signing_key": {
"type": "string",
"description": "the atproto signing key publicKeyMultibase"
}
}
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
87 changes: 87 additions & 0 deletions lexicons/blue/microcosm/links/getBacklinks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"id": "blue.microcosm.links.getBacklinks",
"defs": {
"main": {
"type": "query",
"description": "Constellation: list records linking to any record, identity, or uri",
"parameters": {
"type": "params",
"required": ["subject", "source"],
"properties": {
"subject": {
"type": "string",
"format": "uri",
"description": "the target being linked to (at-uri, did, or uri)"
},
"source": {
"type": "string",
"description": "collection and path specification (e.g., 'app.bsky.feed.like:subject.uri')"
},
"did": {
"type": "array",
"description": "filter links to those from specific users",
"items": {
"type": "string",
"format": "did"
}
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 16,
"description": "number of results to return"
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["total", "records"],
"properties": {
"total": {
"type": "integer",
"description": "total number of matching links"
},
"records": {
"type": "array",
"items": {
"type": "ref",
"ref": "#linkRecord"
}
},
"cursor": {
"type": "string",
"description": "pagination cursor"
}
}
}
}
},
"linkRecord": {
"type": "object",
"description": "a record linking to the subject",
"required": ["did", "collection", "rkey"],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "the DID of the linking record's repository"
},
"collection": {
"type": "string",
"format": "nsid",
"description": "the collection of the linking record"
},
"rkey": {
"type": "string",
"format": "record-key",
"description": "the record key of the linking record"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
39 changes: 39 additions & 0 deletions lexicons/blue/microcosm/links/getBacklinksCount.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "blue.microcosm.links.getBacklinksCount",
"defs": {
"main": {
"type": "query",
"description": "Constellation: count records that link to another record",
"parameters": {
"type": "params",
"required": ["subject", "source"],
"properties": {
"subject": {
"type": "string",
"format": "at-uri",
"description": "the target being linked to (at-uri, did, or uri)"
},
"source": {
"type": "string",
"description": "collection and path specification for the primary link"
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["total"],
"properties": {
"total": {
"type": "integer",
"description": "total number of matching links"
}
}
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
91 changes: 91 additions & 0 deletions lexicons/blue/microcosm/links/getManyToManyCounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"id": "blue.microcosm.links.getManyToManyCounts",
"defs": {
"main": {
"type": "query",
"description": "Constellation: count many-to-many relationships with secondary link paths",
"parameters": {
"type": "params",
"required": ["subject", "source", "pathToOther"],
"properties": {
"subject": {
"type": "string",
"format": "uri",
"description": "the primary target being linked to (at-uri, did, or uri)"
},
"source": {
"type": "string",
"description": "collection and path specification for the primary link"
},
"pathToOther": {
"type": "string",
"description": "path to the secondary link in the many-to-many record (e.g., 'otherThing.uri')"
},
"did": {
"type": "array",
"description": "filter links to those from specific users",
"items": {
"type": "string",
"format": "did"
}
},
"otherSubject": {
"type": "array",
"description": "filter secondary links to specific subjects",
"items": {
"type": "string"
}
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 16,
"description": "number of results to return"
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["counts_by_other_subject"],
"properties": {
"counts_by_other_subject": {
"type": "array",
"items": {
"type": "ref",
"ref": "#countBySubject"
}
},
"cursor": {
"type": "string",
"description": "pagination cursor"
}
}
}
}
},
"countBySubject": {
"type": "object",
"description": "count of links to a secondary subject",
"required": ["subject", "total", "distinct"],
"properties": {
"subject": {
"type": "string",
"description": "the secondary subject being counted"
},
"total": {
"type": "integer",
"description": "total number of links to this subject"
},
"distinct": {
"type": "integer",
"description": "number of distinct DIDs linking to this subject"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
44 changes: 44 additions & 0 deletions lexicons/blue/microcosm/repo/get-record-by-uri.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
document,
object,
params,
query,
required,
string,
unknown,
} from '@atcute/lexicon-doc/builder'

export default document({
id: 'blue.microcosm.repo.getRecordByUri',
defs: {
main: query({
description:
'Slingshot: ergonomic complement to com.atproto.repo.getRecord which accepts an at-uri instead of individual repo/collection/rkey params',
parameters: params({
properties: {
at_uri: required(
string({
format: 'at-uri',
description: 'the at-uri of the record (identifier can be a DID or handle)',
}),
),
cid: string({
format: 'cid',
description:
'optional CID of the version of the record. if not specified, return the most recent version. if specified and a newer version exists, returns 404.',
}),
},
}),
output: {
encoding: 'application/json',
schema: object({
properties: {
uri: required(string({ format: 'at-uri', description: 'at-uri for this record' })),
cid: string({ format: 'cid', description: 'CID for this exact version of the record' }),
value: required(unknown({ description: 'the record itself' })),
},
}),
},
}),
},
})
50 changes: 50 additions & 0 deletions lexicons/blue/microcosm/repo/getRecordByUri.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"id": "blue.microcosm.repo.getRecordByUri",
"defs": {
"main": {
"type": "query",
"description": "Slingshot: ergonomic complement to com.atproto.repo.getRecord which accepts an at-uri instead of individual repo/collection/rkey params",
"parameters": {
"type": "params",
"required": ["at_uri"],
"properties": {
"at_uri": {
"type": "string",
"format": "at-uri",
"description": "the at-uri of the record (identifier can be a DID or handle)"
},
"cid": {
"type": "string",
"format": "cid",
"description": "optional CID of the version of the record. if not specified, return the most recent version. if specified and a newer version exists, returns 404."
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri", "value"],
"properties": {
"uri": {
"type": "string",
"format": "at-uri",
"description": "at-uri for this record"
},
"cid": {
"type": "string",
"format": "cid",
"description": "CID for this exact version of the record"
},
"value": {
"type": "unknown",
"description": "the record itself"
}
}
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
14 changes: 0 additions & 14 deletions server/api/social/profile/[...handle].get.ts

This file was deleted.

14 changes: 14 additions & 0 deletions server/api/social/profile/[identifier]/index.get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default defineEventHandler(async event => {
const identifier = getRouterParam(event, 'identifier')
if (!identifier) {
throw createError({
status: 400,
message: 'identifier not provided',
})
}

const profileUtil = new ProfileUtils()
const profile = await profileUtil.getProfile(identifier)
console.log('ENDPOINT', { identifier, profile })
return profile
})
Loading
Loading