@atproto/bsky 0.0.38 → 0.0.40

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 (65) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/hydration/hydrator.d.ts +12 -2
  3. package/dist/hydration/label.d.ts +7 -3
  4. package/dist/hydration/util.d.ts +5 -2
  5. package/dist/index.js +216 -104
  6. package/dist/index.js.map +2 -2
  7. package/dist/lexicon/lexicons.d.ts +13 -0
  8. package/dist/lexicon/types/com/atproto/server/describeServer.d.ts +7 -0
  9. package/package.json +5 -5
  10. package/src/api/app/bsky/actor/getProfile.ts +10 -6
  11. package/src/api/app/bsky/actor/getProfiles.ts +2 -2
  12. package/src/api/app/bsky/actor/getSuggestions.ts +2 -2
  13. package/src/api/app/bsky/actor/searchActors.ts +7 -3
  14. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +2 -2
  15. package/src/api/app/bsky/feed/getActorFeeds.ts +2 -2
  16. package/src/api/app/bsky/feed/getActorLikes.ts +2 -2
  17. package/src/api/app/bsky/feed/getAuthorFeed.ts +6 -2
  18. package/src/api/app/bsky/feed/getFeed.ts +2 -2
  19. package/src/api/app/bsky/feed/getFeedGenerator.ts +3 -6
  20. package/src/api/app/bsky/feed/getFeedGenerators.ts +2 -2
  21. package/src/api/app/bsky/feed/getLikes.ts +2 -2
  22. package/src/api/app/bsky/feed/getListFeed.ts +2 -2
  23. package/src/api/app/bsky/feed/getPostThread.ts +2 -2
  24. package/src/api/app/bsky/feed/getPosts.ts +2 -2
  25. package/src/api/app/bsky/feed/getRepostedBy.ts +2 -2
  26. package/src/api/app/bsky/feed/getSuggestedFeeds.ts +3 -5
  27. package/src/api/app/bsky/feed/getTimeline.ts +6 -3
  28. package/src/api/app/bsky/feed/searchPosts.ts +2 -2
  29. package/src/api/app/bsky/graph/getBlocks.ts +6 -3
  30. package/src/api/app/bsky/graph/getFollowers.ts +6 -2
  31. package/src/api/app/bsky/graph/getFollows.ts +6 -2
  32. package/src/api/app/bsky/graph/getList.ts +2 -2
  33. package/src/api/app/bsky/graph/getListBlocks.ts +6 -3
  34. package/src/api/app/bsky/graph/getListMutes.ts +6 -3
  35. package/src/api/app/bsky/graph/getLists.ts +2 -2
  36. package/src/api/app/bsky/graph/getMutes.ts +6 -3
  37. package/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +3 -3
  38. package/src/api/app/bsky/labeler/getServices.ts +3 -3
  39. package/src/api/app/bsky/notification/listNotifications.ts +6 -3
  40. package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +2 -2
  41. package/src/data-plane/server/routes/labels.ts +26 -8
  42. package/src/hydration/hydrator.ts +55 -10
  43. package/src/hydration/label.ts +33 -7
  44. package/src/hydration/util.ts +6 -2
  45. package/src/index.ts +1 -1
  46. package/src/lexicon/lexicons.ts +13 -0
  47. package/src/lexicon/types/com/atproto/server/describeServer.ts +18 -0
  48. package/src/views/index.ts +8 -8
  49. package/tests/__snapshots__/feed-generation.test.ts.snap +0 -45
  50. package/tests/data-plane/__snapshots__/indexing.test.ts.snap +0 -8
  51. package/tests/label-hydration.test.ts +31 -0
  52. package/tests/views/__snapshots__/author-feed.test.ts.snap +0 -46
  53. package/tests/views/__snapshots__/block-lists.test.ts.snap +0 -17
  54. package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
  55. package/tests/views/__snapshots__/labeler-service.test.ts.snap +0 -4
  56. package/tests/views/__snapshots__/list-feed.test.ts.snap +0 -20
  57. package/tests/views/__snapshots__/mute-lists.test.ts.snap +0 -18
  58. package/tests/views/__snapshots__/mutes.test.ts.snap +0 -4
  59. package/tests/views/__snapshots__/notifications.test.ts.snap +0 -9
  60. package/tests/views/__snapshots__/posts.test.ts.snap +0 -7
  61. package/tests/views/__snapshots__/profile.test.ts.snap +0 -6
  62. package/tests/views/__snapshots__/thread.test.ts.snap +0 -38
  63. package/tests/views/__snapshots__/timeline.test.ts.snap +0 -145
  64. package/tests/views/labeler-service.test.ts +2 -7
  65. package/tests/views/takedown-labels.test.ts +52 -0
