@atproto/ozone 0.1.166 → 0.1.168
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 +24 -0
- package/dist/api/moderation/emitEvent.d.ts.map +1 -1
- package/dist/api/moderation/emitEvent.js +8 -0
- package/dist/api/moderation/emitEvent.js.map +1 -1
- package/dist/api/report/createReport.d.ts.map +1 -1
- package/dist/api/report/createReport.js +2 -4
- package/dist/api/report/createReport.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 +1 -0
- package/dist/api/util.js.map +1 -1
- package/dist/db/schema/moderation_event.d.ts +1 -1
- package/dist/db/schema/moderation_event.d.ts.map +1 -1
- package/dist/db/schema/moderation_event.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +42 -18
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +22 -10
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +3 -3
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
- package/dist/lexicon/types/com/atproto/label/defs.d.ts +1 -1
- package/dist/lexicon/types/com/atproto/label/defs.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/label/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +10 -2
- 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/emitEvent.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/emitEvent.js.map +1 -1
- package/dist/mod-service/index.d.ts +3 -2
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +11 -0
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/status.d.ts.map +1 -1
- package/dist/mod-service/status.js +7 -0
- package/dist/mod-service/status.js.map +1 -1
- package/package.json +7 -7
- package/src/api/moderation/emitEvent.ts +17 -1
- package/src/api/report/createReport.ts +2 -4
- package/src/api/util.ts +1 -0
- package/src/db/schema/moderation_event.ts +1 -0
- package/src/lexicon/lexicons.ts +24 -11
- package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +3 -3
- package/src/lexicon/types/com/atproto/label/defs.ts +2 -5
- package/src/lexicon/types/tools/ozone/moderation/defs.ts +19 -0
- package/src/lexicon/types/tools/ozone/moderation/emitEvent.ts +1 -0
- package/src/mod-service/index.ts +14 -0
- package/src/mod-service/status.ts +8 -0
- package/tests/3p-labeler.test.ts +2 -2
- package/tests/__snapshots__/get-starter-pack.test.ts.snap +9 -9
- package/tests/__snapshots__/get-subjects.test.ts.snap +2 -2
- package/tests/__snapshots__/team.test.ts.snap +4 -4
- package/tests/__snapshots__/verification-listener.test.ts.snap +2 -2
- package/tests/__snapshots__/verification.test.ts.snap +3 -3
- package/tests/_util.ts +6 -4
- package/tests/account-strikes.test.ts +1 -1
- package/tests/age-assurance.test.ts +134 -7
- package/tests/communication-templates.test.ts +1 -1
- package/tests/expiring-label.test.ts +1 -1
- package/tests/get-account-timeline.test.ts +1 -1
- package/tests/get-config.test.ts +1 -1
- package/tests/get-lists.test.ts +2 -2
- package/tests/get-profiles.test.ts +1 -1
- package/tests/get-record.test.ts +1 -1
- package/tests/get-records.test.ts +1 -1
- package/tests/get-repo.test.ts +2 -2
- package/tests/get-repos.test.ts +2 -2
- package/tests/get-starter-pack.test.ts +2 -2
- package/tests/get-subjects.test.ts +1 -1
- package/tests/moderation.test.ts +3 -3
- package/tests/query-labels.test.ts +1 -1
- package/tests/repo-search.test.ts +1 -1
- package/tests/report-reason.test.ts +1 -1
- package/tests/safelink.test.ts +3 -3
- package/tests/scheduled-action-processor.test.ts +1 -1
- package/tests/scheduled-action.test.ts +3 -3
- package/tests/sets.test.ts +1 -1
- package/tests/settings.test.ts +1 -1
- package/tests/strike-expiry-processor.test.ts +1 -1
- package/tests/takedown.test.ts +2 -2
- package/tests/team.test.ts +2 -2
- package/tests/verification-listener.test.ts +1 -1
- package/tests/verification.test.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atproto/ozone
|
|
2
2
|
|
|
3
|
+
## 0.1.168
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4408](https://github.com/bluesky-social/atproto/pull/4408) [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add "codegen" as part of the build
|
|
8
|
+
|
|
9
|
+
- [#4791](https://github.com/bluesky-social/atproto/pull/4791) [`3aa18f8`](https://github.com/bluesky-social/atproto/commit/3aa18f84ef80a170b572076feeb649906ffcb06c) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Codegen updated lexicons
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`0dbea15`](https://github.com/bluesky-social/atproto/commit/0dbea15da48a6ca913cc3a3a2d8c0ffe64d7c69a), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`4f11fc3`](https://github.com/bluesky-social/atproto/commit/4f11fc341a770e907b0e84ec267aafafeec5ff88), [`527f5d4`](https://github.com/bluesky-social/atproto/commit/527f5d4c5d0c9264c2ff6f23ad06a41163fc6809), [`1479c87`](https://github.com/bluesky-social/atproto/commit/1479c87c6bf352694fdf298083e4f95287700c8e), [`1479c87`](https://github.com/bluesky-social/atproto/commit/1479c87c6bf352694fdf298083e4f95287700c8e), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`527f5d4`](https://github.com/bluesky-social/atproto/commit/527f5d4c5d0c9264c2ff6f23ad06a41163fc6809), [`3aa18f8`](https://github.com/bluesky-social/atproto/commit/3aa18f84ef80a170b572076feeb649906ffcb06c)]:
|
|
12
|
+
- @atproto/syntax@0.5.2
|
|
13
|
+
- @atproto/api@0.19.5
|
|
14
|
+
- @atproto/xrpc-server@0.10.18
|
|
15
|
+
|
|
16
|
+
## 0.1.167
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#4709](https://github.com/bluesky-social/atproto/pull/4709) [`9f9f71a`](https://github.com/bluesky-social/atproto/commit/9f9f71a6a3e58ccbd5e6d3ee079b570096cb11fa) Thanks [@foysalit](https://github.com/foysalit)! - Introduce a purge event to remove ozone's data on age assurance
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`9f9f71a`](https://github.com/bluesky-social/atproto/commit/9f9f71a6a3e58ccbd5e6d3ee079b570096cb11fa), [`67eb0c1`](https://github.com/bluesky-social/atproto/commit/67eb0c19ac415e762e221b2ccda9f0bcf7b3dd6f)]:
|
|
23
|
+
- @atproto/api@0.19.4
|
|
24
|
+
- @atproto/syntax@0.5.1
|
|
25
|
+
- @atproto/xrpc-server@0.10.16
|
|
26
|
+
|
|
3
27
|
## 0.1.166
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitEvent.d.ts","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitEvent.d.ts","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAiUtC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA6CvD"}
|
|
@@ -37,6 +37,14 @@ const handleModerationEvent = async ({ ctx, input, auth, }) => {
|
|
|
37
37
|
throw new xrpc_server_1.AuthRequiredError('Must be a full moderator to override age assurance');
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
if ((0, defs_2.isAgeAssurancePurgeEvent)(event)) {
|
|
41
|
+
if (!subject.isRepo()) {
|
|
42
|
+
throw new xrpc_server_1.InvalidRequestError('Invalid subject type');
|
|
43
|
+
}
|
|
44
|
+
if (!auth.credentials.isModerator) {
|
|
45
|
+
throw new xrpc_server_1.ForbiddenError('Must be a moderator to purge age assurance events');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
40
48
|
if ((0, defs_2.isRevokeAccountCredentialsEvent)(event)) {
|
|
41
49
|
if (!subject.isRepo()) {
|
|
42
50
|
throw new xrpc_server_1.InvalidRequestError('Invalid subject type');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitEvent.js","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":";;AAyTA,4BA6CC;AAtWD,qFAA6F;AAC7F,sDAA6E;AAI7E,qDAA4C;AAC5C,0EAcwD;AAExD,yCAAyC;AACzC,uDAA4D;AAE5D,mDAA8C;AAC9C,iDAAwD;AACxD,qCAAsC;AACtC,kCAAsC;AACtC,iCAAmE;AAEnE,MAAM,qBAAqB,GAAG,KAAK,EAAE,EACnC,GAAG,EACH,KAAK,EACL,IAAI,GAKL,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;IAC/B,MAAM,SAAS,GACb,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,W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,CAAC,CAAA","sourcesContent":["import { isModEventDivert } from '@atproto/api/dist/client/types/tools/ozone/moderation/defs'\nimport { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'\nimport { AdminTokenOutput, ModeratorOutput } from '../../auth-verifier'\nimport { AppContext } from '../../context'\nimport { Server } from '../../lexicon'\nimport { ids } from '../../lexicon/lexicons'\nimport {\n ModEventTag,\n isAgeAssuranceEvent,\n isAgeAssuranceOverrideEvent,\n isModEventAcknowledge,\n isModEventEmail,\n isModEventLabel,\n isModEventMuteReporter,\n isModEventReport,\n isModEventReverseTakedown,\n isModEventTag,\n isModEventTakedown,\n isModEventUnmuteReporter,\n isRevokeAccountCredentialsEvent,\n} from '../../lexicon/types/tools/ozone/moderation/defs'\nimport { HandlerInput } from '../../lexicon/types/tools/ozone/moderation/emitEvent'\nimport { httpLogger } from '../../logger'\nimport { subjectFromInput } from '../../mod-service/subject'\nimport { SettingService } from '../../setting/service'\nimport { TagService } from '../../tag-service'\nimport { getTagForReport } from '../../tag-service/util'\nimport { retryHttp } from '../../util'\nimport { getEventType } from '../util'\nimport { assertProtectedTagAction, getProtectedTags } from './util'\n\nconst handleModerationEvent = async ({\n ctx,\n input,\n auth,\n}: {\n ctx: AppContext\n input: HandlerInput\n auth: ModeratorOutput | AdminTokenOutput\n}) => {\n const access = auth.credentials\n const createdBy =\n auth.credentials.type === 'moderator'\n ? auth.credentials.iss\n : input.body.createdBy\n const db = ctx.db\n const moderationService = ctx.modService(db)\n const settingService = ctx.settingService(db)\n const { event, externalId } = input.body\n const isAcknowledgeEvent = isModEventAcknowledge(event)\n const isTakedownEvent = isModEventTakedown(event)\n const isReverseTakedownEvent = isModEventReverseTakedown(event)\n const isLabelEvent = isModEventLabel(event)\n const subject = subjectFromInput(\n input.body.subject,\n input.body.subjectBlobCids,\n )\n\n if (isAgeAssuranceEvent(event) && !subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (isAgeAssuranceOverrideEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n if (!auth.credentials.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to override age assurance',\n )\n }\n }\n\n if (isRevokeAccountCredentialsEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (!auth.credentials.isAdmin) {\n throw new AuthRequiredError(\n 'Must be an admin to revoke account credentials',\n )\n }\n\n if (!ctx.pdsAgent) {\n throw new InvalidRequestError('PDS not configured')\n }\n\n await ctx.pdsAgent.com.atproto.temp.revokeAccountCredentials(\n { account: subject.did },\n await ctx.pdsAuth(ids.ComAtprotoTempRevokeAccountCredentials),\n )\n }\n\n // if less than moderator access then can only take ack and escalation actions\n if (isTakedownEvent || isReverseTakedownEvent) {\n if (!access.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to take this type of action',\n )\n }\n\n // Non admins should not be able to take down feed generators\n if (\n !access.isAdmin &&\n subject.recordPath?.includes('app.bsky.feed.generator/')\n ) {\n throw new AuthRequiredError(\n 'Must be a full admin to take this type of action on feed generators',\n )\n }\n }\n // if less than moderator access then can not apply labels\n if (!access.isModerator && isLabelEvent) {\n throw new AuthRequiredError('Must be a full moderator to label content')\n }\n\n if (isLabelEvent) {\n validateLabels([\n ...(event.createLabelVals ?? []),\n ...(event.negateLabelVals ?? []),\n ])\n }\n\n const isTakedownOrReverseTakedownEvent =\n isTakedownEvent || isReverseTakedownEvent\n if (isTakedownOrReverseTakedownEvent || isLabelEvent) {\n const status = await moderationService.getStatus(subject)\n\n if (status?.takendown && isTakedownEvent) {\n throw new InvalidRequestError(`Subject is already taken down`)\n }\n\n if (!status?.takendown && isReverseTakedownEvent) {\n throw new InvalidRequestError(`Subject is not taken down`)\n }\n\n if (status?.tags?.length) {\n const protectedTags = await getProtectedTags(\n settingService,\n ctx.cfg.service.did,\n )\n\n if (protectedTags) {\n assertProtectedTagAction({\n protectedTags,\n subjectTags: status.tags,\n actionAuthor: createdBy,\n isAdmin: auth.credentials.isAdmin,\n isModerator: auth.credentials.isModerator,\n isTriage: auth.credentials.isTriage,\n })\n }\n }\n\n if (status?.takendown && isReverseTakedownEvent && subject.isRecord()) {\n // due to the way blob status is modeled, we should reverse takedown on all\n // blobs for the record being restored, which aren't taken down on another record.\n subject.blobCids = status.blobCids ?? []\n }\n }\n\n if (isModEventEmail(event) && event.content) {\n // sending email prior to logging the event to avoid a long transaction below\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Email can only be sent to a repo subject')\n }\n const { content, subjectLine } = event\n // on error, don't fail the whole event. instead, log the event data with isDelivered false\n try {\n await retryHttp(() =>\n ctx.modService(db).sendEmail({\n subject: subjectLine,\n content,\n recipientDid: subject.did,\n }),\n )\n event.isDelivered = true\n } catch (err) {\n event.isDelivered = false\n httpLogger.error({ err, event }, 'failed to send mod event email')\n }\n }\n\n if (isModEventDivert(event) && subject.isRecord()) {\n if (!ctx.blobDiverter) {\n throw new InvalidRequestError(\n 'BlobDiverter not configured for this service',\n )\n }\n await ctx.blobDiverter.uploadBlobOnService(subject.info())\n }\n\n if (\n (isModEventMuteReporter(event) || isModEventUnmuteReporter(event)) &&\n !subject.isRepo()\n ) {\n throw new InvalidRequestError('Subject must be a repo when muting reporter')\n }\n\n if (isModEventTag(event)) {\n await assertTagAuth(settingService, ctx.cfg.service.did, event, auth)\n }\n\n if (isModEventReport(event)) {\n await ctx.moderationServiceProfile().validateReasonType(event.reportType)\n }\n\n const moderationEvent = await db.transaction(async (dbTxn) => {\n const moderationTxn = ctx.modService(dbTxn)\n\n if (externalId) {\n const existingEvent = await moderationTxn.getEventByExternalId(\n getEventType(event.$type),\n externalId,\n subject,\n )\n\n if (existingEvent) {\n throw new InvalidRequestError(\n `An event with the same external ID already exists for the subject.`,\n 'DuplicateExternalId',\n )\n }\n }\n\n const result = await moderationTxn.logEvent({\n event,\n subject,\n createdBy,\n modTool: input.body.modTool,\n externalId,\n })\n\n const tagService = new TagService(\n subject,\n result.subjectStatus,\n ctx.cfg.service.did,\n moderationTxn,\n )\n\n const initialTags = isModEventReport(event)\n ? [getTagForReport(event.reportType)]\n : undefined\n await tagService.evaluateForSubject(initialTags)\n\n if (subject.isRepo()) {\n if (isTakedownEvent) {\n const isSuspend = !!result.event.durationInHours\n await moderationTxn.takedownRepo(\n subject,\n result.event.id,\n new Set(\n result.event.meta?.targetServices\n ? `${result.event.meta.targetServices}`.split(',')\n : undefined,\n ),\n isSuspend,\n )\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRepo(subject)\n }\n }\n\n if (subject.isRecord()) {\n if (isTakedownEvent) {\n await moderationTxn.takedownRecord(\n subject,\n result.event.id,\n new Set(\n result.event.meta?.targetServices\n ? `${result.event.meta.targetServices}`.split(',')\n : undefined,\n ),\n )\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRecord(subject)\n }\n }\n\n if (\n (isTakedownEvent || isAcknowledgeEvent) &&\n result.event.meta?.acknowledgeAccountSubjects\n ) {\n await moderationTxn.resolveSubjectsForAccount(\n subject.did,\n createdBy,\n result.event,\n )\n }\n\n if (isLabelEvent) {\n await moderationTxn.formatAndCreateLabels(\n result.event.subjectUri ?? result.event.subjectDid,\n result.event.subjectCid,\n {\n create: result.event.createLabelVals?.length\n ? result.event.createLabelVals.split(' ')\n : undefined,\n negate: result.event.negateLabelVals?.length\n ? result.event.negateLabelVals.split(' ')\n : undefined,\n },\n result.event.durationInHours ?? undefined,\n )\n }\n\n return result.event\n })\n\n return moderationService.views.formatEvent(moderationEvent)\n}\n\nexport default function (server: Server, ctx: AppContext) {\n server.tools.ozone.moderation.emitEvent({\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n try {\n const moderationEvent = await handleModerationEvent({\n input,\n auth,\n ctx,\n })\n\n // On divert events, we need to automatically take down the blobs\n if (isModEventDivert(input.body.event)) {\n await handleModerationEvent({\n auth,\n ctx,\n input: {\n ...input,\n body: {\n ...input.body,\n event: {\n ...input.body.event,\n $type: 'tools.ozone.moderation.defs#modEventTakedown',\n comment:\n '[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',\n },\n modTool: input.body.modTool,\n },\n },\n })\n }\n\n return {\n encoding: 'application/json',\n body: moderationEvent,\n }\n } catch (err) {\n httpLogger.error(\n { err, body: input.body },\n 'failed to emit moderation event',\n )\n throw err\n }\n },\n })\n}\n\nconst assertTagAuth = async (\n settingService: SettingService,\n serviceDid: string,\n event: ModEventTag,\n auth: ModeratorOutput | AdminTokenOutput,\n) => {\n // admins can add/remove any tag\n if (auth.credentials.isAdmin) return\n\n const protectedTags = await getProtectedTags(settingService, serviceDid)\n\n if (!protectedTags) {\n return\n }\n\n for (const tag of Object.keys(protectedTags)) {\n if (event.add.includes(tag) || event.remove.includes(tag)) {\n // if specific moderators are configured to manage this tag but the current user\n // is not one of them, then throw an error\n const configuredModerators = protectedTags[tag]?.['moderators']\n if (\n configuredModerators &&\n !configuredModerators.includes(auth.credentials.iss)\n ) {\n throw new InvalidRequestError(`Not allowed to manage tag: ${tag}`)\n }\n\n const configuredRoles = protectedTags[tag]?.['roles']\n if (configuredRoles) {\n // admins can already do everything so we only check for moderator and triage role config\n if (\n auth.credentials.isModerator &&\n !configuredRoles.includes('tools.ozone.team.defs#roleModerator')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with moderator role`,\n )\n } else if (\n auth.credentials.isTriage &&\n !configuredRoles.includes('tools.ozone.team.defs#roleTriage')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with triage role`,\n )\n }\n }\n }\n }\n}\n\nconst validateLabels = (labels: string[]) => {\n for (const label of labels) {\n for (const char of badChars) {\n if (label.includes(char)) {\n throw new InvalidRequestError(`Invalid label: ${label}`)\n }\n }\n }\n}\n\nconst badChars = [' ', ',', ';', `'`, `\"`]\n"]}
|
|
1
|
+
{"version":3,"file":"emitEvent.js","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":";;AAyUA,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sB,CAChD,CAAA;gBACH,CAAC;qBAAM,IACL,IAAI,CAAC,WAAW,CAAC,QAAQ;oBACzB,CAAC,eAAe,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EAC7D,CAAC;oBACD,MAAM,IAAI,iCAAmB,CAC3B,sBAAsB,GAAG,mBAAmB,CAC7C,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,MAAgB,EAAE,EAAE;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,iCAAmB,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAA;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA","sourcesContent":["import { isModEventDivert } from '@atproto/api/dist/client/types/tools/ozone/moderation/defs'\nimport {\n AuthRequiredError,\n ForbiddenError,\n InvalidRequestError,\n} from '@atproto/xrpc-server'\nimport { AdminTokenOutput, ModeratorOutput } from '../../auth-verifier'\nimport { AppContext } from '../../context'\nimport { Server } from '../../lexicon'\nimport { ids } from '../../lexicon/lexicons'\nimport {\n ModEventTag,\n isAgeAssuranceEvent,\n isAgeAssuranceOverrideEvent,\n isAgeAssurancePurgeEvent,\n isModEventAcknowledge,\n isModEventEmail,\n isModEventLabel,\n isModEventMuteReporter,\n isModEventReport,\n isModEventReverseTakedown,\n isModEventTag,\n isModEventTakedown,\n isModEventUnmuteReporter,\n isRevokeAccountCredentialsEvent,\n} from '../../lexicon/types/tools/ozone/moderation/defs'\nimport { HandlerInput } from '../../lexicon/types/tools/ozone/moderation/emitEvent'\nimport { httpLogger } from '../../logger'\nimport { subjectFromInput } from '../../mod-service/subject'\nimport { SettingService } from '../../setting/service'\nimport { TagService } from '../../tag-service'\nimport { getTagForReport } from '../../tag-service/util'\nimport { retryHttp } from '../../util'\nimport { getEventType } from '../util'\nimport { assertProtectedTagAction, getProtectedTags } from './util'\n\nconst handleModerationEvent = async ({\n ctx,\n input,\n auth,\n}: {\n ctx: AppContext\n input: HandlerInput\n auth: ModeratorOutput | AdminTokenOutput\n}) => {\n const access = auth.credentials\n const createdBy =\n auth.credentials.type === 'moderator'\n ? auth.credentials.iss\n : input.body.createdBy\n const db = ctx.db\n const moderationService = ctx.modService(db)\n const settingService = ctx.settingService(db)\n const { event, externalId } = input.body\n const isAcknowledgeEvent = isModEventAcknowledge(event)\n const isTakedownEvent = isModEventTakedown(event)\n const isReverseTakedownEvent = isModEventReverseTakedown(event)\n const isLabelEvent = isModEventLabel(event)\n const subject = subjectFromInput(\n input.body.subject,\n input.body.subjectBlobCids,\n )\n\n if (isAgeAssuranceEvent(event) && !subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (isAgeAssuranceOverrideEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n if (!auth.credentials.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to override age assurance',\n )\n }\n }\n\n if (isAgeAssurancePurgeEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n if (!auth.credentials.isModerator) {\n throw new ForbiddenError(\n 'Must be a moderator to purge age assurance events',\n )\n }\n }\n\n if (isRevokeAccountCredentialsEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (!auth.credentials.isAdmin) {\n throw new AuthRequiredError(\n 'Must be an admin to revoke account credentials',\n )\n }\n\n if (!ctx.pdsAgent) {\n throw new InvalidRequestError('PDS not configured')\n }\n\n await ctx.pdsAgent.com.atproto.temp.revokeAccountCredentials(\n { account: subject.did },\n await ctx.pdsAuth(ids.ComAtprotoTempRevokeAccountCredentials),\n )\n }\n\n // if less than moderator access then can only take ack and escalation actions\n if (isTakedownEvent || isReverseTakedownEvent) {\n if (!access.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to take this type of action',\n )\n }\n\n // Non admins should not be able to take down feed generators\n if (\n !access.isAdmin &&\n subject.recordPath?.includes('app.bsky.feed.generator/')\n ) {\n throw new AuthRequiredError(\n 'Must be a full admin to take this type of action on feed generators',\n )\n }\n }\n // if less than moderator access then can not apply labels\n if (!access.isModerator && isLabelEvent) {\n throw new AuthRequiredError('Must be a full moderator to label content')\n }\n\n if (isLabelEvent) {\n validateLabels([\n ...(event.createLabelVals ?? []),\n ...(event.negateLabelVals ?? []),\n ])\n }\n\n const isTakedownOrReverseTakedownEvent =\n isTakedownEvent || isReverseTakedownEvent\n if (isTakedownOrReverseTakedownEvent || isLabelEvent) {\n const status = await moderationService.getStatus(subject)\n\n if (status?.takendown && isTakedownEvent) {\n throw new InvalidRequestError(`Subject is already taken down`)\n }\n\n if (!status?.takendown && isReverseTakedownEvent) {\n throw new InvalidRequestError(`Subject is not taken down`)\n }\n\n if (status?.tags?.length) {\n const protectedTags = await getProtectedTags(\n settingService,\n ctx.cfg.service.did,\n )\n\n if (protectedTags) {\n assertProtectedTagAction({\n protectedTags,\n subjectTags: status.tags,\n actionAuthor: createdBy,\n isAdmin: auth.credentials.isAdmin,\n isModerator: auth.credentials.isModerator,\n isTriage: auth.credentials.isTriage,\n })\n }\n }\n\n if (status?.takendown && isReverseTakedownEvent && subject.isRecord()) {\n // due to the way blob status is modeled, we should reverse takedown on all\n // blobs for the record being restored, which aren't taken down on another record.\n subject.blobCids = status.blobCids ?? []\n }\n }\n\n if (isModEventEmail(event) && event.content) {\n // sending email prior to logging the event to avoid a long transaction below\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Email can only be sent to a repo subject')\n }\n const { content, subjectLine } = event\n // on error, don't fail the whole event. instead, log the event data with isDelivered false\n try {\n await retryHttp(() =>\n ctx.modService(db).sendEmail({\n subject: subjectLine,\n content,\n recipientDid: subject.did,\n }),\n )\n event.isDelivered = true\n } catch (err) {\n event.isDelivered = false\n httpLogger.error({ err, event }, 'failed to send mod event email')\n }\n }\n\n if (isModEventDivert(event) && subject.isRecord()) {\n if (!ctx.blobDiverter) {\n throw new InvalidRequestError(\n 'BlobDiverter not configured for this service',\n )\n }\n await ctx.blobDiverter.uploadBlobOnService(subject.info())\n }\n\n if (\n (isModEventMuteReporter(event) || isModEventUnmuteReporter(event)) &&\n !subject.isRepo()\n ) {\n throw new InvalidRequestError('Subject must be a repo when muting reporter')\n }\n\n if (isModEventTag(event)) {\n await assertTagAuth(settingService, ctx.cfg.service.did, event, auth)\n }\n\n if (isModEventReport(event)) {\n await ctx.moderationServiceProfile().validateReasonType(event.reportType)\n }\n\n const moderationEvent = await db.transaction(async (dbTxn) => {\n const moderationTxn = ctx.modService(dbTxn)\n\n if (externalId) {\n const existingEvent = await moderationTxn.getEventByExternalId(\n getEventType(event.$type),\n externalId,\n subject,\n )\n\n if (existingEvent) {\n throw new InvalidRequestError(\n `An event with the same external ID already exists for the subject.`,\n 'DuplicateExternalId',\n )\n }\n }\n\n const result = await moderationTxn.logEvent({\n event,\n subject,\n createdBy,\n modTool: input.body.modTool,\n externalId,\n })\n\n const tagService = new TagService(\n subject,\n result.subjectStatus,\n ctx.cfg.service.did,\n moderationTxn,\n )\n\n const initialTags = isModEventReport(event)\n ? [getTagForReport(event.reportType)]\n : undefined\n await tagService.evaluateForSubject(initialTags)\n\n if (subject.isRepo()) {\n if (isTakedownEvent) {\n const isSuspend = !!result.event.durationInHours\n await moderationTxn.takedownRepo(\n subject,\n result.event.id,\n new Set(\n result.event.meta?.targetServices\n ? `${result.event.meta.targetServices}`.split(',')\n : undefined,\n ),\n isSuspend,\n )\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRepo(subject)\n }\n }\n\n if (subject.isRecord()) {\n if (isTakedownEvent) {\n await moderationTxn.takedownRecord(\n subject,\n result.event.id,\n new Set(\n result.event.meta?.targetServices\n ? `${result.event.meta.targetServices}`.split(',')\n : undefined,\n ),\n )\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRecord(subject)\n }\n }\n\n if (\n (isTakedownEvent || isAcknowledgeEvent) &&\n result.event.meta?.acknowledgeAccountSubjects\n ) {\n await moderationTxn.resolveSubjectsForAccount(\n subject.did,\n createdBy,\n result.event,\n )\n }\n\n if (isLabelEvent) {\n await moderationTxn.formatAndCreateLabels(\n result.event.subjectUri ?? result.event.subjectDid,\n result.event.subjectCid,\n {\n create: result.event.createLabelVals?.length\n ? result.event.createLabelVals.split(' ')\n : undefined,\n negate: result.event.negateLabelVals?.length\n ? result.event.negateLabelVals.split(' ')\n : undefined,\n },\n result.event.durationInHours ?? undefined,\n )\n }\n\n return result.event\n })\n\n return moderationService.views.formatEvent(moderationEvent)\n}\n\nexport default function (server: Server, ctx: AppContext) {\n server.tools.ozone.moderation.emitEvent({\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n try {\n const moderationEvent = await handleModerationEvent({\n input,\n auth,\n ctx,\n })\n\n // On divert events, we need to automatically take down the blobs\n if (isModEventDivert(input.body.event)) {\n await handleModerationEvent({\n auth,\n ctx,\n input: {\n ...input,\n body: {\n ...input.body,\n event: {\n ...input.body.event,\n $type: 'tools.ozone.moderation.defs#modEventTakedown',\n comment:\n '[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',\n },\n modTool: input.body.modTool,\n },\n },\n })\n }\n\n return {\n encoding: 'application/json',\n body: moderationEvent,\n }\n } catch (err) {\n httpLogger.error(\n { err, body: input.body },\n 'failed to emit moderation event',\n )\n throw err\n }\n },\n })\n}\n\nconst assertTagAuth = async (\n settingService: SettingService,\n serviceDid: string,\n event: ModEventTag,\n auth: ModeratorOutput | AdminTokenOutput,\n) => {\n // admins can add/remove any tag\n if (auth.credentials.isAdmin) return\n\n const protectedTags = await getProtectedTags(settingService, serviceDid)\n\n if (!protectedTags) {\n return\n }\n\n for (const tag of Object.keys(protectedTags)) {\n if (event.add.includes(tag) || event.remove.includes(tag)) {\n // if specific moderators are configured to manage this tag but the current user\n // is not one of them, then throw an error\n const configuredModerators = protectedTags[tag]?.['moderators']\n if (\n configuredModerators &&\n !configuredModerators.includes(auth.credentials.iss)\n ) {\n throw new InvalidRequestError(`Not allowed to manage tag: ${tag}`)\n }\n\n const configuredRoles = protectedTags[tag]?.['roles']\n if (configuredRoles) {\n // admins can already do everything so we only check for moderator and triage role config\n if (\n auth.credentials.isModerator &&\n !configuredRoles.includes('tools.ozone.team.defs#roleModerator')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with moderator role`,\n )\n } else if (\n auth.credentials.isTriage &&\n !configuredRoles.includes('tools.ozone.team.defs#roleTriage')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with triage role`,\n )\n }\n }\n }\n }\n}\n\nconst validateLabels = (labels: string[]) => {\n for (const label of labels) {\n for (const char of badChars) {\n if (label.includes(char)) {\n throw new InvalidRequestError(`Invalid label: ${label}`)\n }\n }\n }\n}\n\nconst badChars = [' ', ',', ';', `'`, `\"`]\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReport.d.ts","sourceRoot":"","sources":["../../../src/api/report/createReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAQtC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"createReport.d.ts","sourceRoot":"","sources":["../../../src/api/report/createReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAQtC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAgDvD"}
|
|
@@ -18,10 +18,8 @@ function default_1(server, ctx) {
|
|
|
18
18
|
throw new xrpc_server_1.ForbiddenError('You cannot appeal this report');
|
|
19
19
|
}
|
|
20
20
|
const db = ctx.db;
|
|
21
|
-
await
|
|
22
|
-
|
|
23
|
-
ctx.moderationServiceProfile().validateReasonType(reasonType),
|
|
24
|
-
]);
|
|
21
|
+
await ctx.moderationServiceProfile().validateReasonType(reasonType);
|
|
22
|
+
await assertValidReporter(ctx.modService(db), reasonType, requester);
|
|
25
23
|
const report = await db.transaction(async (dbTxn) => {
|
|
26
24
|
const moderationTxn = ctx.modService(dbTxn);
|
|
27
25
|
const { event: reportEvent, subjectStatus } = await moderationTxn.report({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReport.js","sourceRoot":"","sources":["../../../src/api/report/createReport.ts"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"createReport.js","sourceRoot":"","sources":["../../../src/api/report/createReport.ts"],"names":[],"mappings":";;AAUA,4BAgDC;AA1DD,sDAAqD;AAKrD,uDAA4D;AAC5D,mDAA8C;AAC9C,iDAAwD;AACxD,kCAAwC;AAExC,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC;QACzC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ;QAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;YACjC,MAAM,SAAS,GACb,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAA;YACxE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,O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,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;YAC1D,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI;aACL,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,mBAAmB,GAAG,KAAK,EAC/B,UAA6B,EAC7B,UAAsB,EACtB,GAAW,EACX,EAAE;IACF,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;IAEjE,+EAA+E;IAC/E,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAM;IACR,CAAC;IAED,uFAAuF;IACvF,IAAI,IAAA,qBAAc,EAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,IAAI,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,4BAAc,CACtB,sCAAsC,EACtC,iBAAiB,CAClB,CAAA;QACH,CAAC;QACD,OAAM;IACR,CAAC;IAED,gGAAgG;IAChG,4GAA4G;IAC5G,wEAAwE;IACxE,IAAI,cAAc,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,4BAAc,CACtB,4CAA4C,EAC5C,iBAAiB,CAClB,CAAA;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { ForbiddenError } from '@atproto/xrpc-server'\nimport { AppContext } from '../../context'\nimport { Server } from '../../lexicon'\nimport { ReasonType } from '../../lexicon/types/com/atproto/moderation/defs'\nimport { ModerationService } from '../../mod-service'\nimport { subjectFromInput } from '../../mod-service/subject'\nimport { TagService } from '../../tag-service'\nimport { getTagForReport } from '../../tag-service/util'\nimport { isAppealReport } from '../util'\n\nexport default function (server: Server, ctx: AppContext) {\n server.com.atproto.moderation.createReport({\n auth: ctx.authVerifier.standard,\n handler: async ({ input, auth }) => {\n const requester =\n 'iss' in auth.credentials ? auth.credentials.iss : ctx.cfg.service.did\n const { reasonType, reason, modTool } = input.body\n const subject = subjectFromInput(input.body.subject)\n\n // If the report is an appeal, the requester must be the author of the subject\n if (isAppealReport(reasonType) && requester !== subject.did) {\n throw new ForbiddenError('You cannot appeal this report')\n }\n\n const db = ctx.db\n\n await ctx.moderationServiceProfile().validateReasonType(reasonType)\n await assertValidReporter(ctx.modService(db), reasonType, requester)\n\n const report = await db.transaction(async (dbTxn) => {\n const moderationTxn = ctx.modService(dbTxn)\n const { event: reportEvent, subjectStatus } =\n await moderationTxn.report({\n reason,\n subject,\n reasonType,\n reportedBy: requester || ctx.cfg.service.did,\n modTool,\n })\n\n const tagService = new TagService(\n subject,\n subjectStatus,\n ctx.cfg.service.did,\n moderationTxn,\n )\n await tagService.evaluateForSubject([getTagForReport(reasonType)])\n\n return reportEvent\n })\n\n const body = ctx.modService(db).views.formatReport(report)\n return {\n encoding: 'application/json',\n body,\n }\n },\n })\n}\n\nconst assertValidReporter = async (\n modService: ModerationService,\n reasonType: ReasonType,\n did: string,\n) => {\n const reporterStatus = await modService.getCurrentStatus({ did })\n\n // If we don't have a mod status for the reporter, no need to do further checks\n if (!reporterStatus.length) {\n return\n }\n\n // For appeals, we just need to make sure that the account does not have pending appeal\n if (isAppealReport(reasonType)) {\n if (reporterStatus[0]?.appealed) {\n throw new ForbiddenError(\n 'Awaiting decision on previous appeal',\n 'AlreadyAppealed',\n )\n }\n return\n }\n\n // For non appeals, we need to make sure the reporter account is not already in takendown status\n // This is necessary because we allow takendown accounts call createReport but that's only meant for appeals\n // and we need to make sure takendown accounts don't abuse this endpoint\n if (reporterStatus[0]?.takendown) {\n throw new ForbiddenError(\n 'Report not accepted from takendown account',\n 'AccountTakedown',\n )\n }\n}\n"]}
|
package/dist/api/util.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { RepoView, RepoViewDetail } from '../lexicon/types/tools/ozone/moderatio
|
|
|
4
4
|
export declare const getPdsAccountInfos: (ctx: AppContext, dids: string[]) => Promise<Map<string, AccountView | null>>;
|
|
5
5
|
export declare const addAccountInfoToRepoViewDetail: (repoView: RepoView | RepoViewDetail, accountInfo: AccountView | null, includeEmail?: boolean) => RepoViewDetail;
|
|
6
6
|
export declare const addAccountInfoToRepoView: (repoView: RepoView, accountInfo: AccountView | null, includeEmail?: boolean) => RepoView;
|
|
7
|
-
export declare const getEventType: (type: string) => "tools.ozone.moderation.defs#modEventTakedown" | "tools.ozone.moderation.defs#modEventReverseTakedown" | "tools.ozone.moderation.defs#modEventComment" | "tools.ozone.moderation.defs#modEventReport" | "tools.ozone.moderation.defs#modEventLabel" | "tools.ozone.moderation.defs#modEventAcknowledge" | "tools.ozone.moderation.defs#modEventEscalate" | "tools.ozone.moderation.defs#modEventMute" | "tools.ozone.moderation.defs#modEventUnmute" | "tools.ozone.moderation.defs#modEventMuteReporter" | "tools.ozone.moderation.defs#modEventUnmuteReporter" | "tools.ozone.moderation.defs#modEventEmail" | "tools.ozone.moderation.defs#modEventResolveAppeal" | "tools.ozone.moderation.defs#modEventTag" | "tools.ozone.moderation.defs#accountEvent" | "tools.ozone.moderation.defs#identityEvent" | "tools.ozone.moderation.defs#recordEvent" | "tools.ozone.moderation.defs#modEventPriorityScore" | "tools.ozone.moderation.defs#revokeAccountCredentialsEvent" | "tools.ozone.moderation.defs#ageAssuranceEvent" | "tools.ozone.moderation.defs#ageAssuranceOverrideEvent";
|
|
7
|
+
export declare const getEventType: (type: string) => "tools.ozone.moderation.defs#modEventTakedown" | "tools.ozone.moderation.defs#modEventReverseTakedown" | "tools.ozone.moderation.defs#modEventComment" | "tools.ozone.moderation.defs#modEventReport" | "tools.ozone.moderation.defs#modEventLabel" | "tools.ozone.moderation.defs#modEventAcknowledge" | "tools.ozone.moderation.defs#modEventEscalate" | "tools.ozone.moderation.defs#modEventMute" | "tools.ozone.moderation.defs#modEventUnmute" | "tools.ozone.moderation.defs#modEventMuteReporter" | "tools.ozone.moderation.defs#modEventUnmuteReporter" | "tools.ozone.moderation.defs#modEventEmail" | "tools.ozone.moderation.defs#modEventResolveAppeal" | "tools.ozone.moderation.defs#modEventTag" | "tools.ozone.moderation.defs#accountEvent" | "tools.ozone.moderation.defs#identityEvent" | "tools.ozone.moderation.defs#recordEvent" | "tools.ozone.moderation.defs#modEventPriorityScore" | "tools.ozone.moderation.defs#revokeAccountCredentialsEvent" | "tools.ozone.moderation.defs#ageAssuranceEvent" | "tools.ozone.moderation.defs#ageAssuranceOverrideEvent" | "tools.ozone.moderation.defs#ageAssurancePurgeEvent";
|
|
8
8
|
export declare const getReviewState: (reviewState?: string) => "tools.ozone.moderation.defs#reviewOpen" | "tools.ozone.moderation.defs#reviewEscalated" | "tools.ozone.moderation.defs#reviewClosed" | "tools.ozone.moderation.defs#reviewNone" | undefined;
|
|
9
9
|
export declare const getMemberRole: (role: string) => "tools.ozone.team.defs#roleAdmin" | "tools.ozone.team.defs#roleModerator" | "tools.ozone.team.defs#roleTriage" | "tools.ozone.team.defs#roleVerifier";
|
|
10
10
|
export declare const OZONE_APPEAL_REASON_TYPE = "tools.ozone.report.defs#reasonAppeal";
|
package/dist/api/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/api/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAErE,OAAO,EAKL,QAAQ,EACR,cAAc,EACf,MAAM,8CAA8C,CAAA;AASrD,eAAO,MAAM,kBAAkB,GAC7B,KAAK,UAAU,EACf,MAAM,MAAM,EAAE,KACb,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,CAkBzC,CAAA;AAUD,eAAO,MAAM,8BAA8B,GACzC,UAAU,QAAQ,GAAG,cAAc,EACnC,aAAa,WAAW,GAAG,IAAI,EAC/B,sBAAoB,KACnB,cAsCF,CAAA;AAED,eA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O,MAAM,oBAAoB,GAAI,WAAW,MAAM,KAAG,iBAKxD,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,GAAG,YAAY,CAAA;AACvE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,CAAA;AAClD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAA;AAC/D,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;AAOtE,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,KAAG,mBAKvD,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,KACb,qBAKF,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAA;AAC5C,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,UAAU,GACV,WAAW,GACX,QAAQ,CAAA"}
|
package/dist/api/util.js
CHANGED
|
@@ -116,6 +116,7 @@ const eventTypes = new Set([
|
|
|
116
116
|
'tools.ozone.moderation.defs#modEventPriorityScore',
|
|
117
117
|
'tools.ozone.moderation.defs#ageAssuranceEvent',
|
|
118
118
|
'tools.ozone.moderation.defs#ageAssuranceOverrideEvent',
|
|
119
|
+
'tools.ozone.moderation.defs#ageAssurancePurgeEvent',
|
|
119
120
|
'tools.ozone.moderation.defs#revokeAccountCredentialsEvent',
|
|
120
121
|
'tools.ozone.moderation.defs#scheduleTakedownEvent',
|
|
121
122
|
'tools.ozone.moderation.defs#cancelScheduledTakedownEvent',
|
package/dist/api/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/api/util.ts"],"names":[],"mappings":";;;AAAA,sDAA0D;AAI1D,kDAAyC;AAEzC,uEAA2E;AAC3E,uEAOqD;AACrD,iEAK+C;AAGxC,MAAM,kBAAkB,GAAG,KAAK,EACrC,GAAe,EACf,IAAc,EA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ent":["import { InvalidRequestError } from '@atproto/xrpc-server'\nimport { AppContext } from '../context'\nimport { Member } from '../db/schema/member'\nimport { ModerationEvent } from '../db/schema/moderation_event'\nimport { ids } from '../lexicon/lexicons'\nimport { AccountView } from '../lexicon/types/com/atproto/admin/defs'\nimport { REASONAPPEAL } from '../lexicon/types/com/atproto/moderation/defs'\nimport {\n REVIEWCLOSED,\n REVIEWESCALATED,\n REVIEWNONE,\n REVIEWOPEN,\n RepoView,\n RepoViewDetail,\n} from '../lexicon/types/tools/ozone/moderation/defs'\nimport {\n ROLEADMIN,\n ROLEMODERATOR,\n ROLETRIAGE,\n ROLEVERIFIER,\n} from '../lexicon/types/tools/ozone/team/defs'\nimport { ModerationSubjectStatusRow } from '../mod-service/types'\n\nexport const getPdsAccountInfos = async (\n ctx: AppContext,\n dids: string[],\n): Promise<Map<string, AccountView | null>> => {\n const results = new Map<string, AccountView | null>()\n\n const agent = ctx.pdsAgent\n if (!agent || !dids.length) return results\n\n const auth = await ctx.pdsAuth(ids.ComAtprotoAdminGetAccountInfos)\n if (!auth) return results\n\n try {\n const res = await agent.com.atproto.admin.getAccountInfos({ dids }, auth)\n res.data.infos.forEach((info) => {\n results.set(info.did, info)\n })\n return results\n } catch {\n return results\n }\n}\n\nfunction un$type<T extends object>(obj: T): Omit<T, '$type'> {\n if ('$type' in obj) {\n const { $type: _, ...rest } = obj\n return rest\n }\n return obj\n}\n\nexport const addAccountInfoToRepoViewDetail = (\n repoView: RepoView | RepoViewDetail,\n accountInfo: AccountView | null,\n includeEmail = false,\n): RepoViewDetail => {\n if (!accountInfo) {\n return un$type({\n ...repoView,\n moderation: un$type(repoView.moderation),\n })\n }\n\n const {\n email,\n deactivatedAt,\n emailConfirmedAt,\n inviteNote,\n invitedBy,\n invites,\n invitesDisabled,\n threatSignatures,\n // pick some duplicate/unwanted details out\n $type: _accountType,\n did: _did,\n handle: _handle,\n indexedAt: _indexedAt,\n relatedRecords: _relatedRecords,\n ...otherAccountInfo\n } = accountInfo\n return {\n ...otherAccountInfo,\n ...un$type(repoView),\n moderation: un$type(repoView.moderation),\n email: includeEmail ? email : undefined,\n invitedBy,\n invitesDisabled,\n inviteNote,\n invites,\n emailConfirmedAt,\n deactivatedAt,\n threatSignatures,\n }\n}\n\nexport const addAccountInfoToRepoView = (\n repoView: RepoView,\n accountInfo: AccountView | null,\n includeEmail = false,\n): RepoView => {\n if (!accountInfo) return repoView\n return {\n ...repoView,\n email: includeEmail ? accountInfo.email : undefined,\n invitedBy: accountInfo.invitedBy,\n invitesDisabled: accountInfo.invitesDisabled,\n inviteNote: accountInfo.inviteNote,\n deactivatedAt: accountInfo.deactivatedAt,\n threatSignatures: accountInfo.threatSignatures,\n }\n}\n\nexport const getEventType = (type: string) => {\n if (eventTypes.has(type)) {\n return type as ModerationEvent['action']\n }\n throw new InvalidRequestError('Invalid event type')\n}\n\nexport const getReviewState = (reviewState?: string) => {\n if (!reviewState) return undefined\n if (reviewStates.has(reviewState)) {\n return reviewState as ModerationSubjectStatusRow['reviewState']\n }\n throw new InvalidRequestError('Invalid review state')\n}\n\nconst reviewStates = new Set([\n REVIEWCLOSED,\n REVIEWESCALATED,\n REVIEWOPEN,\n REVIEWNONE,\n])\n\nconst eventTypes = new Set([\n 'tools.ozone.moderation.defs#modEventTakedown',\n 'tools.ozone.moderation.defs#modEventAcknowledge',\n 'tools.ozone.moderation.defs#modEventEscalate',\n 'tools.ozone.moderation.defs#modEventComment',\n 'tools.ozone.moderation.defs#modEventLabel',\n 'tools.ozone.moderation.defs#modEventReport',\n 'tools.ozone.moderation.defs#modEventMute',\n 'tools.ozone.moderation.defs#modEventUnmute',\n 'tools.ozone.moderation.defs#modEventMuteReporter',\n 'tools.ozone.moderation.defs#modEventUnmuteReporter',\n 'tools.ozone.moderation.defs#modEventReverseTakedown',\n 'tools.ozone.moderation.defs#modEventEmail',\n 'tools.ozone.moderation.defs#modEventResolveAppeal',\n 'tools.ozone.moderation.defs#modEventTag',\n 'tools.ozone.moderation.defs#modEventDivert',\n 'tools.ozone.moderation.defs#accountEvent',\n 'tools.ozone.moderation.defs#identityEvent',\n 'tools.ozone.moderation.defs#recordEvent',\n 'tools.ozone.moderation.defs#modEventPriorityScore',\n 'tools.ozone.moderation.defs#ageAssuranceEvent',\n 'tools.ozone.moderation.defs#ageAssuranceOverrideEvent',\n 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent',\n 'tools.ozone.moderation.defs#scheduleTakedownEvent',\n 'tools.ozone.moderation.defs#cancelScheduledTakedownEvent',\n])\n\nexport const getMemberRole = (role: string) => {\n if (memberRoles.has(role)) {\n return role as Member['role']\n }\n throw new InvalidRequestError('Invalid member role')\n}\n\nconst memberRoles = new Set([\n ROLEADMIN,\n ROLEMODERATOR,\n ROLETRIAGE,\n ROLEVERIFIER,\n])\n\nexport const OZONE_APPEAL_REASON_TYPE = 'tools.ozone.report.defs#reasonAppeal'\nconst APPEAL_REASON_TYPES = [REASONAPPEAL, OZONE_APPEAL_REASON_TYPE]\nexport const isAppealReport = (reasonType?: string): boolean => {\n return !!reasonType && APPEAL_REASON_TYPES.includes(reasonType)\n}\n\nexport const getSafelinkPattern = (pattern: string): SafelinkPatternType => {\n if (safelinkPatterns.has(pattern)) {\n return pattern as SafelinkPatternType\n }\n throw new InvalidRequestError('Invalid safelink pattern type')\n}\n\nexport const getSafelinkAction = (action: string): SafelinkActionType => {\n if (safelinkActions.has(action)) {\n return action as SafelinkActionType\n }\n throw new InvalidRequestError('Invalid safelink action type')\n}\n\nexport const getSafelinkReason = (reason: string): SafelinkReasonType => {\n if (safelinkReasons.has(reason)) {\n return reason as SafelinkReasonType\n }\n throw new InvalidRequestError('Invalid safelink reason type')\n}\n\nexport const getSafelinkEventType = (eventType: string): SafelinkEventType => {\n if (safelinkEventTypes.has(eventType)) {\n return eventType as SafelinkEventType\n }\n throw new InvalidRequestError('Invalid safelink event type')\n}\n\nexport type SafelinkEventType = 'addRule' | 'updateRule' | 'removeRule'\nexport type SafelinkPatternType = 'domain' | 'url'\nexport type SafelinkActionType = 'block' | 'warn' | 'whitelist'\nexport type SafelinkReasonType = 'csam' | 'spam' | 'phishing' | 'none'\n\nconst safelinkPatterns = new Set(['domain', 'url'])\nconst safelinkActions = new Set(['block', 'warn', 'whitelist'])\nconst safelinkReasons = new Set(['csam', 'spam', 'phishing', 'none'])\nconst safelinkEventTypes = new Set(['addRule', 'updateRule', 'removeRule'])\n\nexport const getScheduledActionType = (action: string): ScheduledActionType => {\n if (scheduledActionTypes.has(action)) {\n return action as ScheduledActionType\n }\n throw new InvalidRequestError('Invalid scheduled action type')\n}\n\nexport const getScheduledActionStatus = (\n status: string,\n): ScheduledActionStatus => {\n if (scheduledActionStatuses.has(status)) {\n return status as ScheduledActionStatus\n }\n throw new InvalidRequestError('Invalid scheduled action status')\n}\n\nexport type ScheduledActionType = 'takedown'\nexport type ScheduledActionStatus =\n | 'pending'\n | 'executed'\n | 'cancelled'\n | 'failed'\n\nconst scheduledActionTypes = new Set(['takedown'])\nconst scheduledActionStatuses = new Set([\n 'pending',\n 'executed',\n 'cancelled',\n 'failed',\n])\n"]}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/api/util.ts"],"names":[],"mappings":";;;AAAA,sDAA0D;AAI1D,kDAAyC;AAEzC,uEAA2E;AAC3E,uEAOqD;AACrD,iEAK+C;AAGxC,MAAM,kBAAkB,GAAG,KAAK,EACrC,GAAe,EACf,IAAc,EAC4B,EAAE;IAC5C,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B,CAAA;IAErD,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAA;IAC1B,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAA;IAE1C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,cAAG,CAAC,8BAA8B,CAAC,CAAA;IAClE,IAAI,CAAC,IAAI;QAAE,OAAO,OAAO,CAAA;IAEzB,IAAI,CAA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AC,CAAA;AAC/D,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAA;AACrE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;AAEpE,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAuB,EAAE;IAC5E,IAAI,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,OAAO,MAA6B,CAAA;IACtC,CAAC;IACD,MAAM,IAAI,iCAAmB,CAAC,+BAA+B,CAAC,CAAA;AAChE,CAAC,CAAA;AALY,QAAA,sBAAsB,0BAKlC;AAEM,MAAM,wBAAwB,GAAG,CACtC,MAAc,EACS,EAAE;IACzB,IAAI,uBAAuB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,OAAO,MAA+B,CAAA;IACxC,CAAC;IACD,MAAM,IAAI,iCAAmB,CAAC,iCAAiC,CAAC,CAAA;AAClE,CAAC,CAAA;AAPY,QAAA,wBAAwB,4BAOpC;AASD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;AAClD,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,SAAS;IACT,UAAU;IACV,WAAW;IACX,QAAQ;CACT,CAAC,CAAA","sourcesContent":["import { InvalidRequestError } from '@atproto/xrpc-server'\nimport { AppContext } from '../context'\nimport { Member } from '../db/schema/member'\nimport { ModerationEvent } from '../db/schema/moderation_event'\nimport { ids } from '../lexicon/lexicons'\nimport { AccountView } from '../lexicon/types/com/atproto/admin/defs'\nimport { REASONAPPEAL } from '../lexicon/types/com/atproto/moderation/defs'\nimport {\n REVIEWCLOSED,\n REVIEWESCALATED,\n REVIEWNONE,\n REVIEWOPEN,\n RepoView,\n RepoViewDetail,\n} from '../lexicon/types/tools/ozone/moderation/defs'\nimport {\n ROLEADMIN,\n ROLEMODERATOR,\n ROLETRIAGE,\n ROLEVERIFIER,\n} from '../lexicon/types/tools/ozone/team/defs'\nimport { ModerationSubjectStatusRow } from '../mod-service/types'\n\nexport const getPdsAccountInfos = async (\n ctx: AppContext,\n dids: string[],\n): Promise<Map<string, AccountView | null>> => {\n const results = new Map<string, AccountView | null>()\n\n const agent = ctx.pdsAgent\n if (!agent || !dids.length) return results\n\n const auth = await ctx.pdsAuth(ids.ComAtprotoAdminGetAccountInfos)\n if (!auth) return results\n\n try {\n const res = await agent.com.atproto.admin.getAccountInfos({ dids }, auth)\n res.data.infos.forEach((info) => {\n results.set(info.did, info)\n })\n return results\n } catch {\n return results\n }\n}\n\nfunction un$type<T extends object>(obj: T): Omit<T, '$type'> {\n if ('$type' in obj) {\n const { $type: _, ...rest } = obj\n return rest\n }\n return obj\n}\n\nexport const addAccountInfoToRepoViewDetail = (\n repoView: RepoView | RepoViewDetail,\n accountInfo: AccountView | null,\n includeEmail = false,\n): RepoViewDetail => {\n if (!accountInfo) {\n return un$type({\n ...repoView,\n moderation: un$type(repoView.moderation),\n })\n }\n\n const {\n email,\n deactivatedAt,\n emailConfirmedAt,\n inviteNote,\n invitedBy,\n invites,\n invitesDisabled,\n threatSignatures,\n // pick some duplicate/unwanted details out\n $type: _accountType,\n did: _did,\n handle: _handle,\n indexedAt: _indexedAt,\n relatedRecords: _relatedRecords,\n ...otherAccountInfo\n } = accountInfo\n return {\n ...otherAccountInfo,\n ...un$type(repoView),\n moderation: un$type(repoView.moderation),\n email: includeEmail ? email : undefined,\n invitedBy,\n invitesDisabled,\n inviteNote,\n invites,\n emailConfirmedAt,\n deactivatedAt,\n threatSignatures,\n }\n}\n\nexport const addAccountInfoToRepoView = (\n repoView: RepoView,\n accountInfo: AccountView | null,\n includeEmail = false,\n): RepoView => {\n if (!accountInfo) return repoView\n return {\n ...repoView,\n email: includeEmail ? accountInfo.email : undefined,\n invitedBy: accountInfo.invitedBy,\n invitesDisabled: accountInfo.invitesDisabled,\n inviteNote: accountInfo.inviteNote,\n deactivatedAt: accountInfo.deactivatedAt,\n threatSignatures: accountInfo.threatSignatures,\n }\n}\n\nexport const getEventType = (type: string) => {\n if (eventTypes.has(type)) {\n return type as ModerationEvent['action']\n }\n throw new InvalidRequestError('Invalid event type')\n}\n\nexport const getReviewState = (reviewState?: string) => {\n if (!reviewState) return undefined\n if (reviewStates.has(reviewState)) {\n return reviewState as ModerationSubjectStatusRow['reviewState']\n }\n throw new InvalidRequestError('Invalid review state')\n}\n\nconst reviewStates = new Set([\n REVIEWCLOSED,\n REVIEWESCALATED,\n REVIEWOPEN,\n REVIEWNONE,\n])\n\nconst eventTypes = new Set([\n 'tools.ozone.moderation.defs#modEventTakedown',\n 'tools.ozone.moderation.defs#modEventAcknowledge',\n 'tools.ozone.moderation.defs#modEventEscalate',\n 'tools.ozone.moderation.defs#modEventComment',\n 'tools.ozone.moderation.defs#modEventLabel',\n 'tools.ozone.moderation.defs#modEventReport',\n 'tools.ozone.moderation.defs#modEventMute',\n 'tools.ozone.moderation.defs#modEventUnmute',\n 'tools.ozone.moderation.defs#modEventMuteReporter',\n 'tools.ozone.moderation.defs#modEventUnmuteReporter',\n 'tools.ozone.moderation.defs#modEventReverseTakedown',\n 'tools.ozone.moderation.defs#modEventEmail',\n 'tools.ozone.moderation.defs#modEventResolveAppeal',\n 'tools.ozone.moderation.defs#modEventTag',\n 'tools.ozone.moderation.defs#modEventDivert',\n 'tools.ozone.moderation.defs#accountEvent',\n 'tools.ozone.moderation.defs#identityEvent',\n 'tools.ozone.moderation.defs#recordEvent',\n 'tools.ozone.moderation.defs#modEventPriorityScore',\n 'tools.ozone.moderation.defs#ageAssuranceEvent',\n 'tools.ozone.moderation.defs#ageAssuranceOverrideEvent',\n 'tools.ozone.moderation.defs#ageAssurancePurgeEvent',\n 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent',\n 'tools.ozone.moderation.defs#scheduleTakedownEvent',\n 'tools.ozone.moderation.defs#cancelScheduledTakedownEvent',\n])\n\nexport const getMemberRole = (role: string) => {\n if (memberRoles.has(role)) {\n return role as Member['role']\n }\n throw new InvalidRequestError('Invalid member role')\n}\n\nconst memberRoles = new Set([\n ROLEADMIN,\n ROLEMODERATOR,\n ROLETRIAGE,\n ROLEVERIFIER,\n])\n\nexport const OZONE_APPEAL_REASON_TYPE = 'tools.ozone.report.defs#reasonAppeal'\nconst APPEAL_REASON_TYPES = [REASONAPPEAL, OZONE_APPEAL_REASON_TYPE]\nexport const isAppealReport = (reasonType?: string): boolean => {\n return !!reasonType && APPEAL_REASON_TYPES.includes(reasonType)\n}\n\nexport const getSafelinkPattern = (pattern: string): SafelinkPatternType => {\n if (safelinkPatterns.has(pattern)) {\n return pattern as SafelinkPatternType\n }\n throw new InvalidRequestError('Invalid safelink pattern type')\n}\n\nexport const getSafelinkAction = (action: string): SafelinkActionType => {\n if (safelinkActions.has(action)) {\n return action as SafelinkActionType\n }\n throw new InvalidRequestError('Invalid safelink action type')\n}\n\nexport const getSafelinkReason = (reason: string): SafelinkReasonType => {\n if (safelinkReasons.has(reason)) {\n return reason as SafelinkReasonType\n }\n throw new InvalidRequestError('Invalid safelink reason type')\n}\n\nexport const getSafelinkEventType = (eventType: string): SafelinkEventType => {\n if (safelinkEventTypes.has(eventType)) {\n return eventType as SafelinkEventType\n }\n throw new InvalidRequestError('Invalid safelink event type')\n}\n\nexport type SafelinkEventType = 'addRule' | 'updateRule' | 'removeRule'\nexport type SafelinkPatternType = 'domain' | 'url'\nexport type SafelinkActionType = 'block' | 'warn' | 'whitelist'\nexport type SafelinkReasonType = 'csam' | 'spam' | 'phishing' | 'none'\n\nconst safelinkPatterns = new Set(['domain', 'url'])\nconst safelinkActions = new Set(['block', 'warn', 'whitelist'])\nconst safelinkReasons = new Set(['csam', 'spam', 'phishing', 'none'])\nconst safelinkEventTypes = new Set(['addRule', 'updateRule', 'removeRule'])\n\nexport const getScheduledActionType = (action: string): ScheduledActionType => {\n if (scheduledActionTypes.has(action)) {\n return action as ScheduledActionType\n }\n throw new InvalidRequestError('Invalid scheduled action type')\n}\n\nexport const getScheduledActionStatus = (\n status: string,\n): ScheduledActionStatus => {\n if (scheduledActionStatuses.has(status)) {\n return status as ScheduledActionStatus\n }\n throw new InvalidRequestError('Invalid scheduled action status')\n}\n\nexport type ScheduledActionType = 'takedown'\nexport type ScheduledActionStatus =\n | 'pending'\n | 'executed'\n | 'cancelled'\n | 'failed'\n\nconst scheduledActionTypes = new Set(['takedown'])\nconst scheduledActionStatuses = new Set([\n 'pending',\n 'executed',\n 'cancelled',\n 'failed',\n])\n"]}
|
|
@@ -2,7 +2,7 @@ import { Generated } from 'kysely';
|
|
|
2
2
|
export declare const eventTableName = "moderation_event";
|
|
3
3
|
export interface ModerationEvent {
|
|
4
4
|
id: Generated<number>;
|
|
5
|
-
action: 'tools.ozone.moderation.defs#modEventTakedown' | 'tools.ozone.moderation.defs#modEventAcknowledge' | 'tools.ozone.moderation.defs#modEventEscalate' | 'tools.ozone.moderation.defs#modEventComment' | 'tools.ozone.moderation.defs#modEventLabel' | 'tools.ozone.moderation.defs#modEventReport' | 'tools.ozone.moderation.defs#modEventMute' | 'tools.ozone.moderation.defs#modEventUnmute' | 'tools.ozone.moderation.defs#modEventMuteReporter' | 'tools.ozone.moderation.defs#modEventUnmuteReporter' | 'tools.ozone.moderation.defs#modEventReverseTakedown' | 'tools.ozone.moderation.defs#modEventEmail' | 'tools.ozone.moderation.defs#modEventResolveAppeal' | 'tools.ozone.moderation.defs#modEventTag' | 'tools.ozone.moderation.defs#accountEvent' | 'tools.ozone.moderation.defs#identityEvent' | 'tools.ozone.moderation.defs#recordEvent' | 'tools.ozone.moderation.defs#modEventPriorityScore' | 'tools.ozone.moderation.defs#ageAssuranceEvent' | 'tools.ozone.moderation.defs#ageAssuranceOverrideEvent' | 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent';
|
|
5
|
+
action: 'tools.ozone.moderation.defs#modEventTakedown' | 'tools.ozone.moderation.defs#modEventAcknowledge' | 'tools.ozone.moderation.defs#modEventEscalate' | 'tools.ozone.moderation.defs#modEventComment' | 'tools.ozone.moderation.defs#modEventLabel' | 'tools.ozone.moderation.defs#modEventReport' | 'tools.ozone.moderation.defs#modEventMute' | 'tools.ozone.moderation.defs#modEventUnmute' | 'tools.ozone.moderation.defs#modEventMuteReporter' | 'tools.ozone.moderation.defs#modEventUnmuteReporter' | 'tools.ozone.moderation.defs#modEventReverseTakedown' | 'tools.ozone.moderation.defs#modEventEmail' | 'tools.ozone.moderation.defs#modEventResolveAppeal' | 'tools.ozone.moderation.defs#modEventTag' | 'tools.ozone.moderation.defs#accountEvent' | 'tools.ozone.moderation.defs#identityEvent' | 'tools.ozone.moderation.defs#recordEvent' | 'tools.ozone.moderation.defs#modEventPriorityScore' | 'tools.ozone.moderation.defs#ageAssuranceEvent' | 'tools.ozone.moderation.defs#ageAssuranceOverrideEvent' | 'tools.ozone.moderation.defs#ageAssurancePurgeEvent' | 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent';
|
|
6
6
|
subjectType: 'com.atproto.admin.defs#repoRef' | 'com.atproto.repo.strongRef' | 'chat.bsky.convo.defs#messageRef';
|
|
7
7
|
subjectDid: string;
|
|
8
8
|
subjectUri: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderation_event.d.ts","sourceRoot":"","sources":["../../../src/db/schema/moderation_event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,eAAO,MAAM,cAAc,qBAAqB,CAAA;AAEhD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;IACrB,MAAM,EACF,8CAA8C,GAC9C,iDAAiD,GACjD,8CAA8C,GAC9C,6CAA6C,GAC7C,2CAA2C,GAC3C,4CAA4C,GAC5C,0CAA0C,GAC1C,4CAA4C,GAC5C,kDAAkD,GAClD,oDAAoD,GAC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9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,GAAG,IAAI,CAAA;IACtD,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE;aAAG,CAAC,IAAI,MAAM,GAAG,OAAO;SAAE,CAAA;KAAE,GAAG,IAAI,CAAA;IACnE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,cAAc,CAAC,EAAE,eAAe,CAAA;CAClC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderation_event.js","sourceRoot":"","sources":["../../../src/db/schema/moderation_event.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAG,kBAAkB,CAAA","sourcesContent":["import { Generated } from 'kysely'\n\nexport const eventTableName = 'moderation_event'\n\nexport interface ModerationEvent {\n id: Generated<number>\n action:\n | 'tools.ozone.moderation.defs#modEventTakedown'\n | 'tools.ozone.moderation.defs#modEventAcknowledge'\n | 'tools.ozone.moderation.defs#modEventEscalate'\n | 'tools.ozone.moderation.defs#modEventComment'\n | 'tools.ozone.moderation.defs#modEventLabel'\n | 'tools.ozone.moderation.defs#modEventReport'\n | 'tools.ozone.moderation.defs#modEventMute'\n | 'tools.ozone.moderation.defs#modEventUnmute'\n | 'tools.ozone.moderation.defs#modEventMuteReporter'\n | 'tools.ozone.moderation.defs#modEventUnmuteReporter'\n | 'tools.ozone.moderation.defs#modEventReverseTakedown'\n | 'tools.ozone.moderation.defs#modEventEmail'\n | 'tools.ozone.moderation.defs#modEventResolveAppeal'\n | 'tools.ozone.moderation.defs#modEventTag'\n | 'tools.ozone.moderation.defs#accountEvent'\n | 'tools.ozone.moderation.defs#identityEvent'\n | 'tools.ozone.moderation.defs#recordEvent'\n | 'tools.ozone.moderation.defs#modEventPriorityScore'\n | 'tools.ozone.moderation.defs#ageAssuranceEvent'\n | 'tools.ozone.moderation.defs#ageAssuranceOverrideEvent'\n | 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent'\n subjectType:\n | 'com.atproto.admin.defs#repoRef'\n | 'com.atproto.repo.strongRef'\n | 'chat.bsky.convo.defs#messageRef'\n subjectDid: string\n subjectUri: string | null\n subjectCid: string | null\n subjectBlobCids: string[] | null\n subjectMessageId: string | null\n createLabelVals: string | null\n negateLabelVals: string | null\n comment: string | null\n createdAt: string\n createdBy: string\n durationInHours: number | null\n expiresAt: string | null\n meta: Record<string, string | boolean | number> | null\n addedTags: string[] | null\n removedTags: string[] | null\n legacyRefId: number | null\n modTool: { name: string; meta?: { [_ in string]: unknown } } | null\n externalId: string | null\n severityLevel: string | null\n strikeCount: number | null\n strikeExpiresAt: string | null\n}\n\nexport type PartialDB = {\n [eventTableName]: ModerationEvent\n}\n"]}
|
|
1
|
+
{"version":3,"file":"moderation_event.js","sourceRoot":"","sources":["../../../src/db/schema/moderation_event.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAG,kBAAkB,CAAA","sourcesContent":["import { Generated } from 'kysely'\n\nexport const eventTableName = 'moderation_event'\n\nexport interface ModerationEvent {\n id: Generated<number>\n action:\n | 'tools.ozone.moderation.defs#modEventTakedown'\n | 'tools.ozone.moderation.defs#modEventAcknowledge'\n | 'tools.ozone.moderation.defs#modEventEscalate'\n | 'tools.ozone.moderation.defs#modEventComment'\n | 'tools.ozone.moderation.defs#modEventLabel'\n | 'tools.ozone.moderation.defs#modEventReport'\n | 'tools.ozone.moderation.defs#modEventMute'\n | 'tools.ozone.moderation.defs#modEventUnmute'\n | 'tools.ozone.moderation.defs#modEventMuteReporter'\n | 'tools.ozone.moderation.defs#modEventUnmuteReporter'\n | 'tools.ozone.moderation.defs#modEventReverseTakedown'\n | 'tools.ozone.moderation.defs#modEventEmail'\n | 'tools.ozone.moderation.defs#modEventResolveAppeal'\n | 'tools.ozone.moderation.defs#modEventTag'\n | 'tools.ozone.moderation.defs#accountEvent'\n | 'tools.ozone.moderation.defs#identityEvent'\n | 'tools.ozone.moderation.defs#recordEvent'\n | 'tools.ozone.moderation.defs#modEventPriorityScore'\n | 'tools.ozone.moderation.defs#ageAssuranceEvent'\n | 'tools.ozone.moderation.defs#ageAssuranceOverrideEvent'\n | 'tools.ozone.moderation.defs#ageAssurancePurgeEvent'\n | 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent'\n subjectType:\n | 'com.atproto.admin.defs#repoRef'\n | 'com.atproto.repo.strongRef'\n | 'chat.bsky.convo.defs#messageRef'\n subjectDid: string\n subjectUri: string | null\n subjectCid: string | null\n subjectBlobCids: string[] | null\n subjectMessageId: string | null\n createLabelVals: string | null\n negateLabelVals: string | null\n comment: string | null\n createdAt: string\n createdBy: string\n durationInHours: number | null\n expiresAt: string | null\n meta: Record<string, string | boolean | number> | null\n addedTags: string[] | null\n removedTags: string[] | null\n legacyRefId: number | null\n modTool: { name: string; meta?: { [_ in string]: unknown } } | null\n externalId: string | null\n severityLevel: string | null\n strikeCount: number | null\n strikeExpiresAt: string | null\n}\n\nexport type PartialDB = {\n [eventTableName]: ModerationEvent\n}\n"]}
|
|
@@ -5823,19 +5823,19 @@ export declare const schemaDict: {
|
|
|
5823
5823
|
readonly ref: "lex:app.bsky.actor.defs#profileView";
|
|
5824
5824
|
};
|
|
5825
5825
|
};
|
|
5826
|
+
readonly recIdStr: {
|
|
5827
|
+
readonly type: "string";
|
|
5828
|
+
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
5829
|
+
};
|
|
5826
5830
|
readonly isFallback: {
|
|
5827
5831
|
readonly type: "boolean";
|
|
5828
|
-
readonly description: "
|
|
5832
|
+
readonly description: "DEPRECATED, unused. Previously: if true, response has fallen-back to generic results, and is not scoped using relativeToDid";
|
|
5829
5833
|
readonly default: false;
|
|
5830
5834
|
};
|
|
5831
5835
|
readonly recId: {
|
|
5832
5836
|
readonly type: "integer";
|
|
5833
5837
|
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
5834
5838
|
};
|
|
5835
|
-
readonly recIdStr: {
|
|
5836
|
-
readonly type: "string";
|
|
5837
|
-
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
5838
|
-
};
|
|
5839
5839
|
};
|
|
5840
5840
|
};
|
|
5841
5841
|
};
|
|
@@ -11102,7 +11102,7 @@ export declare const schemaDict: {
|
|
|
11102
11102
|
};
|
|
11103
11103
|
readonly labelValue: {
|
|
11104
11104
|
readonly type: "string";
|
|
11105
|
-
readonly knownValues: ["!hide", "!
|
|
11105
|
+
readonly knownValues: ["!hide", "!warn", "!no-unauthenticated", "porn", "sexual", "nudity", "graphic-media", "bot"];
|
|
11106
11106
|
};
|
|
11107
11107
|
};
|
|
11108
11108
|
};
|
|
@@ -14752,7 +14752,7 @@ export declare const schemaDict: {
|
|
|
14752
14752
|
};
|
|
14753
14753
|
readonly event: {
|
|
14754
14754
|
readonly type: "union";
|
|
14755
|
-
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
14755
|
+
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
14756
14756
|
};
|
|
14757
14757
|
readonly subject: {
|
|
14758
14758
|
readonly type: "union";
|
|
@@ -14793,7 +14793,7 @@ export declare const schemaDict: {
|
|
|
14793
14793
|
};
|
|
14794
14794
|
readonly event: {
|
|
14795
14795
|
readonly type: "union";
|
|
14796
|
-
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
14796
|
+
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
14797
14797
|
};
|
|
14798
14798
|
readonly subject: {
|
|
14799
14799
|
readonly type: "union";
|
|
@@ -15300,6 +15300,18 @@ export declare const schemaDict: {
|
|
|
15300
15300
|
};
|
|
15301
15301
|
};
|
|
15302
15302
|
};
|
|
15303
|
+
readonly ageAssurancePurgeEvent: {
|
|
15304
|
+
readonly type: "object";
|
|
15305
|
+
readonly description: "Purges all age assurance events for the subject. Only works on DID subjects. Moderator-only.";
|
|
15306
|
+
readonly required: ["comment"];
|
|
15307
|
+
readonly properties: {
|
|
15308
|
+
readonly comment: {
|
|
15309
|
+
readonly type: "string";
|
|
15310
|
+
readonly minLength: 1;
|
|
15311
|
+
readonly description: "Comment describing the reason for the purge.";
|
|
15312
|
+
};
|
|
15313
|
+
};
|
|
15314
|
+
};
|
|
15303
15315
|
readonly revokeAccountCredentialsEvent: {
|
|
15304
15316
|
readonly type: "object";
|
|
15305
15317
|
readonly description: "Account credentials revocation by moderators. Only works on DID subjects.";
|
|
@@ -16065,7 +16077,7 @@ export declare const schemaDict: {
|
|
|
16065
16077
|
readonly properties: {
|
|
16066
16078
|
readonly event: {
|
|
16067
16079
|
readonly type: "union";
|
|
16068
|
-
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
16080
|
+
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
16069
16081
|
};
|
|
16070
16082
|
readonly subject: {
|
|
16071
16083
|
readonly type: "union";
|
|
@@ -24677,19 +24689,19 @@ export declare const schemas: ({
|
|
|
24677
24689
|
readonly ref: "lex:app.bsky.actor.defs#profileView";
|
|
24678
24690
|
};
|
|
24679
24691
|
};
|
|
24692
|
+
readonly recIdStr: {
|
|
24693
|
+
readonly type: "string";
|
|
24694
|
+
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
24695
|
+
};
|
|
24680
24696
|
readonly isFallback: {
|
|
24681
24697
|
readonly type: "boolean";
|
|
24682
|
-
readonly description: "
|
|
24698
|
+
readonly description: "DEPRECATED, unused. Previously: if true, response has fallen-back to generic results, and is not scoped using relativeToDid";
|
|
24683
24699
|
readonly default: false;
|
|
24684
24700
|
};
|
|
24685
24701
|
readonly recId: {
|
|
24686
24702
|
readonly type: "integer";
|
|
24687
24703
|
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
24688
24704
|
};
|
|
24689
|
-
readonly recIdStr: {
|
|
24690
|
-
readonly type: "string";
|
|
24691
|
-
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
24692
|
-
};
|
|
24693
24705
|
};
|
|
24694
24706
|
};
|
|
24695
24707
|
};
|
|
@@ -29847,7 +29859,7 @@ export declare const schemas: ({
|
|
|
29847
29859
|
};
|
|
29848
29860
|
readonly labelValue: {
|
|
29849
29861
|
readonly type: "string";
|
|
29850
|
-
readonly knownValues: ["!hide", "!
|
|
29862
|
+
readonly knownValues: ["!hide", "!warn", "!no-unauthenticated", "porn", "sexual", "nudity", "graphic-media", "bot"];
|
|
29851
29863
|
};
|
|
29852
29864
|
};
|
|
29853
29865
|
} | {
|
|
@@ -33421,7 +33433,7 @@ export declare const schemas: ({
|
|
|
33421
33433
|
};
|
|
33422
33434
|
readonly event: {
|
|
33423
33435
|
readonly type: "union";
|
|
33424
|
-
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
33436
|
+
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
33425
33437
|
};
|
|
33426
33438
|
readonly subject: {
|
|
33427
33439
|
readonly type: "union";
|
|
@@ -33462,7 +33474,7 @@ export declare const schemas: ({
|
|
|
33462
33474
|
};
|
|
33463
33475
|
readonly event: {
|
|
33464
33476
|
readonly type: "union";
|
|
33465
|
-
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
33477
|
+
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
33466
33478
|
};
|
|
33467
33479
|
readonly subject: {
|
|
33468
33480
|
readonly type: "union";
|
|
@@ -33969,6 +33981,18 @@ export declare const schemas: ({
|
|
|
33969
33981
|
};
|
|
33970
33982
|
};
|
|
33971
33983
|
};
|
|
33984
|
+
readonly ageAssurancePurgeEvent: {
|
|
33985
|
+
readonly type: "object";
|
|
33986
|
+
readonly description: "Purges all age assurance events for the subject. Only works on DID subjects. Moderator-only.";
|
|
33987
|
+
readonly required: ["comment"];
|
|
33988
|
+
readonly properties: {
|
|
33989
|
+
readonly comment: {
|
|
33990
|
+
readonly type: "string";
|
|
33991
|
+
readonly minLength: 1;
|
|
33992
|
+
readonly description: "Comment describing the reason for the purge.";
|
|
33993
|
+
};
|
|
33994
|
+
};
|
|
33995
|
+
};
|
|
33972
33996
|
readonly revokeAccountCredentialsEvent: {
|
|
33973
33997
|
readonly type: "object";
|
|
33974
33998
|
readonly description: "Account credentials revocation by moderators. Only works on DID subjects.";
|
|
@@ -34733,7 +34757,7 @@ export declare const schemas: ({
|
|
|
34733
34757
|
readonly properties: {
|
|
34734
34758
|
readonly event: {
|
|
34735
34759
|
readonly type: "union";
|
|
34736
|
-
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
34760
|
+
readonly refs: ["lex:tools.ozone.moderation.defs#modEventTakedown", "lex:tools.ozone.moderation.defs#modEventAcknowledge", "lex:tools.ozone.moderation.defs#modEventEscalate", "lex:tools.ozone.moderation.defs#modEventComment", "lex:tools.ozone.moderation.defs#modEventLabel", "lex:tools.ozone.moderation.defs#modEventReport", "lex:tools.ozone.moderation.defs#modEventMute", "lex:tools.ozone.moderation.defs#modEventUnmute", "lex:tools.ozone.moderation.defs#modEventMuteReporter", "lex:tools.ozone.moderation.defs#modEventUnmuteReporter", "lex:tools.ozone.moderation.defs#modEventReverseTakedown", "lex:tools.ozone.moderation.defs#modEventResolveAppeal", "lex:tools.ozone.moderation.defs#modEventEmail", "lex:tools.ozone.moderation.defs#modEventDivert", "lex:tools.ozone.moderation.defs#modEventTag", "lex:tools.ozone.moderation.defs#accountEvent", "lex:tools.ozone.moderation.defs#identityEvent", "lex:tools.ozone.moderation.defs#recordEvent", "lex:tools.ozone.moderation.defs#modEventPriorityScore", "lex:tools.ozone.moderation.defs#ageAssuranceEvent", "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent", "lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent", "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "lex:tools.ozone.moderation.defs#scheduleTakedownEvent", "lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent"];
|
|
34737
34761
|
};
|
|
34738
34762
|
readonly subject: {
|
|
34739
34763
|
readonly type: "union";
|