@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atproto/bsky
2
2
 
3
+ ## 0.0.40
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`7dd9941b7`](https://github.com/bluesky-social/atproto/commit/7dd9941b73dbbd82601740e021cc87d765af60ca)]:
8
+ - @atproto/api@0.11.2
9
+
10
+ ## 0.0.39
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`219480764`](https://github.com/bluesky-social/atproto/commit/2194807644cbdb0021e867437693300c1b0e55f5)]:
15
+ - @atproto/api@0.11.1
16
+
3
17
  ## 0.0.38
4
18
 
5
19
  ### Patch Changes
@@ -6,7 +6,15 @@ import { LabelHydrator, LabelerAggs, LabelerViewerStates, Labelers, Labels } fro
6
6
  import { HydrationMap, RecordInfo } from './util';
7
7
  import { FeedGenAggs, FeedGens, FeedGenViewerStates, FeedHydrator, Likes, Posts, Reposts, PostAggs, PostViewerStates, Threadgates, FeedItem, ItemRef } from './feed';
8
8
  import { ParsedLabelers } from '../util';
9
- export type HydrateCtx = {
9
+ export declare class HydrateCtx {
10
+ private vals;
11
+ labelers: ParsedLabelers;
12
+ viewer: string | null;
13
+ includeTakedowns: boolean | undefined;
14
+ constructor(vals: HydrateCtxVals);
15
+ copy<V extends Partial<HydrateCtxVals>>(vals?: V): HydrateCtx & V;
16
+ }
17
+ export type HydrateCtxVals = {
10
18
  labelers: ParsedLabelers;
11
19
  viewer: string | null;
12
20
  includeTakedowns?: boolean;
@@ -49,7 +57,8 @@ export declare class Hydrator {
49
57
  feed: FeedHydrator;
50
58
  graph: GraphHydrator;
51
59
  label: LabelHydrator;
52
- constructor(dataplane: DataPlaneClient);
60
+ serviceLabelers: Set<string>;
61
+ constructor(dataplane: DataPlaneClient, serviceLabelers?: string[]);
53
62
  hydrateProfileViewers(dids: string[], ctx: HydrateCtx): Promise<HydrationState>;
54
63
  hydrateProfiles(dids: string[], ctx: HydrateCtx): Promise<HydrationState>;
55
64
  hydrateProfilesBasic(dids: string[], ctx: HydrateCtx): Promise<HydrationState>;
@@ -68,5 +77,6 @@ export declare class Hydrator {
68
77
  hydrateFollows(uris: string[]): Promise<HydrationState>;
69
78
  hydrateLabelers(dids: string[], ctx: HydrateCtx): Promise<HydrationState>;
70
79
  getRecord(uri: string, includeTakedowns?: boolean): Promise<RecordInfo<Record<string, unknown>> | undefined>;
80
+ createContext(vals: HydrateCtxVals): Promise<HydrateCtx>;
71
81
  }
72
82
  export declare const mergeStates: (stateA: HydrationState, stateB: HydrationState) => HydrationState;
@@ -1,14 +1,18 @@
1
1
  import { DataPlaneClient } from '../data-plane/client';
2
2
  import { Label } from '../lexicon/types/com/atproto/label/defs';
3
3
  import { Record as LabelerRecord } from '../lexicon/types/app/bsky/labeler/service';
4
- import { HydrationMap, RecordInfo } from './util';
4
+ import { HydrationMap, Merges, RecordInfo } from './util';
5
5
  import { ParsedLabelers } from '../util';
6
6
  export type { Label } from '../lexicon/types/com/atproto/label/defs';
7
7
  export type SubjectLabels = {
8
8
  isTakendown: boolean;
9
- labels: Label[];
9
+ labels: HydrationMap<Label>;
10
10
  };
11
- export type Labels = HydrationMap<SubjectLabels>;
11
+ export declare class Labels extends HydrationMap<SubjectLabels> implements Merges {
12
+ static key(label: Label): string;
13
+ merge(map: Labels): this;
14
+ getBySubject(sub: string): Label[];
15
+ }
12
16
  export type LabelerAgg = {
13
17
  likes: number;
14
18
  };
@@ -1,7 +1,10 @@
1
1
  import { CID } from 'multiformats/cid';
2
2
  import { Record } from '../proto/bsky_pb';
3
- export declare class HydrationMap<T> extends Map<string, T | null> {
4
- merge(map: HydrationMap<T>): HydrationMap<T>;
3
+ export declare class HydrationMap<T> extends Map<string, T | null> implements Merges {
4
+ merge(map: HydrationMap<T>): this;
5
+ }
6
+ export interface Merges {
7
+ merge<T extends this>(map: T): this;
5
8
  }
6
9
  export type RecordInfo<T> = {
7
10
  record: T;