@atproto/ozone 0.1.107 → 0.1.109
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 +27 -0
- package/dist/api/health.js +1 -1
- package/dist/api/health.js.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +6 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/server/getConfig.d.ts.map +1 -1
- package/dist/api/server/getConfig.js +1 -0
- package/dist/api/server/getConfig.js.map +1 -1
- package/dist/api/setting/removeOptions.d.ts.map +1 -1
- package/dist/api/setting/removeOptions.js +1 -0
- package/dist/api/setting/removeOptions.js.map +1 -1
- package/dist/api/setting/upsertOption.js +7 -0
- package/dist/api/setting/upsertOption.js.map +1 -1
- package/dist/api/util.d.ts +1 -1
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +6 -1
- package/dist/api/util.js.map +1 -1
- package/dist/api/verification/grantVerifications.d.ts +4 -0
- package/dist/api/verification/grantVerifications.d.ts.map +1 -0
- package/dist/api/verification/grantVerifications.js +60 -0
- package/dist/api/verification/grantVerifications.js.map +1 -0
- package/dist/api/verification/listVerifications.d.ts +4 -0
- package/dist/api/verification/listVerifications.d.ts.map +1 -0
- package/dist/api/verification/listVerifications.js +32 -0
- package/dist/api/verification/listVerifications.js.map +1 -0
- package/dist/api/verification/revokeVerifications.d.ts +4 -0
- package/dist/api/verification/revokeVerifications.d.ts.map +1 -0
- package/dist/api/verification/revokeVerifications.js +36 -0
- package/dist/api/verification/revokeVerifications.js.map +1 -0
- package/dist/auth-verifier.d.ts +4 -1
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +4 -3
- package/dist/auth-verifier.js.map +1 -1
- package/dist/background.d.ts +3 -1
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +4 -3
- package/dist/background.js.map +1 -1
- package/dist/config/config.d.ts +9 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +10 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +5 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +5 -0
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts +6 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +12 -0
- package/dist/context.js.map +1 -1
- package/dist/daemon/context.d.ts +3 -0
- package/dist/daemon/context.d.ts.map +1 -1
- package/dist/daemon/context.js +11 -0
- package/dist/daemon/context.js.map +1 -1
- package/dist/daemon/verification-listener.d.ts +29 -0
- package/dist/daemon/verification-listener.d.ts.map +1 -0
- package/dist/daemon/verification-listener.js +171 -0
- package/dist/daemon/verification-listener.js.map +1 -0
- package/dist/db/migrations/20250415T201720309Z-verification.d.ts +4 -0
- package/dist/db/migrations/20250415T201720309Z-verification.d.ts.map +1 -0
- package/dist/db/migrations/20250415T201720309Z-verification.js +35 -0
- package/dist/db/migrations/20250415T201720309Z-verification.js.map +1 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.d.ts +4 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.d.ts.map +1 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.js +17 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.js.map +1 -0
- package/dist/db/migrations/index.d.ts +2 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +3 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/db/pagination.d.ts +15 -0
- package/dist/db/pagination.d.ts.map +1 -1
- package/dist/db/pagination.js +23 -1
- package/dist/db/pagination.js.map +1 -1
- package/dist/db/schema/firehose_cursor.d.ts +11 -0
- package/dist/db/schema/firehose_cursor.d.ts.map +1 -0
- package/dist/db/schema/firehose_cursor.js +5 -0
- package/dist/db/schema/firehose_cursor.js.map +1 -0
- package/dist/db/schema/index.d.ts +3 -1
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/member.d.ts +1 -1
- package/dist/db/schema/member.d.ts.map +1 -1
- package/dist/db/schema/verification.d.ts +19 -0
- package/dist/db/schema/verification.d.ts.map +1 -0
- package/dist/db/schema/verification.js +5 -0
- package/dist/db/schema/verification.js.map +1 -0
- package/dist/error.js +1 -1
- package/dist/error.js.map +1 -1
- package/dist/jetstream/service.d.ts +60 -0
- package/dist/jetstream/service.d.ts.map +1 -0
- package/dist/jetstream/service.js +65 -0
- package/dist/jetstream/service.js.map +1 -0
- package/dist/lexicon/index.d.ts +15 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +36 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +918 -98
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +434 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +21 -0
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js +9 -0
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/status.d.ts +23 -0
- package/dist/lexicon/types/app/bsky/actor/status.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/actor/status.js +19 -0
- package/dist/lexicon/types/app/bsky/actor/status.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/server/getConfig.d.ts +3 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/setting/defs.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/setting/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/setting/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/setting/upsertOption.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/setting/upsertOption.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/addMember.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/team/addMember.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.d.ts +3 -1
- package/dist/lexicon/types/tools/ozone/team/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.js +3 -1
- package/dist/lexicon/types/tools/ozone/team/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/updateMember.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/team/updateMember.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/verification/defs.d.ts +43 -0
- package/dist/lexicon/types/tools/ozone/verification/defs.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/defs.js +16 -0
- package/dist/lexicon/types/tools/ozone/verification/defs.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.d.ts +66 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.js +25 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.d.ts +52 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.js +7 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.d.ts +56 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.js +16 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.js.map +1 -0
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/logger.js.map +1 -1
- package/dist/mod-service/index.js +1 -1
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/status.d.ts +6 -0
- package/dist/mod-service/status.d.ts.map +1 -1
- package/dist/mod-service/views.d.ts.map +1 -1
- package/dist/mod-service/views.js +2 -0
- package/dist/mod-service/views.js.map +1 -1
- package/dist/team/index.d.ts +1 -0
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +5 -2
- package/dist/team/index.js.map +1 -1
- package/dist/verification/issuer.d.ts +37 -0
- package/dist/verification/issuer.d.ts.map +1 -0
- package/dist/verification/issuer.js +119 -0
- package/dist/verification/issuer.js.map +1 -0
- package/dist/verification/service.d.ts +47 -0
- package/dist/verification/service.d.ts.map +1 -0
- package/dist/verification/service.js +141 -0
- package/dist/verification/service.js.map +1 -0
- package/dist/verification/util.d.ts +6 -0
- package/dist/verification/util.d.ts.map +1 -0
- package/dist/verification/util.js +32 -0
- package/dist/verification/util.js.map +1 -0
- package/package.json +10 -9
- package/src/api/health.ts +1 -1
- package/src/api/index.ts +6 -0
- package/src/api/server/getConfig.ts +1 -0
- package/src/api/setting/removeOptions.ts +1 -0
- package/src/api/setting/upsertOption.ts +7 -0
- package/src/api/util.ts +7 -1
- package/src/api/verification/grantVerifications.ts +90 -0
- package/src/api/verification/listVerifications.ts +44 -0
- package/src/api/verification/revokeVerifications.ts +43 -0
- package/src/auth-verifier.ts +8 -4
- package/src/background.ts +8 -3
- package/src/config/config.ts +21 -0
- package/src/config/env.ts +10 -0
- package/src/context.ts +22 -0
- package/src/daemon/context.ts +19 -0
- package/src/daemon/verification-listener.ts +164 -0
- package/src/db/migrations/20250415T201720309Z-verification.ts +34 -0
- package/src/db/migrations/20250417T201720309Z-firehose-cursor.ts +16 -0
- package/src/db/migrations/index.ts +2 -0
- package/src/db/pagination.ts +31 -0
- package/src/db/schema/firehose_cursor.ts +13 -0
- package/src/db/schema/index.ts +5 -1
- package/src/db/schema/member.ts +1 -0
- package/src/db/schema/verification.ts +21 -0
- package/src/error.ts +1 -1
- package/src/jetstream/service.ts +104 -0
- package/src/lexicon/index.ts +50 -0
- package/src/lexicon/lexicons.ts +457 -0
- package/src/lexicon/types/app/bsky/actor/defs.ts +26 -0
- package/src/lexicon/types/app/bsky/actor/status.ts +40 -0
- package/src/lexicon/types/tools/ozone/server/getConfig.ts +3 -0
- package/src/lexicon/types/tools/ozone/setting/defs.ts +1 -0
- package/src/lexicon/types/tools/ozone/setting/upsertOption.ts +1 -0
- package/src/lexicon/types/tools/ozone/team/addMember.ts +1 -0
- package/src/lexicon/types/tools/ozone/team/defs.ts +3 -0
- package/src/lexicon/types/tools/ozone/team/updateMember.ts +1 -0
- package/src/lexicon/types/tools/ozone/verification/defs.ts +59 -0
- package/src/lexicon/types/tools/ozone/verification/grantVerifications.ts +100 -0
- package/src/lexicon/types/tools/ozone/verification/listVerifications.ts +70 -0
- package/src/lexicon/types/tools/ozone/verification/revokeVerifications.ts +81 -0
- package/src/logger.ts +2 -0
- package/src/mod-service/index.ts +1 -1
- package/src/mod-service/views.ts +4 -0
- package/src/team/index.ts +6 -5
- package/src/verification/issuer.ts +135 -0
- package/src/verification/service.ts +208 -0
- package/src/verification/util.ts +50 -0
- package/tests/__snapshots__/verification-listener.test.ts.snap +146 -0
- package/tests/__snapshots__/verification.test.ts.snap +288 -0
- package/tests/expiring-label.test.ts +72 -0
- package/tests/verification-listener.test.ts +102 -0
- package/tests/verification.test.ts +166 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Selectable } from 'kysely'
|
|
2
|
+
import {
|
|
3
|
+
$Typed,
|
|
4
|
+
AppBskyActorDefs,
|
|
5
|
+
AtUri,
|
|
6
|
+
ToolsOzoneModerationDefs,
|
|
7
|
+
ToolsOzoneVerificationDefs,
|
|
8
|
+
} from '@atproto/api'
|
|
9
|
+
import { Database } from '../db'
|
|
10
|
+
import { CreatedAtUriKeyset, paginate } from '../db/pagination'
|
|
11
|
+
import { Verification } from '../db/schema/verification'
|
|
12
|
+
|
|
13
|
+
export type VerificationServiceCreator = (db: Database) => VerificationService
|
|
14
|
+
|
|
15
|
+
export class VerificationService {
|
|
16
|
+
constructor(public db: Database) {}
|
|
17
|
+
|
|
18
|
+
static creator() {
|
|
19
|
+
return (db: Database) => new VerificationService(db)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async create(
|
|
23
|
+
verifications: Pick<
|
|
24
|
+
Verification,
|
|
25
|
+
| 'uri'
|
|
26
|
+
| 'issuer'
|
|
27
|
+
| 'subject'
|
|
28
|
+
| 'handle'
|
|
29
|
+
| 'displayName'
|
|
30
|
+
| 'createdAt'
|
|
31
|
+
| 'cid'
|
|
32
|
+
>[],
|
|
33
|
+
) {
|
|
34
|
+
return this.db.transaction(async (tx) => {
|
|
35
|
+
return tx.db
|
|
36
|
+
.insertInto('verification')
|
|
37
|
+
.values(verifications)
|
|
38
|
+
.onConflict((oc) => oc.doNothing())
|
|
39
|
+
.returningAll()
|
|
40
|
+
.execute()
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async markRevoked({
|
|
45
|
+
uris,
|
|
46
|
+
revokedBy,
|
|
47
|
+
revokedAt,
|
|
48
|
+
revokeReason,
|
|
49
|
+
}: {
|
|
50
|
+
uris: string[]
|
|
51
|
+
revokedBy?: string
|
|
52
|
+
revokedAt?: string
|
|
53
|
+
revokeReason?: string
|
|
54
|
+
}) {
|
|
55
|
+
const now = new Date().toISOString()
|
|
56
|
+
return this.db.transaction(async (tx) => {
|
|
57
|
+
for (const uri of uris) {
|
|
58
|
+
return tx.db
|
|
59
|
+
.updateTable('verification')
|
|
60
|
+
.set({
|
|
61
|
+
revokeReason,
|
|
62
|
+
updatedAt: now,
|
|
63
|
+
revokedAt: revokedAt || now,
|
|
64
|
+
// Allow setting revokedBy to a moderator/verifier DID and if it isn't set, default to the author of the verification record
|
|
65
|
+
revokedBy: revokedBy || new AtUri(uri).host,
|
|
66
|
+
})
|
|
67
|
+
.where('uri', '=', uri)
|
|
68
|
+
.where('revokedAt', 'is', null)
|
|
69
|
+
.execute()
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async list({
|
|
75
|
+
sortDirection,
|
|
76
|
+
cursor,
|
|
77
|
+
createdAfter,
|
|
78
|
+
createdBefore,
|
|
79
|
+
issuers = [],
|
|
80
|
+
subjects = [],
|
|
81
|
+
isRevoked,
|
|
82
|
+
limit = 100,
|
|
83
|
+
}: {
|
|
84
|
+
sortDirection?: 'asc' | 'desc'
|
|
85
|
+
cursor?: string
|
|
86
|
+
createdAfter?: string
|
|
87
|
+
createdBefore?: string
|
|
88
|
+
issuers?: string[]
|
|
89
|
+
subjects?: string[]
|
|
90
|
+
isRevoked?: boolean
|
|
91
|
+
limit?: number
|
|
92
|
+
}) {
|
|
93
|
+
const { ref } = this.db.db.dynamic
|
|
94
|
+
|
|
95
|
+
let qb = this.db.db.selectFrom('verification').selectAll()
|
|
96
|
+
|
|
97
|
+
if (issuers.length) {
|
|
98
|
+
qb = qb.where('issuer', 'in', issuers)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (isRevoked !== undefined) {
|
|
102
|
+
qb = qb.where('revokedAt', isRevoked ? 'is not' : 'is', null)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (subjects.length) {
|
|
106
|
+
qb = qb.where('subject', 'in', subjects)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (createdAfter) {
|
|
110
|
+
qb = qb.where('createdAt', '>=', createdAfter)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (createdBefore) {
|
|
114
|
+
qb = qb.where('createdAt', '<=', createdBefore)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const keyset = new CreatedAtUriKeyset(ref(`createdAt`), ref('uri'))
|
|
118
|
+
const paginatedBuilder = paginate(qb, {
|
|
119
|
+
limit,
|
|
120
|
+
cursor,
|
|
121
|
+
keyset,
|
|
122
|
+
tryIndex: true,
|
|
123
|
+
direction: sortDirection === 'desc' ? 'desc' : 'asc',
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const result = await paginatedBuilder.execute()
|
|
127
|
+
return { verifications: result, cursor: keyset.packFromResult(result) }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
view(
|
|
131
|
+
verifications: Selectable<Verification>[],
|
|
132
|
+
repos: Map<
|
|
133
|
+
string,
|
|
134
|
+
| $Typed<ToolsOzoneModerationDefs.RepoViewDetail>
|
|
135
|
+
| $Typed<ToolsOzoneModerationDefs.RepoViewNotFound>
|
|
136
|
+
>,
|
|
137
|
+
profiles: Map<string, AppBskyActorDefs.ProfileViewDetailed>,
|
|
138
|
+
): $Typed<ToolsOzoneVerificationDefs.VerificationView>[] {
|
|
139
|
+
return verifications.map((verification) => {
|
|
140
|
+
const issuerRepo = repos.get(verification.issuer)
|
|
141
|
+
const subjectRepo = repos.get(verification.subject)
|
|
142
|
+
const subjectProfile = profiles.get(verification.subject)
|
|
143
|
+
const issuerProfile = profiles.get(verification.issuer)
|
|
144
|
+
return {
|
|
145
|
+
$type: 'tools.ozone.verification.defs#verificationView',
|
|
146
|
+
uri: verification.uri,
|
|
147
|
+
issuer: verification.issuer,
|
|
148
|
+
subject: verification.subject,
|
|
149
|
+
createdAt: verification.createdAt,
|
|
150
|
+
displayName: verification.displayName,
|
|
151
|
+
handle: verification.handle,
|
|
152
|
+
updatedAt: verification.updatedAt || undefined,
|
|
153
|
+
revokedAt: verification.revokedAt || undefined,
|
|
154
|
+
revokedBy: verification.revokedBy || undefined,
|
|
155
|
+
revokeReason: verification.revokeReason || undefined,
|
|
156
|
+
issuerRepo,
|
|
157
|
+
subjectRepo,
|
|
158
|
+
subjectProfile: subjectProfile
|
|
159
|
+
? {
|
|
160
|
+
$type: 'app.bsky.actor.defs#profileViewDetailed',
|
|
161
|
+
...subjectProfile,
|
|
162
|
+
}
|
|
163
|
+
: undefined,
|
|
164
|
+
issuerProfile: issuerProfile
|
|
165
|
+
? {
|
|
166
|
+
$type: 'app.bsky.actor.defs#profileViewDetailed',
|
|
167
|
+
...issuerProfile,
|
|
168
|
+
}
|
|
169
|
+
: undefined,
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async getFirehoseCursor() {
|
|
175
|
+
const entry = await this.db.db
|
|
176
|
+
.selectFrom('firehose_cursor')
|
|
177
|
+
.select('cursor')
|
|
178
|
+
.where('service', '=', 'verification')
|
|
179
|
+
.executeTakeFirst()
|
|
180
|
+
|
|
181
|
+
return entry?.cursor || null
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
createFirehoseCursor() {
|
|
185
|
+
return this.db.db
|
|
186
|
+
.insertInto('firehose_cursor')
|
|
187
|
+
.values({
|
|
188
|
+
service: 'verification',
|
|
189
|
+
cursor: null,
|
|
190
|
+
})
|
|
191
|
+
.onConflict((oc) => oc.doNothing())
|
|
192
|
+
.execute()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async updateFirehoseCursor(cursor: number) {
|
|
196
|
+
const updated = await this.db.db
|
|
197
|
+
.updateTable('firehose_cursor')
|
|
198
|
+
.set({ cursor })
|
|
199
|
+
.where('service', '=', 'verification')
|
|
200
|
+
.where((qb) =>
|
|
201
|
+
qb.where('cursor', '<', cursor).orWhere('cursor', 'is', null),
|
|
202
|
+
)
|
|
203
|
+
.returningAll()
|
|
204
|
+
.executeTakeFirst()
|
|
205
|
+
|
|
206
|
+
return updated?.cursor
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { $Typed, ToolsOzoneModerationDefs } from '@atproto/api'
|
|
2
|
+
import { addAccountInfoToRepoViewDetail, getPdsAccountInfos } from '../api/util'
|
|
3
|
+
import { AppContext } from '../context'
|
|
4
|
+
import { ModerationService } from '../mod-service'
|
|
5
|
+
import { ParsedLabelers } from '../util'
|
|
6
|
+
|
|
7
|
+
export const getReposForVerifications = async (
|
|
8
|
+
ctx: AppContext,
|
|
9
|
+
labelers: ParsedLabelers,
|
|
10
|
+
modService: ModerationService,
|
|
11
|
+
dids: string[],
|
|
12
|
+
isModerator: boolean,
|
|
13
|
+
) => {
|
|
14
|
+
const [partialRepos, accountInfo] = await Promise.all([
|
|
15
|
+
modService.views.repoDetails(dids, labelers),
|
|
16
|
+
getPdsAccountInfos(ctx, dids),
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
const repos = new Map<
|
|
20
|
+
string,
|
|
21
|
+
| $Typed<ToolsOzoneModerationDefs.RepoViewDetail>
|
|
22
|
+
| $Typed<ToolsOzoneModerationDefs.RepoViewNotFound>
|
|
23
|
+
>(
|
|
24
|
+
dids.map((did) => {
|
|
25
|
+
const partialRepo = partialRepos.get(did)
|
|
26
|
+
if (!partialRepo) {
|
|
27
|
+
return [
|
|
28
|
+
did,
|
|
29
|
+
{
|
|
30
|
+
did,
|
|
31
|
+
$type: 'tools.ozone.moderation.defs#repoViewNotFound',
|
|
32
|
+
},
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
did,
|
|
37
|
+
{
|
|
38
|
+
...addAccountInfoToRepoViewDetail(
|
|
39
|
+
partialRepo,
|
|
40
|
+
accountInfo.get(did) || null,
|
|
41
|
+
isModerator,
|
|
42
|
+
),
|
|
43
|
+
$type: 'tools.ozone.moderation.defs#repoViewDetail',
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return repos
|
|
50
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`verification-listener indexes new and revoked verifications 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Object {
|
|
6
|
+
"$type": "tools.ozone.verification.defs#verificationView",
|
|
7
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
8
|
+
"displayName": "Alice",
|
|
9
|
+
"handle": "alice.test",
|
|
10
|
+
"issuer": "user(0)",
|
|
11
|
+
"issuerProfile": Object {
|
|
12
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
13
|
+
"associated": Object {
|
|
14
|
+
"feedgens": 0,
|
|
15
|
+
"labeler": false,
|
|
16
|
+
"lists": 0,
|
|
17
|
+
"starterPacks": 0,
|
|
18
|
+
},
|
|
19
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(0)@jpeg",
|
|
20
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
21
|
+
"description": "hi im bob label_me",
|
|
22
|
+
"did": "user(0)",
|
|
23
|
+
"displayName": "bobby",
|
|
24
|
+
"followersCount": 2,
|
|
25
|
+
"followsCount": 2,
|
|
26
|
+
"handle": "bob.test",
|
|
27
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
28
|
+
"labels": Array [],
|
|
29
|
+
"postsCount": 3,
|
|
30
|
+
"viewer": Object {
|
|
31
|
+
"blockedBy": false,
|
|
32
|
+
"muted": false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
"issuerRepo": Object {
|
|
36
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
37
|
+
"did": "user(0)",
|
|
38
|
+
"email": "bob@test.com",
|
|
39
|
+
"handle": "bob.test",
|
|
40
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
41
|
+
"invites": Array [],
|
|
42
|
+
"invitesDisabled": false,
|
|
43
|
+
"labels": Array [],
|
|
44
|
+
"moderation": Object {},
|
|
45
|
+
"relatedRecords": Array [
|
|
46
|
+
Object {
|
|
47
|
+
"$type": "app.bsky.actor.profile",
|
|
48
|
+
"avatar": Object {
|
|
49
|
+
"$type": "blob",
|
|
50
|
+
"mimeType": "image/jpeg",
|
|
51
|
+
"ref": Object {
|
|
52
|
+
"$link": "cids(0)",
|
|
53
|
+
},
|
|
54
|
+
"size": 3976,
|
|
55
|
+
},
|
|
56
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
57
|
+
"description": "hi im bob label_me",
|
|
58
|
+
"displayName": "bobby",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
"revokedAt": "1970-01-01T00:00:00.000Z",
|
|
63
|
+
"revokedBy": "user(0)",
|
|
64
|
+
"subject": "user(1)",
|
|
65
|
+
"subjectProfile": Object {
|
|
66
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
67
|
+
"associated": Object {
|
|
68
|
+
"feedgens": 0,
|
|
69
|
+
"labeler": false,
|
|
70
|
+
"lists": 0,
|
|
71
|
+
"starterPacks": 0,
|
|
72
|
+
},
|
|
73
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(2)/cids(0)@jpeg",
|
|
74
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
75
|
+
"description": "its me!",
|
|
76
|
+
"did": "user(1)",
|
|
77
|
+
"displayName": "ali",
|
|
78
|
+
"followersCount": 2,
|
|
79
|
+
"followsCount": 3,
|
|
80
|
+
"handle": "alice.test",
|
|
81
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
82
|
+
"labels": Array [
|
|
83
|
+
Object {
|
|
84
|
+
"cid": "cids(1)",
|
|
85
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
86
|
+
"src": "user(1)",
|
|
87
|
+
"uri": "record(1)",
|
|
88
|
+
"val": "self-label-a",
|
|
89
|
+
},
|
|
90
|
+
Object {
|
|
91
|
+
"cid": "cids(1)",
|
|
92
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
93
|
+
"src": "user(1)",
|
|
94
|
+
"uri": "record(1)",
|
|
95
|
+
"val": "self-label-b",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
"postsCount": 4,
|
|
99
|
+
"viewer": Object {
|
|
100
|
+
"blockedBy": false,
|
|
101
|
+
"muted": false,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
"subjectRepo": Object {
|
|
105
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
106
|
+
"did": "user(1)",
|
|
107
|
+
"email": "alice@test.com",
|
|
108
|
+
"handle": "alice.test",
|
|
109
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
110
|
+
"invites": Array [],
|
|
111
|
+
"invitesDisabled": false,
|
|
112
|
+
"labels": Array [],
|
|
113
|
+
"moderation": Object {},
|
|
114
|
+
"relatedRecords": Array [
|
|
115
|
+
Object {
|
|
116
|
+
"$type": "app.bsky.actor.profile",
|
|
117
|
+
"avatar": Object {
|
|
118
|
+
"$type": "blob",
|
|
119
|
+
"mimeType": "image/jpeg",
|
|
120
|
+
"ref": Object {
|
|
121
|
+
"$link": "cids(0)",
|
|
122
|
+
},
|
|
123
|
+
"size": 3976,
|
|
124
|
+
},
|
|
125
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
126
|
+
"description": "its me!",
|
|
127
|
+
"displayName": "ali",
|
|
128
|
+
"labels": Object {
|
|
129
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
130
|
+
"values": Array [
|
|
131
|
+
Object {
|
|
132
|
+
"val": "self-label-a",
|
|
133
|
+
},
|
|
134
|
+
Object {
|
|
135
|
+
"val": "self-label-b",
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
143
|
+
"uri": "record(0)",
|
|
144
|
+
},
|
|
145
|
+
]
|
|
146
|
+
`;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`verification list returns paginated list of verifications 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"$type": "tools.ozone.verification.defs#verificationView",
|
|
6
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
7
|
+
"displayName": "bobby",
|
|
8
|
+
"handle": "bob.test",
|
|
9
|
+
"issuer": "user(0)",
|
|
10
|
+
"issuerProfile": Object {
|
|
11
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
12
|
+
"associated": Object {
|
|
13
|
+
"feedgens": 0,
|
|
14
|
+
"labeler": false,
|
|
15
|
+
"lists": 0,
|
|
16
|
+
"starterPacks": 0,
|
|
17
|
+
},
|
|
18
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(0)@jpeg",
|
|
19
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
20
|
+
"description": "its me!",
|
|
21
|
+
"did": "user(0)",
|
|
22
|
+
"displayName": "ali",
|
|
23
|
+
"followersCount": 2,
|
|
24
|
+
"followsCount": 3,
|
|
25
|
+
"handle": "alice.test",
|
|
26
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
27
|
+
"labels": Array [
|
|
28
|
+
Object {
|
|
29
|
+
"cid": "cids(1)",
|
|
30
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
31
|
+
"src": "user(0)",
|
|
32
|
+
"uri": "record(1)",
|
|
33
|
+
"val": "self-label-a",
|
|
34
|
+
},
|
|
35
|
+
Object {
|
|
36
|
+
"cid": "cids(1)",
|
|
37
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
38
|
+
"src": "user(0)",
|
|
39
|
+
"uri": "record(1)",
|
|
40
|
+
"val": "self-label-b",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
"postsCount": 4,
|
|
44
|
+
"verification": Object {
|
|
45
|
+
"trustedVerifierStatus": "valid",
|
|
46
|
+
"verifications": Array [],
|
|
47
|
+
"verifiedStatus": "none",
|
|
48
|
+
},
|
|
49
|
+
"viewer": Object {
|
|
50
|
+
"blockedBy": false,
|
|
51
|
+
"muted": false,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
"issuerRepo": Object {
|
|
55
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
56
|
+
"did": "user(0)",
|
|
57
|
+
"email": "alice@test.com",
|
|
58
|
+
"handle": "alice.test",
|
|
59
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
60
|
+
"invites": Array [],
|
|
61
|
+
"invitesDisabled": false,
|
|
62
|
+
"labels": Array [],
|
|
63
|
+
"moderation": Object {},
|
|
64
|
+
"relatedRecords": Array [
|
|
65
|
+
Object {
|
|
66
|
+
"$type": "app.bsky.actor.profile",
|
|
67
|
+
"avatar": Object {
|
|
68
|
+
"$type": "blob",
|
|
69
|
+
"mimeType": "image/jpeg",
|
|
70
|
+
"ref": Object {
|
|
71
|
+
"$link": "cids(0)",
|
|
72
|
+
},
|
|
73
|
+
"size": 3976,
|
|
74
|
+
},
|
|
75
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
76
|
+
"description": "its me!",
|
|
77
|
+
"displayName": "ali",
|
|
78
|
+
"labels": Object {
|
|
79
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
80
|
+
"values": Array [
|
|
81
|
+
Object {
|
|
82
|
+
"val": "self-label-a",
|
|
83
|
+
},
|
|
84
|
+
Object {
|
|
85
|
+
"val": "self-label-b",
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
"subject": "user(1)",
|
|
93
|
+
"subjectProfile": Object {
|
|
94
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
95
|
+
"associated": Object {
|
|
96
|
+
"feedgens": 0,
|
|
97
|
+
"labeler": false,
|
|
98
|
+
"lists": 0,
|
|
99
|
+
"starterPacks": 0,
|
|
100
|
+
},
|
|
101
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(2)/cids(0)@jpeg",
|
|
102
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
103
|
+
"description": "hi im bob label_me",
|
|
104
|
+
"did": "user(1)",
|
|
105
|
+
"displayName": "bobby",
|
|
106
|
+
"followersCount": 2,
|
|
107
|
+
"followsCount": 2,
|
|
108
|
+
"handle": "bob.test",
|
|
109
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
110
|
+
"labels": Array [],
|
|
111
|
+
"postsCount": 3,
|
|
112
|
+
"verification": Object {
|
|
113
|
+
"trustedVerifierStatus": "none",
|
|
114
|
+
"verifications": Array [
|
|
115
|
+
Object {
|
|
116
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
117
|
+
"isValid": true,
|
|
118
|
+
"issuer": "user(0)",
|
|
119
|
+
"uri": "record(0)",
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
"verifiedStatus": "valid",
|
|
123
|
+
},
|
|
124
|
+
"viewer": Object {
|
|
125
|
+
"blockedBy": false,
|
|
126
|
+
"muted": false,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
"subjectRepo": Object {
|
|
130
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
131
|
+
"did": "user(1)",
|
|
132
|
+
"email": "bob@test.com",
|
|
133
|
+
"handle": "bob.test",
|
|
134
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
135
|
+
"invites": Array [],
|
|
136
|
+
"invitesDisabled": false,
|
|
137
|
+
"labels": Array [],
|
|
138
|
+
"moderation": Object {},
|
|
139
|
+
"relatedRecords": Array [
|
|
140
|
+
Object {
|
|
141
|
+
"$type": "app.bsky.actor.profile",
|
|
142
|
+
"avatar": Object {
|
|
143
|
+
"$type": "blob",
|
|
144
|
+
"mimeType": "image/jpeg",
|
|
145
|
+
"ref": Object {
|
|
146
|
+
"$link": "cids(0)",
|
|
147
|
+
},
|
|
148
|
+
"size": 3976,
|
|
149
|
+
},
|
|
150
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
151
|
+
"description": "hi im bob label_me",
|
|
152
|
+
"displayName": "bobby",
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
157
|
+
"uri": "record(0)",
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
exports[`verification list returns paginated list of verifications 2`] = `
|
|
162
|
+
Object {
|
|
163
|
+
"$type": "tools.ozone.verification.defs#verificationView",
|
|
164
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
165
|
+
"displayName": "",
|
|
166
|
+
"handle": "carol.test",
|
|
167
|
+
"issuer": "user(0)",
|
|
168
|
+
"issuerProfile": Object {
|
|
169
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
170
|
+
"associated": Object {
|
|
171
|
+
"feedgens": 0,
|
|
172
|
+
"labeler": false,
|
|
173
|
+
"lists": 0,
|
|
174
|
+
"starterPacks": 0,
|
|
175
|
+
},
|
|
176
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(2)/cids(0)@jpeg",
|
|
177
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
178
|
+
"description": "its me!",
|
|
179
|
+
"did": "user(0)",
|
|
180
|
+
"displayName": "ali",
|
|
181
|
+
"followersCount": 2,
|
|
182
|
+
"followsCount": 3,
|
|
183
|
+
"handle": "alice.test",
|
|
184
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
185
|
+
"labels": Array [
|
|
186
|
+
Object {
|
|
187
|
+
"cid": "cids(1)",
|
|
188
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
189
|
+
"src": "user(0)",
|
|
190
|
+
"uri": "record(1)",
|
|
191
|
+
"val": "self-label-a",
|
|
192
|
+
},
|
|
193
|
+
Object {
|
|
194
|
+
"cid": "cids(1)",
|
|
195
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
196
|
+
"src": "user(0)",
|
|
197
|
+
"uri": "record(1)",
|
|
198
|
+
"val": "self-label-b",
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
"postsCount": 4,
|
|
202
|
+
"verification": Object {
|
|
203
|
+
"trustedVerifierStatus": "valid",
|
|
204
|
+
"verifications": Array [],
|
|
205
|
+
"verifiedStatus": "none",
|
|
206
|
+
},
|
|
207
|
+
"viewer": Object {
|
|
208
|
+
"blockedBy": false,
|
|
209
|
+
"muted": false,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
"issuerRepo": Object {
|
|
213
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
214
|
+
"did": "user(0)",
|
|
215
|
+
"email": "alice@test.com",
|
|
216
|
+
"handle": "alice.test",
|
|
217
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
218
|
+
"invites": Array [],
|
|
219
|
+
"invitesDisabled": false,
|
|
220
|
+
"labels": Array [],
|
|
221
|
+
"moderation": Object {},
|
|
222
|
+
"relatedRecords": Array [
|
|
223
|
+
Object {
|
|
224
|
+
"$type": "app.bsky.actor.profile",
|
|
225
|
+
"avatar": Object {
|
|
226
|
+
"$type": "blob",
|
|
227
|
+
"mimeType": "image/jpeg",
|
|
228
|
+
"ref": Object {
|
|
229
|
+
"$link": "cids(0)",
|
|
230
|
+
},
|
|
231
|
+
"size": 3976,
|
|
232
|
+
},
|
|
233
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
234
|
+
"description": "its me!",
|
|
235
|
+
"displayName": "ali",
|
|
236
|
+
"labels": Object {
|
|
237
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
238
|
+
"values": Array [
|
|
239
|
+
Object {
|
|
240
|
+
"val": "self-label-a",
|
|
241
|
+
},
|
|
242
|
+
Object {
|
|
243
|
+
"val": "self-label-b",
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
"revokeReason": "Testing",
|
|
251
|
+
"revokedAt": "1970-01-01T00:00:00.000Z",
|
|
252
|
+
"revokedBy": "user(0)",
|
|
253
|
+
"subject": "user(1)",
|
|
254
|
+
"subjectProfile": Object {
|
|
255
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
256
|
+
"associated": Object {
|
|
257
|
+
"feedgens": 0,
|
|
258
|
+
"labeler": false,
|
|
259
|
+
"lists": 0,
|
|
260
|
+
"starterPacks": 0,
|
|
261
|
+
},
|
|
262
|
+
"did": "user(1)",
|
|
263
|
+
"followersCount": 2,
|
|
264
|
+
"followsCount": 1,
|
|
265
|
+
"handle": "carol.test",
|
|
266
|
+
"labels": Array [],
|
|
267
|
+
"postsCount": 2,
|
|
268
|
+
"viewer": Object {
|
|
269
|
+
"blockedBy": false,
|
|
270
|
+
"muted": false,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
"subjectRepo": Object {
|
|
274
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
275
|
+
"did": "user(1)",
|
|
276
|
+
"email": "carol@test.com",
|
|
277
|
+
"handle": "carol.test",
|
|
278
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
279
|
+
"invites": Array [],
|
|
280
|
+
"invitesDisabled": false,
|
|
281
|
+
"labels": Array [],
|
|
282
|
+
"moderation": Object {},
|
|
283
|
+
"relatedRecords": Array [],
|
|
284
|
+
},
|
|
285
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
286
|
+
"uri": "record(0)",
|
|
287
|
+
}
|
|
288
|
+
`;
|