Skip to content

Commit

Permalink
✨ Add modEventDivertBlobs event to send blobs to abyss (#2238)
Browse files Browse the repository at this point in the history
* 🚧 Working through an nullable review state

* ✅ Update snapshots on some tests

* ✅ Update snapshots on some tests

* ✅ Add test for reviewOptional status mutation

* ✨ Add divertBlobs event to send blobs to abyss

* ♻️ Rename reviewOptional -> reviewNone

* ♻️ Rename modEventDivertBlobs -> modEventDivert

* 🐛 Rename event type checker

* ✨ Use pds resolver to get blob straight from pds

* ✅ Use FOR UPDATE to respect db transactions

* ♻️ Refactor to use event_pusher table instead of new table

* ✨ Bring back missing lines in pnpm-lock

* 🔨 Rebuild?

* 🚨 Formatting

* ♻️ Refactor to divert blob sync

* 🧹 Cleanup

* ✅ Use modClient seed client in blob-divert test

* update divert blob config to use basic admin auth

* fix

* build

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
  • Loading branch information
foysalit and devinivy authored Mar 12, 2024
1 parent 38656e7 commit 2802880
Show file tree
Hide file tree
Showing 23 changed files with 675 additions and 174 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-ozone-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- divert-blobs
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
13 changes: 11 additions & 2 deletions lexicons/com/atproto/admin/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"#modEventEscalate",
"#modEventMute",
"#modEventEmail",
"#modEventResolveAppeal"
"#modEventResolveAppeal",
"#modEventDivert"
]
},
"subject": {
Expand Down Expand Up @@ -72,7 +73,8 @@
"#modEventEscalate",
"#modEventMute",
"#modEventEmail",
"#modEventResolveAppeal"
"#modEventResolveAppeal",
"#modEventDivert"
]
},
"subject": {
Expand Down Expand Up @@ -625,6 +627,13 @@
}
}
},
"modEventDivert": {
"type": "object",
"description": "Divert a record's blobs to a 3rd party service for further scanning/tagging",
"properties": {
"comment": { "type": "string" }
}
},
"communicationTemplateView": {
"type": "object",
"required": [
Expand Down
12 changes: 12 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#modEventMute',
'lex:com.atproto.admin.defs#modEventEmail',
'lex:com.atproto.admin.defs#modEventResolveAppeal',
'lex:com.atproto.admin.defs#modEventDivert',
],
},
subject: {
Expand Down Expand Up @@ -150,6 +151,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#modEventMute',
'lex:com.atproto.admin.defs#modEventEmail',
'lex:com.atproto.admin.defs#modEventResolveAppeal',
'lex:com.atproto.admin.defs#modEventDivert',
],
},
subject: {
Expand Down Expand Up @@ -940,6 +942,16 @@ export const schemaDict = {
},
},
},
modEventDivert: {
type: 'object',
description:
"Divert a record's blobs to a 3rd party service for further scanning/tagging",
properties: {
comment: {
type: 'string',
},
},
},
communicationTemplateView: {
type: 'object',
required: [
Expand Down
20 changes: 20 additions & 0 deletions packages/api/src/client/types/com/atproto/admin/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface ModEventView {
| ModEventMute
| ModEventEmail
| ModEventResolveAppeal
| ModEventDivert
| { $type: string; [k: string]: unknown }
subject:
| RepoRef
Expand Down Expand Up @@ -79,6 +80,7 @@ export interface ModEventViewDetail {
| ModEventMute
| ModEventEmail
| ModEventResolveAppeal
| ModEventDivert
| { $type: string; [k: string]: unknown }
subject:
| RepoView
Expand Down Expand Up @@ -749,6 +751,24 @@ export function validateModEventTag(v: unknown): ValidationResult {
return lexicons.validate('com.atproto.admin.defs#modEventTag', v)
}

/** Divert a record's blobs to a 3rd party service for further scanning/tagging */
export interface ModEventDivert {
comment?: string
[k: string]: unknown
}

export function isModEventDivert(v: unknown): v is ModEventDivert {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'com.atproto.admin.defs#modEventDivert'
)
}

export function validateModEventDivert(v: unknown): ValidationResult {
return lexicons.validate('com.atproto.admin.defs#modEventDivert', v)
}

export interface CommunicationTemplateView {
id: string
/** Name of the template. */
Expand Down
12 changes: 12 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#modEventMute',
'lex:com.atproto.admin.defs#modEventEmail',
'lex:com.atproto.admin.defs#modEventResolveAppeal',
'lex:com.atproto.admin.defs#modEventDivert',
],
},
subject: {
Expand Down Expand Up @@ -150,6 +151,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#modEventMute',
'lex:com.atproto.admin.defs#modEventEmail',
'lex:com.atproto.admin.defs#modEventResolveAppeal',
'lex:com.atproto.admin.defs#modEventDivert',
],
},
subject: {
Expand Down Expand Up @@ -940,6 +942,16 @@ export const schemaDict = {
},
},
},
modEventDivert: {
type: 'object',
description:
"Divert a record's blobs to a 3rd party service for further scanning/tagging",
properties: {
comment: {
type: 'string',
},
},
},
communicationTemplateView: {
type: 'object',
required: [
Expand Down
20 changes: 20 additions & 0 deletions packages/bsky/src/lexicon/types/com/atproto/admin/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface ModEventView {
| ModEventMute
| ModEventEmail
| ModEventResolveAppeal
| ModEventDivert
| { $type: string; [k: string]: unknown }
subject:
| RepoRef
Expand Down Expand Up @@ -79,6 +80,7 @@ export interface ModEventViewDetail {
| ModEventMute
| ModEventEmail
| ModEventResolveAppeal
| ModEventDivert
| { $type: string; [k: string]: unknown }
subject:
| RepoView
Expand Down Expand Up @@ -749,6 +751,24 @@ export function validateModEventTag(v: unknown): ValidationResult {
return lexicons.validate('com.atproto.admin.defs#modEventTag', v)
}

/** Divert a record's blobs to a 3rd party service for further scanning/tagging */
export interface ModEventDivert {
comment?: string
[k: string]: unknown
}

export function isModEventDivert(v: unknown): v is ModEventDivert {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'com.atproto.admin.defs#modEventDivert'
)
}

export function validateModEventDivert(v: unknown): ValidationResult {
return lexicons.validate('com.atproto.admin.defs#modEventDivert', v)
}

export interface CommunicationTemplateView {
id: string
/** Name of the template. */
Expand Down
Loading

0 comments on commit 2802880

Please sign in to comment.