From ea6be67b03e67d9de9d13a6ddec80bd600cdd860 Mon Sep 17 00:00:00 2001 From: maelstrom Date: Fri, 1 May 2026 17:19:14 +0200 Subject: [PATCH] added reblog chain to lexicon --- lexicons/dev/maelstrom/bramblr/post.json | 33 +++++++++++++++ .../dev/maelstrom/bramblr/post.defs.ts | 42 ++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/lexicons/dev/maelstrom/bramblr/post.json b/lexicons/dev/maelstrom/bramblr/post.json index a88d9aa..cf3d4ca 100644 --- a/lexicons/dev/maelstrom/bramblr/post.json +++ b/lexicons/dev/maelstrom/bramblr/post.json @@ -9,6 +9,8 @@ "description": "Record describing a text post, plain repost, or repost with text", "record": { "type": "object", + "nullable": ["reblog"], + "required": ["createdAt"], "properties": { "text": { "type": "string", @@ -19,9 +21,40 @@ "type": "string", "format": "datetime", "description": "The time when the post was originally created." + }, + "reblog": { + "type": "ref", + "ref": "#reblogRef" + }, + "thread": { + "type": "array", + "items": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + }, + "description": "A list of every previous post within this reblog thread, from root to last" } } } + }, + "reblogRef": { + "type": "object", + "required": [ + "root", + "parent" + ], + "properties": { + "root": { + "type": "ref", + "ref": "com.atproto.repo.strongRef", + "description": "The root post within the reblog chain" + }, + "parent": { + "type": "ref", + "ref": "com.atproto.repo.strongRef", + "description": "The previous post this post is reblogging" + } + } } } } \ No newline at end of file diff --git a/src/lexicons/dev/maelstrom/bramblr/post.defs.ts b/src/lexicons/dev/maelstrom/bramblr/post.defs.ts index 89ed0a3..141fcb4 100644 --- a/src/lexicons/dev/maelstrom/bramblr/post.defs.ts +++ b/src/lexicons/dev/maelstrom/bramblr/post.defs.ts @@ -3,6 +3,7 @@ */ import { l } from '@atproto/lex' +import * as RepoStrongRef from '../../../com/atproto/repo/strongRef.defs' const $nsid = 'dev.maelstrom.bramblr.post' @@ -20,7 +21,13 @@ type Main = { /** * The time when the post was originally created. */ - createdAt?: l.DatetimeString + createdAt: l.DatetimeString + reblog?: ReblogRef | null + + /** + * A list of every previous post within this reblog thread, from root to last + */ + thread?: RepoStrongRef.Main[] } export type { Main } @@ -31,7 +38,11 @@ const main = l.record<'tid', Main>( $nsid, l.object({ text: l.optional(l.string({ maxLength: 4096000 })), - createdAt: l.optional(l.string({ format: 'datetime' })), + createdAt: l.string({ format: 'datetime' }), + reblog: l.optional(l.nullable(l.ref((() => reblogRef) as any))), + thread: l.optional( + l.array(l.ref((() => RepoStrongRef.main) as any)), + ), }), ) @@ -49,3 +60,30 @@ export const $assert = /*#__PURE__*/ main.assert.bind(main), $safeParse = /*#__PURE__*/ main.safeParse.bind(main), $validate = /*#__PURE__*/ main.validate.bind(main), $safeValidate = /*#__PURE__*/ main.safeValidate.bind(main) + +type ReblogRef = { + $type?: 'dev.maelstrom.bramblr.post#reblogRef' + + /** + * The root post within the reblog chain + */ + root: RepoStrongRef.Main + + /** + * The previous post this post is reblogging + */ + parent: RepoStrongRef.Main +} + +export type { ReblogRef } + +const reblogRef = l.typedObject( + $nsid, + 'reblogRef', + l.object({ + root: l.ref((() => RepoStrongRef.main) as any), + parent: l.ref((() => RepoStrongRef.main) as any), + }), +) + +export { reblogRef } -- 2.51.2