@atproto/ozone 0.1.160 → 0.1.162
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/LICENSE.txt +1 -1
- package/dist/api/moderation/emitEvent.d.ts.map +1 -1
- package/dist/api/moderation/emitEvent.js +29 -23
- package/dist/api/moderation/emitEvent.js.map +1 -1
- package/dist/daemon/materialized-view-refresher.d.ts.map +1 -1
- package/dist/daemon/materialized-view-refresher.js +8 -1
- package/dist/daemon/materialized-view-refresher.js.map +1 -1
- package/dist/lexicon/index.d.ts +15 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +41 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +1134 -56
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +603 -26
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +35 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js +27 -0
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/ageassurance/defs.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/ageassurance/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/ageassurance/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/defs.d.ts +10 -0
- package/dist/lexicon/types/app/bsky/contact/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/defs.js +9 -0
- package/dist/lexicon/types/app/bsky/contact/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/getMatches.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/importContacts.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/removeData.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/removeData.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/removeData.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/sendNotification.d.ts +26 -0
- package/dist/lexicon/types/app/bsky/contact/sendNotification.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/sendNotification.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/sendNotification.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.js.map +1 -1
- package/dist/lexicon/types/app/bsky/draft/createDraft.d.ts +27 -0
- package/dist/lexicon/types/app/bsky/draft/createDraft.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/createDraft.js +7 -0
- package/dist/lexicon/types/app/bsky/draft/createDraft.js.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/defs.d.ts +106 -0
- package/dist/lexicon/types/app/bsky/draft/defs.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/defs.js +97 -0
- package/dist/lexicon/types/app/bsky/draft/defs.js.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/deleteDraft.d.ts +14 -0
- package/dist/lexicon/types/app/bsky/draft/deleteDraft.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/deleteDraft.js +7 -0
- package/dist/lexicon/types/app/bsky/draft/deleteDraft.js.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/getDrafts.d.ts +24 -0
- package/dist/lexicon/types/app/bsky/draft/getDrafts.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/getDrafts.js +7 -0
- package/dist/lexicon/types/app/bsky/draft/getDrafts.js.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/updateDraft.d.ts +15 -0
- package/dist/lexicon/types/app/bsky/draft/updateDraft.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/draft/updateDraft.js +7 -0
- package/dist/lexicon/types/app/bsky/draft/updateDraft.js.map +1 -0
- package/dist/lexicon/types/app/bsky/embed/video.d.ts +4 -0
- package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts +2 -0
- 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 +2 -0
- 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/com/atproto/server/deleteSession.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/server/deleteSession.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/deleteSession.js.map +1 -1
- package/dist/lexicon/types/com/atproto/server/getSession.d.ts +3 -3
- package/dist/lexicon/types/com/atproto/server/getSession.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/getSession.js.map +1 -1
- package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +4 -1
- package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/refreshSession.js.map +1 -1
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +10 -4
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/util.d.ts.map +1 -1
- package/dist/mod-service/util.js +3 -1
- package/dist/mod-service/util.js.map +1 -1
- package/package.json +8 -8
- package/src/api/moderation/emitEvent.ts +33 -25
- package/src/daemon/materialized-view-refresher.ts +9 -3
- package/src/lexicon/index.ts +75 -0
- package/src/lexicon/lexicons.ts +624 -26
- package/src/lexicon/types/app/bsky/actor/defs.ts +63 -0
- package/src/lexicon/types/app/bsky/ageassurance/defs.ts +2 -0
- package/src/lexicon/types/app/bsky/contact/defs.ts +19 -0
- package/src/lexicon/types/app/bsky/contact/dismissMatch.ts +1 -1
- package/src/lexicon/types/app/bsky/contact/getMatches.ts +1 -1
- package/src/lexicon/types/app/bsky/contact/getSyncStatus.ts +1 -1
- package/src/lexicon/types/app/bsky/contact/importContacts.ts +6 -1
- package/src/lexicon/types/app/bsky/contact/removeData.ts +1 -1
- package/src/lexicon/types/app/bsky/contact/sendNotification.ts +44 -0
- package/src/lexicon/types/app/bsky/contact/startPhoneVerification.ts +1 -1
- package/src/lexicon/types/app/bsky/contact/verifyPhone.ts +6 -1
- package/src/lexicon/types/app/bsky/draft/createDraft.ts +46 -0
- package/src/lexicon/types/app/bsky/draft/defs.ts +208 -0
- package/src/lexicon/types/app/bsky/draft/deleteDraft.ts +33 -0
- package/src/lexicon/types/app/bsky/draft/getDrafts.ts +42 -0
- package/src/lexicon/types/app/bsky/draft/updateDraft.ts +34 -0
- package/src/lexicon/types/app/bsky/embed/video.ts +4 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +1 -0
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts +2 -0
- package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts +2 -0
- package/src/lexicon/types/com/atproto/server/deleteSession.ts +1 -0
- package/src/lexicon/types/com/atproto/server/getSession.ts +1 -1
- package/src/lexicon/types/com/atproto/server/refreshSession.ts +4 -1
- package/src/mod-service/index.ts +12 -5
- package/src/mod-service/util.ts +3 -2
- package/tests/query-labels.test.ts +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +0 -1
|
@@ -315,36 +315,44 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
315
315
|
server.tools.ozone.moderation.emitEvent({
|
|
316
316
|
auth: ctx.authVerifier.modOrAdminToken,
|
|
317
317
|
handler: async ({ input, auth }) => {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
ctx,
|
|
322
|
-
})
|
|
323
|
-
|
|
324
|
-
// On divert events, we need to automatically take down the blobs
|
|
325
|
-
if (isModEventDivert(input.body.event)) {
|
|
326
|
-
await handleModerationEvent({
|
|
318
|
+
try {
|
|
319
|
+
const moderationEvent = await handleModerationEvent({
|
|
320
|
+
input,
|
|
327
321
|
auth,
|
|
328
322
|
ctx,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
// On divert events, we need to automatically take down the blobs
|
|
326
|
+
if (isModEventDivert(input.body.event)) {
|
|
327
|
+
await handleModerationEvent({
|
|
328
|
+
auth,
|
|
329
|
+
ctx,
|
|
330
|
+
input: {
|
|
331
|
+
...input,
|
|
332
|
+
body: {
|
|
333
|
+
...input.body,
|
|
334
|
+
event: {
|
|
335
|
+
...input.body.event,
|
|
336
|
+
$type: 'tools.ozone.moderation.defs#modEventTakedown',
|
|
337
|
+
comment:
|
|
338
|
+
'[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',
|
|
339
|
+
},
|
|
340
|
+
modTool: input.body.modTool,
|
|
338
341
|
},
|
|
339
|
-
modTool: input.body.modTool,
|
|
340
342
|
},
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
343
|
+
})
|
|
344
|
+
}
|
|
344
345
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
return {
|
|
347
|
+
encoding: 'application/json',
|
|
348
|
+
body: moderationEvent,
|
|
349
|
+
}
|
|
350
|
+
} catch (err) {
|
|
351
|
+
httpLogger.error(
|
|
352
|
+
{ err, body: input.body },
|
|
353
|
+
'failed to emit moderation event',
|
|
354
|
+
)
|
|
355
|
+
throw err
|
|
348
356
|
}
|
|
349
357
|
},
|
|
350
358
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { sql } from 'kysely'
|
|
2
2
|
import { MINUTE } from '@atproto/common'
|
|
3
3
|
import { BackgroundQueue, PeriodicBackgroundTask } from '../background'
|
|
4
|
+
import { dbLogger } from '../logger'
|
|
4
5
|
|
|
5
6
|
export class MaterializedViewRefresher extends PeriodicBackgroundTask {
|
|
6
7
|
constructor(backgroundQueue: BackgroundQueue, interval = 30 * MINUTE) {
|
|
@@ -18,9 +19,14 @@ export class MaterializedViewRefresher extends PeriodicBackgroundTask {
|
|
|
18
19
|
// wait for the current refresh to finish before exiting. This is not
|
|
19
20
|
// ideal, but it is the best we can do until Kysely provides a way to
|
|
20
21
|
// cancel a query.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
try {
|
|
23
|
+
await sql`REFRESH MATERIALIZED VIEW CONCURRENTLY ${sql.id(view)}`.execute(
|
|
24
|
+
db,
|
|
25
|
+
)
|
|
26
|
+
dbLogger.info(`refreshed materialized view ${view}`)
|
|
27
|
+
} catch (err) {
|
|
28
|
+
dbLogger.error({ err, view }, 'failed to refresh materialized view')
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
})
|
|
26
32
|
}
|
package/src/lexicon/index.ts
CHANGED
|
@@ -28,8 +28,13 @@ import * as AppBskyContactGetMatches from './types/app/bsky/contact/getMatches.j
|
|
|
28
28
|
import * as AppBskyContactGetSyncStatus from './types/app/bsky/contact/getSyncStatus.js'
|
|
29
29
|
import * as AppBskyContactImportContacts from './types/app/bsky/contact/importContacts.js'
|
|
30
30
|
import * as AppBskyContactRemoveData from './types/app/bsky/contact/removeData.js'
|
|
31
|
+
import * as AppBskyContactSendNotification from './types/app/bsky/contact/sendNotification.js'
|
|
31
32
|
import * as AppBskyContactStartPhoneVerification from './types/app/bsky/contact/startPhoneVerification.js'
|
|
32
33
|
import * as AppBskyContactVerifyPhone from './types/app/bsky/contact/verifyPhone.js'
|
|
34
|
+
import * as AppBskyDraftCreateDraft from './types/app/bsky/draft/createDraft.js'
|
|
35
|
+
import * as AppBskyDraftDeleteDraft from './types/app/bsky/draft/deleteDraft.js'
|
|
36
|
+
import * as AppBskyDraftGetDrafts from './types/app/bsky/draft/getDrafts.js'
|
|
37
|
+
import * as AppBskyDraftUpdateDraft from './types/app/bsky/draft/updateDraft.js'
|
|
33
38
|
import * as AppBskyFeedDescribeFeedGenerator from './types/app/bsky/feed/describeFeedGenerator.js'
|
|
34
39
|
import * as AppBskyFeedGetActorFeeds from './types/app/bsky/feed/getActorFeeds.js'
|
|
35
40
|
import * as AppBskyFeedGetActorLikes from './types/app/bsky/feed/getActorLikes.js'
|
|
@@ -405,6 +410,7 @@ export class AppBskyNS {
|
|
|
405
410
|
ageassurance: AppBskyAgeassuranceNS
|
|
406
411
|
bookmark: AppBskyBookmarkNS
|
|
407
412
|
contact: AppBskyContactNS
|
|
413
|
+
draft: AppBskyDraftNS
|
|
408
414
|
embed: AppBskyEmbedNS
|
|
409
415
|
feed: AppBskyFeedNS
|
|
410
416
|
graph: AppBskyGraphNS
|
|
@@ -420,6 +426,7 @@ export class AppBskyNS {
|
|
|
420
426
|
this.ageassurance = new AppBskyAgeassuranceNS(server)
|
|
421
427
|
this.bookmark = new AppBskyBookmarkNS(server)
|
|
422
428
|
this.contact = new AppBskyContactNS(server)
|
|
429
|
+
this.draft = new AppBskyDraftNS(server)
|
|
423
430
|
this.embed = new AppBskyEmbedNS(server)
|
|
424
431
|
this.feed = new AppBskyFeedNS(server)
|
|
425
432
|
this.graph = new AppBskyGraphNS(server)
|
|
@@ -678,6 +685,18 @@ export class AppBskyContactNS {
|
|
|
678
685
|
return this._server.xrpc.method(nsid, cfg)
|
|
679
686
|
}
|
|
680
687
|
|
|
688
|
+
sendNotification<A extends Auth = void>(
|
|
689
|
+
cfg: MethodConfigOrHandler<
|
|
690
|
+
A,
|
|
691
|
+
AppBskyContactSendNotification.QueryParams,
|
|
692
|
+
AppBskyContactSendNotification.HandlerInput,
|
|
693
|
+
AppBskyContactSendNotification.HandlerOutput
|
|
694
|
+
>,
|
|
695
|
+
) {
|
|
696
|
+
const nsid = 'app.bsky.contact.sendNotification' // @ts-ignore
|
|
697
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
698
|
+
}
|
|
699
|
+
|
|
681
700
|
startPhoneVerification<A extends Auth = void>(
|
|
682
701
|
cfg: MethodConfigOrHandler<
|
|
683
702
|
A,
|
|
@@ -703,6 +722,62 @@ export class AppBskyContactNS {
|
|
|
703
722
|
}
|
|
704
723
|
}
|
|
705
724
|
|
|
725
|
+
export class AppBskyDraftNS {
|
|
726
|
+
_server: Server
|
|
727
|
+
|
|
728
|
+
constructor(server: Server) {
|
|
729
|
+
this._server = server
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
createDraft<A extends Auth = void>(
|
|
733
|
+
cfg: MethodConfigOrHandler<
|
|
734
|
+
A,
|
|
735
|
+
AppBskyDraftCreateDraft.QueryParams,
|
|
736
|
+
AppBskyDraftCreateDraft.HandlerInput,
|
|
737
|
+
AppBskyDraftCreateDraft.HandlerOutput
|
|
738
|
+
>,
|
|
739
|
+
) {
|
|
740
|
+
const nsid = 'app.bsky.draft.createDraft' // @ts-ignore
|
|
741
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
deleteDraft<A extends Auth = void>(
|
|
745
|
+
cfg: MethodConfigOrHandler<
|
|
746
|
+
A,
|
|
747
|
+
AppBskyDraftDeleteDraft.QueryParams,
|
|
748
|
+
AppBskyDraftDeleteDraft.HandlerInput,
|
|
749
|
+
AppBskyDraftDeleteDraft.HandlerOutput
|
|
750
|
+
>,
|
|
751
|
+
) {
|
|
752
|
+
const nsid = 'app.bsky.draft.deleteDraft' // @ts-ignore
|
|
753
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
getDrafts<A extends Auth = void>(
|
|
757
|
+
cfg: MethodConfigOrHandler<
|
|
758
|
+
A,
|
|
759
|
+
AppBskyDraftGetDrafts.QueryParams,
|
|
760
|
+
AppBskyDraftGetDrafts.HandlerInput,
|
|
761
|
+
AppBskyDraftGetDrafts.HandlerOutput
|
|
762
|
+
>,
|
|
763
|
+
) {
|
|
764
|
+
const nsid = 'app.bsky.draft.getDrafts' // @ts-ignore
|
|
765
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
updateDraft<A extends Auth = void>(
|
|
769
|
+
cfg: MethodConfigOrHandler<
|
|
770
|
+
A,
|
|
771
|
+
AppBskyDraftUpdateDraft.QueryParams,
|
|
772
|
+
AppBskyDraftUpdateDraft.HandlerInput,
|
|
773
|
+
AppBskyDraftUpdateDraft.HandlerOutput
|
|
774
|
+
>,
|
|
775
|
+
) {
|
|
776
|
+
const nsid = 'app.bsky.draft.updateDraft' // @ts-ignore
|
|
777
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
706
781
|
export class AppBskyEmbedNS {
|
|
707
782
|
_server: Server
|
|
708
783
|
|