a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm

docs: flesh out lexicons README

mary.my.id 40509e8b 8f29c616

verified
Changed files
+12 -6
packages
lexicons
lex-cli
lexicon-resolver
lexicons
+2 -2
packages/lexicons/lex-cli/README.md
··· 21 21 }); 22 22 ``` 23 23 24 - then run the tool: 24 + then run the tool (it automatically finds `lex.config.js` or `lex.config.ts`): 25 25 26 26 ``` 27 27 npm exec lex-cli generate ··· 138 138 type: 'atproto', 139 139 mode: 'authority', 140 140 authority: 'atproto-lexicons.bsky.social', 141 - pattern: ['com.atproto.*'], 141 + pattern: ['com.atproto.*'], // optional 142 142 }, 143 143 ], 144 144 },
+1 -1
packages/lexicons/lexicon-resolver/README.md
··· 45 45 }); 46 46 47 47 const resolved = await schemaResolver.resolve(authority, 'app.bsky.feed.post'); 48 - // -> { uri: string, cid: string, schema: LexiconDoc } 48 + // -> { uri: string, cid: string, rawSchema: unknown, schema: LexiconDoc } 49 49 ``` 50 50 51 51 ### error handling
+9 -3
packages/lexicons/lexicons/README.md
··· 42 42 isNsid('com.atproto.repo.createRecord'); // true 43 43 44 44 // CID format (content identifiers) 45 - isCid('bafyreib2rxk3rybk3aobmv5cjuql3setrnhyfnxq...'); // true 45 + isCid('bafyreigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi'); // true 46 46 47 47 // TID format (timestamp identifiers) 48 48 isTid('3jzfcijpj2z2a'); // true ··· 71 71 72 72 // parse any AT URI (handle or DID authority) 73 73 const uri = parseResourceUri('at://alice.bsky.social/app.bsky.feed.post/123'); 74 - // -> { repo: 'alice.bsky.social', collection: 'app.bsky.feed.post', rkey: '123' } 74 + if (uri.ok) { 75 + console.log(uri.value.repo); // 'alice.bsky.social' 76 + console.log(uri.value.collection); // 'app.bsky.feed.post' 77 + console.log(uri.value.rkey); // '123' 78 + } 75 79 76 80 // parse canonical AT URI (DID authority only) 77 81 const canonical = parseCanonicalResourceUri('at://did:plc:123/app.bsky.feed.post/abc'); 78 - // -> { repo: 'did:plc:123', collection: 'app.bsky.feed.post', rkey: 'abc' } 82 + if (canonical.ok) { 83 + console.log(canonical.value.repo); // 'did:plc:123' 84 + } 79 85 ``` 80 86 81 87 ### branded types