@@ -2206,6 +2206,11 @@ export declare const schemaDict: {
2206
2206
  description: string;
2207
2207
  ref: string;
2208
2208
  };
2209
+ contact: {
2210
+ type: string;
2211
+ description: string;
2212
+ ref: string;
2213
+ };
2209
2214
  did: {
2210
2215
  type: string;
2211
2216
  format: string;
@@ -2225,6 +2230,14 @@ export declare const schemaDict: {
2225
2230
  };
2226
2231
  };
2227
2232
  };
2233
+ contact: {
2234
+ type: string;
2235
+ properties: {
2236
+ email: {
2237
+ type: string;
2238
+ };
2239
+ };
2240
+ };
2228
2241
  };
2229
2242
  };
2230
2243
  ComAtprotoServerGetAccountInviteCodes: {
@@ -9,6 +9,7 @@ export interface OutputSchema {
9
9
  phoneVerificationRequired?: boolean;
10
10
  availableUserDomains: string[];
11
11
  links?: Links;
12
+ contact?: Contact;
12
13
  did: string;
13
14
  [k: string]: unknown;
14
15
  }
@@ -40,3 +41,9 @@ export interface Links {
40
41
  }
41
42
  export declare function isLinks(v: unknown): v is Links;
42
43
  export declare function validateLinks(v: unknown): ValidationResult;
44
+ export interface Contact {
45
+ email?: string;
46
+ [k: string]: unknown;
47
+ }
48
+ export declare function isContact(v: unknown): v is Contact;
49
+ export declare function validateContact(v: unknown): ValidationResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/bsky",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of app.bsky App View (Bluesky API)",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "structured-headers": "^1.0.1",
43
43
  "typed-emitter": "^2.1.0",
44
44
  "uint8arrays": "3.0.0",
45
- "@atproto/api": "^0.11.0",
45
+ "@atproto/api": "^0.11.2",
46
46
  "@atproto/common": "^0.3.4",
47
47
  "@atproto/crypto": "^0.3.0",
48
48
  "@atproto/identity": "^0.3.3",
@@ -63,10 +63,10 @@
63
63
  "@types/qs": "^6.9.7",
64
64
  "axios": "^0.27.2",
65
65
  "http2-express-bridge": "^1.0.7",
66
- "@atproto/api": "^0.11.0",
67
- "@atproto/dev-env": "^0.2.38",
66
+ "@atproto/api": "^0.11.2",
67
+ "@atproto/dev-env": "^0.2.41",
68
68
  "@atproto/lex-cli": "^0.3.2",
69
- "@atproto/pds": "^0.4.6",
69
+ "@atproto/pds": "^0.4.8",
70
70
  "@atproto/xrpc": "^0.4.3"
71
71
  },
