add lexicon codegen: vendored lexicons, lex cli and generation scripts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 12:06:59 +03:00
parent a2129885c6
commit a3243820c9
311 changed files with 23342 additions and 14 deletions
+196
View File
@@ -0,0 +1,196 @@
{
"id": "com.atproto.repo.applyWrites",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"repo",
"writes"
],
"properties": {
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo (aka, current account)."
},
"writes": {
"type": "array",
"items": {
"refs": [
"#create",
"#update",
"#delete"
],
"type": "union",
"closed": true
}
},
"validate": {
"type": "boolean",
"description": "Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations."
}
}
},
"encoding": "application/json"
},
"errors": [
{
"name": "InvalidSwap",
"description": "Indicates that the 'swapCommit' parameter did not match current commit."
}
],
"output": {
"schema": {
"type": "object",
"required": [],
"properties": {
"commit": {
"ref": "com.atproto.repo.defs#commitMeta",
"type": "ref"
},
"results": {
"type": "array",
"items": {
"refs": [
"#createResult",
"#updateResult",
"#deleteResult"
],
"type": "union",
"closed": true
}
}
}
},
"encoding": "application/json"
},
"description": "Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS."
},
"create": {
"type": "object",
"required": [
"collection",
"value"
],
"properties": {
"rkey": {
"type": "string",
"format": "record-key",
"maxLength": 512,
"description": "NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility."
},
"value": {
"type": "unknown"
},
"collection": {
"type": "string",
"format": "nsid"
}
},
"description": "Operation which creates a new record."
},
"delete": {
"type": "object",
"required": [
"collection",
"rkey"
],
"properties": {
"rkey": {
"type": "string",
"format": "record-key"
},
"collection": {
"type": "string",
"format": "nsid"
}
},
"description": "Operation which deletes an existing record."
},
"update": {
"type": "object",
"required": [
"collection",
"rkey",
"value"
],
"properties": {
"rkey": {
"type": "string",
"format": "record-key"
},
"value": {
"type": "unknown"
},
"collection": {
"type": "string",
"format": "nsid"
}
},
"description": "Operation which updates an existing record."
},
"createResult": {
"type": "object",
"required": [
"uri",
"cid"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
},
"validationStatus": {
"type": "string",
"knownValues": [
"valid",
"unknown"
]
}
}
},
"deleteResult": {
"type": "object",
"required": [],
"properties": {}
},
"updateResult": {
"type": "object",
"required": [
"uri",
"cid"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
},
"validationStatus": {
"type": "string",
"knownValues": [
"valid",
"unknown"
]
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,90 @@
{
"id": "com.atproto.repo.createRecord",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"repo",
"collection",
"record"
],
"properties": {
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo (aka, current account)."
},
"rkey": {
"type": "string",
"format": "record-key",
"maxLength": 512,
"description": "The Record Key."
},
"record": {
"type": "unknown",
"description": "The record itself. Must contain a $type field."
},
"validate": {
"type": "boolean",
"description": "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous commit by CID."
}
}
},
"encoding": "application/json"
},
"errors": [
{
"name": "InvalidSwap",
"description": "Indicates that 'swapCommit' didn't match current repo commit."
}
],
"output": {
"schema": {
"type": "object",
"required": [
"uri",
"cid"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
},
"commit": {
"ref": "com.atproto.repo.defs#commitMeta",
"type": "ref"
},
"validationStatus": {
"type": "string",
"knownValues": [
"valid",
"unknown"
]
}
}
},
"encoding": "application/json"
},
"description": "Create a single new repository record. Requires auth, implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+24
View File
@@ -0,0 +1,24 @@
{
"id": "com.atproto.repo.defs",
"defs": {
"commitMeta": {
"type": "object",
"required": [
"cid",
"rev"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"rev": {
"type": "string",
"format": "tid"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,66 @@
{
"id": "com.atproto.repo.deleteRecord",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"repo",
"collection",
"rkey"
],
"properties": {
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo (aka, current account)."
},
"rkey": {
"type": "string",
"format": "record-key",
"description": "The Record Key."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous commit by CID."
},
"swapRecord": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous record by CID."
}
}
},
"encoding": "application/json"
},
"errors": [
{
"name": "InvalidSwap"
}
],
"output": {
"schema": {
"type": "object",
"properties": {
"commit": {
"ref": "com.atproto.repo.defs#commitMeta",
"type": "ref"
}
}
},
"encoding": "application/json"
},
"description": "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,63 @@
{
"id": "com.atproto.repo.describeRepo",
"defs": {
"main": {
"type": "query",
"output": {
"schema": {
"type": "object",
"required": [
"handle",
"did",
"didDoc",
"collections",
"handleIsCorrect"
],
"properties": {
"did": {
"type": "string",
"format": "did"
},
"didDoc": {
"type": "unknown",
"description": "The complete DID document for this account."
},
"handle": {
"type": "string",
"format": "handle"
},
"collections": {
"type": "array",
"items": {
"type": "string",
"format": "nsid"
},
"description": "List of all the collections (NSIDs) for which this repo contains at least one record."
},
"handleIsCorrect": {
"type": "boolean",
"description": "Indicates if handle is currently valid (resolves bi-directionally)"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"repo"
],
"properties": {
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo."
}
}
},
"description": "Get information about an account and repository, including the list of collections. Does not require auth."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+69
View File
@@ -0,0 +1,69 @@
{
"id": "com.atproto.repo.getRecord",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "RecordNotFound"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"uri",
"value"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
},
"value": {
"type": "unknown"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"repo",
"collection",
"rkey"
],
"properties": {
"cid": {
"type": "string",
"format": "cid",
"description": "The CID of the version of the record. If not specified, then return the most recent version."
},
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"rkey": {
"type": "string",
"format": "record-key",
"description": "The Record Key."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
}
}
},
"description": "Get a single record from a repository. Does not require auth."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "com.atproto.repo.importRepo",
"defs": {
"main": {
"type": "procedure",
"input": {
"encoding": "application/vnd.ipld.car"
},
"description": "Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,63 @@
{
"id": "com.atproto.repo.listMissingBlobs",
"defs": {
"main": {
"type": "query",
"output": {
"schema": {
"type": "object",
"required": [
"blobs"
],
"properties": {
"blobs": {
"type": "array",
"items": {
"ref": "#recordBlob",
"type": "ref"
}
},
"cursor": {
"type": "string"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"properties": {
"limit": {
"type": "integer",
"default": 500,
"maximum": 1000,
"minimum": 1
},
"cursor": {
"type": "string"
}
}
},
"description": "Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow."
},
"recordBlob": {
"type": "object",
"required": [
"cid",
"recordUri"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"recordUri": {
"type": "string",
"format": "at-uri"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,86 @@
{
"id": "com.atproto.repo.listRecords",
"defs": {
"main": {
"type": "query",
"output": {
"schema": {
"type": "object",
"required": [
"records"
],
"properties": {
"cursor": {
"type": "string"
},
"records": {
"type": "array",
"items": {
"ref": "#record",
"type": "ref"
}
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"repo",
"collection"
],
"properties": {
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"limit": {
"type": "integer",
"default": 50,
"maximum": 100,
"minimum": 1,
"description": "The number of records to return."
},
"cursor": {
"type": "string"
},
"reverse": {
"type": "boolean",
"description": "Flag to reverse the order of the returned records."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record type."
}
}
},
"description": "List a range of records in a repository, matching a specific collection. Does not require auth."
},
"record": {
"type": "object",
"required": [
"uri",
"cid",
"value"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
},
"value": {
"type": "unknown"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+98
View File
@@ -0,0 +1,98 @@
{
"id": "com.atproto.repo.putRecord",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"nullable": [
"swapRecord"
],
"required": [
"repo",
"collection",
"rkey",
"record"
],
"properties": {
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo (aka, current account)."
},
"rkey": {
"type": "string",
"format": "record-key",
"maxLength": 512,
"description": "The Record Key."
},
"record": {
"type": "unknown",
"description": "The record to write."
},
"validate": {
"type": "boolean",
"description": "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous commit by CID."
},
"swapRecord": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation"
}
}
},
"encoding": "application/json"
},
"errors": [
{
"name": "InvalidSwap"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"uri",
"cid"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
},
"commit": {
"ref": "com.atproto.repo.defs#commitMeta",
"type": "ref"
},
"validationStatus": {
"type": "string",
"knownValues": [
"valid",
"unknown"
]
}
}
},
"encoding": "application/json"
},
"description": "Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+25
View File
@@ -0,0 +1,25 @@
{
"id": "com.atproto.repo.strongRef",
"defs": {
"main": {
"type": "object",
"required": [
"uri",
"cid"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"uri": {
"type": "string",
"format": "at-uri"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1,
"description": "A URI with a content-hash fingerprint."
}
+28
View File
@@ -0,0 +1,28 @@
{
"id": "com.atproto.repo.uploadBlob",
"defs": {
"main": {
"type": "procedure",
"input": {
"encoding": "*/*"
},
"output": {
"schema": {
"type": "object",
"required": [
"blob"
],
"properties": {
"blob": {
"type": "blob"
}
}
},
"encoding": "application/json"
},
"description": "Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}