@atproto/bsky 0.0.274 → 0.0.276

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 (105) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
  3. package/dist/api/app/bsky/feed/getActorLikes.js +5 -1
  4. package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
  5. package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  6. package/dist/api/app/bsky/feed/getAuthorFeed.js +7 -1
  7. package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
  8. package/dist/api/app/bsky/feed/getFeed.d.ts +7 -0
  9. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  10. package/dist/api/app/bsky/feed/getFeed.js +14 -1
  11. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  12. package/dist/api/app/bsky/feed/getListFeed.d.ts.map +1 -1
  13. package/dist/api/app/bsky/feed/getListFeed.js +5 -1
  14. package/dist/api/app/bsky/feed/getListFeed.js.map +1 -1
  15. package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
  16. package/dist/api/app/bsky/feed/getTimeline.js +11 -2
  17. package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
  18. package/dist/api/app/bsky/unspecced/getPostThreadV2.js +5 -1
  19. package/dist/api/app/bsky/unspecced/getPostThreadV2.js.map +1 -1
  20. package/dist/auth-verifier.d.ts.map +1 -1
  21. package/dist/auth-verifier.js +16 -9
  22. package/dist/auth-verifier.js.map +1 -1
  23. package/dist/config.d.ts +4 -0
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/config.js +10 -0
  26. package/dist/config.js.map +1 -1
  27. package/dist/data-plane/client/index.js +2 -2
  28. package/dist/data-plane/client/index.js.map +1 -1
  29. package/dist/data-plane/client/util.d.ts +1 -0
  30. package/dist/data-plane/client/util.d.ts.map +1 -1
  31. package/dist/data-plane/client/util.js +45 -0
  32. package/dist/data-plane/client/util.js.map +1 -1
  33. package/dist/data-plane/server/db/migrations/20260819T170000000Z-add-like-subject-sort-index.d.ts +4 -0
  34. package/dist/data-plane/server/db/migrations/20260819T170000000Z-add-like-subject-sort-index.d.ts.map +1 -0
  35. package/dist/data-plane/server/db/migrations/20260819T170000000Z-add-like-subject-sort-index.js +12 -0
  36. package/dist/data-plane/server/db/migrations/20260819T170000000Z-add-like-subject-sort-index.js.map +1 -0
  37. package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
  38. package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
  39. package/dist/data-plane/server/db/migrations/index.js +1 -0
  40. package/dist/data-plane/server/db/migrations/index.js.map +1 -1
  41. package/dist/data-plane/server/routes/likes.d.ts.map +1 -1
  42. package/dist/data-plane/server/routes/likes.js +46 -0
  43. package/dist/data-plane/server/routes/likes.js.map +1 -1
  44. package/dist/feature-gates/gates.d.ts +1 -0
  45. package/dist/feature-gates/gates.d.ts.map +1 -1
  46. package/dist/feature-gates/gates.js +1 -0
  47. package/dist/feature-gates/gates.js.map +1 -1
  48. package/dist/hydration/actor.d.ts +5 -0
  49. package/dist/hydration/actor.d.ts.map +1 -1
  50. package/dist/hydration/actor.js.map +1 -1
  51. package/dist/hydration/hydrator.d.ts +16 -4
  52. package/dist/hydration/hydrator.d.ts.map +1 -1
  53. package/dist/hydration/hydrator.js +70 -6
  54. package/dist/hydration/hydrator.js.map +1 -1
  55. package/dist/lexicons/app/bsky/actor/status.defs.d.ts +5 -3
  56. package/dist/lexicons/app/bsky/actor/status.defs.d.ts.map +1 -1
  57. package/dist/lexicons/app/bsky/actor/status.defs.js +3 -0
  58. package/dist/lexicons/app/bsky/actor/status.defs.js.map +1 -1
  59. package/dist/lexicons/app/bsky/embed/video.defs.d.ts.map +1 -1
  60. package/dist/lexicons/app/bsky/embed/video.defs.js +2 -4
  61. package/dist/lexicons/app/bsky/embed/video.defs.js.map +1 -1
  62. package/dist/lexicons/app/bsky/feed/defs.defs.d.ts +84 -42
  63. package/dist/lexicons/app/bsky/feed/defs.defs.d.ts.map +1 -1
  64. package/dist/lexicons/app/bsky/feed/defs.defs.js +52 -0
  65. package/dist/lexicons/app/bsky/feed/defs.defs.js.map +1 -1
  66. package/dist/lexicons/app/bsky/graph/defs.defs.d.ts +15 -9
  67. package/dist/lexicons/app/bsky/graph/defs.defs.d.ts.map +1 -1
  68. package/dist/lexicons/app/bsky/graph/defs.defs.js +9 -0
  69. package/dist/lexicons/app/bsky/graph/defs.defs.js.map +1 -1
  70. package/dist/lexicons/com/atproto/moderation/defs.defs.d.ts +35 -21
  71. package/dist/lexicons/com/atproto/moderation/defs.defs.d.ts.map +1 -1
  72. package/dist/lexicons/com/atproto/moderation/defs.defs.js +21 -0
  73. package/dist/lexicons/com/atproto/moderation/defs.defs.js.map +1 -1
  74. package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts +35 -21
  75. package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts.map +1 -1
  76. package/dist/lexicons/tools/ozone/moderation/defs.defs.js +21 -0
  77. package/dist/lexicons/tools/ozone/moderation/defs.defs.js.map +1 -1
  78. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts +200 -120
  79. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts.map +1 -1
  80. package/dist/lexicons/tools/ozone/report/defs.defs.js +126 -0
  81. package/dist/lexicons/tools/ozone/report/defs.defs.js.map +1 -1
  82. package/dist/lexicons/tools/ozone/team/defs.defs.d.ts +20 -12
  83. package/dist/lexicons/tools/ozone/team/defs.defs.d.ts.map +1 -1
  84. package/dist/lexicons/tools/ozone/team/defs.defs.js +12 -0
  85. package/dist/lexicons/tools/ozone/team/defs.defs.js.map +1 -1
  86. package/dist/proto/bsky_connect.d.ts +10 -1
  87. package/dist/proto/bsky_connect.d.ts.map +1 -1
  88. package/dist/proto/bsky_connect.js +10 -1
  89. package/dist/proto/bsky_connect.js.map +1 -1
  90. package/dist/proto/bsky_pb.d.ts +67 -0
  91. package/dist/proto/bsky_pb.d.ts.map +1 -1
  92. package/dist/proto/bsky_pb.js +110 -0
  93. package/dist/proto/bsky_pb.js.map +1 -1
  94. package/dist/telemetry.d.ts +2 -0
  95. package/dist/telemetry.d.ts.map +1 -0
  96. package/dist/telemetry.js +7 -0
  97. package/dist/telemetry.js.map +1 -0
  98. package/dist/views/index.d.ts +6 -2
  99. package/dist/views/index.d.ts.map +1 -1
  100. package/dist/views/index.js +26 -10
  101. package/dist/views/index.js.map +1 -1
  102. package/dist/views/types.d.ts +1 -0
  103. package/dist/views/types.d.ts.map +1 -1
  104. package/dist/views/types.js.map +1 -1
  105. package/package.json +20 -13
