@atproto/ozone 0.0.16 → 0.0.17-next.1

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 (157) hide show
  1. package/dist/api/util.d.ts +10 -0
  2. package/dist/auth-verifier.d.ts +8 -12
  3. package/dist/communication-service/template.d.ts +2 -2
  4. package/dist/config/config.d.ts +6 -0
  5. package/dist/config/env.d.ts +3 -2
  6. package/dist/config/secrets.d.ts +0 -2
  7. package/dist/context.d.ts +6 -0
  8. package/dist/daemon/blob-diverter.d.ts +26 -0
  9. package/dist/daemon/event-pusher.d.ts +6 -0
  10. package/dist/daemon/index.d.ts +1 -0
  11. package/dist/db/index.js +21 -1
  12. package/dist/db/index.js.map +3 -3
  13. package/dist/db/migrations/20240228T003647759Z-add-label-sigs.d.ts +3 -0
  14. package/dist/db/migrations/index.d.ts +1 -0
  15. package/dist/db/schema/index.d.ts +2 -1
  16. package/dist/db/schema/label.d.ts +4 -0
  17. package/dist/db/schema/moderation_event.d.ts +1 -1
  18. package/dist/db/schema/moderation_subject_status.d.ts +2 -2
  19. package/dist/db/schema/signing_key.d.ts +9 -0
  20. package/dist/index.js +10400 -10313
  21. package/dist/index.js.map +3 -3
  22. package/dist/lexicon/index.d.ts +55 -27
  23. package/dist/lexicon/lexicons.d.ts +5046 -4757
  24. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +23 -1
  25. package/dist/lexicon/types/app/bsky/embed/record.d.ts +2 -1
  26. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -0
  27. package/dist/lexicon/types/app/bsky/graph/defs.d.ts +3 -0
  28. package/dist/lexicon/types/app/bsky/labeler/defs.d.ts +41 -0
  29. package/dist/lexicon/types/app/bsky/labeler/getServices.d.ts +36 -0
  30. package/dist/lexicon/types/app/bsky/labeler/service.d.ts +14 -0
  31. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +0 -304
  32. package/dist/lexicon/types/com/atproto/label/defs.d.ts +23 -0
  33. package/dist/lexicon/types/{com/atproto/admin/createCommunicationTemplate.d.ts → tools/ozone/communication/createTemplate.d.ts} +2 -2
  34. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts +14 -0
  35. package/dist/lexicon/types/{com/atproto/admin/listCommunicationTemplates.d.ts → tools/ozone/communication/listTemplates.d.ts} +2 -2
  36. package/dist/lexicon/types/{com/atproto/admin/updateCommunicationTemplate.d.ts → tools/ozone/communication/updateTemplate.d.ts} +2 -2
  37. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +269 -0
  38. package/dist/lexicon/types/{com/atproto/admin/emitModerationEvent.d.ts → tools/ozone/moderation/emitEvent.d.ts} +5 -4
  39. package/dist/lexicon/types/{com/atproto/admin/getModerationEvent.d.ts → tools/ozone/moderation/getEvent.d.ts} +2 -2
  40. package/dist/lexicon/types/{com/atproto/admin → tools/ozone/moderation}/getRecord.d.ts +2 -2
  41. package/dist/lexicon/types/{com/atproto/admin → tools/ozone/moderation}/getRepo.d.ts +2 -2
  42. package/dist/lexicon/types/{com/atproto/admin/queryModerationEvents.d.ts → tools/ozone/moderation/queryEvents.d.ts} +2 -2
  43. package/dist/lexicon/types/{com/atproto/admin/queryModerationStatuses.d.ts → tools/ozone/moderation/queryStatuses.d.ts} +2 -2
  44. package/dist/lexicon/types/{com/atproto/admin → tools/ozone/moderation}/searchRepos.d.ts +2 -2
  45. package/dist/mod-service/index.d.ts +16 -15
  46. package/dist/mod-service/subject.d.ts +1 -1
  47. package/dist/mod-service/types.d.ts +2 -2
  48. package/dist/mod-service/util.d.ts +6 -0
  49. package/dist/mod-service/views.d.ts +9 -3
  50. package/dist/sequencer/sequencer.d.ts +6 -4
  51. package/dist/util.d.ts +2 -0
  52. package/package.json +9 -8
  53. package/src/api/{admin/createCommunicationTemplate.ts → communication/createTemplate.ts} +2 -2
  54. package/src/api/{admin/deleteCommunicationTemplate.ts → communication/deleteTemplate.ts} +2 -2
  55. package/src/api/{admin/listCommunicationTemplates.ts → communication/listTemplates.ts} +2 -2
  56. package/src/api/{admin/updateCommunicationTemplate.ts → communication/updateTemplate.ts} +2 -2
  57. package/src/api/index.ts +21 -21
  58. package/src/api/{temp → label}/fetchLabels.ts +5 -3
  59. package/src/api/label/queryLabels.ts +4 -2
  60. package/src/api/moderation/emitEvent.ts +218 -0
  61. package/src/api/{admin/getModerationEvent.ts → moderation/getEvent.ts} +2 -2
  62. package/src/api/{admin → moderation}/getRecord.ts +3 -3
  63. package/src/api/{admin → moderation}/getRepo.ts +3 -3
  64. package/src/api/{admin/queryModerationEvents.ts → moderation/queryEvents.ts} +3 -3
  65. package/src/api/{admin/queryModerationStatuses.ts → moderation/queryStatuses.ts} +3 -3
  66. package/src/api/{admin → moderation}/searchRepos.ts +2 -2
  67. package/src/api/proxied.ts +8 -8
  68. package/src/api/{moderation → report}/createReport.ts +2 -3
  69. package/src/api/util.ts +119 -0
  70. package/src/auth-verifier.ts +20 -30
  71. package/src/communication-service/template.ts +2 -2
  72. package/src/config/config.ts +24 -7
  73. package/src/config/env.ts +6 -4
  74. package/src/config/secrets.ts +0 -6
  75. package/src/context.ts +36 -12
  76. package/src/daemon/blob-diverter.ts +150 -0
  77. package/src/daemon/context.ts +11 -7
  78. package/src/daemon/event-pusher.ts +58 -15
  79. package/src/daemon/index.ts +1 -0
  80. package/src/db/migrations/20240228T003647759Z-add-label-sigs.ts +25 -0
  81. package/src/db/migrations/index.ts +1 -0
  82. package/src/db/schema/index.ts +2 -0
  83. package/src/db/schema/label.ts +3 -0
  84. package/src/db/schema/moderation_event.ts +11 -11
  85. package/src/db/schema/moderation_subject_status.ts +7 -2
  86. package/src/db/schema/signing_key.ts +10 -0
  87. package/src/lexicon/index.ts +200 -137
  88. package/src/lexicon/lexicons.ts +6310 -6012
  89. package/src/lexicon/types/app/bsky/actor/defs.ts +57 -1
  90. package/src/lexicon/types/app/bsky/embed/record.ts +2 -0
  91. package/src/lexicon/types/app/bsky/feed/defs.ts +1 -0
  92. package/src/lexicon/types/app/bsky/graph/defs.ts +3 -0
  93. package/src/lexicon/types/app/bsky/labeler/defs.ts +93 -0
  94. package/src/lexicon/types/app/bsky/labeler/getServices.ts +51 -0
  95. package/src/lexicon/types/app/bsky/labeler/service.ts +31 -0
  96. package/src/lexicon/types/com/atproto/admin/defs.ts +0 -694
  97. package/src/lexicon/types/com/atproto/label/defs.ts +78 -0
  98. package/src/lexicon/types/{com/atproto/admin/createCommunicationTemplate.ts → tools/ozone/communication/createTemplate.ts} +2 -2
  99. package/src/lexicon/types/tools/ozone/communication/defs.ts +35 -0
  100. package/src/lexicon/types/{com/atproto/admin/listCommunicationTemplates.ts → tools/ozone/communication/listTemplates.ts} +2 -2
  101. package/src/lexicon/types/{com/atproto/admin/updateCommunicationTemplate.ts → tools/ozone/communication/updateTemplate.ts} +2 -2
  102. package/src/lexicon/types/tools/ozone/moderation/defs.ts +641 -0
  103. package/src/lexicon/types/{com/atproto/admin/emitModerationEvent.ts → tools/ozone/moderation/emitEvent.ts} +15 -14
  104. package/src/lexicon/types/{com/atproto/admin/getModerationEvent.ts → tools/ozone/moderation/getEvent.ts} +2 -2
  105. package/src/lexicon/types/{com/atproto/admin → tools/ozone/moderation}/getRecord.ts +2 -2
  106. package/src/lexicon/types/{com/atproto/admin → tools/ozone/moderation}/getRepo.ts +2 -2
  107. package/src/lexicon/types/{com/atproto/admin/queryModerationEvents.ts → tools/ozone/moderation/queryEvents.ts} +3 -3
  108. package/src/lexicon/types/{com/atproto/admin/queryModerationStatuses.ts → tools/ozone/moderation/queryStatuses.ts} +2 -2
  109. package/src/lexicon/types/{com/atproto/admin → tools/ozone/moderation}/searchRepos.ts +2 -2
  110. package/src/mod-service/index.ts +46 -50
  111. package/src/mod-service/lang.ts +1 -1
  112. package/src/mod-service/status.ts +60 -41
  113. package/src/mod-service/subject.ts +1 -1
  114. package/src/mod-service/types.ts +10 -10
  115. package/src/mod-service/util.ts +49 -5
  116. package/src/mod-service/views.ts +45 -18
  117. package/src/sequencer/sequencer.ts +12 -11
  118. package/src/util.ts +21 -0
  119. package/tests/__snapshots__/blob-divert.test.ts.snap +22 -0
  120. package/tests/__snapshots__/get-record.test.ts.snap +14 -6
  121. package/tests/__snapshots__/get-repo.test.ts.snap +7 -3
  122. package/tests/__snapshots__/moderation-events.test.ts.snap +8 -8
  123. package/tests/__snapshots__/moderation-statuses.test.ts.snap +6 -6
  124. package/tests/_util.ts +5 -0
  125. package/tests/blob-divert.test.ts +87 -0
  126. package/tests/communication-templates.test.ts +33 -37
  127. package/tests/db.test.ts +6 -6
  128. package/tests/get-record.test.ts +22 -12
  129. package/tests/get-repo.test.ts +33 -21
  130. package/tests/moderation-appeals.test.ts +39 -67
  131. package/tests/moderation-events.test.ts +99 -142
  132. package/tests/moderation-status-tags.test.ts +20 -37
  133. package/tests/moderation-statuses.test.ts +132 -65
  134. package/tests/moderation.test.ts +147 -301
  135. package/tests/query-labels.test.ts +86 -10
  136. package/tests/repo-search.test.ts +18 -11
  137. package/tests/sequencer.test.ts +6 -3
  138. package/dist/api/admin/util.d.ts +0 -5
  139. package/dist/api/moderation/util.d.ts +0 -4
  140. package/src/api/admin/emitModerationEvent.ts +0 -170
  141. package/src/api/admin/util.ts +0 -54
  142. package/src/api/moderation/util.ts +0 -67
  143. /package/dist/api/{admin/createCommunicationTemplate.d.ts → communication/createTemplate.d.ts} +0 -0
  144. /package/dist/api/{admin/deleteCommunicationTemplate.d.ts → communication/deleteTemplate.d.ts} +0 -0
  145. /package/dist/api/{admin/emitModerationEvent.d.ts → communication/listTemplates.d.ts} +0 -0
  146. /package/dist/api/{admin/getModerationEvent.d.ts → communication/updateTemplate.d.ts} +0 -0
  147. /package/dist/api/{temp → label}/fetchLabels.d.ts +0 -0
  148. /package/dist/api/{admin/getRecord.d.ts → moderation/emitEvent.d.ts} +0 -0
  149. /package/dist/api/{admin/getRepo.d.ts → moderation/getEvent.d.ts} +0 -0
  150. /package/dist/api/{admin/listCommunicationTemplates.d.ts → moderation/getRecord.d.ts} +0 -0
  151. /package/dist/api/{admin/queryModerationEvents.d.ts → moderation/getRepo.d.ts} +0 -0
  152. /package/dist/api/{admin/queryModerationStatuses.d.ts → moderation/queryEvents.d.ts} +0 -0
  153. /package/dist/api/{admin/searchRepos.d.ts → moderation/queryStatuses.d.ts} +0 -0
  154. /package/dist/api/{admin/updateCommunicationTemplate.d.ts → moderation/searchRepos.d.ts} +0 -0
  155. /package/dist/api/{moderation → report}/createReport.d.ts +0 -0
  156. /package/dist/lexicon/types/{com/atproto/admin/deleteCommunicationTemplate.d.ts → tools/ozone/communication/deleteTemplate.d.ts} +0 -0
  157. /package/src/lexicon/types/{com/atproto/admin/deleteCommunicationTemplate.ts → tools/ozone/communication/deleteTemplate.ts} +0 -0
