···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from '@atproto/lexicon'
55+import { CID } from 'multiformats/cid'
66+import { validate as _validate } from '../../../lexicons'
77+import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
88+99+const is$typed = _is$typed,
1010+ validate = _validate
1111+const id = 'app.example.defs'
1212+1313+/** Reference to a post */
1414+export interface PostRef {
1515+ $type?: 'app.example.defs#postRef'
1616+ /** AT URI of the post */
1717+ uri: string
1818+ /** CID of the post */
1919+ cid: string
2020+}
2121+2222+const hashPostRef = 'postRef'
2323+2424+export function isPostRef<V>(v: V) {
2525+ return is$typed(v, id, hashPostRef)
2626+}
2727+2828+export function validatePostRef<V>(v: V) {
2929+ return validate<PostRef & V>(v, id, hashPostRef)
3030+}
3131+3232+/** Reference to a parent post in a reply chain */
3333+export interface ReplyRef {
3434+ $type?: 'app.example.defs#replyRef'
3535+ root: PostRef
3636+ parent: PostRef
3737+}
3838+3939+const hashReplyRef = 'replyRef'
4040+4141+export function isReplyRef<V>(v: V) {
4242+ return is$typed(v, id, hashReplyRef)
4343+}
4444+4545+export function validateReplyRef<V>(v: V) {
4646+ return validate<ReplyRef & V>(v, id, hashReplyRef)
4747+}
4848+4949+/** Text entity (mention, link, or tag) */
5050+export interface Entity {
5151+ $type?: 'app.example.defs#entity'
5252+ /** Start index in text */
5353+ start: number
5454+ /** End index in text */
5555+ end: number
5656+ /** Entity type */
5757+ type: string
5858+ /** Entity value (handle, URL, or tag) */
5959+ value: string
6060+}
6161+6262+const hashEntity = 'entity'
6363+6464+export function isEntity<V>(v: V) {
6565+ return is$typed(v, id, hashEntity)
6666+}
6767+6868+export function validateEntity<V>(v: V) {
6969+ return validate<Entity & V>(v, id, hashEntity)
7070+}
+30
packages/example/src/types/app/example/follow.ts
···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from '@atproto/lexicon'
55+import { CID } from 'multiformats/cid'
66+import { validate as _validate } from '../../../lexicons'
77+import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
88+99+const is$typed = _is$typed,
1010+ validate = _validate
1111+const id = 'app.example.follow'
1212+1313+export interface Record {
1414+ $type: 'app.example.follow'
1515+ /** DID of the account being followed */
1616+ subject: string
1717+ /** When the follow was created */
1818+ createdAt: string
1919+ [k: string]: unknown
2020+}
2121+2222+const hashRecord = 'main'
2323+2424+export function isRecord<V>(v: V) {
2525+ return is$typed(v, id, hashRecord)
2626+}
2727+2828+export function validateRecord<V>(v: V) {
2929+ return validate<Record & V>(v, id, hashRecord, true)
3030+}
+30
packages/example/src/types/app/example/like.ts
···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from '@atproto/lexicon'
55+import { CID } from 'multiformats/cid'
66+import { validate as _validate } from '../../../lexicons'
77+import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
88+import type * as AppExampleDefs from './defs.js'
99+1010+const is$typed = _is$typed,
1111+ validate = _validate
1212+const id = 'app.example.like'
1313+1414+export interface Record {
1515+ $type: 'app.example.like'
1616+ subject: AppExampleDefs.PostRef
1717+ /** When the like was created */
1818+ createdAt: string
1919+ [k: string]: unknown
2020+}
2121+2222+const hashRecord = 'main'
2323+2424+export function isRecord<V>(v: V) {
2525+ return is$typed(v, id, hashRecord)
2626+}
2727+2828+export function validateRecord<V>(v: V) {
2929+ return validate<Record & V>(v, id, hashRecord, true)
3030+}
+36
packages/example/src/types/app/example/post.ts
···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from '@atproto/lexicon'
55+import { CID } from 'multiformats/cid'
66+import { validate as _validate } from '../../../lexicons'
77+import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
88+import type * as AppExampleDefs from './defs.js'
99+1010+const is$typed = _is$typed,
1111+ validate = _validate
1212+const id = 'app.example.post'
1313+1414+export interface Record {
1515+ $type: 'app.example.post'
1616+ /** Post text content */
1717+ text: string
1818+ /** Creation timestamp */
1919+ createdAt: string
2020+ /** Languages the post is written in */
2121+ langs?: string[]
2222+ /** Referenced entities in the post */
2323+ entities?: AppExampleDefs.Entity[]
2424+ reply?: AppExampleDefs.ReplyRef
2525+ [k: string]: unknown
2626+}
2727+2828+const hashRecord = 'main'
2929+3030+export function isRecord<V>(v: V) {
3131+ return is$typed(v, id, hashRecord)
3232+}
3333+3434+export function validateRecord<V>(v: V) {
3535+ return validate<Record & V>(v, id, hashRecord, true)
3636+}
+34
packages/example/src/types/app/example/profile.ts
···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from '@atproto/lexicon'
55+import { CID } from 'multiformats/cid'
66+import { validate as _validate } from '../../../lexicons'
77+import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
88+99+const is$typed = _is$typed,
1010+ validate = _validate
1111+const id = 'app.example.profile'
1212+1313+export interface Record {
1414+ $type: 'app.example.profile'
1515+ /** Display name */
1616+ displayName?: string
1717+ /** Profile description */
1818+ description?: string
1919+ /** Profile avatar image */
2020+ avatar?: string
2121+ /** Profile banner image */
2222+ banner?: string
2323+ [k: string]: unknown
2424+}
2525+2626+const hashRecord = 'main'
2727+2828+export function isRecord<V>(v: V) {
2929+ return is$typed(v, id, hashRecord)
3030+}
3131+3232+export function validateRecord<V>(v: V) {
3333+ return validate<Record & V>(v, id, hashRecord, true)
3434+}
+30
packages/example/src/types/app/example/repost.ts
···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from '@atproto/lexicon'
55+import { CID } from 'multiformats/cid'
66+import { validate as _validate } from '../../../lexicons'
77+import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
88+import type * as AppExampleDefs from './defs.js'
99+1010+const is$typed = _is$typed,
1111+ validate = _validate
1212+const id = 'app.example.repost'
1313+1414+export interface Record {
1515+ $type: 'app.example.repost'
1616+ subject: AppExampleDefs.PostRef
1717+ /** When the repost was created */
1818+ createdAt: string
1919+ [k: string]: unknown
2020+}
2121+2222+const hashRecord = 'main'
2323+2424+export function isRecord<V>(v: V) {
2525+ return is$typed(v, id, hashRecord)
2626+}
2727+2828+export function validateRecord<V>(v: V) {
2929+ return validate<Record & V>(v, id, hashRecord, true)
3030+}
+5
packages/example/typlex/main.tsp
···4040 // ============ Records ============
41414242 @lexiconMain
4343+ @record("tid")
4344 @doc("A post in the feed")
4445 model Post {
4546 @doc("Post text content")
···6061 }
61626263 @lexiconMain
6464+ @record("tid")
6365 @doc("A follow relationship")
6466 model Follow {
6567 @doc("DID of the account being followed")
···7173 }
72747375 @lexiconMain
7676+ @record("tid")
7477 @doc("A like on a post")
7578 model Like {
7679 @doc("Post being liked")
···8285 }
83868487 @lexiconMain
8888+ @record("tid")
8589 @doc("A repost of another post")
8690 model Repost {
8791 @doc("Post being reposted")
···9397 }
94989599 @lexiconMain
100100+ @record("self")
96101 @doc("User profile information")
97102 model Profile {
98103 @doc("Display name")