@atproto/bsky 0.0.224 → 0.0.225

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 (146) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
  3. package/dist/api/app/bsky/actor/getProfile.js +2 -1
  4. package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
  5. package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
  6. package/dist/api/app/bsky/actor/getProfiles.js +2 -1
  7. package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
  8. package/dist/api/app/bsky/actor/searchActors.d.ts.map +1 -1
  9. package/dist/api/app/bsky/actor/searchActors.js +2 -1
  10. package/dist/api/app/bsky/actor/searchActors.js.map +1 -1
  11. package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  12. package/dist/api/app/bsky/feed/getAuthorFeed.js +2 -1
  13. package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
  14. package/dist/api/app/bsky/feed/getLikes.d.ts.map +1 -1
  15. package/dist/api/app/bsky/feed/getLikes.js +2 -1
  16. package/dist/api/app/bsky/feed/getLikes.js.map +1 -1
  17. package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
  18. package/dist/api/app/bsky/feed/getPostThread.js +2 -1
  19. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  20. package/dist/api/app/bsky/feed/getQuotes.d.ts.map +1 -1
  21. package/dist/api/app/bsky/feed/getQuotes.js +2 -1
  22. package/dist/api/app/bsky/feed/getQuotes.js.map +1 -1
  23. package/dist/api/app/bsky/feed/getRepostedBy.d.ts.map +1 -1
  24. package/dist/api/app/bsky/feed/getRepostedBy.js +2 -1
  25. package/dist/api/app/bsky/feed/getRepostedBy.js.map +1 -1
  26. package/dist/api/app/bsky/feed/searchPosts.d.ts.map +1 -1
  27. package/dist/api/app/bsky/feed/searchPosts.js +2 -1
  28. package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
  29. package/dist/api/app/bsky/graph/getActorStarterPacks.d.ts.map +1 -1
  30. package/dist/api/app/bsky/graph/getActorStarterPacks.js +2 -1
  31. package/dist/api/app/bsky/graph/getActorStarterPacks.js.map +1 -1
  32. package/dist/api/app/bsky/graph/getFollowers.d.ts.map +1 -1
  33. package/dist/api/app/bsky/graph/getFollowers.js +2 -1
  34. package/dist/api/app/bsky/graph/getFollowers.js.map +1 -1
  35. package/dist/api/app/bsky/graph/getFollows.d.ts.map +1 -1
  36. package/dist/api/app/bsky/graph/getFollows.js +2 -1
  37. package/dist/api/app/bsky/graph/getFollows.js.map +1 -1
  38. package/dist/api/app/bsky/graph/getList.d.ts.map +1 -1
  39. package/dist/api/app/bsky/graph/getList.js +2 -1
  40. package/dist/api/app/bsky/graph/getList.js.map +1 -1
  41. package/dist/api/app/bsky/graph/getLists.d.ts.map +1 -1
  42. package/dist/api/app/bsky/graph/getLists.js +2 -1
  43. package/dist/api/app/bsky/graph/getLists.js.map +1 -1
  44. package/dist/api/app/bsky/graph/getStarterPack.d.ts.map +1 -1
  45. package/dist/api/app/bsky/graph/getStarterPack.js +2 -1
  46. package/dist/api/app/bsky/graph/getStarterPack.js.map +1 -1
  47. package/dist/api/app/bsky/graph/getStarterPacks.d.ts.map +1 -1
  48. package/dist/api/app/bsky/graph/getStarterPacks.js +2 -1
  49. package/dist/api/app/bsky/graph/getStarterPacks.js.map +1 -1
  50. package/dist/api/app/bsky/graph/searchStarterPacks.d.ts.map +1 -1
  51. package/dist/api/app/bsky/graph/searchStarterPacks.js +2 -1
  52. package/dist/api/app/bsky/graph/searchStarterPacks.js.map +1 -1
  53. package/dist/api/app/bsky/unspecced/getPostThreadOtherV2.d.ts.map +1 -1
  54. package/dist/api/app/bsky/unspecced/getPostThreadOtherV2.js +2 -1
  55. package/dist/api/app/bsky/unspecced/getPostThreadOtherV2.js.map +1 -1
  56. package/dist/api/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -1
  57. package/dist/api/app/bsky/unspecced/getPostThreadV2.js +2 -1
  58. package/dist/api/app/bsky/unspecced/getPostThreadV2.js.map +1 -1
  59. package/dist/auth-verifier.d.ts +1 -0
  60. package/dist/auth-verifier.d.ts.map +1 -1
  61. package/dist/auth-verifier.js +1 -0
  62. package/dist/auth-verifier.js.map +1 -1
  63. package/dist/data-plane/server/indexing/plugins/feed-generator.js +2 -1
  64. package/dist/data-plane/server/indexing/plugins/feed-generator.js.map +1 -1
  65. package/dist/data-plane/server/indexing/plugins/list.js +2 -1
  66. package/dist/data-plane/server/indexing/plugins/list.js.map +1 -1
  67. package/dist/data-plane/server/indexing/plugins/post.js +3 -3
  68. package/dist/data-plane/server/indexing/plugins/post.js.map +1 -1
  69. package/dist/data-plane/server/indexing/plugins/profile.js +3 -2
  70. package/dist/data-plane/server/indexing/plugins/profile.js.map +1 -1
  71. package/dist/hydration/hydrator.d.ts +2 -0
  72. package/dist/hydration/hydrator.d.ts.map +1 -1
  73. package/dist/hydration/hydrator.js +8 -0
  74. package/dist/hydration/hydrator.js.map +1 -1
  75. package/dist/hydration/util.d.ts +13 -7
  76. package/dist/hydration/util.d.ts.map +1 -1
  77. package/dist/hydration/util.js +30 -10
  78. package/dist/hydration/util.js.map +1 -1
  79. package/dist/lexicons/app/bsky/actor/defs.defs.d.ts +1 -0
  80. package/dist/lexicons/app/bsky/actor/defs.defs.d.ts.map +1 -1
  81. package/dist/lexicons/app/bsky/actor/defs.defs.js +1 -0
  82. package/dist/lexicons/app/bsky/actor/defs.defs.js.map +1 -1
  83. package/dist/lexicons/app/bsky/actor/profile.defs.d.ts.map +1 -1
  84. package/dist/lexicons/app/bsky/actor/profile.defs.js +2 -10
  85. package/dist/lexicons/app/bsky/actor/profile.defs.js.map +1 -1
  86. package/dist/lexicons/app/bsky/embed/external.defs.d.ts.map +1 -1
  87. package/dist/lexicons/app/bsky/embed/external.defs.js +1 -1
  88. package/dist/lexicons/app/bsky/embed/external.defs.js.map +1 -1
  89. package/dist/lexicons/app/bsky/embed/images.defs.d.ts +3 -0
  90. package/dist/lexicons/app/bsky/embed/images.defs.d.ts.map +1 -1
  91. package/dist/lexicons/app/bsky/embed/images.defs.js +1 -5
  92. package/dist/lexicons/app/bsky/embed/images.defs.js.map +1 -1
  93. package/dist/lexicons/app/bsky/embed/video.defs.d.ts.map +1 -1
  94. package/dist/lexicons/app/bsky/embed/video.defs.js +2 -6
  95. package/dist/lexicons/app/bsky/embed/video.defs.js.map +1 -1
  96. package/dist/lexicons/app/bsky/feed/generator.defs.d.ts.map +1 -1
  97. package/dist/lexicons/app/bsky/feed/generator.defs.js +1 -5
  98. package/dist/lexicons/app/bsky/feed/generator.defs.js.map +1 -1
  99. package/dist/lexicons/app/bsky/graph/list.defs.d.ts.map +1 -1
  100. package/dist/lexicons/app/bsky/graph/list.defs.js +1 -5
  101. package/dist/lexicons/app/bsky/graph/list.defs.js.map +1 -1
  102. package/dist/lexicons/app/bsky/video/defs.defs.js +1 -1
  103. package/dist/lexicons/app/bsky/video/defs.defs.js.map +1 -1
  104. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.d.ts +2 -6
  105. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.d.ts.map +1 -1
  106. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.js +1 -1
  107. package/dist/lexicons/com/atproto/repo/uploadBlob.defs.js.map +1 -1
  108. package/dist/views/index.d.ts.map +1 -1
  109. package/dist/views/index.js +13 -8
  110. package/dist/views/index.js.map +1 -1
  111. package/dist/views/util.d.ts +1 -2
  112. package/dist/views/util.d.ts.map +1 -1
  113. package/dist/views/util.js +1 -5
  114. package/dist/views/util.js.map +1 -1
  115. package/package.json +9 -9
  116. package/src/api/app/bsky/actor/getProfile.ts +3 -1
  117. package/src/api/app/bsky/actor/getProfiles.ts +3 -1
  118. package/src/api/app/bsky/actor/searchActors.ts +3 -1
  119. package/src/api/app/bsky/feed/getAuthorFeed.ts +3 -1
  120. package/src/api/app/bsky/feed/getLikes.ts +3 -1
  121. package/src/api/app/bsky/feed/getPostThread.ts +2 -1
  122. package/src/api/app/bsky/feed/getQuotes.ts +3 -1
  123. package/src/api/app/bsky/feed/getRepostedBy.ts +3 -1
  124. package/src/api/app/bsky/feed/searchPosts.ts +3 -1
  125. package/src/api/app/bsky/graph/getActorStarterPacks.ts +3 -1
  126. package/src/api/app/bsky/graph/getFollowers.ts +3 -1
  127. package/src/api/app/bsky/graph/getFollows.ts +3 -1
  128. package/src/api/app/bsky/graph/getList.ts +3 -1
  129. package/src/api/app/bsky/graph/getLists.ts +3 -1
  130. package/src/api/app/bsky/graph/getStarterPack.ts +3 -1
  131. package/src/api/app/bsky/graph/getStarterPacks.ts +3 -1
  132. package/src/api/app/bsky/graph/searchStarterPacks.ts +3 -1
  133. package/src/api/app/bsky/unspecced/getPostThreadOtherV2.ts +2 -1
  134. package/src/api/app/bsky/unspecced/getPostThreadV2.ts +2 -1
  135. package/src/auth-verifier.ts +1 -0
  136. package/src/data-plane/server/indexing/plugins/feed-generator.ts +2 -2
  137. package/src/data-plane/server/indexing/plugins/list.ts +2 -2
  138. package/src/data-plane/server/indexing/plugins/post.ts +4 -4
  139. package/src/data-plane/server/indexing/plugins/profile.ts +3 -3
  140. package/src/hydration/hydrator.ts +6 -0
  141. package/src/hydration/util.ts +40 -21
  142. package/src/views/index.ts +19 -15
  143. package/src/views/util.ts +1 -5
  144. package/tests/views/__snapshots__/profile.test.ts.snap +3 -0
  145. package/tests/views/blocks.test.ts +69 -0
  146. package/tests/views/profile.test.ts +77 -0