72
72
  "scripts": {
@@ -18,7 +18,11 @@ export default function (server: Server, ctx: AppContext) {
18
18
  handler: async ({ auth, params, req }) => {
19
19
  const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
20
20
  const labelers = ctx.reqLabelers(req)
21
- const hydrateCtx = { labelers, viewer, includeTakedowns }
21
+ const hydrateCtx = await ctx.hydrator.createContext({
22
+ labelers,
23
+ viewer,
24
+ includeTakedowns,
25
+ })
22
26
 
23
27
  const result = await getProfile({ ...params, hydrateCtx }, ctx)
24
28
 
@@ -29,7 +33,7 @@ export default function (server: Server, ctx: AppContext) {
29
33
  body: result,
30
34
  headers: resHeaders({
31
35
  repoRev,
32
- labelers,
36
+ labelers: hydrateCtx.labelers,
33
37
  }),
34
38
  }
35
39
  },
@@ -54,10 +58,10 @@ const hydration = async (input: {
54
58
  skeleton: SkeletonState
55
59
  }) => {
56
60
  const { ctx, params, skeleton } = input
57
- return ctx.hydrator.hydrateProfilesDetailed([skeleton.did], {
58
- ...params.hydrateCtx,
59
- includeTakedowns: true,
60
- })
61
+ return ctx.hydrator.hydrateProfilesDetailed(
62
+ [skeleton.did],
63
+ params.hydrateCtx.copy({ includeTakedowns: true }),
64
+ )
61
65
  }
62
66
 
63
67
  const presentation = (input: {
@@ -18,7 +18,7 @@ export default function (server: Server, ctx: AppContext) {
18
18
  handler: async ({ auth, params, req }) => {
19
19
  const viewer = auth.credentials.iss
20
20
  const labelers = ctx.reqLabelers(req)
21
- const hydrateCtx = { viewer, labelers }
21
+ const hydrateCtx = await ctx.hydrator.createContext({ viewer, labelers })
22
22
 
23
23
  const result = await getProfile({ ...params, hydrateCtx }, ctx)
24
24
 
@@ -29,7 +29,7 @@ export default function (server: Server, ctx: AppContext) {
29
29
  body: result,
30
30
  headers: resHeaders({
31
31
  repoRev,
32
- labelers,
32
+ labelers: hydrateCtx.labelers,
33
33
  }),
34
34
  }
35
35
  },
@@ -25,13 +25,13 @@ export default function (server: Server, ctx: AppContext) {
25
25
  handler: async ({ params, auth, req }) => {
26
26
  const viewer = auth.credentials.iss
27
27
  const labelers = ctx.reqLabelers(req)
28
- const hydrateCtx = { viewer, labelers }
28
+ const hydrateCtx = await ctx.hydrator.createContext({ viewer, labelers })
29
29
  const result = await getSuggestions({ ...params, hydrateCtx }, ctx)
30
30
 
31
31
  return {
32
32
  encoding: 'application/json',
33
33
  body: result,
34
- headers: resHeaders({ labelers }),
34
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
35
35
  }
36
36
  },
37
37
  })
@@ -26,14 +26,18 @@ export default function (server: Server, ctx: AppContext) {
26
26
  server.app.bsky.actor.searchActors({
27
27
  auth: ctx.authVerifier.standardOptional,
28
28
  handler: async ({ auth, params, req }) => {
29
- const viewer = auth.credentials.iss
29
+ const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
30
30
  const labelers = ctx.reqLabelers(req)
31
- const hydrateCtx = { viewer, labelers }
31
+ const hydrateCtx = await ctx.hydrator.createContext({
32
+ viewer,
33
+ labelers,
34
+ includeTakedowns,
35
+ })
32
36
  const results = await searchActors({ ...params, hydrateCtx }, ctx)
33
37
  return {
34
38
  encoding: 'application/json',
35
39
  body: results,
36
- headers: resHeaders({ labelers }),
40
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
37
41
  }
38
42
  },
39
43
  })
@@ -28,7 +28,7 @@ export default function (server: Server, ctx: AppContext) {
28
28
  handler: async ({ params, auth, req }) => {
29
29
  const viewer = auth.credentials.iss
30
30
  const labelers = ctx.reqLabelers(req)
31
- const hydrateCtx = { labelers, viewer }
31
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
32
32
  const results = await searchActorsTypeahead(
33
33
  { ...params, hydrateCtx },
34
34
  ctx,
@@ -36,7 +36,7 @@ export default function (server: Server, ctx: AppContext) {
36
36
  return {
37
37
  encoding: 'application/json',
38
38
  body: results,
39
- headers: resHeaders({ labelers }),
39
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
40
40
  }
41
41
  },
42
42
  })
@@ -26,12 +26,12 @@ export default function (server: Server, ctx: AppContext) {
26
26
  handler: async ({ auth, params, req }) => {
27
27
  const viewer = auth.credentials.iss
28
28
  const labelers = ctx.reqLabelers(req)
29
- const hydrateCtx = { labelers, viewer }
29
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
30
30
  const result = await getActorFeeds({ ...params, hydrateCtx }, ctx)
31
31
  return {
32
32
  encoding: 'application/json',
33
33
  body: result,
34
- headers: resHeaders({ labelers }),
34
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
35
35
  }
36
36
  },
37
37
  })
@@ -28,7 +28,7 @@ export default function (server: Server, ctx: AppContext) {
28
28
  handler: async ({ params, auth, req }) => {
29
29
  const viewer = auth.credentials.iss
30
30
  const labelers = ctx.reqLabelers(req)
31
- const hydrateCtx = { labelers, viewer }
31
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
32
32
 
33
33
  const result = await getActorLikes({ ...params, hydrateCtx }, ctx)
34
34
 
@@ -39,7 +39,7 @@ export default function (server: Server, ctx: AppContext) {
39
39
  body: result,
40
40
  headers: resHeaders({
41
41
  repoRev,
42
- labelers,
42
+ labelers: hydrateCtx.labelers,
43
43
  }),
44
44
  }
45
45
  },
@@ -30,7 +30,11 @@ export default function (server: Server, ctx: AppContext) {
30
30
  handler: async ({ params, auth, req }) => {
31
31
  const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
32
32
  const labelers = ctx.reqLabelers(req)
33
- const hydrateCtx = { labelers, viewer, includeTakedowns }
33
+ const hydrateCtx = await ctx.hydrator.createContext({
34
+ labelers,
35
+ viewer,
36
+ includeTakedowns,
37
+ })
34
38
 
35
39
  const result = await getAuthorFeed({ ...params, hydrateCtx }, ctx)
36
40
 
@@ -41,7 +45,7 @@ export default function (server: Server, ctx: AppContext) {
41
45
  body: result,
42
46
  headers: resHeaders({
43
47
  repoRev,
44
- labelers,
48
+ labelers: hydrateCtx.labelers,
45
49
  }),
46
50
  }
47
51
  },
@@ -42,7 +42,7 @@ export default function (server: Server, ctx: AppContext) {
42
42
  handler: async ({ params, auth, req }) => {
43
43
  const viewer = auth.credentials.iss
44
44
  const labelers = ctx.reqLabelers(req)
45
- const hydrateCtx = { labelers, viewer }
45
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
46
46
  const headers = noUndefinedVals({
47
47
  authorization: req.headers['authorization'],
48
48
  'accept-language': req.headers['accept-language'],
@@ -60,7 +60,7 @@ export default function (server: Server, ctx: AppContext) {
60
60
  body: result,
61
61
  headers: {
62
62
  ...(feedResHeaders ?? {}),
63
- ...resHeaders({ labelers }),
63
+ ...resHeaders({ labelers: hydrateCtx.labelers }),
64
64
  'server-timing': serverTimingHeader([timerSkele, timerHydr]),
65
65
  },
66
66
  }
@@ -17,11 +17,8 @@ export default function (server: Server, ctx: AppContext) {
17
17
  const { feed } = params
18
18
  const viewer = auth.credentials.iss
19
19
  const labelers = ctx.reqLabelers(req)
20
-
21
- const hydration = await ctx.hydrator.hydrateFeedGens([feed], {
22
- viewer,
23
- labelers,
24
- })
20
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
21
+ const hydration = await ctx.hydrator.hydrateFeedGens([feed], hydrateCtx)
25
22
  const feedInfo = hydration.feedgens?.get(feed)
26
23
  if (!feedInfo) {
27
24
  throw new InvalidRequestError('could not find feed')
@@ -64,7 +61,7 @@ export default function (server: Server, ctx: AppContext) {
64
61
  isOnline: true,
65
62
  isValid: true,
66
63
  },
67
- headers: resHeaders({ labelers }),
64
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
68
65
  }
69
66
  },
70
67
  })
@@ -23,12 +23,12 @@ export default function (server: Server, ctx: AppContext) {
23
23
  handler: async ({ params, auth, req }) => {
24
24
  const viewer = auth.credentials.iss
25
25
  const labelers = ctx.reqLabelers(req)
26
- const hydrateCtx = { labelers, viewer }
26
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
27
27
  const view = await getFeedGenerators({ ...params, hydrateCtx }, ctx)
28
28
  return {
29
29
  encoding: 'application/json',
30
30
  body: view,
31
- headers: resHeaders({ labelers }),
31
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
32
32
  }
33
33
  },
34
34
  })
@@ -21,13 +21,13 @@ export default function (server: Server, ctx: AppContext) {
21
21
  handler: async ({ params, auth, req }) => {
22
22
  const viewer = auth.credentials.iss
23
23
  const labelers = ctx.reqLabelers(req)
24
- const hydrateCtx = { labelers, viewer }
24
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
25
25
  const result = await getLikes({ ...params, hydrateCtx }, ctx)
26
26
 
27
27
  return {
28
28
  encoding: 'application/json',
29
29
  body: result,
30
- headers: resHeaders({ labelers }),
30
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
31
31
  }
32
32
  },
33
33
  })
@@ -26,7 +26,7 @@ export default function (server: Server, ctx: AppContext) {
26
26
  handler: async ({ params, auth, req }) => {
27
27
  const viewer = auth.credentials.iss
28
28
  const labelers = ctx.reqLabelers(req)
29
- const hydrateCtx = { labelers, viewer }
29
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
30
30
 
31
31
  const result = await getListFeed({ ...params, hydrateCtx }, ctx)
32
32
 
@@ -35,7 +35,7 @@ export default function (server: Server, ctx: AppContext) {
35
35
  return {
36
36
  encoding: 'application/json',
37
37
  body: result,
38
- headers: resHeaders({ labelers, repoRev }),
38
+ headers: resHeaders({ labelers: hydrateCtx.labelers, repoRev }),
39
39
  }
40
40
  },
41
41
  })
@@ -30,7 +30,7 @@ export default function (server: Server, ctx: AppContext) {
30
30
  handler: async ({ params, auth, req, res }) => {
31
31
  const { viewer } = ctx.authVerifier.parseCreds(auth)
32
32
  const labelers = ctx.reqLabelers(req)
33
- const hydrateCtx = { labelers, viewer }
33
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
34
34
 
35
35
  let result: OutputSchema
36
36
  try {
@@ -50,7 +50,7 @@ export default function (server: Server, ctx: AppContext) {
50
50
  body: result,
51
51
  headers: resHeaders({
52
52
  repoRev,
53
- labelers,
53
+ labelers: hydrateCtx.labelers,
54
54
  }),
55
55
  }
56
56
  },
@@ -19,14 +19,14 @@ export default function (server: Server, ctx: AppContext) {
19
19
  handler: async ({ params, auth, req }) => {
20
20
  const viewer = auth.credentials.iss
21
21
  const labelers = ctx.reqLabelers(req)
22
- const hydrateCtx = { labelers, viewer }
22
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
23
23
 
24
24
  const results = await getPosts({ ...params, hydrateCtx }, ctx)
25
25
 
26
26
  return {
27
27
  encoding: 'application/json',
28
28
  body: results,
29
- headers: resHeaders({ labelers }),
29
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
30
30
  }
31
31
  },
32
32
  })
@@ -25,13 +25,13 @@ export default function (server: Server, ctx: AppContext) {
25
25
  handler: async ({ params, auth, req }) => {
26
26
  const viewer = auth.credentials.iss
27
27
  const labelers = ctx.reqLabelers(req)
28
- const hydrateCtx = { labelers, viewer }
28
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
29
29
  const result = await getRepostedBy({ ...params, hydrateCtx }, ctx)
30
30
 
31
31
  return {
32
32
  encoding: 'application/json',
33
33
  body: result,
34
- headers: resHeaders({ labelers }),
34
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
35
35
  }
36
36
  },
37
37
  })
@@ -18,10 +18,8 @@ export default function (server: Server, ctx: AppContext) {
18
18
  cursor: params.cursor,
19
19
  })
20
20
  const uris = suggestedRes.uris
21
- const hydration = await ctx.hydrator.hydrateFeedGens(uris, {
22
- labelers,
23
- viewer,
24
- })
21
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
22
+ const hydration = await ctx.hydrator.hydrateFeedGens(uris, hydrateCtx)
25
23
  const feedViews = mapDefined(uris, (uri) =>
26
24
  ctx.views.feedGenerator(uri, hydration),
27
25
  )
@@ -32,7 +30,7 @@ export default function (server: Server, ctx: AppContext) {
32
30
  feeds: feedViews,
33
31
  cursor: parseString(suggestedRes.cursor),
34
32
  },
35
- headers: resHeaders({ labelers }),
33
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
36
34
  }
37
35
  },
38
36
  })
@@ -26,16 +26,19 @@ export default function (server: Server, ctx: AppContext) {
26
26
  handler: async ({ params, auth, req }) => {
27
27
  const viewer = auth.credentials.iss
28
28
  const labelers = ctx.reqLabelers(req)
29
- const hydrateCtx = { labelers, viewer }
29
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
30
30
 
31
- const result = await getTimeline({ ...params, hydrateCtx }, ctx)
31
+ const result = await getTimeline(
32
+ { ...params, hydrateCtx: hydrateCtx.copy({ viewer }) },
33
+ ctx,
34
+ )
32
35
 
33
36
  const repoRev = await ctx.hydrator.actor.getRepoRevSafe(viewer)
34
37
 
35
38
  return {
36
39
  encoding: 'application/json',
37
40
  body: result,
38
- headers: resHeaders({ labelers, repoRev }),
41
+ headers: resHeaders({ labelers: hydrateCtx.labelers, repoRev }),
39
42
  }
40
43
  },
41
44
  })
@@ -29,12 +29,12 @@ export default function (server: Server, ctx: AppContext) {
29
29
  handler: async ({ auth, params, req }) => {
30
30
  const viewer = auth.credentials.iss
31
31
  const labelers = ctx.reqLabelers(req)
32
- const hydrateCtx = { labelers, viewer }
32
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
33
33
  const results = await searchPosts({ ...params, hydrateCtx }, ctx)
34
34
  return {
35
35
  encoding: 'application/json',
36
36
  body: results,
37
- headers: resHeaders({ labelers }),
37
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
38
38
  }
39
39
  },
40
40
  })
