@atproto/bsky 0.0.37 → 0.0.39

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 (149) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/api/app/bsky/feed/getAuthorFeed.d.ts +2 -3
  3. package/dist/api/app/bsky/feed/getListFeed.d.ts +2 -2
  4. package/dist/api/app/bsky/feed/getTimeline.d.ts +4 -2
  5. package/dist/api/app/bsky/labeler/getServices.d.ts +3 -0
  6. package/dist/api/util.d.ts +9 -2
  7. package/dist/auth-verifier.d.ts +1 -1
  8. package/dist/context.d.ts +3 -0
  9. package/dist/data-plane/server/db/database-schema.d.ts +2 -2
  10. package/dist/data-plane/server/db/migrations/20240226T225725627Z-labelers.d.ts +3 -0
  11. package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
  12. package/dist/data-plane/server/db/tables/labeler.d.ts +13 -0
  13. package/dist/data-plane/server/indexing/index.d.ts +2 -0
  14. package/dist/data-plane/server/indexing/plugins/labeler.d.ts +10 -0
  15. package/dist/data-plane/server/util.d.ts +6 -6
  16. package/dist/hydration/actor.d.ts +3 -0
  17. package/dist/hydration/hydrator.d.ts +27 -22
  18. package/dist/hydration/label.d.ts +23 -9
  19. package/dist/index.js +4100 -4645
  20. package/dist/index.js.map +3 -3
  21. package/dist/lexicon/index.d.ts +7 -27
  22. package/dist/lexicon/lexicons.d.ts +516 -1463
  23. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +23 -1
  24. package/dist/lexicon/types/app/bsky/embed/record.d.ts +2 -1
  25. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -0
  26. package/dist/lexicon/types/app/bsky/graph/defs.d.ts +3 -0
  27. package/dist/lexicon/types/app/bsky/labeler/defs.d.ts +41 -0
  28. package/dist/lexicon/types/{com/atproto/admin/searchRepos.d.ts → app/bsky/labeler/getServices.d.ts} +7 -7
  29. package/dist/lexicon/types/app/bsky/labeler/service.d.ts +14 -0
  30. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +0 -304
  31. package/dist/lexicon/types/com/atproto/label/defs.d.ts +23 -0
  32. package/dist/lexicon/types/com/atproto/server/describeServer.d.ts +7 -0
  33. package/dist/proto/bsky_connect.d.ts +7 -1
  34. package/dist/proto/bsky_pb.d.ts +25 -0
  35. package/dist/util.d.ts +7 -0
  36. package/dist/views/index.d.ts +3 -0
  37. package/dist/views/types.d.ts +2 -1
  38. package/package.json +14 -13
  39. package/proto/bsky.proto +12 -0
  40. package/src/api/app/bsky/actor/getProfile.ts +21 -17
  41. package/src/api/app/bsky/actor/getProfiles.ts +16 -7
  42. package/src/api/app/bsky/actor/getSuggestions.ts +18 -13
  43. package/src/api/app/bsky/actor/searchActors.ts +9 -5
  44. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +12 -5
  45. package/src/api/app/bsky/feed/getActorFeeds.ts +16 -6
  46. package/src/api/app/bsky/feed/getActorLikes.ts +18 -8
  47. package/src/api/app/bsky/feed/getAuthorFeed.ts +18 -19
  48. package/src/api/app/bsky/feed/getFeed.ts +14 -7
  49. package/src/api/app/bsky/feed/getFeedGenerator.ts +8 -2
  50. package/src/api/app/bsky/feed/getFeedGenerators.ts +16 -5
  51. package/src/api/app/bsky/feed/getLikes.ts +13 -6
  52. package/src/api/app/bsky/feed/getListFeed.ts +13 -7
  53. package/src/api/app/bsky/feed/getPostThread.ts +15 -8
  54. package/src/api/app/bsky/feed/getPosts.ts +14 -5
  55. package/src/api/app/bsky/feed/getRepostedBy.ts +13 -6
  56. package/src/api/app/bsky/feed/getSuggestedFeeds.ts +8 -2
  57. package/src/api/app/bsky/feed/getTimeline.ts +14 -8
  58. package/src/api/app/bsky/feed/searchPosts.ts +9 -5
  59. package/src/api/app/bsky/graph/getBlocks.ts +10 -9
  60. package/src/api/app/bsky/graph/getFollowers.ts +23 -15
  61. package/src/api/app/bsky/graph/getFollows.ts +23 -15
  62. package/src/api/app/bsky/graph/getList.ts +14 -8
  63. package/src/api/app/bsky/graph/getListBlocks.ts +10 -7
  64. package/src/api/app/bsky/graph/getListMutes.ts +10 -7
  65. package/src/api/app/bsky/graph/getLists.ts +9 -7
  66. package/src/api/app/bsky/graph/getMutes.ts +10 -8
  67. package/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +10 -7
  68. package/src/api/app/bsky/graph/muteActor.ts +1 -1
  69. package/src/api/app/bsky/labeler/getServices.ts +46 -0
  70. package/src/api/app/bsky/notification/listNotifications.ts +12 -8
  71. package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +6 -3
  72. package/src/api/com/atproto/admin/getAccountInfos.ts +10 -3
  73. package/src/api/index.ts +2 -0
  74. package/src/api/util.ts +19 -4
  75. package/src/auth-verifier.ts +2 -2
  76. package/src/context.ts +20 -0
  77. package/src/data-plane/server/db/database-schema.ts +4 -4
  78. package/src/data-plane/server/db/migrations/20240226T225725627Z-labelers.ts +27 -0
  79. package/src/data-plane/server/db/migrations/index.ts +1 -0
  80. package/src/data-plane/server/db/tables/labeler.ts +16 -0
  81. package/src/data-plane/server/indexing/index.ts +4 -0
  82. package/src/data-plane/server/indexing/plugins/labeler.ts +77 -0
  83. package/src/data-plane/server/routes/interactions.ts +17 -1
  84. package/src/data-plane/server/routes/labels.ts +4 -2
  85. package/src/data-plane/server/routes/profile.ts +15 -1
  86. package/src/data-plane/server/routes/records.ts +1 -0
  87. package/src/hydration/actor.ts +6 -0
  88. package/src/hydration/hydrator.ts +171 -97
  89. package/src/hydration/label.ts +106 -20
  90. package/src/index.ts +1 -3
  91. package/src/lexicon/index.ts +22 -137
  92. package/src/lexicon/lexicons.ts +552 -1635
  93. package/src/lexicon/types/app/bsky/actor/defs.ts +57 -1
  94. package/src/lexicon/types/app/bsky/embed/record.ts +2 -0
  95. package/src/lexicon/types/app/bsky/feed/defs.ts +1 -0
  96. package/src/lexicon/types/app/bsky/graph/defs.ts +3 -0
  97. package/src/lexicon/types/app/bsky/labeler/defs.ts +93 -0
  98. package/src/lexicon/types/{com/atproto/admin/searchRepos.ts → app/bsky/labeler/getServices.ts} +8 -8
  99. package/src/lexicon/types/app/bsky/labeler/service.ts +31 -0
  100. package/src/lexicon/types/com/atproto/admin/defs.ts +0 -694
  101. package/src/lexicon/types/com/atproto/label/defs.ts +78 -0
  102. package/src/lexicon/types/com/atproto/server/describeServer.ts +18 -0
  103. package/src/proto/bsky_connect.ts +11 -0
  104. package/src/proto/bsky_pb.ts +146 -0
  105. package/src/util.ts +44 -0
  106. package/src/views/index.ts +77 -8
  107. package/src/views/types.ts +6 -3
  108. package/tests/__snapshots__/feed-generation.test.ts.snap +12 -45
  109. package/tests/_util.ts +21 -0
  110. package/tests/data-plane/__snapshots__/indexing.test.ts.snap +20 -8
  111. package/tests/label-hydration.test.ts +162 -0
  112. package/tests/views/__snapshots__/author-feed.test.ts.snap +0 -46
  113. package/tests/views/__snapshots__/block-lists.test.ts.snap +7 -17
  114. package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
  115. package/tests/views/__snapshots__/labeler-service.test.ts.snap +156 -0
  116. package/tests/views/__snapshots__/list-feed.test.ts.snap +0 -20
  117. package/tests/views/__snapshots__/mute-lists.test.ts.snap +10 -18
  118. package/tests/views/__snapshots__/mutes.test.ts.snap +0 -4
  119. package/tests/views/__snapshots__/notifications.test.ts.snap +0 -9
  120. package/tests/views/__snapshots__/posts.test.ts.snap +0 -7
  121. package/tests/views/__snapshots__/profile.test.ts.snap +40 -6
  122. package/tests/views/__snapshots__/thread.test.ts.snap +0 -38
  123. package/tests/views/__snapshots__/threadgating.test.ts.snap +2 -0
  124. package/tests/views/__snapshots__/timeline.test.ts.snap +0 -145
  125. package/tests/views/labeler-service.test.ts +156 -0
  126. package/tests/views/takedown-labels.test.ts +133 -0
  127. package/tests/views/timeline.test.ts +7 -2
  128. package/dist/data-plane/server/db/tables/moderation.d.ts +0 -42
  129. package/dist/lexicon/types/com/atproto/admin/createCommunicationTemplate.d.ts +0 -37
  130. package/dist/lexicon/types/com/atproto/admin/deleteCommunicationTemplate.d.ts +0 -25
  131. package/dist/lexicon/types/com/atproto/admin/emitModerationEvent.d.ts +0 -45
  132. package/dist/lexicon/types/com/atproto/admin/getModerationEvent.d.ts +0 -29
  133. package/dist/lexicon/types/com/atproto/admin/getRecord.d.ts +0 -31
  134. package/dist/lexicon/types/com/atproto/admin/getRepo.d.ts +0 -30
  135. package/dist/lexicon/types/com/atproto/admin/listCommunicationTemplates.d.ts +0 -31
  136. package/dist/lexicon/types/com/atproto/admin/queryModerationEvents.d.ts +0 -48
  137. package/dist/lexicon/types/com/atproto/admin/queryModerationStatuses.d.ts +0 -50
  138. package/dist/lexicon/types/com/atproto/admin/updateCommunicationTemplate.d.ts +0 -39
  139. package/src/data-plane/server/db/tables/moderation.ts +0 -59
  140. package/src/lexicon/types/com/atproto/admin/createCommunicationTemplate.ts +0 -54
  141. package/src/lexicon/types/com/atproto/admin/deleteCommunicationTemplate.ts +0 -38
  142. package/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts +0 -67
  143. package/src/lexicon/types/com/atproto/admin/getModerationEvent.ts +0 -41
  144. package/src/lexicon/types/com/atproto/admin/getRecord.ts +0 -43
  145. package/src/lexicon/types/com/atproto/admin/getRepo.ts +0 -42
  146. package/src/lexicon/types/com/atproto/admin/listCommunicationTemplates.ts +0 -44
  147. package/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +0 -73
  148. package/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts +0 -74
  149. package/src/lexicon/types/com/atproto/admin/updateCommunicationTemplate.ts +0 -57
