@atproto/bsky 0.0.14 → 0.0.16

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 (195) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/api/app/bsky/feed/searchPosts.d.ts +3 -0
  3. package/dist/api/com/atproto/moderation/util.d.ts +4 -3
  4. package/dist/config.d.ts +2 -2
  5. package/dist/context.d.ts +16 -1
  6. package/dist/db/index.js +26 -1
  7. package/dist/db/index.js.map +3 -3
  8. package/dist/db/migrations/20231003T202833377Z-create-moderation-subject-status.d.ts +3 -0
  9. package/dist/db/migrations/index.d.ts +1 -0
  10. package/dist/db/pagination.d.ts +2 -1
  11. package/dist/db/{periodic-moderation-action-reversal.d.ts → periodic-moderation-event-reversal.d.ts} +3 -5
  12. package/dist/db/tables/moderation.d.ts +24 -34
  13. package/dist/feed-gen/types.d.ts +1 -1
  14. package/dist/index.d.ts +2 -1
  15. package/dist/index.js +3332 -2430
  16. package/dist/index.js.map +3 -3
  17. package/dist/lexicon/index.d.ts +18 -18
  18. package/dist/lexicon/lexicons.d.ts +460 -385
  19. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -7
  20. package/dist/lexicon/types/app/bsky/graph/defs.d.ts +1 -0
  21. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +116 -48
  22. package/dist/lexicon/types/com/atproto/admin/{takeModerationAction.d.ts → emitModerationEvent.d.ts} +5 -6
  23. package/dist/lexicon/types/com/atproto/admin/{getModerationAction.d.ts → getModerationEvent.d.ts} +1 -1
  24. package/dist/lexicon/types/com/atproto/admin/{getModerationActions.d.ts → queryModerationEvents.d.ts} +5 -1
  25. package/dist/lexicon/types/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +12 -6
  26. package/dist/lexicon/types/com/atproto/admin/sendEmail.d.ts +1 -0
  27. package/dist/lexicon/types/com/atproto/{admin/getModerationReport.d.ts → temp/fetchLabels.d.ts} +7 -3
  28. package/dist/migrate-moderation-data.d.ts +1 -0
  29. package/dist/services/actor/views.d.ts +2 -5
  30. package/dist/services/feed/index.d.ts +1 -0
  31. package/dist/services/feed/util.d.ts +9 -1
  32. package/dist/services/feed/views.d.ts +6 -17
  33. package/dist/services/graph/index.d.ts +5 -29
  34. package/dist/services/graph/types.d.ts +1 -0
  35. package/dist/services/moderation/index.d.ts +135 -72
  36. package/dist/services/moderation/pagination.d.ts +36 -0
  37. package/dist/services/moderation/status.d.ts +13 -0
  38. package/dist/services/moderation/types.d.ts +35 -0
  39. package/dist/services/moderation/views.d.ts +18 -14
  40. package/dist/util/debug.d.ts +1 -1
  41. package/package.json +14 -15
  42. package/src/api/app/bsky/actor/getSuggestions.ts +45 -21
  43. package/src/api/app/bsky/feed/getActorFeeds.ts +2 -1
  44. package/src/api/app/bsky/feed/getActorLikes.ts +1 -3
  45. package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -3
  46. package/src/api/app/bsky/feed/getFeed.ts +9 -9
  47. package/src/api/app/bsky/feed/getFeedGenerator.ts +3 -0
  48. package/src/api/app/bsky/feed/getFeedGenerators.ts +2 -1
  49. package/src/api/app/bsky/feed/getListFeed.ts +1 -3
  50. package/src/api/app/bsky/feed/getPostThread.ts +31 -58
  51. package/src/api/app/bsky/feed/getPosts.ts +21 -18
  52. package/src/api/app/bsky/feed/getSuggestedFeeds.ts +2 -1
  53. package/src/api/app/bsky/feed/getTimeline.ts +1 -3
  54. package/src/api/app/bsky/feed/searchPosts.ts +130 -0
  55. package/src/api/app/bsky/graph/getList.ts +6 -3
  56. package/src/api/app/bsky/graph/getListBlocks.ts +3 -2
  57. package/src/api/app/bsky/graph/getListMutes.ts +2 -1
  58. package/src/api/app/bsky/graph/getLists.ts +2 -1
  59. package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +3 -1
  60. package/src/api/blob-resolver.ts +6 -11
  61. package/src/api/com/atproto/admin/emitModerationEvent.ts +220 -0
  62. package/src/api/com/atproto/admin/{getModerationActions.ts → getModerationEvent.ts} +5 -11
  63. package/src/api/com/atproto/admin/getRecord.ts +1 -0
  64. package/src/api/com/atproto/admin/{getModerationReports.ts → queryModerationEvents.ts} +13 -16
  65. package/src/api/com/atproto/admin/queryModerationStatuses.ts +55 -0
  66. package/src/api/com/atproto/admin/util.ts +3 -1
  67. package/src/api/com/atproto/moderation/createReport.ts +9 -7
  68. package/src/api/com/atproto/moderation/util.ts +38 -20
  69. package/src/api/com/atproto/temp/fetchLabels.ts +30 -0
  70. package/src/api/index.ts +12 -14
  71. package/src/auth.ts +29 -21
  72. package/src/auto-moderator/index.ts +26 -19
  73. package/src/config.ts +6 -6
  74. package/src/context.ts +15 -9
  75. package/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +123 -0
  76. package/src/db/migrations/index.ts +1 -0
  77. package/src/db/pagination.ts +26 -3
  78. package/src/db/{periodic-moderation-action-reversal.ts → periodic-moderation-event-reversal.ts} +51 -55
  79. package/src/db/tables/moderation.ts +35 -52
  80. package/src/feed-gen/best-of-follows.ts +6 -3
  81. package/src/feed-gen/bsky-team.ts +1 -1
  82. package/src/feed-gen/hot-classic.ts +1 -1
  83. package/src/feed-gen/mutuals.ts +6 -2
  84. package/src/feed-gen/types.ts +1 -1
  85. package/src/feed-gen/whats-hot.ts +1 -1
  86. package/src/feed-gen/with-friends.ts +7 -3
  87. package/src/index.ts +2 -1
  88. package/src/lexicon/index.ts +52 -67
  89. package/src/lexicon/lexicons.ts +674 -579
  90. package/src/lexicon/types/app/bsky/actor/defs.ts +2 -2
  91. package/src/lexicon/types/app/bsky/actor/searchActors.ts +2 -2
  92. package/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts +2 -2
  93. package/src/lexicon/types/app/bsky/feed/defs.ts +1 -18
  94. package/src/lexicon/types/app/bsky/feed/searchPosts.ts +3 -3
  95. package/src/lexicon/types/app/bsky/graph/defs.ts +3 -2
  96. package/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts +4 -4
  97. package/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts +3 -3
  98. package/src/lexicon/types/com/atproto/admin/defs.ts +278 -84
  99. package/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts +1 -1
  100. package/src/lexicon/types/com/atproto/admin/{takeModerationAction.ts → emitModerationEvent.ts} +13 -11
  101. package/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts +1 -1
  102. package/src/lexicon/types/com/atproto/admin/{getModerationReport.ts → getModerationEvent.ts} +1 -1
  103. package/src/lexicon/types/com/atproto/admin/{getModerationReports.ts → queryModerationEvents.ts} +8 -15
  104. package/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts +70 -0
  105. package/src/lexicon/types/com/atproto/admin/sendEmail.ts +1 -0
  106. package/src/lexicon/types/com/atproto/label/defs.ts +9 -9
  107. package/src/lexicon/types/com/atproto/label/queryLabels.ts +2 -2
  108. package/src/lexicon/types/com/atproto/repo/applyWrites.ts +1 -1
  109. package/src/lexicon/types/com/atproto/repo/createRecord.ts +2 -2
  110. package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +2 -2
  111. package/src/lexicon/types/com/atproto/repo/listRecords.ts +1 -1
  112. package/src/lexicon/types/com/atproto/repo/putRecord.ts +3 -3
  113. package/src/lexicon/types/com/atproto/sync/listBlobs.ts +1 -1
  114. package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +4 -4
  115. package/src/lexicon/types/com/atproto/{admin/getModerationActions.ts → temp/fetchLabels.ts} +3 -5
  116. package/src/migrate-moderation-data.ts +414 -0
  117. package/src/services/actor/views.ts +5 -14
  118. package/src/services/feed/index.ts +26 -7
  119. package/src/services/feed/util.ts +47 -19
  120. package/src/services/feed/views.ts +68 -4
  121. package/src/services/graph/index.ts +21 -3
  122. package/src/services/graph/types.ts +1 -0
  123. package/src/services/indexing/plugins/block.ts +2 -3
  124. package/src/services/indexing/plugins/feed-generator.ts +2 -3
  125. package/src/services/indexing/plugins/follow.ts +2 -3
  126. package/src/services/indexing/plugins/like.ts +2 -3
  127. package/src/services/indexing/plugins/list-block.ts +2 -3
  128. package/src/services/indexing/plugins/list-item.ts +2 -3
  129. package/src/services/indexing/plugins/list.ts +2 -3
  130. package/src/services/indexing/plugins/post.ts +3 -4
  131. package/src/services/indexing/plugins/repost.ts +2 -3
  132. package/src/services/indexing/plugins/thread-gate.ts +2 -3
  133. package/src/services/label/index.ts +2 -3
  134. package/src/services/moderation/index.ts +380 -395
  135. package/src/services/moderation/pagination.ts +96 -0
  136. package/src/services/moderation/status.ts +244 -0
  137. package/src/services/moderation/types.ts +49 -0
  138. package/src/services/moderation/views.ts +278 -329
  139. package/src/util/debug.ts +2 -2
  140. package/tests/__snapshots__/feed-generation.test.ts.snap +322 -6
  141. package/tests/__snapshots__/indexing.test.ts.snap +0 -6
  142. package/tests/admin/__snapshots__/get-record.test.ts.snap +30 -132
  143. package/tests/admin/__snapshots__/get-repo.test.ts.snap +14 -60
  144. package/tests/admin/__snapshots__/moderation-events.test.ts.snap +146 -0
  145. package/tests/admin/__snapshots__/moderation-statuses.test.ts.snap +64 -0
  146. package/tests/admin/__snapshots__/moderation.test.ts.snap +0 -125
  147. package/tests/admin/get-record.test.ts +5 -9
  148. package/tests/admin/get-repo.test.ts +38 -9
  149. package/tests/admin/moderation-events.test.ts +221 -0
  150. package/tests/admin/moderation-statuses.test.ts +145 -0
  151. package/tests/admin/moderation.test.ts +512 -860
  152. package/tests/admin/repo-search.test.ts +2 -3
  153. package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -1
  154. package/tests/auto-moderator/takedowns.test.ts +45 -18
  155. package/tests/feed-generation.test.ts +57 -9
  156. package/tests/views/__snapshots__/block-lists.test.ts.snap +3 -9
  157. package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
  158. package/tests/views/__snapshots__/mute-lists.test.ts.snap +5 -5
  159. package/tests/views/__snapshots__/mutes.test.ts.snap +0 -3
  160. package/tests/views/__snapshots__/thread.test.ts.snap +0 -30
  161. package/tests/views/actor-search.test.ts +2 -3
  162. package/tests/views/author-feed.test.ts +42 -36
  163. package/tests/views/follows.test.ts +40 -35
  164. package/tests/views/list-feed.test.ts +17 -9
  165. package/tests/views/notifications.test.ts +13 -9
  166. package/tests/views/profile.test.ts +20 -18
  167. package/tests/views/suggestions.test.ts +15 -7
  168. package/tests/views/thread.test.ts +54 -26
  169. package/tests/views/threadgating.test.ts +51 -19
  170. package/tests/views/timeline.test.ts +21 -13
  171. package/dist/api/com/atproto/admin/reverseModerationAction.d.ts +0 -3
  172. package/dist/api/com/atproto/admin/takeModerationAction.d.ts +0 -3
  173. package/dist/lexicon/types/com/atproto/admin/resolveModerationReports.d.ts +0 -36
  174. package/dist/lexicon/types/com/atproto/admin/reverseModerationAction.d.ts +0 -36
  175. package/src/api/com/atproto/admin/getModerationAction.ts +0 -44
  176. package/src/api/com/atproto/admin/getModerationReport.ts +0 -43
  177. package/src/api/com/atproto/admin/resolveModerationReports.ts +0 -24
  178. package/src/api/com/atproto/admin/reverseModerationAction.ts +0 -115
  179. package/src/api/com/atproto/admin/takeModerationAction.ts +0 -156
  180. package/src/lexicon/types/com/atproto/admin/getModerationAction.ts +0 -41
  181. package/src/lexicon/types/com/atproto/admin/resolveModerationReports.ts +0 -49
  182. package/src/lexicon/types/com/atproto/admin/reverseModerationAction.ts +0 -49
  183. package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +0 -172
  184. package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +0 -178
  185. package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +0 -177
  186. package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +0 -307
  187. package/tests/admin/get-moderation-action.test.ts +0 -100
  188. package/tests/admin/get-moderation-actions.test.ts +0 -164
  189. package/tests/admin/get-moderation-report.test.ts +0 -100
  190. package/tests/admin/get-moderation-reports.test.ts +0 -332
  191. /package/dist/api/com/atproto/admin/{getModerationAction.d.ts → emitModerationEvent.d.ts} +0 -0
  192. /package/dist/api/com/atproto/admin/{getModerationActions.d.ts → getModerationEvent.d.ts} +0 -0
  193. /package/dist/api/com/atproto/admin/{getModerationReport.d.ts → queryModerationEvents.d.ts} +0 -0
  194. /package/dist/api/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +0 -0
  195. /package/dist/api/com/atproto/{admin/resolveModerationReports.d.ts → temp/fetchLabels.d.ts} +0 -0