@@ -20,12 +20,15 @@ export default function (server: Server, ctx: AppContext) {
20
20
  handler: async ({ params, auth, req }) => {
21
21
  const viewer = auth.credentials.iss
22
22
  const labelers = ctx.reqLabelers(req)
23
- const hydrateCtx = { labelers, viewer }
24
- const result = await getBlocks({ ...params, hydrateCtx }, ctx)
23
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
24
+ const result = await getBlocks(
25
+ { ...params, hydrateCtx: hydrateCtx.copy({ viewer }) },
26
+ ctx,
27
+ )
25
28
  return {
26
29
  encoding: 'application/json',
27
30
  body: result,
28
- headers: resHeaders({ labelers }),
31
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
29
32
  }
30
33
  },
31
34
  })
@@ -31,14 +31,18 @@ export default function (server: Server, ctx: AppContext) {
31
31
  handler: async ({ params, auth, req }) => {
32
32
  const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
33
33
  const labelers = ctx.reqLabelers(req)
34
- const hydrateCtx = { labelers, viewer, includeTakedowns }
34
+ const hydrateCtx = await ctx.hydrator.createContext({
35
+ labelers,
36
+ viewer,
37
+ includeTakedowns,
38
+ })
35
39
 
36
40
  const result = await getFollowers({ ...params, hydrateCtx }, ctx)
37
41
 
38
42
  return {
39
43
  encoding: 'application/json',
40
44
  body: result,
41
- headers: resHeaders({ labelers }),
45
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
42
46
  }
43
47
  },
44
48
  })