@@ -64,6 +64,7 @@ export interface ProfileViewDetailed {
64
64
  followersCount?: number
65
65
  followsCount?: number
66
66
  postsCount?: number
67
+ associated?: ProfileAssociated
67
68
  indexedAt?: string
68
69
  viewer?: ViewerState
69
70
  labels?: ComAtprotoLabelDefs.Label[]
@@ -82,6 +83,25 @@ export function validateProfileViewDetailed(v: unknown): ValidationResult {
82
83
  return lexicons.validate('app.bsky.actor.defs#profileViewDetailed', v)
83
84
  }
84
85
 
86
+ export interface ProfileAssociated {
87
+ lists?: number
88
+ feedgens?: number
89
+ labeler?: boolean
90
+ [k: string]: unknown
91
+ }
92
+
93
+ export function isProfileAssociated(v: unknown): v is ProfileAssociated {
94
+ return (
95
+ isObj(v) &&
96
+ hasProp(v, '$type') &&
97
+ v.$type === 'app.bsky.actor.defs#profileAssociated'
98
+ )
99
+ }
100
+
101
+ export function validateProfileAssociated(v: unknown): ValidationResult {
102
+ return lexicons.validate('app.bsky.actor.defs#profileAssociated', v)
103
+ }
104
+
85
105
  /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */
86
106
  export interface ViewerState {
87
107
  muted?: boolean
@@ -137,8 +157,10 @@ export function validateAdultContentPref(v: unknown): ValidationResult {
137
157
  }
138
158
 
139
159
  export interface ContentLabelPref {
160
+ /** Which labeler does this preference apply to? If undefined, applies globally. */
161
+ labelerDid?: string
140
162
  label: string
141
- visibility: 'show' | 'warn' | 'hide' | (string & {})
163
+ visibility: 'ignore' | 'show' | 'warn' | 'hide' | (string & {})
142
164
  [k: string]: unknown
143
165
  }
144
166
 
@@ -315,3 +337,37 @@ export function isHiddenPostsPref(v: unknown): v is HiddenPostsPref {
315
337
  export function validateHiddenPostsPref(v: unknown): ValidationResult {
316
338
  return lexicons.validate('app.bsky.actor.defs#hiddenPostsPref', v)
317
339
  }
340
+
341
+ export interface LabelersPref {
342
+ labelers: LabelerPrefItem[]
343
+ [k: string]: unknown
344
+ }
345
+
346
+ export function isLabelersPref(v: unknown): v is LabelersPref {
347
+ return (
348
+ isObj(v) &&
349
+ hasProp(v, '$type') &&
350
+ v.$type === 'app.bsky.actor.defs#labelersPref'
351
+ )
352
+ }
353
+
354
+ export function validateLabelersPref(v: unknown): ValidationResult {
355
+ return lexicons.validate('app.bsky.actor.defs#labelersPref', v)
356
+ }
357
+
358
+ export interface LabelerPrefItem {
359
+ did: string
360
+ [k: string]: unknown
361
+ }
362
+
363
+ export function isLabelerPrefItem(v: unknown): v is LabelerPrefItem {
364
+ return (
365
+ isObj(v) &&
366
+ hasProp(v, '$type') &&
367
+ v.$type === 'app.bsky.actor.defs#labelerPrefItem'
368
+ )
369
+ }
370
+
371
+ export function validateLabelerPrefItem(v: unknown): ValidationResult {
372
+ return lexicons.validate('app.bsky.actor.defs#labelerPrefItem', v)
373
+ }
@@ -8,6 +8,7 @@ import { CID } from 'multiformats/cid'
8
8
  import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
9
9
  import * as AppBskyFeedDefs from '../feed/defs'
10
10
  import * as AppBskyGraphDefs from '../graph/defs'
11
+ import * as AppBskyLabelerDefs from '../labeler/defs'
11
12
  import * as AppBskyActorDefs from '../actor/defs'
12
13
  import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
13
14
  import * as AppBskyEmbedImages from './images'
@@ -39,6 +40,7 @@ export interface View {
39
40
  | ViewBlocked
40
41
  | AppBskyFeedDefs.GeneratorView
41
42
  | AppBskyGraphDefs.ListView
43
+ | AppBskyLabelerDefs.LabelerView
42
44
  | { $type: string; [k: string]: unknown }
43
45
  [k: string]: unknown
44
46
  }
@@ -219,6 +219,7 @@ export interface GeneratorView {
219
219
  descriptionFacets?: AppBskyRichtextFacet.Main[]
220
220
  avatar?: string
221
221
  likeCount?: number
222
+ labels?: ComAtprotoLabelDefs.Label[]
222
223
  viewer?: GeneratorViewerState
223
224
  indexedAt: string
224
225
  [k: string]: unknown
@@ -5,6 +5,7 @@ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
5
  import { lexicons } from '../../../../lexicons'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { CID } from 'multiformats/cid'
8
+ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
8
9
  import * as AppBskyActorDefs from '../actor/defs'
9
10
  import * as AppBskyRichtextFacet from '../richtext/facet'
10
11
 
@@ -14,6 +15,7 @@ export interface ListViewBasic {
14
15
  name: string
15
16
  purpose: ListPurpose
16
17
  avatar?: string
18
+ labels?: ComAtprotoLabelDefs.Label[]
17
19
  viewer?: ListViewerState
18
20
  indexedAt?: string
19
21
  [k: string]: unknown
@@ -40,6 +42,7 @@ export interface ListView {
40
42
  description?: string
41
43
  descriptionFacets?: AppBskyRichtextFacet.Main[]
42
44
  avatar?: string
45
+ labels?: ComAtprotoLabelDefs.Label[]
43
46
  viewer?: ListViewerState
44
47
  indexedAt: string
45
48
  [k: string]: unknown
@@ -0,0 +1,93 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { lexicons } from '../../../../lexicons'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { CID } from 'multiformats/cid'
8
+ import * as AppBskyActorDefs from '../actor/defs'
9
+ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
10
+
11
+ export interface LabelerView {
12
+ uri: string
13
+ cid: string
14
+ creator: AppBskyActorDefs.ProfileView
15
+ likeCount?: number
16
+ viewer?: LabelerViewerState
17
+ indexedAt: string
18
+ labels?: ComAtprotoLabelDefs.Label[]
19
+ [k: string]: unknown
20
+ }
21
+
22
+ export function isLabelerView(v: unknown): v is LabelerView {
23
+ return (
24
+ isObj(v) &&
25
+ hasProp(v, '$type') &&
26
+ v.$type === 'app.bsky.labeler.defs#labelerView'
27
+ )
28
+ }
29
+
30
+ export function validateLabelerView(v: unknown): ValidationResult {
31
+ return lexicons.validate('app.bsky.labeler.defs#labelerView', v)
32
+ }
33
+
34
+ export interface LabelerViewDetailed {
35
+ uri: string
36
+ cid: string
37
+ creator: AppBskyActorDefs.ProfileView
38
+ policies: LabelerPolicies
39
+ likeCount?: number
40
+ viewer?: LabelerViewerState
41
+ indexedAt: string
42
+ labels?: ComAtprotoLabelDefs.Label[]
43
+ [k: string]: unknown
44
+ }
45
+
46
+ export function isLabelerViewDetailed(v: unknown): v is LabelerViewDetailed {
47
+ return (
48
+ isObj(v) &&
49
+ hasProp(v, '$type') &&
50
+ v.$type === 'app.bsky.labeler.defs#labelerViewDetailed'
51
+ )
52
+ }
53
+
54
+ export function validateLabelerViewDetailed(v: unknown): ValidationResult {
55
+ return lexicons.validate('app.bsky.labeler.defs#labelerViewDetailed', v)
56
+ }
57
+
58
+ export interface LabelerViewerState {
59
+ like?: string
60
+ [k: string]: unknown
61
+ }
62
+
63
+ export function isLabelerViewerState(v: unknown): v is LabelerViewerState {
64
+ return (
65
+ isObj(v) &&
66
+ hasProp(v, '$type') &&
67
+ v.$type === 'app.bsky.labeler.defs#labelerViewerState'
68
+ )
69
+ }
70
+
71
+ export function validateLabelerViewerState(v: unknown): ValidationResult {
72
+ return lexicons.validate('app.bsky.labeler.defs#labelerViewerState', v)
73
+ }
74
+
75
+ export interface LabelerPolicies {
76
+ /** The label values which this labeler publishes. May include global or custom labels. */
77
+ labelValues: ComAtprotoLabelDefs.LabelValue[]
78
+ /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */
79
+ labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]
80
+ [k: string]: unknown
81
+ }
82
+
83
+ export function isLabelerPolicies(v: unknown): v is LabelerPolicies {
84
+ return (
85
+ isObj(v) &&
86
+ hasProp(v, '$type') &&
87
+ v.$type === 'app.bsky.labeler.defs#labelerPolicies'
88
+ )
89
+ }
90
+
91
+ export function validateLabelerPolicies(v: unknown): ValidationResult {
92
+ return lexicons.validate('app.bsky.labeler.defs#labelerPolicies', v)
93
+ }
@@ -7,21 +7,21 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
- import * as ComAtprotoAdminDefs from './defs'
10
+ import * as AppBskyLabelerDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
- /** DEPRECATED: use 'q' instead */
14
- term?: string
15
- q?: string
16
- limit: number
17
- cursor?: string
13
+ dids: string[]
14
+ detailed: boolean
18
15
  }
19
16
 
20
17
  export type InputSchema = undefined
21
18
 
22
19
  export interface OutputSchema {
23
- cursor?: string
24
- repos: ComAtprotoAdminDefs.RepoView[]
20
+ views: (
21
+ | AppBskyLabelerDefs.LabelerView
22
+ | AppBskyLabelerDefs.LabelerViewDetailed
23
+ | { $type: string; [k: string]: unknown }
24
+ )[]
25
25
  [k: string]: unknown
26
26
  }
27
27
 
@@ -0,0 +1,31 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { lexicons } from '../../../../lexicons'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { CID } from 'multiformats/cid'
8
+ import * as AppBskyLabelerDefs from './defs'
9
+ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
10
+
11
+ export interface Record {
12
+ policies: AppBskyLabelerDefs.LabelerPolicies
13
+ labels?:
14
+ | ComAtprotoLabelDefs.SelfLabels
15
+ | { $type: string; [k: string]: unknown }
16
+ createdAt: string
17
+ [k: string]: unknown
18
+ }
19
+
20
+ export function isRecord(v: unknown): v is Record {
21
+ return (
22
+ isObj(v) &&
23
+ hasProp(v, '$type') &&
24
+ (v.$type === 'app.bsky.labeler.service#main' ||
25
+ v.$type === 'app.bsky.labeler.service')
26
+ )
27
+ }
28
+
29
+ export function validateRecord(v: unknown): ValidationResult {
30
+ return lexicons.validate('app.bsky.labeler.service#main', v)
31
+ }