@atproto/bsky 0.0.151 → 0.0.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.d.ts +4 -0
  3. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.d.ts.map +1 -0
  4. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.js +76 -0
  5. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -0
  6. package/dist/api/app/bsky/unspecced/getPostThreadV2.d.ts +4 -0
  7. package/dist/api/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -0
  8. package/dist/api/app/bsky/unspecced/getPostThreadV2.js +86 -0
  9. package/dist/api/app/bsky/unspecced/getPostThreadV2.js.map +1 -0
  10. package/dist/api/index.d.ts.map +1 -1
  11. package/dist/api/index.js +4 -0
  12. package/dist/api/index.js.map +1 -1
  13. package/dist/config.d.ts +2 -0
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/config.js +7 -0
  16. package/dist/config.js.map +1 -1
  17. package/dist/hydration/feed.d.ts.map +1 -1
  18. package/dist/hydration/feed.js.map +1 -1
  19. package/dist/lexicon/index.d.ts +6 -2
  20. package/dist/lexicon/index.d.ts.map +1 -1
  21. package/dist/lexicon/index.js +12 -4
  22. package/dist/lexicon/index.js.map +1 -1
  23. package/dist/lexicon/lexicons.d.ts +498 -82
  24. package/dist/lexicon/lexicons.d.ts.map +1 -1
  25. package/dist/lexicon/lexicons.js +259 -42
  26. package/dist/lexicon/lexicons.js.map +1 -1
  27. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts +61 -0
  28. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts.map +1 -0
  29. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js +25 -0
  30. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -0
  31. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts +92 -0
  32. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -0
  33. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js +52 -0
  34. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js.map +1 -0
  35. package/dist/views/index.d.ts +35 -0
  36. package/dist/views/index.d.ts.map +1 -1
  37. package/dist/views/index.js +463 -0
  38. package/dist/views/index.js.map +1 -1
  39. package/dist/views/threads-v2.d.ts +62 -0
  40. package/dist/views/threads-v2.d.ts.map +1 -0
  41. package/dist/views/threads-v2.js +180 -0
  42. package/dist/views/threads-v2.js.map +1 -0
  43. package/package.json +4 -4
  44. package/src/api/app/bsky/unspecced/getPostThreadHiddenV2.ts +116 -0
  45. package/src/api/app/bsky/unspecced/getPostThreadV2.ts +130 -0
  46. package/src/api/index.ts +4 -0
  47. package/src/config.ts +9 -0
  48. package/src/hydration/feed.ts +1 -0
  49. package/src/lexicon/index.ts +33 -9
  50. package/src/lexicon/lexicons.ts +278 -43
  51. package/src/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.ts +93 -0
  52. package/src/lexicon/types/app/bsky/unspecced/getPostThreadV2.ts +160 -0
  53. package/src/views/index.ts +742 -0
  54. package/src/views/threads-v2.ts +351 -0
  55. package/tests/seed/thread-v2.ts +775 -0
  56. package/tests/seed/util.ts +52 -0
  57. package/tests/views/__snapshots__/thread-v2.test.ts.snap +1091 -0
  58. package/tests/views/thread-v2.test.ts +2009 -0
  59. package/tsconfig.build.tsbuildinfo +1 -1
  60. package/tsconfig.tests.tsbuildinfo +1 -1
