@atproto/ozone 0.1.165 → 0.1.167
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 +20 -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/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 +70 -6
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +35 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/getSuggestions.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/actor/getSuggestions.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/getSuggestions.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.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 +5 -5
- package/src/api/moderation/emitEvent.ts +17 -1
- package/src/api/util.ts +1 -0
- package/src/db/schema/moderation_event.ts +1 -0
- package/src/lexicon/lexicons.ts +36 -0
- package/src/lexicon/types/app/bsky/actor/getSuggestions.ts +3 -1
- package/src/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.ts +3 -1
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedOnboardingUsers.ts +3 -1
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts +3 -1
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts +3 -1
- 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/__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/age-assurance.test.ts +134 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atproto/ozone
|
|
2
2
|
|
|
3
|
+
## 0.1.167
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9f9f71a`](https://github.com/bluesky-social/atproto/commit/9f9f71a6a3e58ccbd5e6d3ee079b570096cb11fa), [`67eb0c1`](https://github.com/bluesky-social/atproto/commit/67eb0c19ac415e762e221b2ccda9f0bcf7b3dd6f)]:
|
|
10
|
+
- @atproto/api@0.19.4
|
|
11
|
+
- @atproto/syntax@0.5.1
|
|
12
|
+
- @atproto/xrpc-server@0.10.16
|
|
13
|
+
|
|
14
|
+
## 0.1.166
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#4683](https://github.com/bluesky-social/atproto/pull/4683) [`6634140`](https://github.com/bluesky-social/atproto/commit/66341400d49d1210619b000a040852d87085c32c) Thanks [@ds-boyce](https://github.com/ds-boyce)! - Introduce recIdStr field
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`6634140`](https://github.com/bluesky-social/atproto/commit/66341400d49d1210619b000a040852d87085c32c), [`0e5df95`](https://github.com/bluesky-social/atproto/commit/0e5df95e3a8d81931524848d301cd43d1f12fb78)]:
|
|
21
|
+
- @atproto/api@0.19.2
|
|
22
|
+
|
|
3
23
|
## 0.1.165
|
|
4
24
|
|
|
5
25
|
### 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,i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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 { 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,4BA6CC;AAtXD,qFAA6F;AAC7F,sDAI6B;AAI7B,qDAA4C;AAC5C,0EAewD;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,WAAW;QACnC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG;QACtB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAA;IAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAA;IACjB,MAAM,iBAAiB,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IAC5C,MAAM,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;IAC7C,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,IAAI,CAAA;IACxC,MAAM,kBAAkB,GAAG,IAAA,4BAAqB,EAAC,KAAK,CAAC,CAAA;IACvD,MAAM,eAAe,GAAG,IAAA,yBAAkB,EAAC,KAAK,CAAC,CAAA;IACjD,MAAM,sBAAsB,GAAG,IAAA,gCAAyB,EAAC,KAAK,CAAC,CAAA;IAC/D,MAAM,YAAY,GAAG,IAAA,sBAAe,EAAC,KAAK,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,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;YACrD,IAAI,eAAe,EAAE,CAAC;gBACpB,yFAAyF;gBACzF,IACE,IAAI,CAAC,WAAW,CAAC,WAAW;oBAC5B,CAAC,eAAe,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAChE,CAAC;oBACD,MAAM,IAAI,iCAAmB,CAC3B,sBAAsB,GAAG,sBAAsB,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"]}
|
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,eAAO,MAAM,wBAAwB,GACnC,UAAU,QAAQ,EAClB,aAAa,W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AAA;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,EAC4B,EAAE;IAC5C,MAAM,OAAO,GAAG,IAAI,GAAG,EA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'\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,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,C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C,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,GACpD,qDAAqD,GACrD,2CAA2C,GAC3C,mDAAmD,GACnD,yC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,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"]}
|
|
@@ -959,6 +959,10 @@ export declare const schemaDict: {
|
|
|
959
959
|
};
|
|
960
960
|
readonly recId: {
|
|
961
961
|
readonly type: "integer";
|
|
962
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
963
|
+
};
|
|
964
|
+
readonly recIdStr: {
|
|
965
|
+
readonly type: "string";
|
|
962
966
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
963
967
|
};
|
|
964
968
|
};
|
|
@@ -7568,6 +7572,10 @@ export declare const schemaDict: {
|
|
|
7568
7572
|
};
|
|
7569
7573
|
};
|
|
7570
7574
|
readonly recId: {
|
|
7575
|
+
readonly type: "string";
|
|
7576
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
7577
|
+
};
|
|
7578
|
+
readonly recIdStr: {
|
|
7571
7579
|
readonly type: "string";
|
|
7572
7580
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
7573
7581
|
};
|
|
@@ -7883,6 +7891,10 @@ export declare const schemaDict: {
|
|
|
7883
7891
|
};
|
|
7884
7892
|
};
|
|
7885
7893
|
readonly recId: {
|
|
7894
|
+
readonly type: "string";
|
|
7895
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
7896
|
+
};
|
|
7897
|
+
readonly recIdStr: {
|
|
7886
7898
|
readonly type: "string";
|
|
7887
7899
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
7888
7900
|
};
|
|
@@ -8007,6 +8019,10 @@ export declare const schemaDict: {
|
|
|
8007
8019
|
};
|
|
8008
8020
|
};
|
|
8009
8021
|
readonly recId: {
|
|
8022
|
+
readonly type: "string";
|
|
8023
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
8024
|
+
};
|
|
8025
|
+
readonly recIdStr: {
|
|
8010
8026
|
readonly type: "string";
|
|
8011
8027
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
8012
8028
|
};
|
|
@@ -8057,6 +8073,10 @@ export declare const schemaDict: {
|
|
|
8057
8073
|
};
|
|
8058
8074
|
};
|
|
8059
8075
|
readonly recId: {
|
|
8076
|
+
readonly type: "string";
|
|
8077
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
8078
|
+
};
|
|
8079
|
+
readonly recIdStr: {
|
|
8060
8080
|
readonly type: "string";
|
|
8061
8081
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
8062
8082
|
};
|
|
@@ -14732,7 +14752,7 @@ export declare const schemaDict: {
|
|
|
14732
14752
|
};
|
|
14733
14753
|
readonly event: {
|
|
14734
14754
|
readonly type: "union";
|
|
14735
|
-
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"];
|
|
14736
14756
|
};
|
|
14737
14757
|
readonly subject: {
|
|
14738
14758
|
readonly type: "union";
|
|
@@ -14773,7 +14793,7 @@ export declare const schemaDict: {
|
|
|
14773
14793
|
};
|
|
14774
14794
|
readonly event: {
|
|
14775
14795
|
readonly type: "union";
|
|
14776
|
-
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"];
|
|
14777
14797
|
};
|
|
14778
14798
|
readonly subject: {
|
|
14779
14799
|
readonly type: "union";
|
|
@@ -15280,6 +15300,18 @@ export declare const schemaDict: {
|
|
|
15280
15300
|
};
|
|
15281
15301
|
};
|
|
15282
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
|
+
};
|
|
15283
15315
|
readonly revokeAccountCredentialsEvent: {
|
|
15284
15316
|
readonly type: "object";
|
|
15285
15317
|
readonly description: "Account credentials revocation by moderators. Only works on DID subjects.";
|
|
@@ -16045,7 +16077,7 @@ export declare const schemaDict: {
|
|
|
16045
16077
|
readonly properties: {
|
|
16046
16078
|
readonly event: {
|
|
16047
16079
|
readonly type: "union";
|
|
16048
|
-
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"];
|
|
16049
16081
|
};
|
|
16050
16082
|
readonly subject: {
|
|
16051
16083
|
readonly type: "union";
|
|
@@ -19870,6 +19902,10 @@ export declare const schemas: ({
|
|
|
19870
19902
|
};
|
|
19871
19903
|
readonly recId: {
|
|
19872
19904
|
readonly type: "integer";
|
|
19905
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
19906
|
+
};
|
|
19907
|
+
readonly recIdStr: {
|
|
19908
|
+
readonly type: "string";
|
|
19873
19909
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
19874
19910
|
};
|
|
19875
19911
|
};
|
|
@@ -26368,6 +26404,10 @@ export declare const schemas: ({
|
|
|
26368
26404
|
};
|
|
26369
26405
|
};
|
|
26370
26406
|
readonly recId: {
|
|
26407
|
+
readonly type: "string";
|
|
26408
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
26409
|
+
};
|
|
26410
|
+
readonly recIdStr: {
|
|
26371
26411
|
readonly type: "string";
|
|
26372
26412
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
26373
26413
|
};
|
|
@@ -26677,6 +26717,10 @@ export declare const schemas: ({
|
|
|
26677
26717
|
};
|
|
26678
26718
|
};
|
|
26679
26719
|
readonly recId: {
|
|
26720
|
+
readonly type: "string";
|
|
26721
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
26722
|
+
};
|
|
26723
|
+
readonly recIdStr: {
|
|
26680
26724
|
readonly type: "string";
|
|
26681
26725
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
26682
26726
|
};
|
|
@@ -26798,6 +26842,10 @@ export declare const schemas: ({
|
|
|
26798
26842
|
};
|
|
26799
26843
|
};
|
|
26800
26844
|
readonly recId: {
|
|
26845
|
+
readonly type: "string";
|
|
26846
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
26847
|
+
};
|
|
26848
|
+
readonly recIdStr: {
|
|
26801
26849
|
readonly type: "string";
|
|
26802
26850
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
26803
26851
|
};
|
|
@@ -26847,6 +26895,10 @@ export declare const schemas: ({
|
|
|
26847
26895
|
};
|
|
26848
26896
|
};
|
|
26849
26897
|
readonly recId: {
|
|
26898
|
+
readonly type: "string";
|
|
26899
|
+
readonly description: "DEPRECATED: use recIdStr instead.";
|
|
26900
|
+
};
|
|
26901
|
+
readonly recIdStr: {
|
|
26850
26902
|
readonly type: "string";
|
|
26851
26903
|
readonly description: "Snowflake for this recommendation, use when submitting recommendation events.";
|
|
26852
26904
|
};
|
|
@@ -33381,7 +33433,7 @@ export declare const schemas: ({
|
|
|
33381
33433
|
};
|
|
33382
33434
|
readonly event: {
|
|
33383
33435
|
readonly type: "union";
|
|
33384
|
-
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"];
|
|
33385
33437
|
};
|
|
33386
33438
|
readonly subject: {
|
|
33387
33439
|
readonly type: "union";
|
|
@@ -33422,7 +33474,7 @@ export declare const schemas: ({
|
|
|
33422
33474
|
};
|
|
33423
33475
|
readonly event: {
|
|
33424
33476
|
readonly type: "union";
|
|
33425
|
-
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"];
|
|
33426
33478
|
};
|
|
33427
33479
|
readonly subject: {
|
|
33428
33480
|
readonly type: "union";
|
|
@@ -33929,6 +33981,18 @@ export declare const schemas: ({
|
|
|
33929
33981
|
};
|
|
33930
33982
|
};
|
|
33931
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
|
+
};
|
|
33932
33996
|
readonly revokeAccountCredentialsEvent: {
|
|
33933
33997
|
readonly type: "object";
|
|
33934
33998
|
readonly description: "Account credentials revocation by moderators. Only works on DID subjects.";
|
|
@@ -34693,7 +34757,7 @@ export declare const schemas: ({
|
|
|
34693
34757
|
readonly properties: {
|
|
34694
34758
|
readonly event: {
|
|
34695
34759
|
readonly type: "union";
|
|
34696
|
-
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"];
|
|
34697
34761
|
};
|
|
34698
34762
|
readonly subject: {
|
|
34699
34763
|
readonly type: "union";
|