@atproto/bsky 0.0.15 → 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 (170) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/api/com/atproto/moderation/util.d.ts +4 -3
  3. package/dist/context.d.ts +15 -0
  4. package/dist/db/index.js +26 -1
  5. package/dist/db/index.js.map +3 -3
  6. package/dist/db/migrations/20231003T202833377Z-create-moderation-subject-status.d.ts +3 -0
  7. package/dist/db/migrations/index.d.ts +1 -0
  8. package/dist/db/pagination.d.ts +2 -1
  9. package/dist/db/{periodic-moderation-action-reversal.d.ts → periodic-moderation-event-reversal.d.ts} +3 -5
  10. package/dist/db/tables/moderation.d.ts +24 -34
  11. package/dist/feed-gen/types.d.ts +1 -1
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.js +2750 -2121
  14. package/dist/index.js.map +3 -3
  15. package/dist/lexicon/index.d.ts +11 -18
  16. package/dist/lexicon/lexicons.d.ts +414 -399
  17. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -7
  18. package/dist/lexicon/types/app/bsky/graph/defs.d.ts +1 -0
  19. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +114 -48
  20. package/dist/lexicon/types/com/atproto/admin/{takeModerationAction.d.ts → emitModerationEvent.d.ts} +5 -6
  21. package/dist/lexicon/types/com/atproto/admin/{getModerationAction.d.ts → getModerationEvent.d.ts} +1 -1
  22. package/dist/lexicon/types/com/atproto/admin/{getModerationActions.d.ts → queryModerationEvents.d.ts} +5 -1
  23. package/dist/lexicon/types/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +12 -6
  24. package/dist/lexicon/types/com/atproto/admin/sendEmail.d.ts +1 -0
  25. package/dist/migrate-moderation-data.d.ts +1 -0
  26. package/dist/services/actor/views.d.ts +2 -5
  27. package/dist/services/feed/index.d.ts +1 -0
  28. package/dist/services/feed/util.d.ts +9 -1
  29. package/dist/services/feed/views.d.ts +6 -17
  30. package/dist/services/graph/index.d.ts +5 -29
  31. package/dist/services/graph/types.d.ts +1 -0
  32. package/dist/services/moderation/index.d.ts +135 -72
  33. package/dist/services/moderation/pagination.d.ts +36 -0
  34. package/dist/services/moderation/status.d.ts +13 -0
  35. package/dist/services/moderation/types.d.ts +35 -0
  36. package/dist/services/moderation/views.d.ts +18 -14
  37. package/dist/util/debug.d.ts +1 -1
  38. package/package.json +11 -11
  39. package/src/api/app/bsky/feed/getActorFeeds.ts +2 -1
  40. package/src/api/app/bsky/feed/getActorLikes.ts +1 -3
  41. package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -3
  42. package/src/api/app/bsky/feed/getFeed.ts +9 -9
  43. package/src/api/app/bsky/feed/getFeedGenerator.ts +3 -0
  44. package/src/api/app/bsky/feed/getFeedGenerators.ts +2 -1
  45. package/src/api/app/bsky/feed/getListFeed.ts +1 -3
  46. package/src/api/app/bsky/feed/getPostThread.ts +15 -54
  47. package/src/api/app/bsky/feed/getPosts.ts +21 -18
  48. package/src/api/app/bsky/feed/getSuggestedFeeds.ts +2 -1
  49. package/src/api/app/bsky/feed/getTimeline.ts +1 -3
  50. package/src/api/app/bsky/feed/searchPosts.ts +20 -17
  51. package/src/api/app/bsky/graph/getList.ts +6 -3
  52. package/src/api/app/bsky/graph/getListBlocks.ts +3 -2
  53. package/src/api/app/bsky/graph/getListMutes.ts +2 -1
  54. package/src/api/app/bsky/graph/getLists.ts +2 -1
  55. package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +3 -1
  56. package/src/api/blob-resolver.ts +6 -11
  57. package/src/api/com/atproto/admin/emitModerationEvent.ts +220 -0
  58. package/src/api/com/atproto/admin/{getModerationActions.ts → getModerationEvent.ts} +5 -11
  59. package/src/api/com/atproto/admin/getRecord.ts +1 -0
  60. package/src/api/com/atproto/admin/{getModerationReports.ts → queryModerationEvents.ts} +13 -16
  61. package/src/api/com/atproto/admin/queryModerationStatuses.ts +55 -0
  62. package/src/api/com/atproto/moderation/createReport.ts +9 -7
  63. package/src/api/com/atproto/moderation/util.ts +38 -20
  64. package/src/api/index.ts +8 -14
  65. package/src/auth.ts +29 -21
  66. package/src/auto-moderator/index.ts +26 -19
  67. package/src/context.ts +4 -0
  68. package/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +123 -0
  69. package/src/db/migrations/index.ts +1 -0
  70. package/src/db/pagination.ts +26 -3
  71. package/src/db/{periodic-moderation-action-reversal.ts → periodic-moderation-event-reversal.ts} +50 -46
  72. package/src/db/tables/moderation.ts +35 -52
  73. package/src/feed-gen/best-of-follows.ts +6 -3
  74. package/src/feed-gen/bsky-team.ts +1 -1
  75. package/src/feed-gen/hot-classic.ts +1 -1
  76. package/src/feed-gen/mutuals.ts +6 -2
  77. package/src/feed-gen/types.ts +1 -1
  78. package/src/feed-gen/whats-hot.ts +1 -1
  79. package/src/feed-gen/with-friends.ts +7 -3
  80. package/src/index.ts +2 -1
  81. package/src/lexicon/index.ts +30 -67
  82. package/src/lexicon/lexicons.ts +526 -491
  83. package/src/lexicon/types/app/bsky/feed/defs.ts +1 -18
  84. package/src/lexicon/types/app/bsky/graph/defs.ts +1 -0
  85. package/src/lexicon/types/com/atproto/admin/defs.ts +276 -84
  86. package/src/lexicon/types/com/atproto/admin/{takeModerationAction.ts → emitModerationEvent.ts} +13 -11
  87. package/src/lexicon/types/com/atproto/admin/{getModerationReport.ts → getModerationEvent.ts} +1 -1
  88. package/src/lexicon/types/com/atproto/admin/{getModerationActions.ts → queryModerationEvents.ts} +8 -1
  89. package/src/lexicon/types/com/atproto/admin/{getModerationReports.ts → queryModerationStatuses.ts} +21 -14
  90. package/src/lexicon/types/com/atproto/admin/sendEmail.ts +1 -0
  91. package/src/migrate-moderation-data.ts +414 -0
  92. package/src/services/actor/views.ts +5 -14
  93. package/src/services/feed/index.ts +26 -7
  94. package/src/services/feed/util.ts +47 -19
  95. package/src/services/feed/views.ts +68 -4
  96. package/src/services/graph/index.ts +21 -3
  97. package/src/services/graph/types.ts +1 -0
  98. package/src/services/indexing/plugins/block.ts +2 -3
  99. package/src/services/indexing/plugins/feed-generator.ts +2 -3
  100. package/src/services/indexing/plugins/follow.ts +2 -3
  101. package/src/services/indexing/plugins/like.ts +2 -3
  102. package/src/services/indexing/plugins/list-block.ts +2 -3
  103. package/src/services/indexing/plugins/list-item.ts +2 -3
  104. package/src/services/indexing/plugins/list.ts +2 -3
  105. package/src/services/indexing/plugins/post.ts +3 -4
  106. package/src/services/indexing/plugins/repost.ts +2 -3
  107. package/src/services/indexing/plugins/thread-gate.ts +2 -3
  108. package/src/services/label/index.ts +2 -3
  109. package/src/services/moderation/index.ts +380 -395
  110. package/src/services/moderation/pagination.ts +96 -0
  111. package/src/services/moderation/status.ts +244 -0
  112. package/src/services/moderation/types.ts +49 -0
  113. package/src/services/moderation/views.ts +278 -329
  114. package/src/util/debug.ts +2 -2
  115. package/tests/__snapshots__/feed-generation.test.ts.snap +322 -6
  116. package/tests/__snapshots__/indexing.test.ts.snap +0 -6
  117. package/tests/admin/__snapshots__/get-record.test.ts.snap +30 -132
  118. package/tests/admin/__snapshots__/get-repo.test.ts.snap +14 -60
  119. package/tests/admin/__snapshots__/moderation-events.test.ts.snap +146 -0
  120. package/tests/admin/__snapshots__/moderation-statuses.test.ts.snap +64 -0
  121. package/tests/admin/__snapshots__/moderation.test.ts.snap +0 -125
  122. package/tests/admin/get-record.test.ts +5 -9
  123. package/tests/admin/get-repo.test.ts +5 -9
  124. package/tests/admin/moderation-events.test.ts +221 -0
  125. package/tests/admin/moderation-statuses.test.ts +145 -0
  126. package/tests/admin/moderation.test.ts +512 -860
  127. package/tests/admin/repo-search.test.ts +2 -3
  128. package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -1
  129. package/tests/auto-moderator/takedowns.test.ts +45 -18
  130. package/tests/feed-generation.test.ts +57 -9
  131. package/tests/views/__snapshots__/block-lists.test.ts.snap +3 -9
  132. package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
  133. package/tests/views/__snapshots__/mute-lists.test.ts.snap +5 -5
  134. package/tests/views/__snapshots__/mutes.test.ts.snap +0 -3
  135. package/tests/views/__snapshots__/thread.test.ts.snap +0 -30
  136. package/tests/views/actor-search.test.ts +2 -3
  137. package/tests/views/author-feed.test.ts +42 -36
  138. package/tests/views/follows.test.ts +40 -35
  139. package/tests/views/list-feed.test.ts +17 -9
  140. package/tests/views/notifications.test.ts +13 -9
  141. package/tests/views/profile.test.ts +20 -18
  142. package/tests/views/thread.test.ts +54 -26
  143. package/tests/views/threadgating.test.ts +51 -19
  144. package/tests/views/timeline.test.ts +21 -13
  145. package/dist/api/com/atproto/admin/resolveModerationReports.d.ts +0 -3
  146. package/dist/api/com/atproto/admin/reverseModerationAction.d.ts +0 -3
  147. package/dist/api/com/atproto/admin/takeModerationAction.d.ts +0 -3
  148. package/dist/lexicon/types/com/atproto/admin/getModerationReport.d.ts +0 -29
  149. package/dist/lexicon/types/com/atproto/admin/resolveModerationReports.d.ts +0 -36
  150. package/dist/lexicon/types/com/atproto/admin/reverseModerationAction.d.ts +0 -36
  151. package/src/api/com/atproto/admin/getModerationAction.ts +0 -44
  152. package/src/api/com/atproto/admin/getModerationReport.ts +0 -43
  153. package/src/api/com/atproto/admin/resolveModerationReports.ts +0 -24
  154. package/src/api/com/atproto/admin/reverseModerationAction.ts +0 -115
  155. package/src/api/com/atproto/admin/takeModerationAction.ts +0 -156
  156. package/src/lexicon/types/com/atproto/admin/getModerationAction.ts +0 -41
  157. package/src/lexicon/types/com/atproto/admin/resolveModerationReports.ts +0 -49
  158. package/src/lexicon/types/com/atproto/admin/reverseModerationAction.ts +0 -49
  159. package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +0 -172
  160. package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +0 -178
  161. package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +0 -177
  162. package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +0 -307
  163. package/tests/admin/get-moderation-action.test.ts +0 -100
  164. package/tests/admin/get-moderation-actions.test.ts +0 -164
  165. package/tests/admin/get-moderation-report.test.ts +0 -100
  166. package/tests/admin/get-moderation-reports.test.ts +0 -332
  167. /package/dist/api/com/atproto/admin/{getModerationAction.d.ts → emitModerationEvent.d.ts} +0 -0
  168. /package/dist/api/com/atproto/admin/{getModerationActions.d.ts → getModerationEvent.d.ts} +0 -0
  169. /package/dist/api/com/atproto/admin/{getModerationReport.d.ts → queryModerationEvents.d.ts} +0 -0
  170. /package/dist/api/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +0 -0