@@ -169,7 +169,7 @@ export function validateSavedFeedsPref(v: unknown): ValidationResult {
169
169
  }
170
170
 
171
171
  export interface PersonalDetailsPref {
172
- /** The birth date of the owner of the account. */
172
+ /** The birth date of account owner. */
173
173
  birthDate?: string
174
174
  [k: string]: unknown
175
175
  }
@@ -215,7 +215,7 @@ export function validateFeedViewPref(v: unknown): ValidationResult {
215
215
  }
216
216
 
217
217
  export interface ThreadViewPref {
218
- /** Sorting mode. */
218
+ /** Sorting mode for threads. */
219
219
  sort?: 'oldest' | 'newest' | 'most-likes' | 'random' | (string & {})
220
220
  /** Show followed users at the top of all replies. */
221
221
  prioritizeFollowedUsers?: boolean
@@ -10,9 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server'
10
10
  import * as AppBskyActorDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
- /** DEPRECATED: use 'q' instead */
13
+ /** DEPRECATED: use 'q' instead. */
14
14
  term?: string
15
- /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */
15
+ /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
16
16
  q?: string
17
17
  limit: number
18
18
  cursor?: string
@@ -10,9 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server'
10
10
  import * as AppBskyActorDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
- /** DEPRECATED: use 'q' instead */
13
+ /** DEPRECATED: use 'q' instead. */
14
14
  term?: string
15
- /** search query prefix; not a full query string */
15
+ /** Search query prefix; not a full query string. */
16
16
  q?: string
17
17
  limit: number
18
18
  }