@@ -1,4 +1,4 @@
1
- import { AtUriString, BlobRef, DidString, UriString } from '@atproto/lex';
1
+ import { AtUriString, DidString, UriString } from '@atproto/lex';
2
2
  import { GateRecord, PostRecord, PostgateRecord } from './types.js';
3
3
  export declare const parseThreadGate: (replierDid: string, ownerDid: string, rootPost: PostRecord | null, gate: GateRecord | null) => ParsedThreadGate;
4
4
  type ParsedThreadGate = {
@@ -8,7 +8,6 @@ type ParsedThreadGate = {
8
8
  allowFollowing?: boolean;
9
9
  allowListUris?: AtUriString[];
10
10
  };
11
- export declare const cidFromBlobJson: (json: BlobRef) => string;
12
11
  export declare const parsePostgate: ({ gate, viewerDid, authorDid, }: {
13
12
  gate: PostgateRecord | undefined;
14
13
  viewerDid: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/views/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EACL,UAAU,EACV,UAAU,EACV,cAAc,EAOf,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,eAAe,GAC1B,YAAY,MAAM,EAClB,UAAU,MAAM,EAChB,UAAU,UAAU,GAAG,IAAI,EAC3B,MAAM,UAAU,GAAG,IAAI,KACtB,gBAgCF,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,WAAW,EAAE,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,MAAM,OAAO,KAAG,MAE/C,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,iCAI3B;IACD,IAAI,EAAE,cAAc,GAAG,SAAS,CAAA;IAChC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB,KAAG,cAeH,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,cAAc,EAAE;QACd,QAAQ,EAAE,OAAO,CAAA;KAClB,CAAA;CACF,CAAA;AAED,qBAAa,eAAe;IAExB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE;QACZ,kBAAkB,EAAE,MAAM,CAAA;QAC1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AAkB,EAAE,MAAM,CAAA;QAC1B,mBAAmB,EAAE,MAAM,CAAA;KAC5B;IAEH,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAOlE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;CAOpE"}
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.VideoUriBuilder = exports.parsePostgate = exports.cidFromBlobJson = exports.parseThreadGate = void 0;
36
+ exports.VideoUriBuilder = exports.parsePostgate = exports.parseThreadGate = void 0;
37
37
  const util = __importStar(require("node:util"));
38
38
  const types_js_1 = require("./types.js");
39
39
  const parseThreadGate = (replierDid, ownerDid, rootPost, gate) => {
@@ -66,10 +66,6 @@ const parseThreadGate = (replierDid, ownerDid, rootPost, gate) => {
66
66
  return { allowMentions, allowFollower, allowFollowing, allowListUris };
67
67
  };
68
68
  exports.parseThreadGate = parseThreadGate;
69
- const cidFromBlobJson = (json) => {
70
- return json.ref.toString();
71
- };
72
- exports.cidFromBlobJson = cidFromBlobJson;
73
69
  const parsePostgate = ({ gate, viewerDid, authorDid, }) => {
74
70
  if (viewerDid === authorDid) {
75
71
  return { embeddingRules: { canEmbed: true } };
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/views/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAiC;AAEjC,yCAUmB;AAEZ,MAAM,eAAe,GAAG,CAC7B,UAAkB,EAClB,QAAgB,EAChB,QAA2B,EAC3B,IAAuB,EACL,EAAE;IACpB,IAAI,UAAU,KAAK,QA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,GAAG,CAAC,EACvB,kBAAkB,CAAC,GAAG,CAAC,CACX,CAAA;IAChB,CAAC;CACF;AArBD,0CAqBC","sourcesContent":["import * as util from 'node:util'\nimport { AtUriString, BlobRef, DidString, UriString } from '@atproto/lex'\nimport {\n GateRecord,\n PostRecord,\n PostgateRecord,\n isFollowerRuleType,\n isFollowingRuleType,\n isListRuleType,\n isMentionFacetType,\n isMentionRuleType,\n isPostgateDisableRuleType,\n} from './types.js'\n\nexport const parseThreadGate = (\n replierDid: string,\n ownerDid: string,\n rootPost: PostRecord | null,\n gate: GateRecord | null,\n): ParsedThreadGate => {\n if (replierDid === ownerDid) {\n return { canReply: true }\n }\n // if gate.allow is unset then *any* reply is allowed, if it is an empty array then *no* reply is allowed\n if (!gate || !gate.allow) {\n return { canReply: true }\n }\n\n const allowMentions = gate.allow.some(isMentionRuleType)\n const allowFollower = gate.allow.some(isFollowerRuleType)\n const allowFollowing = gate.allow.some(isFollowingRuleType)\n const allowListUris = gate.allow.filter(isListRuleType).map((i) => i.list)\n\n // check mentions first since it's quick and synchronous\n if (allowMentions) {\n const isMentioned = rootPost?.facets?.some((facet) => {\n return facet.features.some(\n (item) => isMentionFacetType(item) && item.did === replierDid,\n )\n })\n if (isMentioned) {\n return {\n canReply: true,\n allowMentions,\n allowFollower,\n allowFollowing,\n allowListUris,\n }\n }\n }\n return { allowMentions, allowFollower, allowFollowing, allowListUris }\n}\n\ntype ParsedThreadGate = {\n canReply?: boolean\n allowMentions?: boolean\n allowFollower?: boolean\n allowFollowing?: boolean\n allowListUris?: AtUriString[]\n}\n\nexport const cidFromBlobJson = (json: BlobRef): string => {\n return json.ref.toString()\n}\n\nexport const parsePostgate = ({\n gate,\n viewerDid,\n authorDid,\n}: {\n gate: PostgateRecord | undefined\n viewerDid: string | undefined\n authorDid: string\n}): ParsedPostgate => {\n if (viewerDid === authorDid) {\n return { embeddingRules: { canEmbed: true } }\n }\n // default state is unset, allow everyone\n if (!gate || !gate.embeddingRules) {\n return { embeddingRules: { canEmbed: true } }\n }\n\n const disabled = gate.embeddingRules.some(isPostgateDisableRuleType)\n if (disabled) {\n return { embeddingRules: { canEmbed: false } }\n }\n\n return { embeddingRules: { canEmbed: true } }\n}\n\ntype ParsedPostgate = {\n embeddingRules: {\n canEmbed: boolean\n }\n}\n\nexport class VideoUriBuilder {\n constructor(\n private opts: {\n playlistUrlPattern: string // e.g. https://hostname/vid/%s/%s/playlist.m3u8\n thumbnailUrlPattern: string // e.g. https://hostname/vid/%s/%s/thumbnail.jpg\n },\n ) {}\n playlist({ did, cid }: { did: DidString; cid: string }): UriString {\n return util.format(\n this.opts.playlistUrlPattern,\n encodeURIComponent(did),\n encodeURIComponent(cid),\n ) as UriString\n }\n thumbnail({ did, cid }: { did: DidString; cid: string }): UriString {\n return util.format(\n this.opts.thumbnailUrlPattern,\n encodeURIComponent(did),\n encodeURIComponent(cid),\n ) as UriString\n }\n}\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/views/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAiC;AAEjC,yCAUmB;AAEZ,MAAM,eAAe,GAAG,CAC7B,UAAkB,EAClB,QAAgB,EAChB,QAA2B,EAC3B,IAAuB,EACL,EAAE;IACpB,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAC3B,CAAC;IACD,yGAAyG;IACzG,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAC3B,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,4BAAiB,CAAC,CAAA;IACxD,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,6BAAkB,CAAC,CAAA;IACzD,MAAM,cAAc,GAAG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CAAyB,CAAC,CAAA;IACpE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAA;IAChD,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAA;AAC/C,CAAC,CAAA;AAvBY,QAAA,aAAa,iBAuBzB;AAQD,MAAa,eAAe;IAC1B,YACU,IAGP;QAHD;;;;mBAAQ,IAAI;WAGX;IACA,CAAC;IACJ,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,EAAmC;QACpD,OAAO,IAAI,CAAC,MAAM,CAChB,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAC5B,kBAAkB,CAAC,GAAG,CAAC,EACvB,kBAAkB,CAAC,GAAG,CAAC,CACX,CAAA;IAChB,CAAC;IACD,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,EAAmC;QACrD,OAAO,IAAI,CAAC,MAAM,CAChB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAC7B,kBAAkB,CAAC,GAAG,CAAC,EACvB,kBAAkB,CAAC,GAAG,CAAC,CACX,CAAA;IAChB,CAAC;CACF;AArBD,0CAqBC","sourcesContent":["import * as util from 'node:util'\nimport { AtUriString, DidString, UriString } from '@atproto/lex'\nimport {\n GateRecord,\n PostRecord,\n PostgateRecord,\n isFollowerRuleType,\n isFollowingRuleType,\n isListRuleType,\n isMentionFacetType,\n isMentionRuleType,\n isPostgateDisableRuleType,\n} from './types.js'\n\nexport const parseThreadGate = (\n replierDid: string,\n ownerDid: string,\n rootPost: PostRecord | null,\n gate: GateRecord | null,\n): ParsedThreadGate => {\n if (replierDid === ownerDid) {\n return { canReply: true }\n }\n // if gate.allow is unset then *any* reply is allowed, if it is an empty array then *no* reply is allowed\n if (!gate || !gate.allow) {\n return { canReply: true }\n }\n\n const allowMentions = gate.allow.some(isMentionRuleType)\n const allowFollower = gate.allow.some(isFollowerRuleType)\n const allowFollowing = gate.allow.some(isFollowingRuleType)\n const allowListUris = gate.allow.filter(isListRuleType).map((i) => i.list)\n\n // check mentions first since it's quick and synchronous\n if (allowMentions) {\n const isMentioned = rootPost?.facets?.some((facet) => {\n return facet.features.some(\n (item) => isMentionFacetType(item) && item.did === replierDid,\n )\n })\n if (isMentioned) {\n return {\n canReply: true,\n allowMentions,\n allowFollower,\n allowFollowing,\n allowListUris,\n }\n }\n }\n return { allowMentions, allowFollower, allowFollowing, allowListUris }\n}\n\ntype ParsedThreadGate = {\n canReply?: boolean\n allowMentions?: boolean\n allowFollower?: boolean\n allowFollowing?: boolean\n allowListUris?: AtUriString[]\n}\n\nexport const parsePostgate = ({\n gate,\n viewerDid,\n authorDid,\n}: {\n gate: PostgateRecord | undefined\n viewerDid: string | undefined\n authorDid: string\n}): ParsedPostgate => {\n if (viewerDid === authorDid) {\n return { embeddingRules: { canEmbed: true } }\n }\n // default state is unset, allow everyone\n if (!gate || !gate.embeddingRules) {\n return { embeddingRules: { canEmbed: true } }\n }\n\n const disabled = gate.embeddingRules.some(isPostgateDisableRuleType)\n if (disabled) {\n return { embeddingRules: { canEmbed: false } }\n }\n\n return { embeddingRules: { canEmbed: true } }\n}\n\ntype ParsedPostgate = {\n embeddingRules: {\n canEmbed: boolean\n }\n}\n\nexport class VideoUriBuilder {\n constructor(\n private opts: {\n playlistUrlPattern: string // e.g. https://hostname/vid/%s/%s/playlist.m3u8\n thumbnailUrlPattern: string // e.g. https://hostname/vid/%s/%s/thumbnail.jpg\n },\n ) {}\n playlist({ did, cid }: { did: DidString; cid: string }): UriString {\n return util.format(\n this.opts.playlistUrlPattern,\n encodeURIComponent(did),\n encodeURIComponent(cid),\n ) as UriString\n }\n thumbnail({ did, cid }: { did: DidString; cid: string }): UriString {\n return util.format(\n this.opts.thumbnailUrlPattern,\n encodeURIComponent(did),\n encodeURIComponent(cid),\n ) as UriString\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/bsky",
3
- "version": "0.0.224",
3
+ "version": "0.0.225",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of app.bsky App View (Bluesky API)",
6
6
  "keywords": [
@@ -52,16 +52,16 @@
52
52
  "zod": "3.23.8",
53
53
  "@atproto-labs/fetch-node": "^0.2.0",
54
54
  "@atproto-labs/xrpc-utils": "^0.0.24",
55
- "@atproto/api": "^0.19.6",
56
- "@atproto/common": "^0.5.15",
55
+ "@atproto/api": "^0.19.7",
56
+ "@atproto/common": "^0.5.16",
57
57
  "@atproto/crypto": "^0.4.5",
58
58
  "@atproto/did": "^0.3.0",
59
- "@atproto/repo": "^0.9.0",
60
- "@atproto/lex": "^0.0.23",
61
- "@atproto/sync": "^0.2.0",
59
+ "@atproto/identity": "^0.4.12",
60
+ "@atproto/lex": "^0.0.24",
61
+ "@atproto/repo": "^0.9.1",
62
+ "@atproto/sync": "^0.2.1",
62
63
  "@atproto/syntax": "^0.5.3",
63
- "@atproto/xrpc-server": "^0.10.18",
64
- "@atproto/identity": "^0.4.12"
64
+ "@atproto/xrpc-server": "^0.10.19"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@bufbuild/buf": "^1.28.1",
@@ -77,7 +77,7 @@
77
77
  "jest": "^28.1.2",
78
78
  "ts-node": "^10.8.2",
79
79
  "typescript": "^5.6.3",
80
- "@atproto/pds": "^0.4.217"
80
+ "@atproto/pds": "^0.4.218"
81
81
  },
82
82
  "scripts": {
83
83
  "codegen": "lex build --override --indexFile --lexicons ../../lexicons",
@@ -16,12 +16,14 @@ export default function (server: Server, ctx: AppContext) {
16
16
  server.add(app.bsky.actor.getProfile, {
17
17
  auth: ctx.authVerifier.optionalStandardOrRole,
18
18
  handler: async ({ auth, params, req }) => {
19
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
19
+ const { viewer, includeTakedowns, skipViewerBlocks } =
20
+ ctx.authVerifier.parseCreds(auth)
20
21
  const labelers = ctx.reqLabelers(req)
21
22
  const hydrateCtx = await ctx.hydrator.createContext({
22
23
  labelers,
23
24
  viewer,
24
25
  includeTakedowns,
26
+ skipViewerBlocks,
25
27
  })
26
28
 
27
29
  const result = await getProfile({ ...params, hydrateCtx }, ctx)
@@ -30,12 +30,14 @@ export default function (server: Server, ctx: AppContext) {
30
30
  paramsParseLoose: true,
31
31
  },
32
32
  handler: async ({ auth, params, req }) => {
33
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
33
+ const { viewer, includeTakedowns, skipViewerBlocks } =
34
+ ctx.authVerifier.parseCreds(auth)
34
35
  const labelers = ctx.reqLabelers(req)
35
36
  const hydrateCtx = await ctx.hydrator.createContext({
36
37
  viewer,
37
38
  labelers,
38
39
  includeTakedowns,
40
+ skipViewerBlocks,
39
41
  })
40
42
 
41
43
  const result = await getProfile({ ...params, hydrateCtx }, ctx)
@@ -26,12 +26,14 @@ export default function (server: Server, ctx: AppContext) {
26
26
  server.add(app.bsky.actor.searchActors, {
27
27
  auth: ctx.authVerifier.standardOptional,
28
28
  handler: async ({ auth, params, req }) => {
29
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
29
+ const { viewer, includeTakedowns, skipViewerBlocks } =
30
+ ctx.authVerifier.parseCreds(auth)
30
31
  const labelers = ctx.reqLabelers(req)
31
32
  const hydrateCtx = await ctx.hydrator.createContext({
32
33
  viewer,
33
34
  labelers,
34
35
  includeTakedowns,
36
+ skipViewerBlocks,
35
37
  })
36
38
  const results = await searchActors({ ...params, hydrateCtx }, ctx)
37
39
  return {
@@ -29,12 +29,14 @@ export default function (server: Server, ctx: AppContext) {
29
29
  server.add(app.bsky.feed.getAuthorFeed, {
30
30
  auth: ctx.authVerifier.optionalStandardOrRole,
31
31
  handler: async ({ params, auth, req }) => {
32
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
32
+ const { viewer, includeTakedowns, skipViewerBlocks } =
33
+ ctx.authVerifier.parseCreds(auth)
33
34
  const labelers = ctx.reqLabelers(req)
34
35
  const hydrateCtx = await ctx.hydrator.createContext({
35
36
  labelers,
36
37
  viewer,
37
38
  includeTakedowns,
39
+ skipViewerBlocks,
38
40
  })
39
41
 
40
42
  const result = await getAuthorFeed({ ...params, hydrateCtx }, ctx)
@@ -24,12 +24,14 @@ export default function (server: Server, ctx: AppContext) {
24
24
  server.add(app.bsky.feed.getLikes, {
25
25
  auth: ctx.authVerifier.standardOptional,
26
26
  handler: async ({ params, auth, req }) => {
27
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
27
+ const { viewer, includeTakedowns, skipViewerBlocks } =
28
+ ctx.authVerifier.parseCreds(auth)
28
29
  const labelers = ctx.reqLabelers(req)
29
30
  const hydrateCtx = await ctx.hydrator.createContext({
30
31
  labelers,
31
32
  viewer,
32
33
  includeTakedowns,
34
+ skipViewerBlocks,
33
35
  })
34
36
  const result = await getLikes({ ...params, hydrateCtx }, ctx)
35
37
 
@@ -31,7 +31,7 @@ export default function (server: Server, ctx: AppContext) {
31
31
  paramsParseLoose: true,
32
32
  },
33
33
  handler: async ({ params, auth, req, res }) => {
34
- const { viewer, includeTakedowns, include3pBlocks } =
34
+ const { viewer, includeTakedowns, include3pBlocks, skipViewerBlocks } =
35
35
  ctx.authVerifier.parseCreds(auth)
36
36
  const labelers = ctx.reqLabelers(req)
37
37
  const hydrateCtx = await ctx.hydrator.createContext({
@@ -39,6 +39,7 @@ export default function (server: Server, ctx: AppContext) {
39
39
  viewer,
40
40
  includeTakedowns,
41
41
  include3pBlocks,
42
+ skipViewerBlocks,
42
43
  })
43
44
 
44
45
  let result: app.bsky.feed.getPostThread.$OutputBody
@@ -24,12 +24,14 @@ export default function (server: Server, ctx: AppContext) {
24
24
  server.add(app.bsky.feed.getQuotes, {
25
25
  auth: ctx.authVerifier.standardOptional,
26
26
  handler: async ({ params, auth, req }) => {
27
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
27
+ const { viewer, includeTakedowns, skipViewerBlocks } =
28
+ ctx.authVerifier.parseCreds(auth)
28
29
  const labelers = ctx.reqLabelers(req)
29
30
  const hydrateCtx = await ctx.hydrator.createContext({
30
31
  labelers,
31
32
  viewer,
32
33
  includeTakedowns,
34
+ skipViewerBlocks,
33
35
  })
34
36
  const result = await getQuotes({ ...params, hydrateCtx }, ctx)
35
37
  return {
@@ -24,12 +24,14 @@ export default function (server: Server, ctx: AppContext) {
24
24
  server.add(app.bsky.feed.getRepostedBy, {
25
25
  auth: ctx.authVerifier.standardOptional,
26
26
  handler: async ({ params, auth, req }) => {
27
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
27
+ const { viewer, includeTakedowns, skipViewerBlocks } =
28
+ ctx.authVerifier.parseCreds(auth)
28
29
  const labelers = ctx.reqLabelers(req)
29
30
  const hydrateCtx = await ctx.hydrator.createContext({
30
31
  labelers,
31
32
  viewer,
32
33
  includeTakedowns,
34
+ skipViewerBlocks,
33
35
  })
34
36
  const result = await getRepostedBy({ ...params, hydrateCtx }, ctx)
35
37
 
@@ -32,12 +32,14 @@ export default function (server: Server, ctx: AppContext) {
32
32
  server.add(app.bsky.feed.searchPosts, {
33
33
  auth: ctx.authVerifier.standardOptional,
34
34
  handler: async ({ auth, params, req }) => {
35
- const { viewer, isModService } = ctx.authVerifier.parseCreds(auth)
35
+ const { viewer, isModService, skipViewerBlocks } =
36
+ ctx.authVerifier.parseCreds(auth)
36
37
 
37
38
  const labelers = ctx.reqLabelers(req)
38
39
  const hydrateCtx = await ctx.hydrator.createContext({
39
40
  labelers,
40
41
  viewer,
42
+ skipViewerBlocks,
41
43
  features: ctx.featureGatesClient.scope(
42
44
  ctx.featureGatesClient.parseUserContextFromHandler({
43
45
  viewer,
@@ -26,12 +26,14 @@ export default function (server: Server, ctx: AppContext) {
26
26
  server.add(app.bsky.graph.getActorStarterPacks, {
27
27
  auth: ctx.authVerifier.standardOptional,
28
28
  handler: async ({ params, auth, req }) => {
29
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
29
+ const { viewer, includeTakedowns, skipViewerBlocks } =
30
+ ctx.authVerifier.parseCreds(auth)
30
31
  const labelers = ctx.reqLabelers(req)
31
32
  const hydrateCtx = await ctx.hydrator.createContext({
32
33
  labelers,
33
34
  viewer,
34
35
  includeTakedowns,
36
+ skipViewerBlocks,
35
37
  })
36
38
  const result = await getActorStarterPacks({ ...params, hydrateCtx }, ctx)
37
39
  return {
@@ -29,12 +29,14 @@ export default function (server: Server, ctx: AppContext) {
29
29
  server.add(app.bsky.graph.getFollowers, {
30
30
  auth: ctx.authVerifier.optionalStandardOrRole,
31
31
  handler: async ({ params, auth, req }) => {
32
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
32
+ const { viewer, includeTakedowns, skipViewerBlocks } =
33
+ ctx.authVerifier.parseCreds(auth)
33
34
  const labelers = ctx.reqLabelers(req)
34
35
  const hydrateCtx = await ctx.hydrator.createContext({
35
36
  labelers,
36
37
  viewer,
37
38
  includeTakedowns,
39
+ skipViewerBlocks,
38
40
  })
39
41
 
40
42
  const result = await getFollowers({ ...params, hydrateCtx }, ctx)
@@ -23,12 +23,14 @@ export default function (server: Server, ctx: AppContext) {
23
23
  server.add(app.bsky.graph.getFollows, {
24
24
  auth: ctx.authVerifier.optionalStandardOrRole,
25
25
  handler: async ({ params, auth, req }) => {
26
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
26
+ const { viewer, includeTakedowns, skipViewerBlocks } =
27
+ ctx.authVerifier.parseCreds(auth)
27
28
  const labelers = ctx.reqLabelers(req)
28
29
  const hydrateCtx = await ctx.hydrator.createContext({
29
30
  labelers,
30
31
  viewer,
31
32
  includeTakedowns,
33
+ skipViewerBlocks,
32
34
  })
33
35
 
34
36
  // @TODO ensure canViewTakedowns gets threaded through and applied properly
@@ -26,13 +26,15 @@ export default function (server: Server, ctx: AppContext) {
26
26
  server.add(app.bsky.graph.getList, {
27
27
  auth: ctx.authVerifier.standardOptional,
28
28
  handler: async ({ params, auth, req }) => {
29
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
29
+ const { viewer, includeTakedowns, skipViewerBlocks } =
30
+ ctx.authVerifier.parseCreds(auth)
30
31
 
31
32
  const labelers = ctx.reqLabelers(req)
32
33
  const hydrateCtx = await ctx.hydrator.createContext({
33
34
  labelers,
34
35
  viewer,
35
36
  includeTakedowns,
37
+ skipViewerBlocks,
36
38
  })
37
39
  const result = await getList({ ...params, hydrateCtx }, ctx)
38
40
  return {
@@ -29,11 +29,13 @@ export default function (server: Server, ctx: AppContext) {
29
29
  auth: ctx.authVerifier.optionalStandardOrRole,
30
30
  handler: async ({ params, auth, req }) => {
31
31
  const labelers = ctx.reqLabelers(req)
32
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
32
+ const { viewer, includeTakedowns, skipViewerBlocks } =
33
+ ctx.authVerifier.parseCreds(auth)
33
34
  const hydrateCtx = await ctx.hydrator.createContext({
34
35
  labelers,
35
36
  viewer,
36
37
  includeTakedowns,
38
+ skipViewerBlocks,
37
39
  })
38
40
  const result = await getLists({ ...params, hydrateCtx }, ctx)
39
41
 
@@ -23,12 +23,14 @@ export default function (server: Server, ctx: AppContext) {
23
23
  server.add(app.bsky.graph.getStarterPack, {
24
24
  auth: ctx.authVerifier.standardOptional,
25
25
  handler: async ({ params, auth, req }) => {
26
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
26
+ const { viewer, includeTakedowns, skipViewerBlocks } =
27
+ ctx.authVerifier.parseCreds(auth)
27
28
  const labelers = ctx.reqLabelers(req)
28
29
  const hydrateCtx = await ctx.hydrator.createContext({
29
30
  labelers,
30
31
  viewer,
31
32
  includeTakedowns,
33
+ skipViewerBlocks,
32
34
  })
33
35
  const result = await getStarterPack({ ...params, hydrateCtx }, ctx)
34
36
  return {
@@ -22,12 +22,14 @@ export default function (server: Server, ctx: AppContext) {
22
22
  server.add(app.bsky.graph.getStarterPacks, {
23
23
  auth: ctx.authVerifier.standardOptional,
24
24
  handler: async ({ auth, params, req }) => {
25
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
25
+ const { viewer, includeTakedowns, skipViewerBlocks } =
26
+ ctx.authVerifier.parseCreds(auth)
26
27
  const labelers = ctx.reqLabelers(req)
27
28
  const hydrateCtx = await ctx.hydrator.createContext({
28
29
  viewer,
29
30
  labelers,
30
31
  includeTakedowns,
32
+ skipViewerBlocks,
31
33
  })
32
34
 
33
35
  const result = await getStarterPacks({ ...params, hydrateCtx }, ctx)
@@ -27,12 +27,14 @@ export default function (server: Server, ctx: AppContext) {
27
27
  server.add(app.bsky.graph.searchStarterPacks, {
28
28
  auth: ctx.authVerifier.standardOptional,
29
29
  handler: async ({ auth, params, req }) => {
30
- const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
30
+ const { viewer, includeTakedowns, skipViewerBlocks } =
31
+ ctx.authVerifier.parseCreds(auth)
31
32
  const labelers = ctx.reqLabelers(req)
32
33
  const hydrateCtx = await ctx.hydrator.createContext({
33
34
  viewer,
34
35
  labelers,
35
36
  includeTakedowns,
37
+ skipViewerBlocks,
36
38
  })
37
39
  const results = await searchStarterPacks({ ...params, hydrateCtx }, ctx)
38
40
  return {
@@ -35,7 +35,7 @@ export default function (server: Server, ctx: AppContext) {
35
35
  server.add(app.bsky.unspecced.getPostThreadOtherV2, {
36
36
  auth: ctx.authVerifier.optionalStandardOrRole,
37
37
  handler: async ({ params, auth, req }) => {
38
- const { viewer, includeTakedowns, include3pBlocks } =
38
+ const { viewer, includeTakedowns, include3pBlocks, skipViewerBlocks } =
39
39
  ctx.authVerifier.parseCreds(auth)
40
40
  const labelers = ctx.reqLabelers(req)
41
41
  const hydrateCtx = await ctx.hydrator.createContext({
@@ -43,6 +43,7 @@ export default function (server: Server, ctx: AppContext) {
43
43
  viewer,
44
44
  includeTakedowns,
45
45
  include3pBlocks,
46
+ skipViewerBlocks,
46
47
  })
47
48
 
48
49
  return {
@@ -26,7 +26,7 @@ export default function (server: Server, ctx: AppContext) {
26
26
  server.add(app.bsky.unspecced.getPostThreadV2, {
27
27
  auth: ctx.authVerifier.optionalStandardOrRole,
28
28
  handler: async ({ params, auth, req }) => {
29
- const { viewer, includeTakedowns, include3pBlocks } =
29
+ const { viewer, includeTakedowns, include3pBlocks, skipViewerBlocks } =
30
30
  ctx.authVerifier.parseCreds(auth)
31
31
  const labelers = ctx.reqLabelers(req)
32
32
  const features = ctx.featureGatesClient.scope(
@@ -42,6 +42,7 @@ export default function (server: Server, ctx: AppContext) {
42
42
  viewer,
43
43
  includeTakedowns,
44
44
  include3pBlocks,
45
+ skipViewerBlocks,
45
46
  features,
46
47
  })
47
48
 
@@ -411,6 +411,7 @@ export class AuthVerifier {
411
411
  include3pBlocks: includeTakedownsAnd3pBlocks,
412
412
  canPerformTakedown,
413
413
  isModService,
414
+ skipViewerBlocks: isModService && viewer !== null,
414
415
  }
415
416
  }
416
417
  }
@@ -1,5 +1,5 @@
1
1
  import { Selectable } from 'kysely'
2
- import { Cid } from '@atproto/lex'
2
+ import { Cid, getBlobCidString } from '@atproto/lex'
3
3
  import { AtUri, normalizeDatetimeAlways } from '@atproto/syntax'
4
4
  import { app } from '../../../../lexicons'
5
5
  import { BackgroundQueue } from '../../background'
@@ -28,7 +28,7 @@ const insertFn = async (
28
28
  descriptionFacets: obj.descriptionFacets
29
29
  ? JSON.stringify(obj.descriptionFacets)
30
30
  : undefined,
31
- avatarCid: obj.avatar?.ref.toString(),
31
+ avatarCid: getBlobCidString(obj.avatar),
32
32
  createdAt: normalizeDatetimeAlways(obj.createdAt),
33
33
  indexedAt: timestamp,
34
34
  })
@@ -1,5 +1,5 @@
1
1
  import { Selectable } from 'kysely'
2
- import { Cid } from '@atproto/lex'
2
+ import { Cid, getBlobCidString } from '@atproto/lex'
3
3
  import { AtUri, normalizeDatetimeAlways } from '@atproto/syntax'
4
4
  import { app } from '../../../../lexicons'
5
5
  import { BackgroundQueue } from '../../background'
@@ -28,7 +28,7 @@ const insertFn = async (
28
28
  descriptionFacets: obj.descriptionFacets
29
29
  ? JSON.stringify(obj.descriptionFacets)
30
30
  : undefined,
31
- avatarCid: obj.avatar?.ref.toString(),
31
+ avatarCid: getBlobCidString(obj.avatar),
32
32
  createdAt: normalizeDatetimeAlways(obj.createdAt),
33
33
  indexedAt: timestamp,
34
34
  })
@@ -1,5 +1,5 @@
1
1
  import { Insertable, Selectable, sql } from 'kysely'
2
- import { $Typed, Cid, lexParse } from '@atproto/lex'
2
+ import { $Typed, Cid, getBlobCidString, lexParse } from '@atproto/lex'
3
3
  import { AtUri, normalizeDatetimeAlways } from '@atproto/syntax'
4
4
  import { app } from '../../../../lexicons'
5
5
  import {
@@ -152,7 +152,7 @@ const insertFn = async (
152
152
  const imagesEmbed = images.map((img, i) => ({
153
153
  postUri: uri.toString(),
154
154
  position: i,
155
- imageCid: img.image.ref.toString(),
155
+ imageCid: getBlobCidString(img.image),
156
156
  alt: img.alt,
157
157
  }))
158
158
  embeds.push(imagesEmbed)
@@ -164,7 +164,7 @@ const insertFn = async (
164
164
  uri: external.uri,
165
165
  title: external.title,
166
166
  description: external.description,
167
- thumbCid: external.thumb?.ref.toString() || null,
167
+ thumbCid: getBlobCidString(external.thumb) || null,
168
168
  }
169
169
  embeds.push(externalEmbed)
170
170
  await db.insertInto('post_embed_external').values(externalEmbed).execute()
@@ -231,7 +231,7 @@ const insertFn = async (
231
231
  const { video } = postEmbed
232
232
  const videoEmbed = {
233
233
  postUri: uri.toString(),
234
- videoCid: video.ref.toString(),
234
+ videoCid: getBlobCidString(video),
235
235
  // @NOTE: alt is required for image but not for video on the lexicon.
236
236
  alt: postEmbed.alt ?? null,
237
237
  }
@@ -1,4 +1,4 @@
1
- import { Cid } from '@atproto/lex'
1
+ import { Cid, getBlobCidString } from '@atproto/lex'
2
2
  import { AtUri } from '@atproto/syntax'
3
3
  import { app } from '../../../../lexicons'
4
4
  import { BackgroundQueue } from '../../background'
@@ -24,8 +24,8 @@ const insertFn = async (
24
24
  creator: uri.host,
25
25
  displayName: obj.displayName,
26
26
  description: obj.description,
27
- avatarCid: obj.avatar?.ref.toString(),
28
- bannerCid: obj.banner?.ref.toString(),
27
+ avatarCid: getBlobCidString(obj.avatar),
28
+ bannerCid: getBlobCidString(obj.banner),
29
29
  joinedViaStarterPackUri: obj.joinedViaStarterPack?.uri,
30
30
  createdAt: obj.createdAt ?? new Date().toISOString(),
31
31
  indexedAt: timestamp,
@@ -85,6 +85,7 @@ export class HydrateCtx {
85
85
  includeTakedowns = this.vals.includeTakedowns
86
86
  overrideIncludeTakedownsForActor = this.vals.overrideIncludeTakedownsForActor
87
87
  include3pBlocks = this.vals.include3pBlocks
88
+ skipViewerBlocks = this.vals.skipViewerBlocks
88
89
  includeDebugField = this.vals.includeDebugField
89
90
  features = this.vals.features
90
91
  constructor(private vals: HydrateCtxVals) {}
@@ -104,6 +105,7 @@ export type HydrateCtxVals = {
104
105
  includeTakedowns?: boolean
105
106
  overrideIncludeTakedownsForActor?: boolean
106
107
  include3pBlocks?: boolean
108
+ skipViewerBlocks?: boolean
107
109
  includeDebugField?: boolean
108
110
  features: ScopedFeatureGatesClient
109
111
  }
@@ -1357,6 +1359,7 @@ export class Hydrator {
1357
1359
  viewer: vals.viewer,
1358
1360
  includeTakedowns: vals.includeTakedowns,
1359
1361
  include3pBlocks: vals.include3pBlocks,
1362
+ skipViewerBlocks: vals.skipViewerBlocks,
1360
1363
  includeDebugField,
1361
1364
  // create default anonymous scope
1362
1365
  features: vals.features || this.config.featureGatesClient.scope({}),
@@ -1425,6 +1428,9 @@ const labelSubjectsForDid = (dids: DidString[]) => {
1425
1428
  ...dids.map((did) =>
1426
1429
  AtUri.make(did, app.bsky.actor.profile.$type, 'self').toString(),
1427
1430
  ),
1431
+ ...dids.map((did) =>
1432
+ AtUri.make(did, app.bsky.actor.status.$type, 'self').toString(),
1433
+ ),
1428
1434
  ]
1429
1435
  }
1430
1436