@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.
- package/CHANGELOG.md +11 -0
- package/dist/api/com/atproto/moderation/util.d.ts +4 -3
- package/dist/context.d.ts +15 -0
- package/dist/db/index.js +26 -1
- package/dist/db/index.js.map +3 -3
- package/dist/db/migrations/20231003T202833377Z-create-moderation-subject-status.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/pagination.d.ts +2 -1
- package/dist/db/{periodic-moderation-action-reversal.d.ts → periodic-moderation-event-reversal.d.ts} +3 -5
- package/dist/db/tables/moderation.d.ts +24 -34
- package/dist/feed-gen/types.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2750 -2121
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +11 -18
- package/dist/lexicon/lexicons.d.ts +414 -399
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -7
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +114 -48
- package/dist/lexicon/types/com/atproto/admin/{takeModerationAction.d.ts → emitModerationEvent.d.ts} +5 -6
- package/dist/lexicon/types/com/atproto/admin/{getModerationAction.d.ts → getModerationEvent.d.ts} +1 -1
- package/dist/lexicon/types/com/atproto/admin/{getModerationActions.d.ts → queryModerationEvents.d.ts} +5 -1
- package/dist/lexicon/types/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +12 -6
- package/dist/lexicon/types/com/atproto/admin/sendEmail.d.ts +1 -0
- package/dist/migrate-moderation-data.d.ts +1 -0
- package/dist/services/actor/views.d.ts +2 -5
- package/dist/services/feed/index.d.ts +1 -0
- package/dist/services/feed/util.d.ts +9 -1
- package/dist/services/feed/views.d.ts +6 -17
- package/dist/services/graph/index.d.ts +5 -29
- package/dist/services/graph/types.d.ts +1 -0
- package/dist/services/moderation/index.d.ts +135 -72
- package/dist/services/moderation/pagination.d.ts +36 -0
- package/dist/services/moderation/status.d.ts +13 -0
- package/dist/services/moderation/types.d.ts +35 -0
- package/dist/services/moderation/views.d.ts +18 -14
- package/dist/util/debug.d.ts +1 -1
- package/package.json +11 -11
- package/src/api/app/bsky/feed/getActorFeeds.ts +2 -1
- package/src/api/app/bsky/feed/getActorLikes.ts +1 -3
- package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -3
- package/src/api/app/bsky/feed/getFeed.ts +9 -9
- package/src/api/app/bsky/feed/getFeedGenerator.ts +3 -0
- package/src/api/app/bsky/feed/getFeedGenerators.ts +2 -1
- package/src/api/app/bsky/feed/getListFeed.ts +1 -3
- package/src/api/app/bsky/feed/getPostThread.ts +15 -54
- package/src/api/app/bsky/feed/getPosts.ts +21 -18
- package/src/api/app/bsky/feed/getSuggestedFeeds.ts +2 -1
- package/src/api/app/bsky/feed/getTimeline.ts +1 -3
- package/src/api/app/bsky/feed/searchPosts.ts +20 -17
- package/src/api/app/bsky/graph/getList.ts +6 -3
- package/src/api/app/bsky/graph/getListBlocks.ts +3 -2
- package/src/api/app/bsky/graph/getListMutes.ts +2 -1
- package/src/api/app/bsky/graph/getLists.ts +2 -1
- package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +3 -1
- package/src/api/blob-resolver.ts +6 -11
- package/src/api/com/atproto/admin/emitModerationEvent.ts +220 -0
- package/src/api/com/atproto/admin/{getModerationActions.ts → getModerationEvent.ts} +5 -11
- package/src/api/com/atproto/admin/getRecord.ts +1 -0
- package/src/api/com/atproto/admin/{getModerationReports.ts → queryModerationEvents.ts} +13 -16
- package/src/api/com/atproto/admin/queryModerationStatuses.ts +55 -0
- package/src/api/com/atproto/moderation/createReport.ts +9 -7
- package/src/api/com/atproto/moderation/util.ts +38 -20
- package/src/api/index.ts +8 -14
- package/src/auth.ts +29 -21
- package/src/auto-moderator/index.ts +26 -19
- package/src/context.ts +4 -0
- package/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +123 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/pagination.ts +26 -3
- package/src/db/{periodic-moderation-action-reversal.ts → periodic-moderation-event-reversal.ts} +50 -46
- package/src/db/tables/moderation.ts +35 -52
- package/src/feed-gen/best-of-follows.ts +6 -3
- package/src/feed-gen/bsky-team.ts +1 -1
- package/src/feed-gen/hot-classic.ts +1 -1
- package/src/feed-gen/mutuals.ts +6 -2
- package/src/feed-gen/types.ts +1 -1
- package/src/feed-gen/whats-hot.ts +1 -1
- package/src/feed-gen/with-friends.ts +7 -3
- package/src/index.ts +2 -1
- package/src/lexicon/index.ts +30 -67
- package/src/lexicon/lexicons.ts +526 -491
- package/src/lexicon/types/app/bsky/feed/defs.ts +1 -18
- package/src/lexicon/types/app/bsky/graph/defs.ts +1 -0
- package/src/lexicon/types/com/atproto/admin/defs.ts +276 -84
- package/src/lexicon/types/com/atproto/admin/{takeModerationAction.ts → emitModerationEvent.ts} +13 -11
- package/src/lexicon/types/com/atproto/admin/{getModerationReport.ts → getModerationEvent.ts} +1 -1
- package/src/lexicon/types/com/atproto/admin/{getModerationActions.ts → queryModerationEvents.ts} +8 -1
- package/src/lexicon/types/com/atproto/admin/{getModerationReports.ts → queryModerationStatuses.ts} +21 -14
- package/src/lexicon/types/com/atproto/admin/sendEmail.ts +1 -0
- package/src/migrate-moderation-data.ts +414 -0
- package/src/services/actor/views.ts +5 -14
- package/src/services/feed/index.ts +26 -7
- package/src/services/feed/util.ts +47 -19
- package/src/services/feed/views.ts +68 -4
- package/src/services/graph/index.ts +21 -3
- package/src/services/graph/types.ts +1 -0
- package/src/services/indexing/plugins/block.ts +2 -3
- package/src/services/indexing/plugins/feed-generator.ts +2 -3
- package/src/services/indexing/plugins/follow.ts +2 -3
- package/src/services/indexing/plugins/like.ts +2 -3
- package/src/services/indexing/plugins/list-block.ts +2 -3
- package/src/services/indexing/plugins/list-item.ts +2 -3
- package/src/services/indexing/plugins/list.ts +2 -3
- package/src/services/indexing/plugins/post.ts +3 -4
- package/src/services/indexing/plugins/repost.ts +2 -3
- package/src/services/indexing/plugins/thread-gate.ts +2 -3
- package/src/services/label/index.ts +2 -3
- package/src/services/moderation/index.ts +380 -395
- package/src/services/moderation/pagination.ts +96 -0
- package/src/services/moderation/status.ts +244 -0
- package/src/services/moderation/types.ts +49 -0
- package/src/services/moderation/views.ts +278 -329
- package/src/util/debug.ts +2 -2
- package/tests/__snapshots__/feed-generation.test.ts.snap +322 -6
- package/tests/__snapshots__/indexing.test.ts.snap +0 -6
- package/tests/admin/__snapshots__/get-record.test.ts.snap +30 -132
- package/tests/admin/__snapshots__/get-repo.test.ts.snap +14 -60
- package/tests/admin/__snapshots__/moderation-events.test.ts.snap +146 -0
- package/tests/admin/__snapshots__/moderation-statuses.test.ts.snap +64 -0
- package/tests/admin/__snapshots__/moderation.test.ts.snap +0 -125
- package/tests/admin/get-record.test.ts +5 -9
- package/tests/admin/get-repo.test.ts +5 -9
- package/tests/admin/moderation-events.test.ts +221 -0
- package/tests/admin/moderation-statuses.test.ts +145 -0
- package/tests/admin/moderation.test.ts +512 -860
- package/tests/admin/repo-search.test.ts +2 -3
- package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -1
- package/tests/auto-moderator/takedowns.test.ts +45 -18
- package/tests/feed-generation.test.ts +57 -9
- package/tests/views/__snapshots__/block-lists.test.ts.snap +3 -9
- package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
- package/tests/views/__snapshots__/mute-lists.test.ts.snap +5 -5
- package/tests/views/__snapshots__/mutes.test.ts.snap +0 -3
- package/tests/views/__snapshots__/thread.test.ts.snap +0 -30
- package/tests/views/actor-search.test.ts +2 -3
- package/tests/views/author-feed.test.ts +42 -36
- package/tests/views/follows.test.ts +40 -35
- package/tests/views/list-feed.test.ts +17 -9
- package/tests/views/notifications.test.ts +13 -9
- package/tests/views/profile.test.ts +20 -18
- package/tests/views/thread.test.ts +54 -26
- package/tests/views/threadgating.test.ts +51 -19
- package/tests/views/timeline.test.ts +21 -13
- package/dist/api/com/atproto/admin/resolveModerationReports.d.ts +0 -3
- package/dist/api/com/atproto/admin/reverseModerationAction.d.ts +0 -3
- package/dist/api/com/atproto/admin/takeModerationAction.d.ts +0 -3
- package/dist/lexicon/types/com/atproto/admin/getModerationReport.d.ts +0 -29
- package/dist/lexicon/types/com/atproto/admin/resolveModerationReports.d.ts +0 -36
- package/dist/lexicon/types/com/atproto/admin/reverseModerationAction.d.ts +0 -36
- package/src/api/com/atproto/admin/getModerationAction.ts +0 -44
- package/src/api/com/atproto/admin/getModerationReport.ts +0 -43
- package/src/api/com/atproto/admin/resolveModerationReports.ts +0 -24
- package/src/api/com/atproto/admin/reverseModerationAction.ts +0 -115
- package/src/api/com/atproto/admin/takeModerationAction.ts +0 -156
- package/src/lexicon/types/com/atproto/admin/getModerationAction.ts +0 -41
- package/src/lexicon/types/com/atproto/admin/resolveModerationReports.ts +0 -49
- package/src/lexicon/types/com/atproto/admin/reverseModerationAction.ts +0 -49
- package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +0 -172
- package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +0 -178
- package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +0 -177
- package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +0 -307
- package/tests/admin/get-moderation-action.test.ts +0 -100
- package/tests/admin/get-moderation-actions.test.ts +0 -164
- package/tests/admin/get-moderation-report.test.ts +0 -100
- package/tests/admin/get-moderation-reports.test.ts +0 -332
- /package/dist/api/com/atproto/admin/{getModerationAction.d.ts → emitModerationEvent.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationActions.d.ts → getModerationEvent.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationReport.d.ts → queryModerationEvents.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +0 -0
|
@@ -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
|
|
@@ -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
|
|
31
|
+
export interface ModEventView {
|
|
32
32
|
id: number
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
47
|
-
|
|
51
|
+
creatorHandle?: string
|
|
52
|
+
subjectHandle?: string
|
|
48
53
|
[k: string]: unknown
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
export function
|
|
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#
|
|
60
|
+
v.$type === 'com.atproto.admin.defs#modEventView'
|
|
56
61
|
)
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
export function
|
|
60
|
-
return lexicons.validate('com.atproto.admin.defs#
|
|
64
|
+
export function validateModEventView(v: unknown): ValidationResult {
|
|
65
|
+
return lexicons.validate('com.atproto.admin.defs#modEventView', v)
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
export interface
|
|
68
|
+
export interface ModEventViewDetail {
|
|
64
69
|
id: number
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
|
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#
|
|
96
|
+
v.$type === 'com.atproto.admin.defs#modEventViewDetail'
|
|
90
97
|
)
|
|
91
98
|
}
|
|
92
99
|
|
|
93
|
-
export function
|
|
94
|
-
return lexicons.validate('com.atproto.admin.defs#
|
|
100
|
+
export function validateModEventViewDetail(v: unknown): ValidationResult {
|
|
101
|
+
return lexicons.validate('com.atproto.admin.defs#modEventViewDetail', v)
|
|
95
102
|
}
|
|
96
103
|
|
|
97
|
-
export interface
|
|
104
|
+
export interface ReportView {
|
|
98
105
|
id: number
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
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#
|
|
123
|
+
v.$type === 'com.atproto.admin.defs#reportView'
|
|
129
124
|
)
|
|
130
125
|
}
|
|
131
126
|
|
|
132
|
-
export function
|
|
133
|
-
return lexicons.validate('com.atproto.admin.defs#
|
|
127
|
+
export function validateReportView(v: unknown): ValidationResult {
|
|
128
|
+
return lexicons.validate('com.atproto.admin.defs#reportView', v)
|
|
134
129
|
}
|
|
135
130
|
|
|
136
|
-
export
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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#
|
|
159
|
+
v.$type === 'com.atproto.admin.defs#subjectStatusView'
|
|
172
160
|
)
|
|
173
161
|
}
|
|
174
162
|
|
|
175
|
-
export function
|
|
176
|
-
return lexicons.validate('com.atproto.admin.defs#
|
|
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
|
-
|
|
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:
|
|
180
|
+
resolvedByActions: ModEventView[]
|
|
192
181
|
[k: string]: unknown
|
|
193
182
|
}
|
|
194
183
|
|
|
@@ -400,7 +389,7 @@ export function validateRecordViewNotFound(v: unknown): ValidationResult {
|
|
|
400
389
|
}
|
|
401
390
|
|
|
402
391
|
export interface Moderation {
|
|
403
|
-
|
|
392
|
+
subjectStatus?: SubjectStatusView
|
|
404
393
|
[k: string]: unknown
|
|
405
394
|
}
|
|
406
395
|
|
|
@@ -417,9 +406,7 @@ export function validateModeration(v: unknown): ValidationResult {
|
|
|
417
406
|
}
|
|
418
407
|
|
|
419
408
|
export interface ModerationDetail {
|
|
420
|
-
|
|
421
|
-
actions: ActionView[]
|
|
422
|
-
reports: ReportView[]
|
|
409
|
+
subjectStatus?: SubjectStatusView
|
|
423
410
|
[k: string]: unknown
|
|
424
411
|
}
|
|
425
412
|
|
|
@@ -496,3 +483,208 @@ export function isVideoDetails(v: unknown): v is VideoDetails {
|
|
|
496
483
|
export function validateVideoDetails(v: unknown): ValidationResult {
|
|
497
484
|
return lexicons.validate('com.atproto.admin.defs#videoDetails', v)
|
|
498
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
|
+
}
|
package/src/lexicon/types/com/atproto/admin/{takeModerationAction.ts → emitModerationEvent.ts}
RENAMED
|
@@ -13,26 +13,28 @@ import * as ComAtprotoRepoStrongRef from '../repo/strongRef'
|
|
|
13
13
|
export interface QueryParams {}
|
|
14
14
|
|
|
15
15
|
export interface InputSchema {
|
|
16
|
-
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
16
|
+
event:
|
|
17
|
+
| ComAtprotoAdminDefs.ModEventTakedown
|
|
18
|
+
| ComAtprotoAdminDefs.ModEventAcknowledge
|
|
19
|
+
| ComAtprotoAdminDefs.ModEventEscalate
|
|
20
|
+
| ComAtprotoAdminDefs.ModEventComment
|
|
21
|
+
| ComAtprotoAdminDefs.ModEventLabel
|
|
22
|
+
| ComAtprotoAdminDefs.ModEventReport
|
|
23
|
+
| ComAtprotoAdminDefs.ModEventMute
|
|
24
|
+
| ComAtprotoAdminDefs.ModEventReverseTakedown
|
|
25
|
+
| ComAtprotoAdminDefs.ModEventUnmute
|
|
26
|
+
| ComAtprotoAdminDefs.ModEventEmail
|
|
27
|
+
| { $type: string; [k: string]: unknown }
|
|
21
28
|
subject:
|
|
22
29
|
| ComAtprotoAdminDefs.RepoRef
|
|
23
30
|
| ComAtprotoRepoStrongRef.Main
|
|
24
31
|
| { $type: string; [k: string]: unknown }
|
|
25
32
|
subjectBlobCids?: string[]
|
|
26
|
-
createLabelVals?: string[]
|
|
27
|
-
negateLabelVals?: string[]
|
|
28
|
-
reason: string
|
|
29
|
-
/** Indicates how long this action is meant to be in effect before automatically expiring. */
|
|
30
|
-
durationInHours?: number
|
|
31
33
|
createdBy: string
|
|
32
34
|
[k: string]: unknown
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
export type OutputSchema = ComAtprotoAdminDefs.
|
|
37
|
+
export type OutputSchema = ComAtprotoAdminDefs.ModEventView
|
|
36
38
|
|
|
37
39
|
export interface HandlerInput {
|
|
38
40
|
encoding: 'application/json'
|
package/src/lexicon/types/com/atproto/admin/{getModerationReport.ts → getModerationEvent.ts}
RENAMED
|
@@ -14,7 +14,7 @@ export interface QueryParams {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type InputSchema = undefined
|
|
17
|
-
export type OutputSchema = ComAtprotoAdminDefs.
|
|
17
|
+
export type OutputSchema = ComAtprotoAdminDefs.ModEventViewDetail
|
|
18
18
|
export type HandlerInput = undefined
|
|
19
19
|
|
|
20
20
|
export interface HandlerSuccess {
|
package/src/lexicon/types/com/atproto/admin/{getModerationActions.ts → queryModerationEvents.ts}
RENAMED
|
@@ -10,7 +10,14 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as ComAtprotoAdminDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
+
/** The types of events (fully qualified string in the format of com.atproto.admin#modEvent<name>) to filter by. If not specified, all events are returned. */
|
|
14
|
+
types?: string[]
|
|
15
|
+
createdBy?: string
|
|
16
|
+
/** Sort direction for the events. Defaults to descending order of created at timestamp. */
|
|
17
|
+
sortDirection: 'asc' | 'desc'
|
|
13
18
|
subject?: string
|
|
19
|
+
/** If true, events on all record types (posts, lists, profile etc.) owned by the did are returned */
|
|
20
|
+
includeAllUserRecords: boolean
|
|
14
21
|
limit: number
|
|
15
22
|
cursor?: string
|
|
16
23
|
}
|
|
@@ -19,7 +26,7 @@ export type InputSchema = undefined
|
|
|
19
26
|
|
|
20
27
|
export interface OutputSchema {
|
|
21
28
|
cursor?: string
|
|
22
|
-
|
|
29
|
+
events: ComAtprotoAdminDefs.ModEventView[]
|
|
23
30
|
[k: string]: unknown
|
|
24
31
|
}
|
|
25
32
|
|
package/src/lexicon/types/com/atproto/admin/{getModerationReports.ts → queryModerationStatuses.ts}
RENAMED
|
@@ -11,29 +11,36 @@ import * as ComAtprotoAdminDefs from './defs'
|
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
13
|
subject?: string
|
|
14
|
+
/** Search subjects by keyword from comments */
|
|
15
|
+
comment?: string
|
|
16
|
+
/** Search subjects reported after a given timestamp */
|
|
17
|
+
reportedAfter?: string
|
|
18
|
+
/** Search subjects reported before a given timestamp */
|
|
19
|
+
reportedBefore?: string
|
|
20
|
+
/** Search subjects reviewed after a given timestamp */
|
|
21
|
+
reviewedAfter?: string
|
|
22
|
+
/** Search subjects reviewed before a given timestamp */
|
|
23
|
+
reviewedBefore?: string
|
|
24
|
+
/** By default, we don't include muted subjects in the results. Set this to true to include them. */
|
|
25
|
+
includeMuted?: boolean
|
|
26
|
+
/** Specify when fetching subjects in a certain state */
|
|
27
|
+
reviewState?: string
|
|
14
28
|
ignoreSubjects?: string[]
|
|
15
|
-
/** Get all
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| 'com.atproto.admin.defs#takedown'
|
|
22
|
-
| 'com.atproto.admin.defs#flag'
|
|
23
|
-
| 'com.atproto.admin.defs#acknowledge'
|
|
24
|
-
| 'com.atproto.admin.defs#escalate'
|
|
25
|
-
| (string & {})
|
|
29
|
+
/** Get all subject statuses that were reviewed by a specific moderator */
|
|
30
|
+
lastReviewedBy?: string
|
|
31
|
+
sortField: 'lastReviewedAt' | 'lastReportedAt'
|
|
32
|
+
sortDirection: 'asc' | 'desc'
|
|
33
|
+
/** Get subjects that were taken down */
|
|
34
|
+
takendown?: boolean
|
|
26
35
|
limit: number
|
|
27
36
|
cursor?: string
|
|
28
|
-
/** Reverse the order of the returned records. When true, returns reports in chronological order. */
|
|
29
|
-
reverse?: boolean
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
export type InputSchema = undefined
|
|
33
40
|
|
|
34
41
|
export interface OutputSchema {
|
|
35
42
|
cursor?: string
|
|
36
|
-
|
|
43
|
+
subjectStatuses: ComAtprotoAdminDefs.SubjectStatusView[]
|
|
37
44
|
[k: string]: unknown
|
|
38
45
|
}
|
|
39
46
|
|