@@ -48,6 +48,7 @@ export function validatePostView(v: unknown): ValidationResult {
48
48
  export interface ViewerState {
49
49
  repost?: string
50
50
  like?: string
51
+ replyDisabled?: boolean
51
52
  [k: string]: unknown
52
53
  }
53
54
 
@@ -137,7 +138,6 @@ export interface ThreadViewPost {
137
138
  | BlockedPost
138
139
  | { $type: string; [k: string]: unknown }
139
140
  )[]
140
- viewer?: ViewerThreadState
141
141
  [k: string]: unknown
142
142
  }
143
143
 
@@ -208,23 +208,6 @@ export function validateBlockedAuthor(v: unknown): ValidationResult {
208
208
  return lexicons.validate('app.bsky.feed.defs#blockedAuthor', v)
209
209
  }
210
210
 
211
- export interface ViewerThreadState {
212
- canReply?: boolean
213
- [k: string]: unknown
214
- }
215
-
216
- export function isViewerThreadState(v: unknown): v is ViewerThreadState {
217
- return (
218
- isObj(v) &&
219
- hasProp(v, '$type') &&
220
- v.$type === 'app.bsky.feed.defs#viewerThreadState'
221
- )
222
- }
223
-
224
- export function validateViewerThreadState(v: unknown): ValidationResult {
225
- return lexicons.validate('app.bsky.feed.defs#viewerThreadState', v)
226
- }
227
-
228
211
  export interface GeneratorView {
229
212
  uri: string
230
213
  cid: string
@@ -10,10 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server'
10
10
  import * as AppBskyFeedDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
- /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */
13
+ /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
14
14
  q: string
15
15
  limit: number
16
- /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */
16
+ /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
17
17
  cursor?: string
18
18
  }