@@ -25,7 +25,11 @@ export default function (server: Server, ctx: AppContext) {
25
25
  handler: async ({ params, auth, req }) => {
26
26
  const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
27
27
  const labelers = ctx.reqLabelers(req)
28
- const hydrateCtx = { labelers, viewer, includeTakedowns }
28
+ const hydrateCtx = await ctx.hydrator.createContext({
29
+ labelers,
30
+ viewer,
31
+ includeTakedowns,
32
+ })
29
33
 
30
34
  // @TODO ensure canViewTakedowns gets threaded through and applied properly
31
35
  const result = await getFollows({ ...params, hydrateCtx }, ctx)
@@ -33,7 +37,7 @@ export default function (server: Server, ctx: AppContext) {
33
37
  return {
34
38
  encoding: 'application/json',
35
39
  body: result,
36
- headers: resHeaders({ labelers }),
40
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
37
41
  }
38
42
  },
39
43
  })
@@ -26,12 +26,12 @@ export default function (server: Server, ctx: AppContext) {
26
26
  handler: async ({ params, auth, req }) => {
27
27
  const viewer = auth.credentials.iss
28
28
  const labelers = ctx.reqLabelers(req)
29
- const hydrateCtx = { labelers, viewer }
29
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
30
30
  const result = await getList({ ...params, hydrateCtx }, ctx)
31
31
  return {
32
32
  encoding: 'application/json',
33
33
  body: result,
34
- headers: resHeaders({ labelers }),
34
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
35
35
  }
36
36
  },
37
37
  })
