Skip to content

Commit

Permalink
Add threadContext def
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbsky committed Jan 3, 2025
1 parent 713eece commit 688ee02
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 19 deletions.
9 changes: 8 additions & 1 deletion lexicons/app/bsky/feed/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
"pinned": { "type": "boolean" }
}
},
"threadContext": {
"type": "object",
"description": "Metadata about this post within the context of the thread it is in.",
"properties": {
"rootAuthorLike": { "type": "string", "format": "at-uri" }
}
},
"feedViewPost": {
"type": "object",
"required": ["post"],
Expand Down Expand Up @@ -109,7 +116,7 @@
"refs": ["#threadViewPost", "#notFoundPost", "#blockedPost"]
}
},
"isLikedByRootAuthor": { "type": "boolean" }
"threadContext": { "type": "ref", "ref": "#threadContext" }
}
},
"notFoundPost": {
Expand Down
16 changes: 14 additions & 2 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5540,6 +5540,17 @@ export const schemaDict = {
},
},
},
threadContext: {
type: 'object',
description:
'Metadata about this post within the context of the thread it is in.',
properties: {
rootAuthorLike: {
type: 'string',
format: 'at-uri',
},
},
},
feedViewPost: {
type: 'object',
required: ['post'],
Expand Down Expand Up @@ -5640,8 +5651,9 @@ export const schemaDict = {
],
},
},
isLikedByRootAuthor: {
type: 'boolean',
threadContext: {
type: 'ref',
ref: 'lex:app.bsky.feed.defs#threadContext',
},
},
},
Expand Down
20 changes: 19 additions & 1 deletion packages/api/src/client/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ export function validateViewerState(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#viewerState', v)
}

/** Metadata about this post within the context of the thread it is in. */
export interface ThreadContext {
rootAuthorLike?: string
[k: string]: unknown
}

export function isThreadContext(v: unknown): v is ThreadContext {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.feed.defs#threadContext'
)
}

export function validateThreadContext(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#threadContext', v)
}

export interface FeedViewPost {
post: PostView
reply?: ReplyRef
Expand Down Expand Up @@ -164,7 +182,7 @@ export interface ThreadViewPost {
| BlockedPost
| { $type: string; [k: string]: unknown }
)[]
isLikedByRootAuthor?: boolean
threadContext?: ThreadContext
[k: string]: unknown
}

Expand Down
4 changes: 2 additions & 2 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2165,13 +2165,13 @@ export class ChatBskyModerationNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down
16 changes: 14 additions & 2 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5540,6 +5540,17 @@ export const schemaDict = {
},
},
},
threadContext: {
type: 'object',
description:
'Metadata about this post within the context of the thread it is in.',
properties: {
rootAuthorLike: {
type: 'string',
format: 'at-uri',
},
},
},
feedViewPost: {
type: 'object',
required: ['post'],
Expand Down Expand Up @@ -5640,8 +5651,9 @@ export const schemaDict = {
],
},
},
isLikedByRootAuthor: {
type: 'boolean',
threadContext: {
type: 'ref',
ref: 'lex:app.bsky.feed.defs#threadContext',
},
},
},
Expand Down
20 changes: 19 additions & 1 deletion packages/bsky/src/lexicon/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ export function validateViewerState(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#viewerState', v)
}

/** Metadata about this post within the context of the thread it is in. */
export interface ThreadContext {
rootAuthorLike?: string
[k: string]: unknown
}

export function isThreadContext(v: unknown): v is ThreadContext {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.feed.defs#threadContext'
)
}

export function validateThreadContext(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#threadContext', v)
}

export interface FeedViewPost {
post: PostView
reply?: ReplyRef
Expand Down Expand Up @@ -164,7 +182,7 @@ export interface ThreadViewPost {
| BlockedPost
| { $type: string; [k: string]: unknown }
)[]
isLikedByRootAuthor?: boolean
threadContext?: ThreadContext
[k: string]: unknown
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ozone/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2626,13 +2626,13 @@ export class ToolsOzoneTeamNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down
16 changes: 14 additions & 2 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5540,6 +5540,17 @@ export const schemaDict = {
},
},
},
threadContext: {
type: 'object',
description:
'Metadata about this post within the context of the thread it is in.',
properties: {
rootAuthorLike: {
type: 'string',
format: 'at-uri',
},
},
},
feedViewPost: {
type: 'object',
required: ['post'],
Expand Down Expand Up @@ -5640,8 +5651,9 @@ export const schemaDict = {
],
},
},
isLikedByRootAuthor: {
type: 'boolean',
threadContext: {
type: 'ref',
ref: 'lex:app.bsky.feed.defs#threadContext',
},
},
},
Expand Down
20 changes: 19 additions & 1 deletion packages/ozone/src/lexicon/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ export function validateViewerState(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#viewerState', v)
}

/** Metadata about this post within the context of the thread it is in. */
export interface ThreadContext {
rootAuthorLike?: string
[k: string]: unknown
}

export function isThreadContext(v: unknown): v is ThreadContext {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.feed.defs#threadContext'
)
}

export function validateThreadContext(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#threadContext', v)
}

export interface FeedViewPost {
post: PostView
reply?: ReplyRef
Expand Down Expand Up @@ -164,7 +182,7 @@ export interface ThreadViewPost {
| BlockedPost
| { $type: string; [k: string]: unknown }
)[]
isLikedByRootAuthor?: boolean
threadContext?: ThreadContext
[k: string]: unknown
}

Expand Down
4 changes: 2 additions & 2 deletions packages/pds/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2626,13 +2626,13 @@ export class ToolsOzoneTeamNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down
16 changes: 14 additions & 2 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5540,6 +5540,17 @@ export const schemaDict = {
},
},
},
threadContext: {
type: 'object',
description:
'Metadata about this post within the context of the thread it is in.',
properties: {
rootAuthorLike: {
type: 'string',
format: 'at-uri',
},
},
},
feedViewPost: {
type: 'object',
required: ['post'],
Expand Down Expand Up @@ -5640,8 +5651,9 @@ export const schemaDict = {
],
},
},
isLikedByRootAuthor: {
type: 'boolean',
threadContext: {
type: 'ref',
ref: 'lex:app.bsky.feed.defs#threadContext',
},
},
},
Expand Down
20 changes: 19 additions & 1 deletion packages/pds/src/lexicon/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ export function validateViewerState(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#viewerState', v)
}

/** Metadata about this post within the context of the thread it is in. */
export interface ThreadContext {
rootAuthorLike?: string
[k: string]: unknown
}

export function isThreadContext(v: unknown): v is ThreadContext {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.feed.defs#threadContext'
)
}

export function validateThreadContext(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#threadContext', v)
}

export interface FeedViewPost {
post: PostView
reply?: ReplyRef
Expand Down Expand Up @@ -164,7 +182,7 @@ export interface ThreadViewPost {
| BlockedPost
| { $type: string; [k: string]: unknown }
)[]
isLikedByRootAuthor?: boolean
threadContext?: ThreadContext
[k: string]: unknown
}

Expand Down

0 comments on commit 688ee02

Please sign in to comment.