19
19
 
@@ -21,7 +21,7 @@ export type InputSchema = undefined
21
21
 
22
22
  export interface OutputSchema {
23
23
  cursor?: string
24
- /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */
24
+ /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
25
25
  hitsTotal?: number
26
26
  posts: AppBskyFeedDefs.PostView[]
27
27
  [k: string]: unknown
@@ -58,6 +58,7 @@ export function validateListView(v: unknown): ValidationResult {
58
58
  }
59
59
 
60
60
  export interface ListItemView {
61
+ uri: string
61
62
  subject: AppBskyActorDefs.ProfileView
62
63
  [k: string]: unknown
63
64
  }
@@ -79,9 +80,9 @@ export type ListPurpose =
79
80
  | 'app.bsky.graph.defs#curatelist'
80
81
  | (string & {})
81
82
 
82
- /** A list of actors to apply an aggregate moderation action (mute/block) on */
83
+ /** A list of actors to apply an aggregate moderation action (mute/block) on. */
83
84
  export const MODLIST = 'app.bsky.graph.defs#modlist'
84
- /** A list of actors used for curation purposes such as list feeds or interaction gating */
85
+ /** A list of actors used for curation purposes such as list feeds or interaction gating. */
85
86
  export const CURATELIST = 'app.bsky.graph.defs#curatelist'
86
87
 
87
88
  export interface ListViewerState {
@@ -10,12 +10,12 @@ import { HandlerAuth } from '@atproto/xrpc-server'
10
10
  import * as AppBskyUnspeccedDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
- /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */
13
+ /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */
14
14
  q: string
15
- /** if true, acts as fast/simple 'typeahead' query */
15
+ /** If true, acts as fast/simple 'typeahead' query. */
16
16
  typeahead?: boolean
17
17
  limit: number
18
- /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */
18
+ /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
19
19
  cursor?: string
20
20
  }
21
21
 
@@ -23,7 +23,7 @@ export type InputSchema = undefined
23
23
 
24
24
  export interface OutputSchema {
25
25
  cursor?: string
26
- /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */
26
+ /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
27
27
  hitsTotal?: number
28
28
  actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
29
29
  [k: string]: unknown
@@ -10,10 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server'
10
10
  import * as AppBskyUnspeccedDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
- /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */
13
+ /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
14
14
  q: string
15
15
  limit: number
16
- /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */
16
+ /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
17
17
  cursor?: string
18
18
  }
19
19
 
@@ -21,7 +21,7 @@ export type InputSchema = undefined
21
21
 
22
22
  export interface OutputSchema {
23
23
  cursor?: string
24
- /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */
24
+ /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
25
25
  hitsTotal?: number
26
26
  posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]
27
27
  [k: string]: unknown
@@ -28,43 +28,55 @@ export function validateStatusAttr(v: unknown): ValidationResult {
28
28
  return lexicons.validate('com.atproto.admin.defs#statusAttr', v)
29
29
  }
30
30
 
31
- export interface ActionView {
31
+ export interface ModEventView {
32
32
  id: number
33
- action: ActionType
34
- /** Indicates how long this action was meant to be in effect before automatically expiring. */
35
- durationInHours?: number
33
+ event:
34
+ | ModEventTakedown
35
+ | ModEventReverseTakedown
36
+ | ModEventComment
37
+ | ModEventReport
38
+ | ModEventLabel
39
+ | ModEventAcknowledge
40
+ | ModEventEscalate
41
+ | ModEventMute
42
+ | ModEventEmail
43
+ | { $type: string; [k: string]: unknown }
36
44
  subject:
37
45
  | RepoRef
38
46
  | ComAtprotoRepoStrongRef.Main
39
47
  | { $type: string; [k: string]: unknown }
40
48
  subjectBlobCids: string[]
41
- createLabelVals?: string[]
42
- negateLabelVals?: string[]
43
- reason: string
44
49
  createdBy: string
45
50
  createdAt: string
46
- reversal?: ActionReversal
47
- resolvedReportIds: number[]
51
+ creatorHandle?: string
52
+ subjectHandle?: string
48
53
  [k: string]: unknown
49
54
  }
50
55
 
51
- export function isActionView(v: unknown): v is ActionView {
56
+ export function isModEventView(v: unknown): v is ModEventView {
52
57
  return (
53
58
  isObj(v) &&
54
59
  hasProp(v, '$type') &&
55
- v.$type === 'com.atproto.admin.defs#actionView'
60
+ v.$type === 'com.atproto.admin.defs#modEventView'
56
61
  )
57
62
  }
58
63
 
59
- export function validateActionView(v: unknown): ValidationResult {
60
- return lexicons.validate('com.atproto.admin.defs#actionView', v)
64
+ export function validateModEventView(v: unknown): ValidationResult {
65
+ return lexicons.validate('com.atproto.admin.defs#modEventView', v)
61
66
  }
62
67
 
63
- export interface ActionViewDetail {
68
+ export interface ModEventViewDetail {
64
69
  id: number
65
- action: ActionType
66
- /** Indicates how long this action was meant to be in effect before automatically expiring. */
67
- durationInHours?: number
70
+ event:
71
+ | ModEventTakedown
72
+ | ModEventReverseTakedown
73
+ | ModEventComment
74
+ | ModEventReport
75
+ | ModEventLabel
76
+ | ModEventAcknowledge
77
+ | ModEventEscalate
78
+ | ModEventMute
79
+ | { $type: string; [k: string]: unknown }
68
80
  subject:
69
81
  | RepoView
70
82
  | RepoViewNotFound
@@ -72,123 +84,100 @@ export interface ActionViewDetail {
72
84
  | RecordViewNotFound
73
85
  | { $type: string; [k: string]: unknown }
74
86
  subjectBlobs: BlobView[]
75
- createLabelVals?: string[]
76
- negateLabelVals?: string[]
77
- reason: string
78
87
  createdBy: string
79
88
  createdAt: string
80
- reversal?: ActionReversal
81
- resolvedReports: ReportView[]
82
89
  [k: string]: unknown
83
90
  }
84
91
 
85
- export function isActionViewDetail(v: unknown): v is ActionViewDetail {
92
+ export function isModEventViewDetail(v: unknown): v is ModEventViewDetail {
86
93
  return (
87
94
  isObj(v) &&
88
95
  hasProp(v, '$type') &&
89
- v.$type === 'com.atproto.admin.defs#actionViewDetail'
96
+ v.$type === 'com.atproto.admin.defs#modEventViewDetail'
90
97
  )
91
98
  }
92
99
 
93
- export function validateActionViewDetail(v: unknown): ValidationResult {
94
- return lexicons.validate('com.atproto.admin.defs#actionViewDetail', v)
100
+ export function validateModEventViewDetail(v: unknown): ValidationResult {
101
+ return lexicons.validate('com.atproto.admin.defs#modEventViewDetail', v)
95
102
  }
96
103
 
97
- export interface ActionViewCurrent {
104
+ export interface ReportView {
98
105
  id: number
99
- action: ActionType
100
- /** Indicates how long this action was meant to be in effect before automatically expiring. */
101
- durationInHours?: number
102
- [k: string]: unknown
103
- }
104
-
105
- export function isActionViewCurrent(v: unknown): v is ActionViewCurrent {
106
- return (
107
- isObj(v) &&
108
- hasProp(v, '$type') &&
109
- v.$type === 'com.atproto.admin.defs#actionViewCurrent'
110
- )
111
- }
112
-
113
- export function validateActionViewCurrent(v: unknown): ValidationResult {
114
- return lexicons.validate('com.atproto.admin.defs#actionViewCurrent', v)
115
- }
116
-
117
- export interface ActionReversal {
118
- reason: string
119
- createdBy: string
106
+ reasonType: ComAtprotoModerationDefs.ReasonType
107
+ comment?: string
108
+ subjectRepoHandle?: string
109
+ subject:
110
+ | RepoRef
111
+ | ComAtprotoRepoStrongRef.Main
112
+ | { $type: string; [k: string]: unknown }
113
+ reportedBy: string
120
114
  createdAt: string
115
+ resolvedByActionIds: number[]
121
116
  [k: string]: unknown
122
117
  }
123
118
 
124
- export function isActionReversal(v: unknown): v is ActionReversal {
119
+ export function isReportView(v: unknown): v is ReportView {
125
120
  return (
126
121
  isObj(v) &&
127
122
  hasProp(v, '$type') &&
128
- v.$type === 'com.atproto.admin.defs#actionReversal'
123
+ v.$type === 'com.atproto.admin.defs#reportView'
129
124
  )
130
125
  }
131
126
 
132
- export function validateActionReversal(v: unknown): ValidationResult {
133
- return lexicons.validate('com.atproto.admin.defs#actionReversal', v)
127
+ export function validateReportView(v: unknown): ValidationResult {
128
+ return lexicons.validate('com.atproto.admin.defs#reportView', v)
134
129
  }
135
130
 
136
- export type ActionType =
137
- | 'lex:com.atproto.admin.defs#takedown'
138
- | 'lex:com.atproto.admin.defs#flag'
139
- | 'lex:com.atproto.admin.defs#acknowledge'
140
- | 'lex:com.atproto.admin.defs#escalate'
141
- | (string & {})
142
-
143
- /** Moderation action type: Takedown. Indicates that content should not be served by the PDS. */
144
- export const TAKEDOWN = 'com.atproto.admin.defs#takedown'
145
- /** Moderation action type: Flag. Indicates that the content was reviewed and considered to violate PDS rules, but may still be served. */
146
- export const FLAG = 'com.atproto.admin.defs#flag'
147
- /** Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules. */
148
- export const ACKNOWLEDGE = 'com.atproto.admin.defs#acknowledge'
149
- /** Moderation action type: Escalate. Indicates that the content has been flagged for additional review. */
150
- export const ESCALATE = 'com.atproto.admin.defs#escalate'
151
-
152
- export interface ReportView {
131
+ export interface SubjectStatusView {
153
132
  id: number
154
- reasonType: ComAtprotoModerationDefs.ReasonType
155
- reason?: string
156
- subjectRepoHandle?: string
157
133
  subject:
158
134
  | RepoRef
159
135
  | ComAtprotoRepoStrongRef.Main
160
136
  | { $type: string; [k: string]: unknown }
161
- reportedBy: string
137
+ subjectBlobCids?: string[]
138
+ subjectRepoHandle?: string
139
+ /** Timestamp referencing when the last update was made to the moderation status of the subject */
140
+ updatedAt: string
141
+ /** Timestamp referencing the first moderation status impacting event was emitted on the subject */
162
142
  createdAt: string
163
- resolvedByActionIds: number[]
143
+ reviewState: SubjectReviewState
144
+ /** Sticky comment on the subject. */
145
+ comment?: string
146
+ muteUntil?: string
147
+ lastReviewedBy?: string
148
+ lastReviewedAt?: string
149
+ lastReportedAt?: string
150
+ takendown?: boolean
151
+ suspendUntil?: string
164
152
  [k: string]: unknown
165
153
  }
166
154
 
167
- export function isReportView(v: unknown): v is ReportView {
155
+ export function isSubjectStatusView(v: unknown): v is SubjectStatusView {
168
156
  return (
169
157
  isObj(v) &&
170
158
  hasProp(v, '$type') &&
171
- v.$type === 'com.atproto.admin.defs#reportView'
159
+ v.$type === 'com.atproto.admin.defs#subjectStatusView'
172
160
  )
173
161
  }
174
162
 
175
- export function validateReportView(v: unknown): ValidationResult {
176
- return lexicons.validate('com.atproto.admin.defs#reportView', v)
163
+ export function validateSubjectStatusView(v: unknown): ValidationResult {
164
+ return lexicons.validate('com.atproto.admin.defs#subjectStatusView', v)
177
165
  }
178
166
 
179
167
  export interface ReportViewDetail {
180
168
  id: number
181
169
  reasonType: ComAtprotoModerationDefs.ReasonType
182
- reason?: string
170
+ comment?: string
183
171
  subject:
184
172
  | RepoView
185
173
  | RepoViewNotFound
186
174
  | RecordView
187
175
  | RecordViewNotFound
188
176
  | { $type: string; [k: string]: unknown }
177
+ subjectStatus?: SubjectStatusView
189
178
  reportedBy: string
190
179
  createdAt: string
191
- resolvedByActions: ActionView[]
180
+ resolvedByActions: ModEventView[]
192
181
  [k: string]: unknown
193
182
  }
194
183
 
@@ -241,6 +230,7 @@ export interface RepoViewDetail {
241
230
  invites?: ComAtprotoServerDefs.InviteCode[]
242
231
  invitesDisabled?: boolean
243
232
  inviteNote?: string
233
+ emailConfirmedAt?: string
244
234
  [k: string]: unknown
245
235
  }
246
236
 
@@ -264,6 +254,7 @@ export interface AccountView {
264
254
  invitedBy?: ComAtprotoServerDefs.InviteCode
265
255
  invites?: ComAtprotoServerDefs.InviteCode[]
266
256
  invitesDisabled?: boolean
257
+ emailConfirmedAt?: string
267
258
  inviteNote?: string
268
259
  [k: string]: unknown
269
260
  }
@@ -398,7 +389,7 @@ export function validateRecordViewNotFound(v: unknown): ValidationResult {
398
389
  }
399
390
 
400
391
  export interface Moderation {
401
- currentAction?: ActionViewCurrent
392
+ subjectStatus?: SubjectStatusView
402
393
  [k: string]: unknown
403
394
  }
404
395
 
@@ -415,9 +406,7 @@ export function validateModeration(v: unknown): ValidationResult {
415
406
  }
416
407
 
417
408
  export interface ModerationDetail {
418
- currentAction?: ActionViewCurrent
419
- actions: ActionView[]
420
- reports: ReportView[]
409
+ subjectStatus?: SubjectStatusView
421
410
  [k: string]: unknown
422
411
  }
423
412
 
@@ -494,3 +483,208 @@ export function isVideoDetails(v: unknown): v is VideoDetails {
494
483
  export function validateVideoDetails(v: unknown): ValidationResult {
495
484
  return lexicons.validate('com.atproto.admin.defs#videoDetails', v)
496
485
  }
486
+
487
+ export type SubjectReviewState =
488
+ | 'lex:com.atproto.admin.defs#reviewOpen'
489
+ | 'lex:com.atproto.admin.defs#reviewEscalated'
490
+ | 'lex:com.atproto.admin.defs#reviewClosed'
491
+ | (string & {})
492
+
493
+ /** Moderator review status of a subject: Open. Indicates that the subject needs to be reviewed by a moderator */
494
+ export const REVIEWOPEN = 'com.atproto.admin.defs#reviewOpen'
495
+ /** Moderator review status of a subject: Escalated. Indicates that the subject was escalated for review by a moderator */
496
+ export const REVIEWESCALATED = 'com.atproto.admin.defs#reviewEscalated'
497
+ /** Moderator review status of a subject: Closed. Indicates that the subject was already reviewed and resolved by a moderator */
498
+ export const REVIEWCLOSED = 'com.atproto.admin.defs#reviewClosed'
499
+
500
+ /** Take down a subject permanently or temporarily */
501
+ export interface ModEventTakedown {
502
+ comment?: string
503
+ /** Indicates how long the takedown should be in effect before automatically expiring. */
504
+ durationInHours?: number
505
+ [k: string]: unknown
506
+ }
507
+
508
+ export function isModEventTakedown(v: unknown): v is ModEventTakedown {
509
+ return (
510
+ isObj(v) &&
511
+ hasProp(v, '$type') &&
512
+ v.$type === 'com.atproto.admin.defs#modEventTakedown'
513
+ )
514
+ }
515
+
516
+ export function validateModEventTakedown(v: unknown): ValidationResult {
517
+ return lexicons.validate('com.atproto.admin.defs#modEventTakedown', v)
518
+ }
519
+
520
+ /** Revert take down action on a subject */
521
+ export interface ModEventReverseTakedown {
522
+ /** Describe reasoning behind the reversal. */
523
+ comment?: string
524
+ [k: string]: unknown
525
+ }
526
+
527
+ export function isModEventReverseTakedown(
528
+ v: unknown,
529
+ ): v is ModEventReverseTakedown {
530
+ return (
531
+ isObj(v) &&
532
+ hasProp(v, '$type') &&
533
+ v.$type === 'com.atproto.admin.defs#modEventReverseTakedown'
534
+ )
535
+ }
536
+
537
+ export function validateModEventReverseTakedown(v: unknown): ValidationResult {
538
+ return lexicons.validate('com.atproto.admin.defs#modEventReverseTakedown', v)
539
+ }
540
+
541
+ /** Add a comment to a subject */
542
+ export interface ModEventComment {
543
+ comment: string
544
+ /** Make the comment persistent on the subject */
545
+ sticky?: boolean
546
+ [k: string]: unknown
547
+ }
548
+
549
+ export function isModEventComment(v: unknown): v is ModEventComment {
550
+ return (
551
+ isObj(v) &&
552
+ hasProp(v, '$type') &&
553
+ v.$type === 'com.atproto.admin.defs#modEventComment'
554
+ )
555
+ }
556
+
557
+ export function validateModEventComment(v: unknown): ValidationResult {
558
+ return lexicons.validate('com.atproto.admin.defs#modEventComment', v)
559
+ }
560
+
561
+ /** Report a subject */
562
+ export interface ModEventReport {
563
+ comment?: string
564
+ reportType: ComAtprotoModerationDefs.ReasonType
565
+ [k: string]: unknown
566
+ }
567
+
568
+ export function isModEventReport(v: unknown): v is ModEventReport {
569
+ return (
570
+ isObj(v) &&
571
+ hasProp(v, '$type') &&
572
+ v.$type === 'com.atproto.admin.defs#modEventReport'
573
+ )
574
+ }
575
+
576
+ export function validateModEventReport(v: unknown): ValidationResult {
577
+ return lexicons.validate('com.atproto.admin.defs#modEventReport', v)
578
+ }
579
+
580
+ /** Apply/Negate labels on a subject */
581
+ export interface ModEventLabel {
582
+ comment?: string
583
+ createLabelVals: string[]
584
+ negateLabelVals: string[]
585
+ [k: string]: unknown
586
+ }
587
+
588
+ export function isModEventLabel(v: unknown): v is ModEventLabel {
589
+ return (
590
+ isObj(v) &&
591
+ hasProp(v, '$type') &&
592
+ v.$type === 'com.atproto.admin.defs#modEventLabel'
593
+ )
594
+ }
595
+
596
+ export function validateModEventLabel(v: unknown): ValidationResult {
597
+ return lexicons.validate('com.atproto.admin.defs#modEventLabel', v)
598
+ }
599
+
600
+ export interface ModEventAcknowledge {
601
+ comment?: string
602
+ [k: string]: unknown
603
+ }
604
+
605
+ export function isModEventAcknowledge(v: unknown): v is ModEventAcknowledge {
606
+ return (
607
+ isObj(v) &&
608
+ hasProp(v, '$type') &&
609
+ v.$type === 'com.atproto.admin.defs#modEventAcknowledge'
610
+ )
611
+ }
612
+
613
+ export function validateModEventAcknowledge(v: unknown): ValidationResult {
614
+ return lexicons.validate('com.atproto.admin.defs#modEventAcknowledge', v)
615
+ }
616
+
617
+ export interface ModEventEscalate {
618
+ comment?: string
619
+ [k: string]: unknown
620
+ }
621
+
622
+ export function isModEventEscalate(v: unknown): v is ModEventEscalate {
623
+ return (
624
+ isObj(v) &&
625
+ hasProp(v, '$type') &&
626
+ v.$type === 'com.atproto.admin.defs#modEventEscalate'
627
+ )
628
+ }
629
+
630
+ export function validateModEventEscalate(v: unknown): ValidationResult {
631
+ return lexicons.validate('com.atproto.admin.defs#modEventEscalate', v)
632
+ }
633
+
634
+ /** Mute incoming reports on a subject */
635
+ export interface ModEventMute {
636
+ comment?: string
637
+ /** Indicates how long the subject should remain muted. */
638
+ durationInHours: number
639
+ [k: string]: unknown
640
+ }
641
+
642
+ export function isModEventMute(v: unknown): v is ModEventMute {
643
+ return (
644
+ isObj(v) &&
645
+ hasProp(v, '$type') &&
646
+ v.$type === 'com.atproto.admin.defs#modEventMute'
647
+ )
648
+ }
649
+
650
+ export function validateModEventMute(v: unknown): ValidationResult {
651
+ return lexicons.validate('com.atproto.admin.defs#modEventMute', v)
652
+ }
653
+
654
+ /** Unmute action on a subject */
655
+ export interface ModEventUnmute {
656
+ /** Describe reasoning behind the reversal. */
657
+ comment?: string
658
+ [k: string]: unknown
659
+ }
660
+
661
+ export function isModEventUnmute(v: unknown): v is ModEventUnmute {
662
+ return (
663
+ isObj(v) &&
664
+ hasProp(v, '$type') &&
665
+ v.$type === 'com.atproto.admin.defs#modEventUnmute'
666
+ )
667
+ }
668
+
669
+ export function validateModEventUnmute(v: unknown): ValidationResult {
670
+ return lexicons.validate('com.atproto.admin.defs#modEventUnmute', v)
671
+ }
672
+
673
+ /** Keep a log of outgoing email to a user */
674
+ export interface ModEventEmail {
675
+ /** The subject line of the email sent to the user. */
676
+ subjectLine: string
677
+ [k: string]: unknown
678
+ }
679
+
680
+ export function isModEventEmail(v: unknown): v is ModEventEmail {
681
+ return (
682
+ isObj(v) &&
683
+ hasProp(v, '$type') &&
684
+ v.$type === 'com.atproto.admin.defs#modEventEmail'
685
+ )
686
+ }
687
+
688
+ export function validateModEventEmail(v: unknown): ValidationResult {
689
+ return lexicons.validate('com.atproto.admin.defs#modEventEmail', v)
690
+ }
@@ -12,7 +12,7 @@ export interface QueryParams {}
12
12
 
13
13
  export interface InputSchema {
14
14
  account: string
15
- /** Additionally add a note describing why the invites were disabled */
15
+ /** Optional reason for disabled invites. */
16
16
  note?: string
17
17
  [k: string]: unknown
18
18
  }