@@ -25,12 +25,15 @@ export default function (server: Server, ctx: AppContext) {
25
25
  handler: async ({ params, auth, req }) => {
26
26
  const viewer = auth.credentials.iss
27
27
  const labelers = ctx.reqLabelers(req)
28
- const hydrateCtx = { labelers, viewer }
29
- const result = await getListBlocks({ ...params, hydrateCtx }, ctx)
28
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
29
+ const result = await getListBlocks(
30
+ { ...params, hydrateCtx: hydrateCtx.copy({ viewer }) },
31
+ ctx,
32
+ )
30
33
  return {
31
34
  encoding: 'application/json',
32
35
  body: result,
33
- headers: resHeaders({ labelers }),
36
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
34
37
  }
35
38
  },
36
39
  })
@@ -25,12 +25,15 @@ export default function (server: Server, ctx: AppContext) {
25
25
  handler: async ({ params, auth, req }) => {
26
26
  const viewer = auth.credentials.iss
27
27
  const labelers = ctx.reqLabelers(req)
28
- const hydrateCtx = { labelers, viewer }
29
- const result = await getListMutes({ ...params, hydrateCtx }, ctx)
28
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
29
+ const result = await getListMutes(
30
+ { ...params, hydrateCtx: hydrateCtx.copy({ viewer }) },
31
+ ctx,
32
+ )
30
33
  return {
31
34
  encoding: 'application/json',
32
35
  body: result,
33
- headers: resHeaders({ labelers }),
36
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
34
37
  }
35
38
  },
36
39
  })