@@ -0,0 +1,641 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { lexicons } from '../../../../lexicons'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { CID } from 'multiformats/cid'
8
+ import * as ComAtprotoAdminDefs from '../../../com/atproto/admin/defs'
9
+ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
10
+ import * as ComAtprotoModerationDefs from '../../../com/atproto/moderation/defs'
11
+ import * as ComAtprotoServerDefs from '../../../com/atproto/server/defs'
12
+ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
13
+
14
+ export interface ModEventView {
15
+ id: number
16
+ event:
17
+ | ModEventTakedown
18
+ | ModEventReverseTakedown
19
+ | ModEventComment
20
+ | ModEventReport
21
+ | ModEventLabel
22
+ | ModEventAcknowledge
23
+ | ModEventEscalate
24
+ | ModEventMute
25
+ | ModEventEmail
26
+ | ModEventResolveAppeal
27
+ | ModEventDivert
28
+ | { $type: string; [k: string]: unknown }
29
+ subject:
30
+ | ComAtprotoAdminDefs.RepoRef
31
+ | ComAtprotoRepoStrongRef.Main
32
+ | { $type: string; [k: string]: unknown }
33
+ subjectBlobCids: string[]
34
+ createdBy: string
35
+ createdAt: string
36
+ creatorHandle?: string
37
+ subjectHandle?: string
38
+ [k: string]: unknown
39
+ }
40
+
41
+ export function isModEventView(v: unknown): v is ModEventView {
42
+ return (
43
+ isObj(v) &&
44
+ hasProp(v, '$type') &&
45
+ v.$type === 'tools.ozone.moderation.defs#modEventView'
46
+ )
47
+ }
48
+
49
+ export function validateModEventView(v: unknown): ValidationResult {
50
+ return lexicons.validate('tools.ozone.moderation.defs#modEventView', v)
51
+ }
52
+
53
+ export interface ModEventViewDetail {
54
+ id: number
55
+ event:
56
+ | ModEventTakedown
57
+ | ModEventReverseTakedown
58
+ | ModEventComment
59
+ | ModEventReport
60
+ | ModEventLabel
61
+ | ModEventAcknowledge
62
+ | ModEventEscalate
63
+ | ModEventMute
64
+ | ModEventEmail
65
+ | ModEventResolveAppeal
66
+ | ModEventDivert
67
+ | { $type: string; [k: string]: unknown }
68
+ subject:
69
+ | RepoView
70
+ | RepoViewNotFound
71
+ | RecordView
72
+ | RecordViewNotFound
73
+ | { $type: string; [k: string]: unknown }
74
+ subjectBlobs: BlobView[]
75
+ createdBy: string
76
+ createdAt: string
77
+ [k: string]: unknown
78
+ }
79
+
80
+ export function isModEventViewDetail(v: unknown): v is ModEventViewDetail {
81
+ return (
82
+ isObj(v) &&
83
+ hasProp(v, '$type') &&
84
+ v.$type === 'tools.ozone.moderation.defs#modEventViewDetail'
85
+ )
86
+ }
87
+
88
+ export function validateModEventViewDetail(v: unknown): ValidationResult {
89
+ return lexicons.validate('tools.ozone.moderation.defs#modEventViewDetail', v)
90
+ }
91
+
92
+ export interface SubjectStatusView {
93
+ id: number
94
+ subject:
95
+ | ComAtprotoAdminDefs.RepoRef
96
+ | ComAtprotoRepoStrongRef.Main
97
+ | { $type: string; [k: string]: unknown }
98
+ subjectBlobCids?: string[]
99
+ subjectRepoHandle?: string
100
+ /** Timestamp referencing when the last update was made to the moderation status of the subject */
101
+ updatedAt: string
102
+ /** Timestamp referencing the first moderation status impacting event was emitted on the subject */
103
+ createdAt: string
104
+ reviewState: SubjectReviewState
105
+ /** Sticky comment on the subject. */
106
+ comment?: string
107
+ muteUntil?: string
108
+ lastReviewedBy?: string
109
+ lastReviewedAt?: string
110
+ lastReportedAt?: string
111
+ /** Timestamp referencing when the author of the subject appealed a moderation action */
112
+ lastAppealedAt?: string
113
+ takendown?: boolean
114
+ /** True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. */
115
+ appealed?: boolean
116
+ suspendUntil?: string
117
+ tags?: string[]
118
+ [k: string]: unknown
119
+ }
120
+
121
+ export function isSubjectStatusView(v: unknown): v is SubjectStatusView {
122
+ return (
123
+ isObj(v) &&
124
+ hasProp(v, '$type') &&
125
+ v.$type === 'tools.ozone.moderation.defs#subjectStatusView'
126
+ )
127
+ }
128
+
129
+ export function validateSubjectStatusView(v: unknown): ValidationResult {
130
+ return lexicons.validate('tools.ozone.moderation.defs#subjectStatusView', v)
131
+ }
132
+
133
+ export type SubjectReviewState =
134
+ | 'lex:tools.ozone.moderation.defs#reviewOpen'
135
+ | 'lex:tools.ozone.moderation.defs#reviewEscalated'
136
+ | 'lex:tools.ozone.moderation.defs#reviewClosed'
137
+ | 'lex:tools.ozone.moderation.defs#reviewNone'
138
+ | (string & {})
139
+
140
+ /** Moderator review status of a subject: Open. Indicates that the subject needs to be reviewed by a moderator */
141
+ export const REVIEWOPEN = 'tools.ozone.moderation.defs#reviewOpen'
142
+ /** Moderator review status of a subject: Escalated. Indicates that the subject was escalated for review by a moderator */
143
+ export const REVIEWESCALATED = 'tools.ozone.moderation.defs#reviewEscalated'
144
+ /** Moderator review status of a subject: Closed. Indicates that the subject was already reviewed and resolved by a moderator */
145
+ export const REVIEWCLOSED = 'tools.ozone.moderation.defs#reviewClosed'
146
+ /** Moderator review status of a subject: Unnecessary. Indicates that the subject does not need a review at the moment but there is probably some moderation related metadata available for it */
147
+ export const REVIEWNONE = 'tools.ozone.moderation.defs#reviewNone'
148
+
149
+ /** Take down a subject permanently or temporarily */
150
+ export interface ModEventTakedown {
151
+ comment?: string
152
+ /** Indicates how long the takedown should be in effect before automatically expiring. */
153
+ durationInHours?: number
154
+ [k: string]: unknown
155
+ }
156
+
157
+ export function isModEventTakedown(v: unknown): v is ModEventTakedown {
158
+ return (
159
+ isObj(v) &&
160
+ hasProp(v, '$type') &&
161
+ v.$type === 'tools.ozone.moderation.defs#modEventTakedown'
162
+ )
163
+ }
164
+
165
+ export function validateModEventTakedown(v: unknown): ValidationResult {
166
+ return lexicons.validate('tools.ozone.moderation.defs#modEventTakedown', v)
167
+ }
168
+
169
+ /** Revert take down action on a subject */
170
+ export interface ModEventReverseTakedown {
171
+ /** Describe reasoning behind the reversal. */
172
+ comment?: string
173
+ [k: string]: unknown
174
+ }
175
+
176
+ export function isModEventReverseTakedown(
177
+ v: unknown,
178
+ ): v is ModEventReverseTakedown {
179
+ return (
180
+ isObj(v) &&
181
+ hasProp(v, '$type') &&
182
+ v.$type === 'tools.ozone.moderation.defs#modEventReverseTakedown'
183
+ )
184
+ }
185
+
186
+ export function validateModEventReverseTakedown(v: unknown): ValidationResult {
187
+ return lexicons.validate(
188
+ 'tools.ozone.moderation.defs#modEventReverseTakedown',
189
+ v,
190
+ )
191
+ }
192
+
193
+ /** Resolve appeal on a subject */
194
+ export interface ModEventResolveAppeal {
195
+ /** Describe resolution. */
196
+ comment?: string
197
+ [k: string]: unknown
198
+ }
199
+
200
+ export function isModEventResolveAppeal(
201
+ v: unknown,
202
+ ): v is ModEventResolveAppeal {
203
+ return (
204
+ isObj(v) &&
205
+ hasProp(v, '$type') &&
206
+ v.$type === 'tools.ozone.moderation.defs#modEventResolveAppeal'
207
+ )
208
+ }
209
+
210
+ export function validateModEventResolveAppeal(v: unknown): ValidationResult {
211
+ return lexicons.validate(
212
+ 'tools.ozone.moderation.defs#modEventResolveAppeal',
213
+ v,
214
+ )
215
+ }
216
+
217
+ /** Add a comment to a subject */
218
+ export interface ModEventComment {
219
+ comment: string
220
+ /** Make the comment persistent on the subject */
221
+ sticky?: boolean
222
+ [k: string]: unknown
223
+ }
224
+
225
+ export function isModEventComment(v: unknown): v is ModEventComment {
226
+ return (
227
+ isObj(v) &&
228
+ hasProp(v, '$type') &&
229
+ v.$type === 'tools.ozone.moderation.defs#modEventComment'
230
+ )
231
+ }
232
+
233
+ export function validateModEventComment(v: unknown): ValidationResult {
234
+ return lexicons.validate('tools.ozone.moderation.defs#modEventComment', v)
235
+ }
236
+
237
+ /** Report a subject */
238
+ export interface ModEventReport {
239
+ comment?: string
240
+ reportType: ComAtprotoModerationDefs.ReasonType
241
+ [k: string]: unknown
242
+ }
243
+
244
+ export function isModEventReport(v: unknown): v is ModEventReport {
245
+ return (
246
+ isObj(v) &&
247
+ hasProp(v, '$type') &&
248
+ v.$type === 'tools.ozone.moderation.defs#modEventReport'
249
+ )
250
+ }
251
+
252
+ export function validateModEventReport(v: unknown): ValidationResult {
253
+ return lexicons.validate('tools.ozone.moderation.defs#modEventReport', v)
254
+ }
255
+
256
+ /** Apply/Negate labels on a subject */
257
+ export interface ModEventLabel {
258
+ comment?: string
259
+ createLabelVals: string[]
260
+ negateLabelVals: string[]
261
+ [k: string]: unknown
262
+ }
263
+
264
+ export function isModEventLabel(v: unknown): v is ModEventLabel {
265
+ return (
266
+ isObj(v) &&
267
+ hasProp(v, '$type') &&
268
+ v.$type === 'tools.ozone.moderation.defs#modEventLabel'
269
+ )
270
+ }
271
+
272
+ export function validateModEventLabel(v: unknown): ValidationResult {
273
+ return lexicons.validate('tools.ozone.moderation.defs#modEventLabel', v)
274
+ }
275
+
276
+ export interface ModEventAcknowledge {
277
+ comment?: string
278
+ [k: string]: unknown
279
+ }
280
+
281
+ export function isModEventAcknowledge(v: unknown): v is ModEventAcknowledge {
282
+ return (
283
+ isObj(v) &&
284
+ hasProp(v, '$type') &&
285
+ v.$type === 'tools.ozone.moderation.defs#modEventAcknowledge'
286
+ )
287
+ }
288
+
289
+ export function validateModEventAcknowledge(v: unknown): ValidationResult {
290
+ return lexicons.validate('tools.ozone.moderation.defs#modEventAcknowledge', v)
291
+ }
292
+
293
+ export interface ModEventEscalate {
294
+ comment?: string
295
+ [k: string]: unknown
296
+ }
297
+
298
+ export function isModEventEscalate(v: unknown): v is ModEventEscalate {
299
+ return (
300
+ isObj(v) &&
301
+ hasProp(v, '$type') &&
302
+ v.$type === 'tools.ozone.moderation.defs#modEventEscalate'
303
+ )
304
+ }
305
+
306
+ export function validateModEventEscalate(v: unknown): ValidationResult {
307
+ return lexicons.validate('tools.ozone.moderation.defs#modEventEscalate', v)
308
+ }
309
+
310
+ /** Mute incoming reports on a subject */
311
+ export interface ModEventMute {
312
+ comment?: string
313
+ /** Indicates how long the subject should remain muted. */
314
+ durationInHours: number
315
+ [k: string]: unknown
316
+ }
317
+
318
+ export function isModEventMute(v: unknown): v is ModEventMute {
319
+ return (
320
+ isObj(v) &&
321
+ hasProp(v, '$type') &&
322
+ v.$type === 'tools.ozone.moderation.defs#modEventMute'
323
+ )
324
+ }
325
+
326
+ export function validateModEventMute(v: unknown): ValidationResult {
327
+ return lexicons.validate('tools.ozone.moderation.defs#modEventMute', v)
328
+ }
329
+
330
+ /** Unmute action on a subject */
331
+ export interface ModEventUnmute {
332
+ /** Describe reasoning behind the reversal. */
333
+ comment?: string
334
+ [k: string]: unknown
335
+ }
336
+
337
+ export function isModEventUnmute(v: unknown): v is ModEventUnmute {
338
+ return (
339
+ isObj(v) &&
340
+ hasProp(v, '$type') &&
341
+ v.$type === 'tools.ozone.moderation.defs#modEventUnmute'
342
+ )
343
+ }
344
+
345
+ export function validateModEventUnmute(v: unknown): ValidationResult {
346
+ return lexicons.validate('tools.ozone.moderation.defs#modEventUnmute', v)
347
+ }
348
+
349
+ /** Keep a log of outgoing email to a user */
350
+ export interface ModEventEmail {
351
+ /** The subject line of the email sent to the user. */
352
+ subjectLine: string
353
+ /** The content of the email sent to the user. */
354
+ content?: string
355
+ /** Additional comment about the outgoing comm. */
356
+ comment?: string
357
+ [k: string]: unknown
358
+ }
359
+
360
+ export function isModEventEmail(v: unknown): v is ModEventEmail {
361
+ return (
362
+ isObj(v) &&
363
+ hasProp(v, '$type') &&
364
+ v.$type === 'tools.ozone.moderation.defs#modEventEmail'
365
+ )
366
+ }
367
+
368
+ export function validateModEventEmail(v: unknown): ValidationResult {
369
+ return lexicons.validate('tools.ozone.moderation.defs#modEventEmail', v)
370
+ }
371
+
372
+ /** Divert a record's blobs to a 3rd party service for further scanning/tagging */
373
+ export interface ModEventDivert {
374
+ comment?: string
375
+ [k: string]: unknown
376
+ }
377
+
378
+ export function isModEventDivert(v: unknown): v is ModEventDivert {
379
+ return (
380
+ isObj(v) &&
381
+ hasProp(v, '$type') &&
382
+ v.$type === 'tools.ozone.moderation.defs#modEventDivert'
383
+ )
384
+ }
385
+
386
+ export function validateModEventDivert(v: unknown): ValidationResult {
387
+ return lexicons.validate('tools.ozone.moderation.defs#modEventDivert', v)
388
+ }
389
+
390
+ /** Add/Remove a tag on a subject */
391
+ export interface ModEventTag {
392
+ /** Tags to be added to the subject. If already exists, won't be duplicated. */
393
+ add: string[]
394
+ /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */
395
+ remove: string[]
396
+ /** Additional comment about added/removed tags. */
397
+ comment?: string
398
+ [k: string]: unknown
399
+ }
400
+
401
+ export function isModEventTag(v: unknown): v is ModEventTag {
402
+ return (
403
+ isObj(v) &&
404
+ hasProp(v, '$type') &&
405
+ v.$type === 'tools.ozone.moderation.defs#modEventTag'
406
+ )
407
+ }
408
+
409
+ export function validateModEventTag(v: unknown): ValidationResult {
410
+ return lexicons.validate('tools.ozone.moderation.defs#modEventTag', v)
411
+ }
412
+
413
+ export interface RepoView {
414
+ did: string
415
+ handle: string
416
+ email?: string
417
+ relatedRecords: {}[]
418
+ indexedAt: string
419
+ moderation: Moderation
420
+ invitedBy?: ComAtprotoServerDefs.InviteCode
421
+ invitesDisabled?: boolean
422
+ inviteNote?: string
423
+ [k: string]: unknown
424
+ }
425
+
426
+ export function isRepoView(v: unknown): v is RepoView {
427
+ return (
428
+ isObj(v) &&
429
+ hasProp(v, '$type') &&
430
+ v.$type === 'tools.ozone.moderation.defs#repoView'
431
+ )
432
+ }
433
+
434
+ export function validateRepoView(v: unknown): ValidationResult {
435
+ return lexicons.validate('tools.ozone.moderation.defs#repoView', v)
436
+ }
437
+
438
+ export interface RepoViewDetail {
439
+ did: string
440
+ handle: string
441
+ email?: string
442
+ relatedRecords: {}[]
443
+ indexedAt: string
444
+ moderation: ModerationDetail
445
+ labels?: ComAtprotoLabelDefs.Label[]
446
+ invitedBy?: ComAtprotoServerDefs.InviteCode
447
+ invites?: ComAtprotoServerDefs.InviteCode[]
448
+ invitesDisabled?: boolean
449
+ inviteNote?: string
450
+ emailConfirmedAt?: string
451
+ [k: string]: unknown
452
+ }
453
+
454
+ export function isRepoViewDetail(v: unknown): v is RepoViewDetail {
455
+ return (
456
+ isObj(v) &&
457
+ hasProp(v, '$type') &&
458
+ v.$type === 'tools.ozone.moderation.defs#repoViewDetail'
459
+ )
460
+ }
461
+
462
+ export function validateRepoViewDetail(v: unknown): ValidationResult {
463
+ return lexicons.validate('tools.ozone.moderation.defs#repoViewDetail', v)
464
+ }
465
+
466
+ export interface RepoViewNotFound {
467
+ did: string
468
+ [k: string]: unknown
469
+ }
470
+
471
+ export function isRepoViewNotFound(v: unknown): v is RepoViewNotFound {
472
+ return (
473
+ isObj(v) &&
474
+ hasProp(v, '$type') &&
475
+ v.$type === 'tools.ozone.moderation.defs#repoViewNotFound'
476
+ )
477
+ }
478
+
479
+ export function validateRepoViewNotFound(v: unknown): ValidationResult {
480
+ return lexicons.validate('tools.ozone.moderation.defs#repoViewNotFound', v)
481
+ }
482
+
483
+ export interface RecordView {
484
+ uri: string
485
+ cid: string
486
+ value: {}
487
+ blobCids: string[]
488
+ indexedAt: string
489
+ moderation: Moderation
490
+ repo: RepoView
491
+ [k: string]: unknown
492
+ }
493
+
494
+ export function isRecordView(v: unknown): v is RecordView {
495
+ return (
496
+ isObj(v) &&
497
+ hasProp(v, '$type') &&
498
+ v.$type === 'tools.ozone.moderation.defs#recordView'
499
+ )
500
+ }
501
+
502
+ export function validateRecordView(v: unknown): ValidationResult {
503
+ return lexicons.validate('tools.ozone.moderation.defs#recordView', v)
504
+ }
505
+
506
+ export interface RecordViewDetail {
507
+ uri: string
508
+ cid: string
509
+ value: {}
510
+ blobs: BlobView[]
511
+ labels?: ComAtprotoLabelDefs.Label[]
512
+ indexedAt: string
513
+ moderation: ModerationDetail
514
+ repo: RepoView
515
+ [k: string]: unknown
516
+ }
517
+
518
+ export function isRecordViewDetail(v: unknown): v is RecordViewDetail {
519
+ return (
520
+ isObj(v) &&
521
+ hasProp(v, '$type') &&
522
+ v.$type === 'tools.ozone.moderation.defs#recordViewDetail'
523
+ )
524
+ }
525
+
526
+ export function validateRecordViewDetail(v: unknown): ValidationResult {
527
+ return lexicons.validate('tools.ozone.moderation.defs#recordViewDetail', v)
528
+ }
529
+
530
+ export interface RecordViewNotFound {
531
+ uri: string
532
+ [k: string]: unknown
533
+ }
534
+
535
+ export function isRecordViewNotFound(v: unknown): v is RecordViewNotFound {
536
+ return (
537
+ isObj(v) &&
538
+ hasProp(v, '$type') &&
539
+ v.$type === 'tools.ozone.moderation.defs#recordViewNotFound'
540
+ )
541
+ }
542
+
543
+ export function validateRecordViewNotFound(v: unknown): ValidationResult {
544
+ return lexicons.validate('tools.ozone.moderation.defs#recordViewNotFound', v)
545
+ }
546
+
547
+ export interface Moderation {
548
+ subjectStatus?: SubjectStatusView
549
+ [k: string]: unknown
550
+ }
551
+
552
+ export function isModeration(v: unknown): v is Moderation {
553
+ return (
554
+ isObj(v) &&
555
+ hasProp(v, '$type') &&
556
+ v.$type === 'tools.ozone.moderation.defs#moderation'
557
+ )
558
+ }
559
+
560
+ export function validateModeration(v: unknown): ValidationResult {
561
+ return lexicons.validate('tools.ozone.moderation.defs#moderation', v)
562
+ }
563
+
564
+ export interface ModerationDetail {
565
+ subjectStatus?: SubjectStatusView
566
+ [k: string]: unknown
567
+ }
568
+
569
+ export function isModerationDetail(v: unknown): v is ModerationDetail {
570
+ return (
571
+ isObj(v) &&
572
+ hasProp(v, '$type') &&
573
+ v.$type === 'tools.ozone.moderation.defs#moderationDetail'
574
+ )
575
+ }
576
+
577
+ export function validateModerationDetail(v: unknown): ValidationResult {
578
+ return lexicons.validate('tools.ozone.moderation.defs#moderationDetail', v)
579
+ }
580
+
581
+ export interface BlobView {
582
+ cid: string
583
+ mimeType: string
584
+ size: number
585
+ createdAt: string
586
+ details?:
587
+ | ImageDetails
588
+ | VideoDetails
589
+ | { $type: string; [k: string]: unknown }
590
+ moderation?: Moderation
591
+ [k: string]: unknown
592
+ }
593
+
594
+ export function isBlobView(v: unknown): v is BlobView {
595
+ return (
596
+ isObj(v) &&
597
+ hasProp(v, '$type') &&
598
+ v.$type === 'tools.ozone.moderation.defs#blobView'
599
+ )
600
+ }
601
+
602
+ export function validateBlobView(v: unknown): ValidationResult {
603
+ return lexicons.validate('tools.ozone.moderation.defs#blobView', v)
604
+ }
605
+
606
+ export interface ImageDetails {
607
+ width: number
608
+ height: number
609
+ [k: string]: unknown
610
+ }
611
+
612
+ export function isImageDetails(v: unknown): v is ImageDetails {
613
+ return (
614
+ isObj(v) &&
615
+ hasProp(v, '$type') &&
616
+ v.$type === 'tools.ozone.moderation.defs#imageDetails'
617
+ )
618
+ }
619
+
620
+ export function validateImageDetails(v: unknown): ValidationResult {
621
+ return lexicons.validate('tools.ozone.moderation.defs#imageDetails', v)
622
+ }
623
+
624
+ export interface VideoDetails {
625
+ width: number
626
+ height: number
627
+ length: number
628
+ [k: string]: unknown
629
+ }
630
+
631
+ export function isVideoDetails(v: unknown): v is VideoDetails {
632
+ return (
633
+ isObj(v) &&
634
+ hasProp(v, '$type') &&
635
+ v.$type === 'tools.ozone.moderation.defs#videoDetails'
636
+ )
637
+ }
638
+
639
+ export function validateVideoDetails(v: unknown): ValidationResult {
640
+ return lexicons.validate('tools.ozone.moderation.defs#videoDetails', v)
641
+ }
@@ -7,24 +7,25 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
- import * as ComAtprotoAdminDefs from './defs'
11
- import * as ComAtprotoRepoStrongRef from '../repo/strongRef'
10
+ import * as ToolsOzoneModerationDefs from './defs'
11
+ import * as ComAtprotoAdminDefs from '../../../com/atproto/admin/defs'
12
+ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
12
13
 