@@ -270,6 +270,9 @@ export class Hydrator {
270
270
  // - list basic
271
271
  async hydratePosts(refs, ctx, state = {}, options = {}) {
272
272
  const uris = refs.map((ref) => ref.uri);
273
+ const knownLikersPromise = options.knownLikers
274
+ ? this.hydrateKnownLikers(options.knownLikers, ctx)
275
+ : undefined;
273
276
  state.posts ??= new HydrationMap();
274
277
  const addPostsToHydrationState = (posts) => {
275
278
  posts.forEach((post, uri) => {
@@ -361,17 +364,31 @@ export class Hydrator {
361
364
  // post-author profile fetch below; any DIDs surfaced later by the
362
365
  // dataplane are picked up by the top-up after the parallel batch.
363
366
  const ssRefDids = siteStandardRefs.map((ref) => uriToDid(ref.uri));
367
+ // Collect known-liker profiles and author-liker block relationships.
368
+ const knownLikers = await knownLikersPromise;
369
+ const knownLikerDids = [];
370
+ const authorsAndKnownLikersRelationships = [];
371
+ knownLikers?.forEach((knownLiker, uri) => {
372
+ if (!knownLiker)
373
+ return;
374
+ knownLikerDids.push(...knownLiker.actors);
375
+ const authorDid = uriToDid(uri);
376
+ for (const likerDid of knownLiker.actors) {
377
+ authorsAndKnownLikersRelationships.push([authorDid, likerDid]);
378
+ }
379
+ });
364
380
  const knownProfileDids = dedupeStrs([
365
381
  ...allPostUris.map(didFromUri),
366
382
  ...ssRefDids,
383
+ ...knownLikerDids,
367
384
  ]);
368
- const [postAggs, postViewers, labels, postBlocks, profileState, listState, feedGenState, labelerState, starterPackState, postgates, { documents: siteStandardDocuments, publications: siteStandardPublications, },] = await Promise.all([
385
+ const [postAggs, postViewers, labels, { postBlocks, additionalRelationshipsBidirectionalBlocks: authorsAndKnownLikersBidirectionalBlocks, }, profileState, listState, feedGenState, labelerState, starterPackState, postgates, { documents: siteStandardDocuments, publications: siteStandardPublications, },] = await Promise.all([
369
386
  this.feed.getPostAggregates(allRefs, ctx.viewer),
370
387
  ctx.viewer
371
388
  ? this.feed.getPostViewerStates(threadRefs, ctx.viewer)
372
389
  : undefined,
373
390
  this.label.getLabelsForSubjects([...allPostUris, ...siteStandardLabelSubjects], ctx.labelers),
374
- this.hydratePostBlocks(posts, ctx),
391
+ this.hydratePostBlocks(posts, ctx, authorsAndKnownLikersRelationships),
375
392
  this.hydrateProfiles(knownProfileDids, ctx),
376
393
  this.hydrateLists([...nestedListUris, ...threadgateListUris], ctx),
377
394
  this.hydrateFeedGens(nestedFeedGenUris, ctx),
@@ -405,6 +422,8 @@ export class Hydrator {
405
422
  postAggs,
406
423
  postViewers,
407
424
  postBlocks,
425
+ knownLikers,
426
+ bidirectionalBlocks: authorsAndKnownLikersBidirectionalBlocks,
408
427
  labels,
409
428
  threadgates,
410
429
  postgates,
@@ -413,7 +432,7 @@ export class Hydrator {
413
432
  ctx,
414
433
  });
415
434
  }
416
- async hydratePostBlocks(posts, ctx) {
435
+ async hydratePostBlocks(posts, ctx, additionalRelationships = []) {
417
436
  const postBlocks = new HydrationMap();
418
437
  const postBlocksPairs = new Map();
419
438
  const relationships = [];
@@ -446,6 +465,7 @@ export class Hydrator {
446
465
  postBlockPairs.embed = pair;
447
466
  }
448
467
  }
468
+ relationships.push(...additionalRelationships);
449
469
  // replace embed/parent/root pairs with block state
450
470
  const blocks = await this.hydrateBidirectionalBlocks(pairsToMap(relationships), ctx);
451
471
  for (const [uri, { embed, parent, root }] of postBlocksPairs) {
@@ -455,7 +475,18 @@ export class Hydrator {
455
475
  root: !!root && !!isBlocked(blocks, root),
456
476
  });
457
477
  }
458
- return postBlocks;
478
+ const additionalRelationshipsBidirectionalBlocks = new HydrationMap();
479
+ for (const [source, targets] of pairsToMap(additionalRelationships)) {
480
+ const didBlocks = new HydrationMap();
481
+ for (const target of targets) {
482
+ didBlocks.set(target, blocks.get(source)?.get(target) ?? false);
483
+ }
484
+ additionalRelationshipsBidirectionalBlocks.set(source, didBlocks);
485
+ }
486
+ return {
487
+ postBlocks,
488
+ additionalRelationshipsBidirectionalBlocks,
489
+ };
459
490
  }
460
491
  // app.bsky.feed.defs#feedViewPost
461
492
  // - post (+ replies w/ reply parent author)
@@ -472,7 +503,7 @@ export class Hydrator {
472
503
  // - list basic
473
504
  // - post
474
505
  // - ...
475
- async hydrateFeedItems(items, ctx) {
506
+ async hydrateFeedItems(items, ctx, options = {}) {
476
507
  // get posts, collect reply refs
477
508
  const posts = await this.feed.getPosts(items.map((item) => item.post.uri), ctx.includeTakedowns, undefined, undefined, {
478
509
  includeOpThreadMetadata: ctx.features.checkGate(ctx.features.Gate.OpThreadMetadataEnable),
@@ -504,6 +535,8 @@ export class Hydrator {
504
535
  const [postState, repostProfileState, reposts] = await Promise.all([
505
536
  this.hydratePosts(postAndReplyRefs, ctx, {
506
537
  posts: replies.merge(posts), // avoids refetches while preserving feed-item metadata
538
+ }, {
539
+ knownLikers: options.knownLikers,
507
540
  }),
508
541
  this.hydrateProfiles([...repostUris.map(didFromUri), ...replyParentAuthors], ctx),
509
542
  this.feed.getReposts(repostUris, ctx.includeTakedowns),
@@ -566,11 +599,12 @@ export class Hydrator {
566
599
  // - feedgen
567
600
  // - profile
568
601
  // - list basic
569
- async hydrateThreadPosts(refs, ctx) {
602
+ async hydrateThreadPosts(refs, ctx, options = {}) {
570
603
  const postsState = await this.hydratePosts(refs, ctx, undefined, {
571
604
  processDynamicTagsForView: ctx.features.checkGate(ctx.features.Gate.ThreadsReplyRankingExplorationEnable)
572
605
  ? 'thread'
573
606
  : undefined,
607
+ knownLikers: options.knownLikers,
574
608
  });
575
609
  const threadRefs = [];
576
610
  if (postsState.posts) {
@@ -587,6 +621,35 @@ export class Hydrator {
587
621
  const threadContexts = await this.feed.getThreadContexts(threadRefs);
588
622
  return mergeStates(postsState, { threadContexts });
589
623
  }
624
+ async hydrateKnownLikers(options, ctx) {
625
+ const { subjectUris } = options;
626
+ if (!ctx.viewer || subjectUris.length === 0)
627
+ return undefined;
628
+ // Fail open.
629
+ try {
630
+ const { results } = await this.dataplane.getKnownLikers({
631
+ actorDid: ctx.viewer,
632
+ subjectUris,
633
+ limit: 3,
634
+ }, { signal: AbortSignal.timeout(100) });
635
+ const knownLikers = new HydrationMap();
636
+ for (const result of results) {
637
+ const subjectUri = result.subjectUri;
638
+ const dids = result.dids;
639
+ if (result.count > 0) {
640
+ knownLikers.set(subjectUri, {
641
+ count: result.count,
642
+ actors: dids,
643
+ });
644
+ }
645
+ }
646
+ return knownLikers;
647
+ }
648
+ catch (err) {
649
+ hydrationLogger.error({ err }, 'Failed to hydrate known likers');
650
+ return undefined;
651
+ }
652
+ }
590
653
  // app.bsky.feed.defs#generatorView
591
654
  // - feedgen
592
655
  // - profile
@@ -1235,6 +1298,7 @@ export const mergeStates = (stateA, stateB) => {
1235
1298
  labelerAggs: mergeMaps(stateA.labelerAggs, stateB.labelerAggs),
1236
1299
  labelerViewers: mergeMaps(stateA.labelerViewers, stateB.labelerViewers),
1237
1300
  knownFollowers: mergeMaps(stateA.knownFollowers, stateB.knownFollowers),
1301
+ knownLikers: mergeMaps(stateA.knownLikers, stateB.knownLikers),
1238
1302
  activitySubscriptions: mergeMaps(stateA.activitySubscriptions, stateB.activitySubscriptions),
1239
1303
  bidirectionalBlocks: mergeNestedMaps(stateA.bidirectionalBlocks, stateB.bidirectionalBlocks),
1240
1304
  verifications: mergeMaps(stateA.verifications, stateB.verifications),