@@ -20,13 +20,13 @@ export default function (server: Server, ctx: AppContext) {
20
20
  handler: async ({ params, auth, req }) => {
21
21
  const viewer = auth.credentials.iss
22
22
  const labelers = ctx.reqLabelers(req)
23
- const hydrateCtx = { labelers, viewer }
23
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
24
24
  const result = await getLists({ ...params, hydrateCtx }, ctx)
25
25
 
26
26
  return {
27
27
  encoding: 'application/json',
28
28
  body: result,
29
- headers: resHeaders({ labelers }),
29
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
30
30
  }
31
31
  },
32
32
  })
@@ -20,12 +20,15 @@ export default function (server: Server, ctx: AppContext) {
20
20
  handler: async ({ params, auth, req }) => {
21
21
  const viewer = auth.credentials.iss
22
22
  const labelers = ctx.reqLabelers(req)
23
- const hydrateCtx = { labelers, viewer }
24
- const result = await getMutes({ ...params, hydrateCtx }, ctx)
23
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
24
+ const result = await getMutes(
25
+ { ...params, hydrateCtx: hydrateCtx.copy({ viewer }) },
26
+ ctx,
27
+ )
25
28
  return {
26
29
  encoding: 'application/json',
27
30
  body: result,
28
- headers: resHeaders({ labelers }),
31
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
29
32
  }
30
33
  },
31
34
  })
@@ -26,15 +26,15 @@ export default function (server: Server, ctx: AppContext) {
26
26
  handler: async ({ auth, params, req }) => {
27
27
  const viewer = auth.credentials.iss
28
28
  const labelers = ctx.reqLabelers(req)
29
- const hydrateCtx = { labelers, viewer }
29
+ const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
30
30
  const result = await getSuggestedFollowsByActor(
31
- { ...params, hydrateCtx },
31
+ { ...params, hydrateCtx: hydrateCtx.copy({ viewer }) },
32
32
  ctx,
33
33
  )
34
34
  return {
35
35
  encoding: 'application/json',
36
36
  body: result,
37
- headers: resHeaders({ labelers }),
37
+ headers: resHeaders({ labelers: hydrateCtx.labelers }),
38
38
  }
39
39
  },
40
40
  })