@atproto/ozone 0.1.79 → 0.1.80
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 +9 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/moderation/getReporterStats.d.ts +4 -0
- package/dist/api/moderation/getReporterStats.d.ts.map +1 -0
- package/dist/api/moderation/getReporterStats.js +17 -0
- package/dist/api/moderation/getReporterStats.js.map +1 -0
- package/dist/daemon/materialized-view-refresher.d.ts.map +1 -1
- package/dist/daemon/materialized-view-refresher.js +1 -0
- package/dist/daemon/materialized-view-refresher.js.map +1 -1
- package/dist/db/migrations/20250211T003647759Z-add-reporter-stats-index.d.ts +4 -0
- package/dist/db/migrations/20250211T003647759Z-add-reporter-stats-index.d.ts.map +1 -0
- package/dist/db/migrations/20250211T003647759Z-add-reporter-stats-index.js +38 -0
- package/dist/db/migrations/20250211T003647759Z-add-reporter-stats-index.js.map +1 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +2 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +4 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +8 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +282 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +153 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/listReposByCollection.d.ts +46 -0
- package/dist/lexicon/types/com/atproto/sync/listReposByCollection.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/listReposByCollection.js +16 -0
- package/dist/lexicon/types/com/atproto/sync/listReposByCollection.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +22 -0
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.js +9 -0
- package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/getReporterStats.d.ts +36 -0
- package/dist/lexicon/types/tools/ozone/moderation/getReporterStats.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/moderation/getReporterStats.js +7 -0
- package/dist/lexicon/types/tools/ozone/moderation/getReporterStats.js.map +1 -0
- package/dist/mod-service/index.d.ts +5 -1
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +94 -0
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/types.d.ts +21 -0
- package/dist/mod-service/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/api/index.ts +2 -0
- package/src/api/moderation/getReporterStats.ts +18 -0
- package/src/daemon/materialized-view-refresher.ts +1 -0
- package/src/db/migrations/20250211T003647759Z-add-reporter-stats-index.ts +38 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/lexicon/index.ts +24 -0
- package/src/lexicon/lexicons.ts +162 -0
- package/src/lexicon/types/com/atproto/sync/listReposByCollection.ts +68 -0
- package/src/lexicon/types/tools/ozone/moderation/defs.ts +31 -0
- package/src/lexicon/types/tools/ozone/moderation/getReporterStats.ts +50 -0
- package/src/mod-service/index.ts +126 -0
- package/src/mod-service/types.ts +23 -0
- package/tests/get-reporter-stats.test.ts +117 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
|
@@ -49,5 +49,26 @@ type RecordHostingView = {
|
|
|
49
49
|
deletedAt?: Date;
|
|
50
50
|
};
|
|
51
51
|
export type ModerationSubjectHostingView = AccountHostingView | RecordHostingView;
|
|
52
|
+
export type ReporterStats = {
|
|
53
|
+
did: string;
|
|
54
|
+
accountReportCount: number;
|
|
55
|
+
recordReportCount: number;
|
|
56
|
+
reportedAccountCount: number;
|
|
57
|
+
reportedRecordCount: number;
|
|
58
|
+
takendownAccountCount: number;
|
|
59
|
+
takendownRecordCount: number;
|
|
60
|
+
labeledAccountCount: number;
|
|
61
|
+
labeledRecordCount: number;
|
|
62
|
+
};
|
|
63
|
+
export type ReporterStatsResult = {
|
|
64
|
+
accountReportCount?: number;
|
|
65
|
+
recordReportCount?: number;
|
|
66
|
+
reportedAccountCount?: number;
|
|
67
|
+
reportedRecordCount?: number;
|
|
68
|
+
takendownAccountCount?: number;
|
|
69
|
+
takendownRecordCount?: number;
|
|
70
|
+
labeledAccountCount?: number;
|
|
71
|
+
labeledRecordCount?: number;
|
|
72
|
+
};
|
|
52
73
|
export {};
|
|
53
74
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mod-service/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAA;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;AAC5D,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,kBAAkB,EAClB,WAAW,GAAG,SAAS,GAAG,QAAQ,CACnC,GAAG;IACF,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,OAAO,EAAE,UAAU,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,GAAG;IAC9D,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,CAAA;AACD,MAAM,M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C1B,GAAG,EAAE,MAAM,CAAA;IACX,kBAAkB,EAAE,MAAM,CAAA;IAC1B,iBAAiB,EAAE,MAAM,CAAA;IACzB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/ozone",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Backend service for moderating the Bluesky network.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typed-emitter": "^2.1.0",
|
|
36
36
|
"uint8arrays": "3.0.0",
|
|
37
37
|
"undici": "^6.14.1",
|
|
38
|
-
"@atproto/api": "^0.14.
|
|
38
|
+
"@atproto/api": "^0.14.2",
|
|
39
39
|
"@atproto/common": "^0.4.8",
|
|
40
40
|
"@atproto/crypto": "^0.4.4",
|
|
41
41
|
"@atproto/identity": "^0.4.6",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"ts-node": "^10.8.2",
|
|
56
56
|
"typescript": "^5.6.3",
|
|
57
57
|
"@atproto/lex-cli": "^0.6.1",
|
|
58
|
-
"@atproto/pds": "^0.4.
|
|
58
|
+
"@atproto/pds": "^0.4.98"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/*",
|
package/src/api/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import getEvent from './moderation/getEvent'
|
|
|
13
13
|
import adminGetRecord from './moderation/getRecord'
|
|
14
14
|
import adminGetRecords from './moderation/getRecords'
|
|
15
15
|
import getRepo from './moderation/getRepo'
|
|
16
|
+
import getReporterStats from './moderation/getReporterStats'
|
|
16
17
|
import getRepos from './moderation/getRepos'
|
|
17
18
|
import queryEvents from './moderation/queryEvents'
|
|
18
19
|
import queryStatuses from './moderation/queryStatuses'
|
|
@@ -72,5 +73,6 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
72
73
|
upsertOption(server, ctx)
|
|
73
74
|
listOptions(server, ctx)
|
|
74
75
|
removeOptions(server, ctx)
|
|
76
|
+
getReporterStats(server, ctx)
|
|
75
77
|
return server
|
|
76
78
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppContext } from '../../context'
|
|
2
|
+
import { Server } from '../../lexicon'
|
|
3
|
+
|
|
4
|
+
export default function (server: Server, ctx: AppContext) {
|
|
5
|
+
server.tools.ozone.moderation.getReporterStats({
|
|
6
|
+
auth: ctx.authVerifier.modOrAdminToken,
|
|
7
|
+
handler: async ({ params }) => {
|
|
8
|
+
const db = ctx.db
|
|
9
|
+
|
|
10
|
+
const stats = await ctx.modService(db).getReporterStats(params.dids)
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
encoding: 'application/json',
|
|
14
|
+
body: { stats },
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Kysely, sql } from 'kysely'
|
|
2
|
+
|
|
3
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
|
+
await sql`
|
|
5
|
+
CREATE INDEX "moderation_event_account_reports_idx"
|
|
6
|
+
ON moderation_event("createdBy","subjectDid", "createdAt")
|
|
7
|
+
WHERE "subjectUri" IS NULL
|
|
8
|
+
AND "action" = 'tools.ozone.moderation.defs#modEventReport'
|
|
9
|
+
`.execute(db)
|
|
10
|
+
|
|
11
|
+
await sql`
|
|
12
|
+
CREATE INDEX "moderation_event_record_reports_idx"
|
|
13
|
+
ON moderation_event("createdBy","subjectDid","subjectUri", "createdAt")
|
|
14
|
+
WHERE "subjectUri" IS NOT NULL
|
|
15
|
+
AND "action" = 'tools.ozone.moderation.defs#modEventReport'
|
|
16
|
+
`.execute(db)
|
|
17
|
+
|
|
18
|
+
await sql`
|
|
19
|
+
CREATE INDEX "moderation_event_account_actions_ids"
|
|
20
|
+
ON moderation_event("subjectDid","action", "createdAt")
|
|
21
|
+
WHERE "subjectUri" IS NULL
|
|
22
|
+
AND "action" IN ( 'tools.ozone.moderation.defs#modEventTakedown', 'tools.ozone.moderation.defs#modEventLabel')
|
|
23
|
+
`.execute(db)
|
|
24
|
+
|
|
25
|
+
await sql`
|
|
26
|
+
CREATE INDEX "moderation_event_record_actions_ids"
|
|
27
|
+
ON moderation_event("subjectDid","subjectUri", "action", "createdAt")
|
|
28
|
+
WHERE "subjectUri" IS NOT NULL
|
|
29
|
+
AND "action" IN ( 'tools.ozone.moderation.defs#modEventTakedown', 'tools.ozone.moderation.defs#modEventLabel')
|
|
30
|
+
`.execute(db)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
34
|
+
await db.schema.dropIndex('moderation_event_account_reports_idx').execute()
|
|
35
|
+
await db.schema.dropIndex('moderation_event_record_reports_idx').execute()
|
|
36
|
+
await db.schema.dropIndex('moderation_event_account_actions_ids').execute()
|
|
37
|
+
await db.schema.dropIndex('moderation_event_record_actions_ids').execute()
|
|
38
|
+
}
|
|
@@ -19,4 +19,5 @@ export * as _20241018T205730722Z from './20241018T205730722Z-setting'
|
|
|
19
19
|
export * as _20241026T205730722Z from './20241026T205730722Z-add-hosting-status-to-subject-status'
|
|
20
20
|
export * as _20241220T144630860Z from './20241220T144630860Z-stats-materialized-views'
|
|
21
21
|
export * as _20250204T003647759Z from './20250204T003647759Z-add-subject-priority-score'
|
|
22
|
+
export * as _20250211T003647759Z from './20250211T003647759Z-add-reporter-stats-index'
|
|
22
23
|
export * as _20250211T132135150Z from './20250211T132135150Z-moderation-event-message-partial-idx'
|
package/src/lexicon/index.ts
CHANGED
|
@@ -77,6 +77,7 @@ import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js'
|
|
|
77
77
|
import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js'
|
|
78
78
|
import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js'
|
|
79
79
|
import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js'
|
|
80
|
+
import * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js'
|
|
80
81
|
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js'
|
|
81
82
|
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js'
|
|
82
83
|
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js'
|
|
@@ -173,6 +174,7 @@ import * as ToolsOzoneModerationGetEvent from './types/tools/ozone/moderation/ge
|
|
|
173
174
|
import * as ToolsOzoneModerationGetRecord from './types/tools/ozone/moderation/getRecord.js'
|
|
174
175
|
import * as ToolsOzoneModerationGetRecords from './types/tools/ozone/moderation/getRecords.js'
|
|
175
176
|
import * as ToolsOzoneModerationGetRepo from './types/tools/ozone/moderation/getRepo.js'
|
|
177
|
+
import * as ToolsOzoneModerationGetReporterStats from './types/tools/ozone/moderation/getReporterStats.js'
|
|
176
178
|
import * as ToolsOzoneModerationGetRepos from './types/tools/ozone/moderation/getRepos.js'
|
|
177
179
|
import * as ToolsOzoneModerationQueryEvents from './types/tools/ozone/moderation/queryEvents.js'
|
|
178
180
|
import * as ToolsOzoneModerationQueryStatuses from './types/tools/ozone/moderation/queryStatuses.js'
|
|
@@ -1108,6 +1110,17 @@ export class ComAtprotoSyncNS {
|
|
|
1108
1110
|
return this._server.xrpc.method(nsid, cfg)
|
|
1109
1111
|
}
|
|
1110
1112
|
|
|
1113
|
+
listReposByCollection<AV extends AuthVerifier>(
|
|
1114
|
+
cfg: ConfigOf<
|
|
1115
|
+
AV,
|
|
1116
|
+
ComAtprotoSyncListReposByCollection.Handler<ExtractAuth<AV>>,
|
|
1117
|
+
ComAtprotoSyncListReposByCollection.HandlerReqCtx<ExtractAuth<AV>>
|
|
1118
|
+
>,
|
|
1119
|
+
) {
|
|
1120
|
+
const nsid = 'com.atproto.sync.listReposByCollection' // @ts-ignore
|
|
1121
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1111
1124
|
notifyOfUpdate<AV extends AuthVerifier>(
|
|
1112
1125
|
cfg: ConfigOf<
|
|
1113
1126
|
AV,
|
|
@@ -2376,6 +2389,17 @@ export class ToolsOzoneModerationNS {
|
|
|
2376
2389
|
return this._server.xrpc.method(nsid, cfg)
|
|
2377
2390
|
}
|
|
2378
2391
|
|
|
2392
|
+
getReporterStats<AV extends AuthVerifier>(
|
|
2393
|
+
cfg: ConfigOf<
|
|
2394
|
+
AV,
|
|
2395
|
+
ToolsOzoneModerationGetReporterStats.Handler<ExtractAuth<AV>>,
|
|
2396
|
+
ToolsOzoneModerationGetReporterStats.HandlerReqCtx<ExtractAuth<AV>>
|
|
2397
|
+
>,
|
|
2398
|
+
) {
|
|
2399
|
+
const nsid = 'tools.ozone.moderation.getReporterStats' // @ts-ignore
|
|
2400
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2379
2403
|
getRepos<AV extends AuthVerifier>(
|
|
2380
2404
|
cfg: ConfigOf<
|
|
2381
2405
|
AV,
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -3661,6 +3661,67 @@ export const schemaDict = {
|
|
|
3661
3661
|
},
|
|
3662
3662
|
},
|
|
3663
3663
|
},
|
|
3664
|
+
ComAtprotoSyncListReposByCollection: {
|
|
3665
|
+
lexicon: 1,
|
|
3666
|
+
id: 'com.atproto.sync.listReposByCollection',
|
|
3667
|
+
defs: {
|
|
3668
|
+
main: {
|
|
3669
|
+
type: 'query',
|
|
3670
|
+
description:
|
|
3671
|
+
'Enumerates all the DIDs which have records with the given collection NSID.',
|
|
3672
|
+
parameters: {
|
|
3673
|
+
type: 'params',
|
|
3674
|
+
required: ['collection'],
|
|
3675
|
+
properties: {
|
|
3676
|
+
collection: {
|
|
3677
|
+
type: 'string',
|
|
3678
|
+
format: 'nsid',
|
|
3679
|
+
},
|
|
3680
|
+
limit: {
|
|
3681
|
+
type: 'integer',
|
|
3682
|
+
description:
|
|
3683
|
+
'Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.',
|
|
3684
|
+
minimum: 1,
|
|
3685
|
+
maximum: 2000,
|
|
3686
|
+
default: 500,
|
|
3687
|
+
},
|
|
3688
|
+
cursor: {
|
|
3689
|
+
type: 'string',
|
|
3690
|
+
},
|
|
3691
|
+
},
|
|
3692
|
+
},
|
|
3693
|
+
output: {
|
|
3694
|
+
encoding: 'application/json',
|
|
3695
|
+
schema: {
|
|
3696
|
+
type: 'object',
|
|
3697
|
+
required: ['repos'],
|
|
3698
|
+
properties: {
|
|
3699
|
+
cursor: {
|
|
3700
|
+
type: 'string',
|
|
3701
|
+
},
|
|
3702
|
+
repos: {
|
|
3703
|
+
type: 'array',
|
|
3704
|
+
items: {
|
|
3705
|
+
type: 'ref',
|
|
3706
|
+
ref: 'lex:com.atproto.sync.listReposByCollection#repo',
|
|
3707
|
+
},
|
|
3708
|
+
},
|
|
3709
|
+
},
|
|
3710
|
+
},
|
|
3711
|
+
},
|
|
3712
|
+
},
|
|
3713
|
+
repo: {
|
|
3714
|
+
type: 'object',
|
|
3715
|
+
required: ['did'],
|
|
3716
|
+
properties: {
|
|
3717
|
+
did: {
|
|
3718
|
+
type: 'string',
|
|
3719
|
+
format: 'did',
|
|
3720
|
+
},
|
|
3721
|
+
},
|
|
3722
|
+
},
|
|
3723
|
+
},
|
|
3724
|
+
},
|
|
3664
3725
|
ComAtprotoSyncNotifyOfUpdate: {
|
|
3665
3726
|
lexicon: 1,
|
|
3666
3727
|
id: 'com.atproto.sync.notifyOfUpdate',
|
|
@@ -12219,6 +12280,64 @@ export const schemaDict = {
|
|
|
12219
12280
|
},
|
|
12220
12281
|
},
|
|
12221
12282
|
},
|
|
12283
|
+
reporterStats: {
|
|
12284
|
+
type: 'object',
|
|
12285
|
+
required: [
|
|
12286
|
+
'did',
|
|
12287
|
+
'accountReportCount',
|
|
12288
|
+
'recordReportCount',
|
|
12289
|
+
'reportedAccountCount',
|
|
12290
|
+
'reportedRecordCount',
|
|
12291
|
+
'takendownAccountCount',
|
|
12292
|
+
'takendownRecordCount',
|
|
12293
|
+
'labeledAccountCount',
|
|
12294
|
+
'labeledRecordCount',
|
|
12295
|
+
],
|
|
12296
|
+
properties: {
|
|
12297
|
+
did: {
|
|
12298
|
+
type: 'string',
|
|
12299
|
+
format: 'did',
|
|
12300
|
+
},
|
|
12301
|
+
accountReportCount: {
|
|
12302
|
+
type: 'integer',
|
|
12303
|
+
description:
|
|
12304
|
+
'The total number of reports made by the user on accounts.',
|
|
12305
|
+
},
|
|
12306
|
+
recordReportCount: {
|
|
12307
|
+
type: 'integer',
|
|
12308
|
+
description:
|
|
12309
|
+
'The total number of reports made by the user on records.',
|
|
12310
|
+
},
|
|
12311
|
+
reportedAccountCount: {
|
|
12312
|
+
type: 'integer',
|
|
12313
|
+
description: 'The total number of accounts reported by the user.',
|
|
12314
|
+
},
|
|
12315
|
+
reportedRecordCount: {
|
|
12316
|
+
type: 'integer',
|
|
12317
|
+
description: 'The total number of records reported by the user.',
|
|
12318
|
+
},
|
|
12319
|
+
takendownAccountCount: {
|
|
12320
|
+
type: 'integer',
|
|
12321
|
+
description:
|
|
12322
|
+
"The total number of accounts taken down as a result of the user's reports.",
|
|
12323
|
+
},
|
|
12324
|
+
takendownRecordCount: {
|
|
12325
|
+
type: 'integer',
|
|
12326
|
+
description:
|
|
12327
|
+
"The total number of records taken down as a result of the user's reports.",
|
|
12328
|
+
},
|
|
12329
|
+
labeledAccountCount: {
|
|
12330
|
+
type: 'integer',
|
|
12331
|
+
description:
|
|
12332
|
+
"The total number of accounts labeled as a result of the user's reports.",
|
|
12333
|
+
},
|
|
12334
|
+
labeledRecordCount: {
|
|
12335
|
+
type: 'integer',
|
|
12336
|
+
description:
|
|
12337
|
+
"The total number of records labeled as a result of the user's reports.",
|
|
12338
|
+
},
|
|
12339
|
+
},
|
|
12340
|
+
},
|
|
12222
12341
|
},
|
|
12223
12342
|
},
|
|
12224
12343
|
ToolsOzoneModerationEmitEvent: {
|
|
@@ -12430,6 +12549,46 @@ export const schemaDict = {
|
|
|
12430
12549
|
},
|
|
12431
12550
|
},
|
|
12432
12551
|
},
|
|
12552
|
+
ToolsOzoneModerationGetReporterStats: {
|
|
12553
|
+
lexicon: 1,
|
|
12554
|
+
id: 'tools.ozone.moderation.getReporterStats',
|
|
12555
|
+
defs: {
|
|
12556
|
+
main: {
|
|
12557
|
+
type: 'query',
|
|
12558
|
+
description: 'Get reporter stats for a list of users.',
|
|
12559
|
+
parameters: {
|
|
12560
|
+
type: 'params',
|
|
12561
|
+
required: ['dids'],
|
|
12562
|
+
properties: {
|
|
12563
|
+
dids: {
|
|
12564
|
+
type: 'array',
|
|
12565
|
+
maxLength: 100,
|
|
12566
|
+
items: {
|
|
12567
|
+
type: 'string',
|
|
12568
|
+
format: 'did',
|
|
12569
|
+
},
|
|
12570
|
+
},
|
|
12571
|
+
},
|
|
12572
|
+
},
|
|
12573
|
+
output: {
|
|
12574
|
+
encoding: 'application/json',
|
|
12575
|
+
schema: {
|
|
12576
|
+
type: 'object',
|
|
12577
|
+
required: ['stats'],
|
|
12578
|
+
properties: {
|
|
12579
|
+
stats: {
|
|
12580
|
+
type: 'array',
|
|
12581
|
+
items: {
|
|
12582
|
+
type: 'ref',
|
|
12583
|
+
ref: 'lex:tools.ozone.moderation.defs#reporterStats',
|
|
12584
|
+
},
|
|
12585
|
+
},
|
|
12586
|
+
},
|
|
12587
|
+
},
|
|
12588
|
+
},
|
|
12589
|
+
},
|
|
12590
|
+
},
|
|
12591
|
+
},
|
|
12433
12592
|
ToolsOzoneModerationGetRepos: {
|
|
12434
12593
|
lexicon: 1,
|
|
12435
12594
|
id: 'tools.ozone.moderation.getRepos',
|
|
@@ -13993,6 +14152,7 @@ export const ids = {
|
|
|
13993
14152
|
ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus',
|
|
13994
14153
|
ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs',
|
|
13995
14154
|
ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos',
|
|
14155
|
+
ComAtprotoSyncListReposByCollection: 'com.atproto.sync.listReposByCollection',
|
|
13996
14156
|
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
|
|
13997
14157
|
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
|
|
13998
14158
|
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
|
|
@@ -14133,6 +14293,8 @@ export const ids = {
|
|
|
14133
14293
|
ToolsOzoneModerationGetRecord: 'tools.ozone.moderation.getRecord',
|
|
14134
14294
|
ToolsOzoneModerationGetRecords: 'tools.ozone.moderation.getRecords',
|
|
14135
14295
|
ToolsOzoneModerationGetRepo: 'tools.ozone.moderation.getRepo',
|
|
14296
|
+
ToolsOzoneModerationGetReporterStats:
|
|
14297
|
+
'tools.ozone.moderation.getReporterStats',
|
|
14136
14298
|
ToolsOzoneModerationGetRepos: 'tools.ozone.moderation.getRepos',
|
|
14137
14299
|
ToolsOzoneModerationQueryEvents: 'tools.ozone.moderation.queryEvents',
|
|
14138
14300
|
ToolsOzoneModerationQueryStatuses: 'tools.ozone.moderation.queryStatuses',
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { CID } from 'multiformats/cid'
|
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
|
8
|
+
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
|
|
11
|
+
const is$typed = _is$typed,
|
|
12
|
+
validate = _validate
|
|
13
|
+
const id = 'com.atproto.sync.listReposByCollection'
|
|
14
|
+
|
|
15
|
+
export interface QueryParams {
|
|
16
|
+
collection: string
|
|
17
|
+
/** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */
|
|
18
|
+
limit: number
|
|
19
|
+
cursor?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type InputSchema = undefined
|
|
23
|
+
|
|
24
|
+
export interface OutputSchema {
|
|
25
|
+
cursor?: string
|
|
26
|
+
repos: Repo[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type HandlerInput = undefined
|
|
30
|
+
|
|
31
|
+
export interface HandlerSuccess {
|
|
32
|
+
encoding: 'application/json'
|
|
33
|
+
body: OutputSchema
|
|
34
|
+
headers?: { [key: string]: string }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface HandlerError {
|
|
38
|
+
status: number
|
|
39
|
+
message?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
43
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
44
|
+
auth: HA
|
|
45
|
+
params: QueryParams
|
|
46
|
+
input: HandlerInput
|
|
47
|
+
req: express.Request
|
|
48
|
+
res: express.Response
|
|
49
|
+
resetRouteRateLimits: () => Promise<void>
|
|
50
|
+
}
|
|
51
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
52
|
+
ctx: HandlerReqCtx<HA>,
|
|
53
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
54
|
+
|
|
55
|
+
export interface Repo {
|
|
56
|
+
$type?: 'com.atproto.sync.listReposByCollection#repo'
|
|
57
|
+
did: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const hashRepo = 'repo'
|
|
61
|
+
|
|
62
|
+
export function isRepo<V>(v: V) {
|
|
63
|
+
return is$typed(v, id, hashRepo)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function validateRepo<V>(v: V) {
|
|
67
|
+
return validate<Repo & V>(v, id, hashRepo)
|
|
68
|
+
}
|
|
@@ -836,3 +836,34 @@ export function isRecordHosting<V>(v: V) {
|
|
|
836
836
|
export function validateRecordHosting<V>(v: V) {
|
|
837
837
|
return validate<RecordHosting & V>(v, id, hashRecordHosting)
|
|
838
838
|
}
|
|
839
|
+
|
|
840
|
+
export interface ReporterStats {
|
|
841
|
+
$type?: 'tools.ozone.moderation.defs#reporterStats'
|
|
842
|
+
did: string
|
|
843
|
+
/** The total number of reports made by the user on accounts. */
|
|
844
|
+
accountReportCount: number
|
|
845
|
+
/** The total number of reports made by the user on records. */
|
|
846
|
+
recordReportCount: number
|
|
847
|
+
/** The total number of accounts reported by the user. */
|
|
848
|
+
reportedAccountCount: number
|
|
849
|
+
/** The total number of records reported by the user. */
|
|
850
|
+
reportedRecordCount: number
|
|
851
|
+
/** The total number of accounts taken down as a result of the user's reports. */
|
|
852
|
+
takendownAccountCount: number
|
|
853
|
+
/** The total number of records taken down as a result of the user's reports. */
|
|
854
|
+
takendownRecordCount: number
|
|
855
|
+
/** The total number of accounts labeled as a result of the user's reports. */
|
|
856
|
+
labeledAccountCount: number
|
|
857
|
+
/** The total number of records labeled as a result of the user's reports. */
|
|
858
|
+
labeledRecordCount: number
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
const hashReporterStats = 'reporterStats'
|
|
862
|
+
|
|
863
|
+
export function isReporterStats<V>(v: V) {
|
|
864
|
+
return is$typed(v, id, hashReporterStats)
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
export function validateReporterStats<V>(v: V) {
|
|
868
|
+
return validate<ReporterStats & V>(v, id, hashReporterStats)
|
|
869
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { CID } from 'multiformats/cid'
|
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
|
8
|
+
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
import type * as ToolsOzoneModerationDefs from './defs.js'
|
|
11
|
+
|
|
12
|
+
const is$typed = _is$typed,
|
|
13
|
+
validate = _validate
|
|
14
|
+
const id = 'tools.ozone.moderation.getReporterStats'
|
|
15
|
+
|
|
16
|
+
export interface QueryParams {
|
|
17
|
+
dids: string[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type InputSchema = undefined
|
|
21
|
+
|
|
22
|
+
export interface OutputSchema {
|
|
23
|
+
stats: ToolsOzoneModerationDefs.ReporterStats[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type HandlerInput = undefined
|
|
27
|
+
|
|
28
|
+
export interface HandlerSuccess {
|
|
29
|
+
encoding: 'application/json'
|
|
30
|
+
body: OutputSchema
|
|
31
|
+
headers?: { [key: string]: string }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface HandlerError {
|
|
35
|
+
status: number
|
|
36
|
+
message?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
40
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
41
|
+
auth: HA
|
|
42
|
+
params: QueryParams
|
|
43
|
+
input: HandlerInput
|
|
44
|
+
req: express.Request
|
|
45
|
+
res: express.Response
|
|
46
|
+
resetRouteRateLimits: () => Promise<void>
|
|
47
|
+
}
|
|
48
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
49
|
+
ctx: HandlerReqCtx<HA>,
|
|
50
|
+
) => Promise<HandlerOutput> | HandlerOutput
|