@@ -30,6 +30,7 @@ export declare function validatePostView(v: unknown): ValidationResult;
30
30
  export interface ViewerState {
31
31
  repost?: string;
32
32
  like?: string;
33
+ replyDisabled?: boolean;
33
34
  [k: string]: unknown;
34
35
  }
35
36
  export declare function isViewerState(v: unknown): v is ViewerState;
@@ -75,7 +76,6 @@ export interface ThreadViewPost {
75
76
  $type: string;
76
77
  [k: string]: unknown;
77
78
  })[];
78
- viewer?: ViewerThreadState;
79
79
  [k: string]: unknown;
80
80
  }
81
81
  export declare function isThreadViewPost(v: unknown): v is ThreadViewPost;
@@ -102,12 +102,6 @@ export interface BlockedAuthor {
102
102
  }
103
103
  export declare function isBlockedAuthor(v: unknown): v is BlockedAuthor;
104
104
  export declare function validateBlockedAuthor(v: unknown): ValidationResult;
105
- export interface ViewerThreadState {
106
- canReply?: boolean;
107
- [k: string]: unknown;
108
- }
109
- export declare function isViewerThreadState(v: unknown): v is ViewerThreadState;
110
- export declare function validateViewerThreadState(v: unknown): ValidationResult;
111
105
  export interface GeneratorView {
112
106
  uri: string;
113
107
  cid: string;
@@ -29,6 +29,7 @@ export interface ListView {
29
29
  export declare function isListView(v: unknown): v is ListView;
30
30
  export declare function validateListView(v: unknown): ValidationResult;
31
31
  export interface ListItemView {
32
+ uri: string;
32
33
  subject: AppBskyActorDefs.ProfileView;
33
34
  [k: string]: unknown;
34
35
  }
@@ -10,71 +10,46 @@ export interface StatusAttr {
10
10
  }
11
11
  export declare function isStatusAttr(v: unknown): v is StatusAttr;
12
12
  export declare function validateStatusAttr(v: unknown): ValidationResult;
13
- export interface ActionView {
13
+ export interface ModEventView {
14
14
  id: number;
15
- action: ActionType;
16
- durationInHours?: number;
15
+ event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | ModEventEmail | {
16
+ $type: string;
17
+ [k: string]: unknown;
18
+ };
17
19
  subject: RepoRef | ComAtprotoRepoStrongRef.Main | {
18
20
  $type: string;
19
21
  [k: string]: unknown;
20
22
  };
21
23
  subjectBlobCids: string[];
22
- createLabelVals?: string[];
23
- negateLabelVals?: string[];
24
- reason: string;
25
24
  createdBy: string;
26
25
  createdAt: string;
27
- reversal?: ActionReversal;
28
- resolvedReportIds: number[];
26
+ creatorHandle?: string;
27
+ subjectHandle?: string;
29
28
  [k: string]: unknown;
30
29
  }
31
- export declare function isActionView(v: unknown): v is ActionView;
32
- export declare function validateActionView(v: unknown): ValidationResult;
33
- export interface ActionViewDetail {
30
+ export declare function isModEventView(v: unknown): v is ModEventView;
31
+ export declare function validateModEventView(v: unknown): ValidationResult;
32
+ export interface ModEventViewDetail {
34
33
  id: number;
35
- action: ActionType;
36
- durationInHours?: number;
34
+ event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | {
35
+ $type: string;
36
+ [k: string]: unknown;
37
+ };
37
38
  subject: RepoView | RepoViewNotFound | RecordView | RecordViewNotFound | {
38
39
  $type: string;
39
40
  [k: string]: unknown;
40
41
  };
41
42
  subjectBlobs: BlobView[];
42
- createLabelVals?: string[];
43
- negateLabelVals?: string[];
44
- reason: string;
45
43
  createdBy: string;
46
44
  createdAt: string;
47
- reversal?: ActionReversal;
48
- resolvedReports: ReportView[];
49
- [k: string]: unknown;
50
- }
51
- export declare function isActionViewDetail(v: unknown): v is ActionViewDetail;
52
- export declare function validateActionViewDetail(v: unknown): ValidationResult;
53
- export interface ActionViewCurrent {
54
- id: number;
55
- action: ActionType;
56
- durationInHours?: number;
57
45
  [k: string]: unknown;
58
46
  }
59
- export declare function isActionViewCurrent(v: unknown): v is ActionViewCurrent;
60
- export declare function validateActionViewCurrent(v: unknown): ValidationResult;
61
- export interface ActionReversal {
62
- reason: string;
63
- createdBy: string;
64
- createdAt: string;
65
- [k: string]: unknown;
66
- }
67
- export declare function isActionReversal(v: unknown): v is ActionReversal;
68
- export declare function validateActionReversal(v: unknown): ValidationResult;
69
- export declare type ActionType = 'lex:com.atproto.admin.defs#takedown' | 'lex:com.atproto.admin.defs#flag' | 'lex:com.atproto.admin.defs#acknowledge' | 'lex:com.atproto.admin.defs#escalate' | (string & {});
70
- export declare const TAKEDOWN = "com.atproto.admin.defs#takedown";
71
- export declare const FLAG = "com.atproto.admin.defs#flag";
72
- export declare const ACKNOWLEDGE = "com.atproto.admin.defs#acknowledge";
73
- export declare const ESCALATE = "com.atproto.admin.defs#escalate";
47
+ export declare function isModEventViewDetail(v: unknown): v is ModEventViewDetail;
48
+ export declare function validateModEventViewDetail(v: unknown): ValidationResult;
74
49
  export interface ReportView {
75
50
  id: number;
76
51
  reasonType: ComAtprotoModerationDefs.ReasonType;
77
- reason?: string;
52
+ comment?: string;
78
53
  subjectRepoHandle?: string;
79
54
  subject: RepoRef | ComAtprotoRepoStrongRef.Main | {
80
55
  $type: string;
@@ -87,17 +62,40 @@ export interface ReportView {
87
62
  }
88
63
  export declare function isReportView(v: unknown): v is ReportView;
89
64
  export declare function validateReportView(v: unknown): ValidationResult;
65
+ export interface SubjectStatusView {
66
+ id: number;
67
+ subject: RepoRef | ComAtprotoRepoStrongRef.Main | {
68
+ $type: string;
69
+ [k: string]: unknown;
70
+ };
71
+ subjectBlobCids?: string[];
72
+ subjectRepoHandle?: string;
73
+ updatedAt: string;
74
+ createdAt: string;
75
+ reviewState: SubjectReviewState;
76
+ comment?: string;
77
+ muteUntil?: string;
78
+ lastReviewedBy?: string;
79
+ lastReviewedAt?: string;
80
+ lastReportedAt?: string;
81
+ takendown?: boolean;
82
+ suspendUntil?: string;
83
+ [k: string]: unknown;
84
+ }
85
+ export declare function isSubjectStatusView(v: unknown): v is SubjectStatusView;
86
+ export declare function validateSubjectStatusView(v: unknown): ValidationResult;
90
87
  export interface ReportViewDetail {
91
88
  id: number;
92
89
  reasonType: ComAtprotoModerationDefs.ReasonType;
93
- reason?: string;
90
+ comment?: string;
94
91
  subject: RepoView | RepoViewNotFound | RecordView | RecordViewNotFound | {
95
92
  $type: string;
96
93
  [k: string]: unknown;
97
94
  };
95
+ subjectStatus?: SubjectStatusView;
98
96
  reportedBy: string;
99
97
  createdAt: string;
100
- resolvedByActions: ActionView[];
98
+ resolvedByActions: ModEventView[];
101
99
  [k: string]: unknown;
102
100
  }
103
101
  export declare function isReportViewDetail(v: unknown): v is ReportViewDetail;
@@ -199,15 +197,13 @@ export interface RecordViewNotFound {
199
197
  export declare function isRecordViewNotFound(v: unknown): v is RecordViewNotFound;
200
198
  export declare function validateRecordViewNotFound(v: unknown): ValidationResult;
201
199
  export interface Moderation {
202
- currentAction?: ActionViewCurrent;
200
+ subjectStatus?: SubjectStatusView;
203
201
  [k: string]: unknown;
204
202
  }
205
203
  export declare function isModeration(v: unknown): v is Moderation;
206
204
  export declare function validateModeration(v: unknown): ValidationResult;
207
205
  export interface ModerationDetail {
208
- currentAction?: ActionViewCurrent;
209
- actions: ActionView[];
210
- reports: ReportView[];
206
+ subjectStatus?: SubjectStatusView;
211
207
  [k: string]: unknown;
212
208
  }
213
209
  export declare function isModerationDetail(v: unknown): v is ModerationDetail;
@@ -241,3 +237,73 @@ export interface VideoDetails {
241
237
  }
242
238
  export declare function isVideoDetails(v: unknown): v is VideoDetails;
243
239
  export declare function validateVideoDetails(v: unknown): ValidationResult;
240
+ export declare type SubjectReviewState = 'lex:com.atproto.admin.defs#reviewOpen' | 'lex:com.atproto.admin.defs#reviewEscalated' | 'lex:com.atproto.admin.defs#reviewClosed' | (string & {});
241
+ export declare const REVIEWOPEN = "com.atproto.admin.defs#reviewOpen";
242
+ export declare const REVIEWESCALATED = "com.atproto.admin.defs#reviewEscalated";
243
+ export declare const REVIEWCLOSED = "com.atproto.admin.defs#reviewClosed";
244
+ export interface ModEventTakedown {
245
+ comment?: string;
246
+ durationInHours?: number;
247
+ [k: string]: unknown;
248
+ }
249
+ export declare function isModEventTakedown(v: unknown): v is ModEventTakedown;
250
+ export declare function validateModEventTakedown(v: unknown): ValidationResult;
251
+ export interface ModEventReverseTakedown {
252
+ comment?: string;
253
+ [k: string]: unknown;
254
+ }
255
+ export declare function isModEventReverseTakedown(v: unknown): v is ModEventReverseTakedown;
256
+ export declare function validateModEventReverseTakedown(v: unknown): ValidationResult;
257
+ export interface ModEventComment {
258
+ comment: string;
259
+ sticky?: boolean;
260
+ [k: string]: unknown;
261
+ }
262
+ export declare function isModEventComment(v: unknown): v is ModEventComment;
263
+ export declare function validateModEventComment(v: unknown): ValidationResult;
264
+ export interface ModEventReport {
265
+ comment?: string;
266
+ reportType: ComAtprotoModerationDefs.ReasonType;
267
+ [k: string]: unknown;
268
+ }
269
+ export declare function isModEventReport(v: unknown): v is ModEventReport;
270
+ export declare function validateModEventReport(v: unknown): ValidationResult;
271
+ export interface ModEventLabel {
272
+ comment?: string;
273
+ createLabelVals: string[];
274
+ negateLabelVals: string[];
275
+ [k: string]: unknown;
276
+ }
277
+ export declare function isModEventLabel(v: unknown): v is ModEventLabel;
278
+ export declare function validateModEventLabel(v: unknown): ValidationResult;
279
+ export interface ModEventAcknowledge {
280
+ comment?: string;
281
+ [k: string]: unknown;
282
+ }
283
+ export declare function isModEventAcknowledge(v: unknown): v is ModEventAcknowledge;
284
+ export declare function validateModEventAcknowledge(v: unknown): ValidationResult;
285
+ export interface ModEventEscalate {
286
+ comment?: string;
287
+ [k: string]: unknown;
288
+ }
289
+ export declare function isModEventEscalate(v: unknown): v is ModEventEscalate;
290
+ export declare function validateModEventEscalate(v: unknown): ValidationResult;
291
+ export interface ModEventMute {
292
+ comment?: string;
293
+ durationInHours: number;
294
+ [k: string]: unknown;
295
+ }
296
+ export declare function isModEventMute(v: unknown): v is ModEventMute;
297
+ export declare function validateModEventMute(v: unknown): ValidationResult;
298
+ export interface ModEventUnmute {
299
+ comment?: string;
300
+ [k: string]: unknown;
301
+ }
302
+ export declare function isModEventUnmute(v: unknown): v is ModEventUnmute;
303
+ export declare function validateModEventUnmute(v: unknown): ValidationResult;
304
+ export interface ModEventEmail {
305
+ subjectLine: string;
306
+ [k: string]: unknown;
307
+ }
308
+ export declare function isModEventEmail(v: unknown): v is ModEventEmail;
309
+ export declare function validateModEventEmail(v: unknown): ValidationResult;
@@ -5,20 +5,19 @@ import * as ComAtprotoRepoStrongRef from '../repo/strongRef';
5
5
  export interface QueryParams {
6
6
  }
7
7
  export interface InputSchema {
8
- action: 'com.atproto.admin.defs#takedown' | 'com.atproto.admin.defs#flag' | 'com.atproto.admin.defs#acknowledge' | (string & {});
8
+ event: ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown | ComAtprotoAdminDefs.ModEventUnmute | ComAtprotoAdminDefs.ModEventEmail | {
9
+ $type: string;
10
+ [k: string]: unknown;
11
+ };
9
12
  subject: ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main | {
10
13
  $type: string;
11
14
  [k: string]: unknown;
12
15
  };
13
16
  subjectBlobCids?: string[];
14
- createLabelVals?: string[];
15
- negateLabelVals?: string[];
16
- reason: string;
17
- durationInHours?: number;
18
17
  createdBy: string;
19
18
  [k: string]: unknown;
20
19
  }
21
- export declare type OutputSchema = ComAtprotoAdminDefs.ActionView;
20
+ export declare type OutputSchema = ComAtprotoAdminDefs.ModEventView;
22
21
  export interface HandlerInput {
23
22
  encoding: 'application/json';
24
23
  body: InputSchema;
@@ -5,7 +5,7 @@ export interface QueryParams {
5
5
  id: number;
6
6
  }
7
7
  export declare type InputSchema = undefined;
8
- export declare type OutputSchema = ComAtprotoAdminDefs.ActionViewDetail;
8
+ export declare type OutputSchema = ComAtprotoAdminDefs.ModEventViewDetail;
9
9
  export declare type HandlerInput = undefined;
10
10
  export interface HandlerSuccess {
11
11
  encoding: 'application/json';
@@ -2,14 +2,18 @@ import express from 'express';
2
2
  import { HandlerAuth } from '@atproto/xrpc-server';
3
3
  import * as ComAtprotoAdminDefs from './defs';
4
4
  export interface QueryParams {
5
+ types?: string[];
6
+ createdBy?: string;
7
+ sortDirection: 'asc' | 'desc';
5
8
  subject?: string;
9
+ includeAllUserRecords: boolean;
6
10
  limit: number;
7
11
  cursor?: string;
8
12
  }
9
13
  export declare type InputSchema = undefined;
10
14
  export interface OutputSchema {
11
15
  cursor?: string;
12
- actions: ComAtprotoAdminDefs.ActionView[];
16
+ events: ComAtprotoAdminDefs.ModEventView[];
13
17
  [k: string]: unknown;
14
18
  }
15
19
  export declare type HandlerInput = undefined;
@@ -3,19 +3,25 @@ import { HandlerAuth } from '@atproto/xrpc-server';
3
3
  import * as ComAtprotoAdminDefs from './defs';
4
4
  export interface QueryParams {
5
5
  subject?: string;
6
+ comment?: string;
7
+ reportedAfter?: string;
8
+ reportedBefore?: string;
9
+ reviewedAfter?: string;
10
+ reviewedBefore?: string;
11
+ includeMuted?: boolean;
12
+ reviewState?: string;
6
13
  ignoreSubjects?: string[];
7
- actionedBy?: string;
8
- reporters?: string[];
9
- resolved?: boolean;
10
- actionType?: 'com.atproto.admin.defs#takedown' | 'com.atproto.admin.defs#flag' | 'com.atproto.admin.defs#acknowledge' | 'com.atproto.admin.defs#escalate' | (string & {});
14
+ lastReviewedBy?: string;
15
+ sortField: 'lastReviewedAt' | 'lastReportedAt';
16
+ sortDirection: 'asc' | 'desc';
17
+ takendown?: boolean;
11
18
  limit: number;
12
19
  cursor?: string;
13
- reverse?: boolean;
14
20
  }
15
21
  export declare type InputSchema = undefined;
16
22
  export interface OutputSchema {
17
23
  cursor?: string;
18
- reports: ComAtprotoAdminDefs.ReportView[];
24
+ subjectStatuses: ComAtprotoAdminDefs.SubjectStatusView[];
19
25
  [k: string]: unknown;
20
26
  }
21
27
  export declare type HandlerInput = undefined;
@@ -6,6 +6,7 @@ export interface InputSchema {
6
6
  recipientDid: string;
7
7
  content: string;
8
8
  subject?: string;
9
+ senderDid: string;
9
10
  [k: string]: unknown;
10
11
  }
11
12
  export interface OutputSchema {
@@ -0,0 +1 @@
1
+ export declare function MigrateModerationData(): Promise<void>;
@@ -48,11 +48,8 @@ export declare class ActorViews {
48
48
  lists: ListInfoMap;
49
49
  labels: Labels;
50
50
  bam: BlockAndMuteState;
51
- }, opts?: {
52
- viewer?: string | null;
53
- }): ProfileViewMap;
54
- profileBasicPresentation(dids: string[], state: ProfileHydrationState, opts?: {
55
- viewer?: string | null;
51
+ }, viewer: string | null): ProfileViewMap;
52
+ profileBasicPresentation(dids: string[], state: ProfileHydrationState, viewer: string | null, opts?: {
56
53
  omitLabels?: boolean;
57
54
  }): ProfileViewMap;
58
55
  }
@@ -45,6 +45,7 @@ export declare class FeedService {
45
45
  getPostInfos(postUris: string[], viewer: string | null): Promise<PostInfoMap>;
46
46
  getFeedGeneratorInfos(generatorUris: string[], viewer: string | null): Promise<FeedGenInfoMap>;
47
47
  getFeedItems(uris: string[]): Promise<Record<string, FeedRow>>;
48
+ postUrisToFeedItems(uris: string[]): Promise<FeedRow[]>;
48
49
  feedItemRefs(items: FeedRow[]): {
49
50
  dids: Set<string>;
50
51
  uris: Set<string>;
@@ -5,6 +5,14 @@ export declare const invalidReplyRoot: (reply: ReplyRef, parent: {
5
5
  record: PostRecord;
6
6
  invalidReplyRoot: boolean | null;
7
7
  }) => boolean;
8
- export declare const violatesThreadGate: (db: DatabaseSchema, did: string, owner: string, root: PostRecord | null, gate: GateRecord | null) => Promise<boolean>;
8
+ declare type ParsedThreadGate = {
9
+ canReply?: boolean;
10
+ allowMentions?: boolean;
11
+ allowFollowing?: boolean;
12
+ allowListUris?: string[];
13
+ };
14
+ export declare const parseThreadGate: (replierDid: string, ownerDid: string, rootPost: PostRecord | null, gate: GateRecord | null) => ParsedThreadGate;
15
+ export declare const violatesThreadGate: (db: DatabaseSchema, replierDid: string, ownerDid: string, rootPost: PostRecord | null, gate: GateRecord | null) => Promise<boolean>;
9
16
  export declare const postToThreadgateUri: (postUri: string) => string;
10
17
  export declare const threadgateToPostUri: (gateUri: string) => string;
18
+ export {};
@@ -20,13 +20,13 @@ export declare class FeedViews {
20
20
  actor: ActorService;
21
21
  graph: GraphService;
22
22
  };
23
- formatFeedGeneratorView(info: FeedGenInfo, profiles: ActorInfoMap): GeneratorView;
24
- formatFeed(items: FeedRow[], state: FeedHydrationState, opts?: {
25
- viewer?: string | null;
23
+ formatFeedGeneratorView(info: FeedGenInfo, profiles: ActorInfoMap): GeneratorView | undefined;
24
+ formatFeed(items: FeedRow[], state: FeedHydrationState, viewer: string | null, opts?: {
26
25
  usePostViewUnion?: boolean;
27
26
  }): FeedViewPost[];
28
- formatPostView(uri: string, actors: ActorInfoMap, posts: PostInfoMap, threadgates: ThreadgateInfoMap, embeds: PostEmbedViews, labels: Labels, lists: ListInfoMap): PostView | undefined;
29
- formatMaybePostView(uri: string, actors: ActorInfoMap, posts: PostInfoMap, threadgates: ThreadgateInfoMap, embeds: PostEmbedViews, labels: Labels, lists: ListInfoMap, blocks: PostBlocksMap, opts?: {
27
+ formatPostView(uri: string, actors: ActorInfoMap, posts: PostInfoMap, threadgates: ThreadgateInfoMap, embeds: PostEmbedViews, labels: Labels, lists: ListInfoMap, viewer: string | null): PostView | undefined;
28
+ userReplyDisabled(uri: string, actors: ActorInfoMap, posts: PostInfoMap, threadgates: ThreadgateInfoMap, lists: ListInfoMap, viewer: string | null): boolean | undefined;
29
+ formatMaybePostView(uri: string, actors: ActorInfoMap, posts: PostInfoMap, threadgates: ThreadgateInfoMap, embeds: PostEmbedViews, labels: Labels, lists: ListInfoMap, blocks: PostBlocksMap, viewer: string | null, opts?: {
30
30
  usePostViewUnion?: boolean;
31
31
  }): MaybePostView | undefined;
32
32
  blockedPost(post: PostView): {
@@ -78,17 +78,6 @@ export declare class FeedViews {
78
78
  uri: string;
79
79
  cid: string;
80
80
  record: import("../../lexicon/types/app/bsky/feed/threadgate").Record;
81
- lists: {
82
- uri: string;
83
- cid: string;
84
- name: string;
85
- purpose: string;
86
- avatar: string | undefined;
87
- indexedAt: string;
88
- viewer: {
89
- muted: boolean;
90
- blocked: string | undefined;
91
- };
92
- }[];
81
+ lists: import("../../lexicon/types/app/bsky/graph/defs").ListViewBasic[];
93
82
  };
94
83
  }
@@ -2,6 +2,7 @@ import { Database } from '../../db';
2
2
  import { ImageUriBuilder } from '../../image/uri';
3
3
  import { ListInfo } from './types';
4
4
  import { ActorInfoMap } from '../actor';
5
+ import { ListView, ListViewBasic } from '../../lexicon/types/app/bsky/graph/defs';
5
6
  export * from './types';
6
7
  export declare class GraphService {
7
8
  db: Database;
@@ -43,43 +44,18 @@ export declare class GraphService {
43
44
  handle: string | null;
44
45
  indexedAt: string;
45
46
  takedownId: number | null;
46
- } & import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list">, "list" | "actor", "list.sortAt as sortAt">, import("kysely").AliasedQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_mute">, "list_mute", import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_mute">, "list_mute", "list_mute.listUri">, "viewerMuted"> | import("kysely").AliasedQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_block">, "list_block", import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_block">, "list_block", "list_block.uri">, "viewerListBlockUri">>;
47
+ } & import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list">, "list" | "actor", "list.sortAt as sortAt">, import("kysely").AliasedQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_mute">, "list_mute", import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_mute">, "list_mute", "list_mute.listUri">, "viewerMuted"> | import("kysely").AliasedQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_block">, "list_block", import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_block">, "list_block", "list_block.uri">, "viewerListBlockUri"> | import("kysely").AliasedQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_item">, "list_item", import("kysely").Selection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_item">, "list_item", "list_item.uri">, "viewerInList">>;
47
48
  getListItemsQb(): import("kysely/dist/cjs/parser/select-parser").QueryBuilderWithSelection<import("kysely/dist/cjs/parser/table-parser").From<import("../../db/database-schema").DatabaseSchemaType, "list_item"> & Record<"subject", import("../../db/tables/actor").Actor>, "list_item" | "subject", {
48
49
  did: string;
49
50
  handle: string | null;
50
51
  indexedAt: string;
51
52
  takedownId: number | null;
52
- }, "list_item.cid as cid" | "list_item.sortAt as sortAt">;
53
+ }, "list_item.uri as uri" | "list_item.cid as cid" | "list_item.sortAt as sortAt">;
53
54
  getBlockAndMuteState(pairs: RelationshipPair[], bam?: BlockAndMuteState): Promise<BlockAndMuteState>;
54
55
  getBlockState(pairs: RelationshipPair[], bam?: BlockAndMuteState): Promise<BlockAndMuteState>;
55
56
  getListViews(listUris: string[], requester: string | null): Promise<{}>;
56
- formatListView(list: ListInfo, profiles: ActorInfoMap): {
57
- creator: import("../actor").ActorInfo;
58
- description: string | undefined;
59
- descriptionFacets: any;
60
- uri: string;
61
- cid: string;
62
- name: string;
63
- purpose: string;
64
- avatar: string | undefined;
65
- indexedAt: string;
66
- viewer: {
67
- muted: boolean;
68
- blocked: string | undefined;
69
- };
70
- };
71
- formatListViewBasic(list: ListInfo): {
72
- uri: string;
73
- cid: string;
74
- name: string;
75
- purpose: string;
76
- avatar: string | undefined;
77
- indexedAt: string;
78
- viewer: {
79
- muted: boolean;
80
- blocked: string | undefined;
81
- };
82
- };
57
+ formatListView(list: ListInfo, profiles: ActorInfoMap): ListView | undefined;
58
+ formatListViewBasic(list: ListInfo): ListViewBasic;
83
59
  }
84
60
  export declare type RelationshipPair = [didA: string, didB: string];
85
61
  export declare class BlockAndMuteState {
@@ -3,5 +3,6 @@ import { List } from '../../db/tables/list';
3
3
  export declare type ListInfo = Selectable<List> & {
4
4
  viewerMuted: string | null;
5
5
  viewerListBlockUri: string | null;
6
+ viewerInList: string | null;
6
7
  };
7
8
  export declare type ListInfoMap = Record<string, ListInfo>;