@@ -0,0 +1,130 @@
1
+ import { ServerConfig } from '../../../../config'
2
+ import { AppContext } from '../../../../context'
3
+ import { Code, DataPlaneClient, isDataplaneError } from '../../../../data-plane'
4
+ import { HydrateCtx, Hydrator } from '../../../../hydration/hydrator'
5
+ import { Server } from '../../../../lexicon'
6
+ import { QueryParams } from '../../../../lexicon/types/app/bsky/unspecced/getPostThreadV2'
7
+ import {
8
+ HydrationFnInput,
9
+ PresentationFnInput,
10
+ SkeletonFnInput,
11
+ createPipeline,
12
+ noRules,
13
+ } from '../../../../pipeline'
14
+ import { postUriToThreadgateUri } from '../../../../util/uris'
15
+ import { Views } from '../../../../views'
16
+ import { resHeaders } from '../../../util'
17
+
18
+ export default function (server: Server, ctx: AppContext) {
19
+ const getPostThread = createPipeline(
20
+ skeleton,
21
+ hydration,
22
+ noRules, // handled in presentation: 3p block-violating replies are turned to #blockedPost, viewer blocks turned to #notFoundPost.
23
+ presentation,
24
+ )
25
+ server.app.bsky.unspecced.getPostThreadV2({
26
+ auth: ctx.authVerifier.optionalStandardOrRole,
27
+ handler: async ({ params, auth, req }) => {
28
+ const { viewer, includeTakedowns, include3pBlocks } =
29
+ ctx.authVerifier.parseCreds(auth)
30
+ const labelers = ctx.reqLabelers(req)
31
+ const hydrateCtx = await ctx.hydrator.createContext({
32
+ labelers,
33
+ viewer,
34
+ includeTakedowns,
35
+ include3pBlocks,
36
+ })
37
+
38
+ return {
39
+ encoding: 'application/json',
40
+ body: await getPostThread({ ...params, hydrateCtx }, ctx),
41
+ headers: resHeaders({
42
+ labelers: hydrateCtx.labelers,
43
+ }),
44
+ }
45
+ },
46
+ })
47
+ }
48
+
49
+ const skeleton = async (inputs: SkeletonFnInput<Context, Params>) => {
50
+ const { ctx, params } = inputs
51
+ const anchor = await ctx.hydrator.resolveUri(params.anchor)
52
+ try {
53
+ const res = await ctx.dataplane.getThread({
54
+ postUri: anchor,
55
+ above: calculateAbove(ctx, params),
56
+ below: calculateBelow(ctx, anchor, params),
57
+ })
58
+ return {
59
+ anchor,
60
+ uris: res.uris,
61
+ }
62
+ } catch (err) {
63
+ if (isDataplaneError(err, Code.NotFound)) {
64
+ return {
65
+ anchor,
66
+ uris: [],
67
+ }
68
+ } else {
69
+ throw err
70
+ }
71
+ }
72
+ }
73
+
74
+ const hydration = async (
75
+ inputs: HydrationFnInput<Context, Params, Skeleton>,
76
+ ) => {
77
+ const { ctx, params, skeleton } = inputs
78
+ return ctx.hydrator.hydrateThreadPosts(
79
+ skeleton.uris.map((uri) => ({ uri })),
80
+ params.hydrateCtx,
81
+ )
82
+ }
83
+
84
+ const presentation = (
85
+ inputs: PresentationFnInput<Context, Params, Skeleton>,
86
+ ) => {
87
+ const { ctx, params, skeleton, hydration } = inputs
88
+ const { hasHiddenReplies, thread } = ctx.views.threadV2(skeleton, hydration, {
89
+ above: calculateAbove(ctx, params),
90
+ below: calculateBelow(ctx, skeleton.anchor, params),
91
+ branchingFactor: params.branchingFactor,
92
+ prioritizeFollowedUsers: params.prioritizeFollowedUsers,
93
+ sort: params.sort,
94
+ })
95
+
96
+ const rootUri =
97
+ hydration.posts?.get(skeleton.anchor)?.record.reply?.root.uri ??
98
+ skeleton.anchor
99
+ const threadgate = ctx.views.threadgate(
100
+ postUriToThreadgateUri(rootUri),
101
+ hydration,
102
+ )
103
+ return { hasHiddenReplies, thread, threadgate }
104
+ }
105
+
106
+ type Context = {
107
+ dataplane: DataPlaneClient
108
+ hydrator: Hydrator
109
+ views: Views
110
+ cfg: ServerConfig
111
+ }
112
+
113
+ type Params = QueryParams & { hydrateCtx: HydrateCtx }
114
+
115
+ type Skeleton = {
116
+ anchor: string
117
+ uris: string[]
118
+ }
119
+
120
+ const calculateAbove = (ctx: Context, params: Params) => {
121
+ return params.above ? ctx.cfg.maxThreadParents : 0
122
+ }
123
+
124
+ const calculateBelow = (ctx: Context, anchor: string, params: Params) => {
125
+ let maxDepth = ctx.cfg.maxThreadDepth
126
+ if (ctx.cfg.bigThreadUris.has(anchor) && ctx.cfg.bigThreadDepth) {
127
+ maxDepth = ctx.cfg.bigThreadDepth
128
+ }
129
+ return maxDepth ? Math.min(maxDepth, params.below) : params.below
130
+ }
package/src/api/index.ts CHANGED
@@ -49,6 +49,8 @@ import registerPush from './app/bsky/notification/registerPush'
49
49
  import updateSeen from './app/bsky/notification/updateSeen'