13
14
  export interface QueryParams {}
14
15
 
15
16
  export interface InputSchema {
16
17
  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
- | ComAtprotoAdminDefs.ModEventTag
18
+ | ToolsOzoneModerationDefs.ModEventTakedown
19
+ | ToolsOzoneModerationDefs.ModEventAcknowledge
20
+ | ToolsOzoneModerationDefs.ModEventEscalate
21
+ | ToolsOzoneModerationDefs.ModEventComment
22
+ | ToolsOzoneModerationDefs.ModEventLabel
23
+ | ToolsOzoneModerationDefs.ModEventReport
24
+ | ToolsOzoneModerationDefs.ModEventMute
25
+ | ToolsOzoneModerationDefs.ModEventReverseTakedown
26
+ | ToolsOzoneModerationDefs.ModEventUnmute
27
+ | ToolsOzoneModerationDefs.ModEventEmail
28
+ | ToolsOzoneModerationDefs.ModEventTag
28
29
  | { $type: string; [k: string]: unknown }
29
30
  subject:
30
31
  | ComAtprotoAdminDefs.RepoRef
@@ -35,7 +36,7 @@ export interface InputSchema {
35
36
  [k: string]: unknown
36
37
  }
37
38
 
38
- export type OutputSchema = ComAtprotoAdminDefs.ModEventView
39
+ export type OutputSchema = ToolsOzoneModerationDefs.ModEventView
39
40
 
40
41
  export interface HandlerInput {
41
42
  encoding: 'application/json'
@@ -7,14 +7,14 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
- import * as ComAtprotoAdminDefs from './defs'
10
+ import * as ToolsOzoneModerationDefs from './defs'
11
11
 
12
12
  export interface QueryParams {
13
13
  id: number
14
14
  }
15
15
 
16
16
  export type InputSchema = undefined
17
- export type OutputSchema = ComAtprotoAdminDefs.ModEventViewDetail
17
+ export type OutputSchema = ToolsOzoneModerationDefs.ModEventViewDetail
18
18
  export type HandlerInput = undefined
19
19
 
20
20
  export interface HandlerSuccess {