50
50
  import getConfig from './app/bsky/unspecced/getConfig'
51
51
  import getPopularFeedGenerators from './app/bsky/unspecced/getPopularFeedGenerators'
52
+ import getPostThreadHiddenV2 from './app/bsky/unspecced/getPostThreadHiddenV2'
53
+ import getPostThreadV2 from './app/bsky/unspecced/getPostThreadV2'
52
54
  import getUnspeccedSuggestedFeeds from './app/bsky/unspecced/getSuggestedFeeds'
53
55
  import getSuggestedStarterPacks from './app/bsky/unspecced/getSuggestedStarterPacks'
54
56
  import getSuggestedUsers from './app/bsky/unspecced/getSuggestedUsers'
@@ -82,6 +84,8 @@ export default function (server: Server, ctx: AppContext) {
82
84
  getListFeed(server, ctx)
83
85
  getQuotes(server, ctx)
84
86
  getPostThread(server, ctx)
87
+ getPostThreadHiddenV2(server, ctx)
88
+ getPostThreadV2(server, ctx)
85
89
  getPosts(server, ctx)
86
90
  searchPosts(server, ctx)
87
91
  getActorLikes(server, ctx)
package/src/config.ts CHANGED
@@ -56,6 +56,7 @@ export interface ServerConfigValues {
56
56
  bigThreadUris: Set<string>
57
57
  bigThreadDepth?: number
58
58
  maxThreadDepth?: number
59
+ maxThreadParents: number
59
60
  // notifications
60
61
  notificationsDelayMs?: number
61
62
  // client config
@@ -191,6 +192,9 @@ export class ServerConfig {
191
192
  const maxThreadDepth = process.env.BSKY_MAX_THREAD_DEPTH
192
193
  ? parseInt(process.env.BSKY_MAX_THREAD_DEPTH || '', 10)
193
194
  : undefined
195
+ const maxThreadParents = process.env.BSKY_MAX_THREAD_PARENTS
196
+ ? parseInt(process.env.BSKY_MAX_THREAD_PARENTS || '', 10)
197
+ : 50
194
198
 
195
199
  const notificationsDelayMs = process.env.BSKY_NOTIFICATIONS_DELAY_MS
196
200
  ? parseInt(process.env.BSKY_NOTIFICATIONS_DELAY_MS || '', 10)
@@ -258,6 +262,7 @@ export class ServerConfig {
258
262
  bigThreadUris,
259
263
  bigThreadDepth,
260
264
  maxThreadDepth,
265
+ maxThreadParents,
261
266
  notificationsDelayMs,
262
267
  disableSsrfProtection,
263
268
  proxyAllowHTTP2,
@@ -458,6 +463,10 @@ export class ServerConfig {
458
463
  return this.cfg.maxThreadDepth
459
464
  }
460
465
 
466
+ get maxThreadParents() {
467
+ return this.cfg.maxThreadParents
468
+ }
469
+
461
470
  get notificationsDelayMs() {
462
471
  return this.cfg.notificationsDelayMs ?? 0
463
472
  }
@@ -37,6 +37,7 @@ export type PostViewerState = {
37
37
  export type PostViewerStates = HydrationMap<PostViewerState>
38
38
 
39
39
  export type ThreadContext = {
40
+ // Whether the root author has liked the post.
40
41
  like?: string
41
42
  }
42
43
 
@@ -108,8 +108,8 @@ import * as AppBskyFeedGetFeedGenerators from './types/app/bsky/feed/getFeedGene
108
108
  import * as AppBskyFeedGetFeedSkeleton from './types/app/bsky/feed/getFeedSkeleton.js'
109
109
  import * as AppBskyFeedGetLikes from './types/app/bsky/feed/getLikes.js'
110
110
  import * as AppBskyFeedGetListFeed from './types/app/bsky/feed/getListFeed.js'
111
- import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.js'
112
111
  import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
112
+ import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.js'
113
113
  import * as AppBskyFeedGetQuotes from './types/app/bsky/feed/getQuotes.js'
114
114
  import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy.js'
115
115
  import * as AppBskyFeedGetSuggestedFeeds from './types/app/bsky/feed/getSuggestedFeeds.js'
@@ -145,6 +145,8 @@ import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/
145
145
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen.js'
146
146
  import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig.js'
147
147
  import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators.js'
148
+ import * as AppBskyUnspeccedGetPostThreadHiddenV2 from './types/app/bsky/unspecced/getPostThreadHiddenV2.js'
149
+ import * as AppBskyUnspeccedGetPostThreadV2 from './types/app/bsky/unspecced/getPostThreadV2.js'
148
150
  import * as AppBskyUnspeccedGetSuggestedFeeds from './types/app/bsky/unspecced/getSuggestedFeeds.js'
149
151
  import * as AppBskyUnspeccedGetSuggestedFeedsSkeleton from './types/app/bsky/unspecced/getSuggestedFeedsSkeleton.js'
150
152
  import * as AppBskyUnspeccedGetSuggestedStarterPacks from './types/app/bsky/unspecced/getSuggestedStarterPacks.js'
@@ -1497,25 +1499,25 @@ export class AppBskyFeedNS {
1497
1499
  return this._server.xrpc.method(nsid, cfg)
1498
1500
  }
1499
1501
 
1500
- getPosts<AV extends AuthVerifier>(
1502
+ getPostThread<AV extends AuthVerifier>(
1501
1503
  cfg: ConfigOf<
1502
1504
  AV,
1503
- AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
1504
- AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
1505
+ AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
1506
+ AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
1505
1507
  >,
1506
1508
  ) {
1507
- const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
1509
+ const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
1508
1510
  return this._server.xrpc.method(nsid, cfg)
1509
1511
  }
1510
1512
 
1511
- getPostThread<AV extends AuthVerifier>(
1513
+ getPosts<AV extends AuthVerifier>(
1512
1514
  cfg: ConfigOf<
1513
1515
  AV,
1514
- AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
1515
- AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
1516
+ AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
1517
+ AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
1516
1518
  >,
1517
1519
  ) {
1518
- const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
1520
+ const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
1519
1521
  return this._server.xrpc.method(nsid, cfg)
1520
1522
  }
1521
1523
 
@@ -1944,6 +1946,28 @@ export class AppBskyUnspeccedNS {
1944
1946
  return this._server.xrpc.method(nsid, cfg)
1945
1947
  }
1946
1948
 
1949
+ getPostThreadHiddenV2<AV extends AuthVerifier>(
1950
+ cfg: ConfigOf<
1951
+ AV,
1952
+ AppBskyUnspeccedGetPostThreadHiddenV2.Handler<ExtractAuth<AV>>,
1953
+ AppBskyUnspeccedGetPostThreadHiddenV2.HandlerReqCtx<ExtractAuth<AV>>
1954
+ >,
1955
+ ) {
1956
+ const nsid = 'app.bsky.unspecced.getPostThreadHiddenV2' // @ts-ignore
1957
+ return this._server.xrpc.method(nsid, cfg)
1958
+ }
1959
+
1960
+ getPostThreadV2<AV extends AuthVerifier>(
1961
+ cfg: ConfigOf<
1962
+ AV,
1963
+ AppBskyUnspeccedGetPostThreadV2.Handler<ExtractAuth<AV>>,
1964
+ AppBskyUnspeccedGetPostThreadV2.HandlerReqCtx<ExtractAuth<AV>>
1965
+ >,
1966
+ ) {
1967
+ const nsid = 'app.bsky.unspecced.getPostThreadV2' // @ts-ignore
1968
+ return this._server.xrpc.method(nsid, cfg)
1969
+ }
1970
+
1947
1971
  getSuggestedFeeds<AV extends AuthVerifier>(
1948
1972
  cfg: ConfigOf<
1949
1973
  AV,
@@ -7239,48 +7239,6 @@ export const schemaDict = {
7239
7239
  },
7240
7240
  },
7241
7241
  },
7242
- AppBskyFeedGetPosts: {
7243
- lexicon: 1,
7244
- id: 'app.bsky.feed.getPosts',
7245
- defs: {
7246
- main: {
7247
- type: 'query',
7248
- description:
7249
- "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
7250
- parameters: {
7251
- type: 'params',
7252
- required: ['uris'],
7253
- properties: {
7254
- uris: {
7255
- type: 'array',
7256
- description: 'List of post AT-URIs to return hydrated views for.',
7257
- items: {
7258
- type: 'string',
7259
- format: 'at-uri',
7260
- },
7261
- maxLength: 25,
7262
- },
7263
- },
7264
- },
7265
- output: {
7266
- encoding: 'application/json',
7267
- schema: {
7268
- type: 'object',
7269
- required: ['posts'],
7270
- properties: {
7271
- posts: {
7272
- type: 'array',
7273
- items: {
7274
- type: 'ref',
7275
- ref: 'lex:app.bsky.feed.defs#postView',
7276
- },
7277
- },
7278
- },
7279
- },
7280
- },
7281
- },
7282
- },
7283
- },
7284
7242
  AppBskyFeedGetPostThread: {
7285
7243
  lexicon: 1,
7286
7244
  id: 'app.bsky.feed.getPostThread',
@@ -7345,6 +7303,48 @@ export const schemaDict = {
7345
7303
  },
7346
7304
  },
7347
7305
  },
7306
+ AppBskyFeedGetPosts: {
7307
+ lexicon: 1,
7308
+ id: 'app.bsky.feed.getPosts',
7309
+ defs: {
7310
+ main: {
7311
+ type: 'query',
7312
+ description:
7313
+ "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
7314
+ parameters: {
7315
+ type: 'params',
7316
+ required: ['uris'],
7317
+ properties: {
7318
+ uris: {
7319
+ type: 'array',
7320
+ description: 'List of post AT-URIs to return hydrated views for.',
7321
+ items: {
7322
+ type: 'string',
7323
+ format: 'at-uri',
7324
+ },
7325
+ maxLength: 25,
7326
+ },
7327
+ },
7328
+ },
7329
+ output: {
7330
+ encoding: 'application/json',
7331
+ schema: {
7332
+ type: 'object',
7333
+ required: ['posts'],
7334
+ properties: {
7335
+ posts: {
7336
+ type: 'array',
7337
+ items: {
7338
+ type: 'ref',
7339
+ ref: 'lex:app.bsky.feed.defs#postView',
7340
+ },
7341
+ },
7342
+ },
7343
+ },
7344
+ },
7345
+ },
7346
+ },
7347
+ },
7348
7348
  AppBskyFeedGetQuotes: {
7349
7349
  lexicon: 1,
7350
7350
  id: 'app.bsky.feed.getQuotes',
@@ -10294,6 +10294,238 @@ export const schemaDict = {
10294
10294
  },
10295
10295
  },
10296
10296
  },
10297
+ AppBskyUnspeccedGetPostThreadHiddenV2: {
10298
+ lexicon: 1,
10299
+ id: 'app.bsky.unspecced.getPostThreadHiddenV2',
10300
+ defs: {
10301
+ main: {
10302
+ type: 'query',
10303
+ description:
10304
+ "(NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get the hidden posts in a thread. It is based in an anchor post at any depth of the tree, and returns hidden replies (recursive replies, with branching to their replies) below the anchor. It does not include ancestors nor the anchor. This should be called after exhausting `app.bsky.unspecced.getPostThreadV2`. Does not require auth, but additional metadata and filtering will be applied for authed requests.",
10305
+ parameters: {
10306
+ type: 'params',
10307
+ required: ['anchor'],
10308
+ properties: {
10309
+ anchor: {
10310
+ type: 'string',
10311
+ format: 'at-uri',
10312
+ description:
10313
+ 'Reference (AT-URI) to post record. This is the anchor post.',
10314
+ },
10315
+ },
10316
+ },
10317
+ output: {
10318
+ encoding: 'application/json',
10319
+ schema: {
10320
+ type: 'object',
10321
+ required: ['thread'],
10322
+ properties: {
10323
+ thread: {
10324
+ type: 'array',
10325
+ description:
10326
+ 'A flat list of thread hidden items. The depth of each item is indicated by the depth property inside the item.',
10327
+ items: {
10328
+ type: 'ref',
10329
+ ref: 'lex:app.bsky.unspecced.getPostThreadHiddenV2#threadHiddenItem',
10330
+ },
10331
+ },
10332
+ },
10333
+ },
10334
+ },
10335
+ },
10336
+ threadHiddenItem: {
10337
+ type: 'object',
10338
+ required: ['uri', 'depth', 'value'],
10339
+ properties: {
10340
+ uri: {
10341
+ type: 'string',
10342
+ format: 'at-uri',
10343
+ },
10344
+ depth: {
10345
+ type: 'integer',
10346
+ description:
10347
+ 'The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths.',
10348
+ },
10349
+ value: {
10350
+ type: 'union',
10351
+ refs: [
10352
+ 'lex:app.bsky.unspecced.getPostThreadHiddenV2#threadHiddenItemPost',
10353
+ ],
10354
+ },
10355
+ },
10356
+ },
10357
+ threadHiddenItemPost: {
10358
+ type: 'object',
10359
+ required: ['post', 'hiddenByThreadgate', 'mutedByViewer'],
10360
+ properties: {
10361
+ post: {
10362
+ type: 'ref',
10363
+ ref: 'lex:app.bsky.feed.defs#postView',
10364
+ },
10365
+ hiddenByThreadgate: {
10366
+ type: 'boolean',
10367
+ description:
10368
+ 'The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread.',
10369
+ },
10370
+ mutedByViewer: {
10371
+ type: 'boolean',
10372
+ description:
10373
+ 'This is by an account muted by the viewer requesting it.',
10374
+ },
10375
+ },
10376
+ },
10377
+ },
10378
+ },
10379
+ AppBskyUnspeccedGetPostThreadV2: {
10380
+ lexicon: 1,
10381
+ id: 'app.bsky.unspecced.getPostThreadV2',
10382
+ defs: {
10383
+ main: {
10384
+ type: 'query',
10385
+ description:
10386
+ "(NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get posts in a thread. It is based in an anchor post at any depth of the tree, and returns posts above it (recursively resolving the parent, without further branching to their replies) and below it (recursive replies, with branching to their replies). Does not require auth, but additional metadata and filtering will be applied for authed requests.",
10387
+ parameters: {
10388
+ type: 'params',
10389
+ required: ['anchor'],
10390
+ properties: {
10391
+ anchor: {
10392
+ type: 'string',
10393
+ format: 'at-uri',
10394
+ description:
10395
+ 'Reference (AT-URI) to post record. This is the anchor post, and the thread will be built around it. It can be any post in the tree, not necessarily a root post.',
10396
+ },
10397
+ above: {
10398
+ type: 'boolean',
10399
+ description: 'Whether to include parents above the anchor.',
10400
+ default: true,
10401
+ },
10402
+ below: {
10403
+ type: 'integer',
10404
+ description:
10405
+ 'How many levels of replies to include below the anchor.',
10406
+ default: 6,
10407
+ minimum: 0,
10408
+ maximum: 20,
10409
+ },
10410
+ branchingFactor: {
10411
+ type: 'integer',
10412
+ description:
10413
+ 'Maximum of replies to include at each level of the thread, except for the direct replies to the anchor, which are (NOTE: currently, during unspecced phase) all returned (NOTE: later they might be paginated).',
10414
+ default: 10,
10415
+ minimum: 0,
10416
+ maximum: 100,
10417
+ },
10418
+ prioritizeFollowedUsers: {
10419
+ type: 'boolean',
10420
+ description:
10421
+ 'Whether to prioritize posts from followed users. It only has effect when the user is authenticated.',
10422
+ default: false,
10423
+ },
10424
+ sort: {
10425
+ type: 'string',
10426
+ description: 'Sorting for the thread replies.',
10427
+ knownValues: ['newest', 'oldest', 'top'],
10428
+ default: 'oldest',
10429
+ },
10430
+ },
10431
+ },
10432
+ output: {
10433
+ encoding: 'application/json',
10434
+ schema: {
10435
+ type: 'object',
10436
+ required: ['thread', 'hasHiddenReplies'],
10437
+ properties: {
10438
+ thread: {
10439
+ type: 'array',
10440
+ description:
10441
+ 'A flat list of thread items. The depth of each item is indicated by the depth property inside the item.',
10442
+ items: {
10443
+ type: 'ref',
10444
+ ref: 'lex:app.bsky.unspecced.getPostThreadV2#threadItem',
10445
+ },
10446
+ },
10447
+ threadgate: {
10448
+ type: 'ref',
10449
+ ref: 'lex:app.bsky.feed.defs#threadgateView',
10450
+ },
10451
+ hasHiddenReplies: {
10452
+ type: 'boolean',
10453
+ description:
10454
+ 'Whether this thread has hidden replies. If true, a call can be made to the `getPostThreadHiddenV2` endpoint to retrieve them.',
10455
+ },
10456
+ },
10457
+ },
10458
+ },
10459
+ },
10460
+ threadItem: {
10461
+ type: 'object',
10462
+ required: ['uri', 'depth', 'value'],
10463
+ properties: {
10464
+ uri: {
10465
+ type: 'string',
10466
+ format: 'at-uri',
10467
+ },
10468
+ depth: {
10469
+ type: 'integer',
10470
+ description:
10471
+ 'The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths.',
10472
+ },
10473
+ value: {
10474
+ type: 'union',
10475
+ refs: [
10476
+ 'lex:app.bsky.unspecced.getPostThreadV2#threadItemPost',
10477
+ 'lex:app.bsky.unspecced.getPostThreadV2#threadItemNoUnauthenticated',
10478
+ 'lex:app.bsky.unspecced.getPostThreadV2#threadItemNotFound',
10479
+ 'lex:app.bsky.unspecced.getPostThreadV2#threadItemBlocked',
10480
+ ],
10481
+ },
10482
+ },
10483
+ },
10484
+ threadItemPost: {
10485
+ type: 'object',
10486
+ required: ['post', 'moreParents', 'moreReplies', 'opThread'],
10487
+ properties: {
10488
+ post: {
10489
+ type: 'ref',
10490
+ ref: 'lex:app.bsky.feed.defs#postView',
10491
+ },
10492
+ moreParents: {
10493
+ type: 'boolean',
10494
+ description:
10495
+ 'This post has more parents that were not present in the response. This is just a boolean, without the number of parents.',
10496
+ },
10497
+ moreReplies: {
10498
+ type: 'integer',
10499
+ description:
10500
+ 'This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate.',
10501
+ },
10502
+ opThread: {
10503
+ type: 'boolean',
10504
+ description:
10505
+ 'This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread.',
10506
+ },
10507
+ },
10508
+ },
10509
+ threadItemNoUnauthenticated: {
10510
+ type: 'object',
10511
+ properties: {},
10512
+ },
10513
+ threadItemNotFound: {
10514
+ type: 'object',
10515
+ properties: {},
10516
+ },
10517
+ threadItemBlocked: {
10518
+ type: 'object',
10519
+ required: ['author'],
10520
+ properties: {
10521
+ author: {
10522
+ type: 'ref',
10523
+ ref: 'lex:app.bsky.feed.defs#blockedAuthor',
10524
+ },
10525
+ },
10526
+ },
10527
+ },
10528
+ },
10297
10529
  AppBskyUnspeccedGetSuggestedFeeds: {
10298
10530
  lexicon: 1,
10299
10531
  id: 'app.bsky.unspecced.getSuggestedFeeds',
@@ -12659,8 +12891,8 @@ export const ids = {
12659
12891
  AppBskyFeedGetFeedSkeleton: 'app.bsky.feed.getFeedSkeleton',
12660
12892
  AppBskyFeedGetLikes: 'app.bsky.feed.getLikes',
12661
12893
  AppBskyFeedGetListFeed: 'app.bsky.feed.getListFeed',
12662
- AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
12663
12894
  AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
12895
+ AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
12664
12896
  AppBskyFeedGetQuotes: 'app.bsky.feed.getQuotes',
12665
12897
  AppBskyFeedGetRepostedBy: 'app.bsky.feed.getRepostedBy',
12666
12898
  AppBskyFeedGetSuggestedFeeds: 'app.bsky.feed.getSuggestedFeeds',
@@ -12717,6 +12949,9 @@ export const ids = {
12717
12949
  AppBskyUnspeccedGetConfig: 'app.bsky.unspecced.getConfig',
12718
12950
  AppBskyUnspeccedGetPopularFeedGenerators:
12719
12951
  'app.bsky.unspecced.getPopularFeedGenerators',
12952
+ AppBskyUnspeccedGetPostThreadHiddenV2:
12953
+ 'app.bsky.unspecced.getPostThreadHiddenV2',
12954
+ AppBskyUnspeccedGetPostThreadV2: 'app.bsky.unspecced.getPostThreadV2',
12720
12955
  AppBskyUnspeccedGetSuggestedFeeds: 'app.bsky.unspecced.getSuggestedFeeds',
12721
12956
  AppBskyUnspeccedGetSuggestedFeedsSkeleton:
12722
12957
  'app.bsky.unspecced.getSuggestedFeedsSkeleton',