@atproto/ozone 0.1.50 → 0.1.52
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 +18 -0
- package/dist/api/chat/getActorMetadata.js +1 -1
- package/dist/api/chat/getActorMetadata.js.map +1 -1
- package/dist/api/chat/getMessageContext.js +1 -1
- package/dist/api/chat/getMessageContext.js.map +1 -1
- package/dist/api/chat/index.js +1 -1
- package/dist/api/chat/index.js.map +1 -1
- package/dist/api/communication/createTemplate.js +1 -1
- package/dist/api/communication/createTemplate.js.map +1 -1
- package/dist/api/communication/deleteTemplate.js +1 -1
- package/dist/api/communication/deleteTemplate.js.map +1 -1
- package/dist/api/communication/listTemplates.js +1 -1
- package/dist/api/communication/listTemplates.js.map +1 -1
- package/dist/api/communication/updateTemplate.js +1 -1
- package/dist/api/communication/updateTemplate.js.map +1 -1
- package/dist/api/health.d.ts.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +13 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/label/fetchLabels.js +1 -1
- package/dist/api/label/fetchLabels.js.map +1 -1
- package/dist/api/label/queryLabels.js +1 -1
- package/dist/api/label/queryLabels.js.map +1 -1
- package/dist/api/label/subscribeLabels.js +1 -1
- package/dist/api/label/subscribeLabels.js.map +1 -1
- package/dist/api/moderation/emitEvent.js +1 -1
- package/dist/api/moderation/emitEvent.js.map +1 -1
- package/dist/api/moderation/getEvent.js +1 -1
- package/dist/api/moderation/getEvent.js.map +1 -1
- package/dist/api/moderation/getRecord.js +1 -1
- package/dist/api/moderation/getRecord.js.map +1 -1
- package/dist/api/moderation/getRecords.js +1 -1
- package/dist/api/moderation/getRecords.js.map +1 -1
- package/dist/api/moderation/getRepo.js +1 -1
- package/dist/api/moderation/getRepo.js.map +1 -1
- package/dist/api/moderation/getRepos.js +1 -1
- package/dist/api/moderation/getRepos.js.map +1 -1
- package/dist/api/moderation/queryEvents.d.ts.map +1 -1
- package/dist/api/moderation/queryEvents.js +4 -2
- package/dist/api/moderation/queryEvents.js.map +1 -1
- package/dist/api/moderation/queryStatuses.d.ts.map +1 -1
- package/dist/api/moderation/queryStatuses.js +4 -2
- package/dist/api/moderation/queryStatuses.js.map +1 -1
- package/dist/api/moderation/searchRepos.js +1 -1
- package/dist/api/moderation/searchRepos.js.map +1 -1
- package/dist/api/proxied.js +12 -12
- package/dist/api/proxied.js.map +1 -1
- package/dist/api/report/createReport.js +1 -1
- package/dist/api/report/createReport.js.map +1 -1
- package/dist/api/server/getConfig.js +1 -1
- package/dist/api/server/getConfig.js.map +1 -1
- package/dist/api/set/addValues.d.ts +4 -0
- package/dist/api/set/addValues.d.ts.map +1 -0
- package/dist/api/set/addValues.js +24 -0
- package/dist/api/set/addValues.js.map +1 -0
- package/dist/api/set/deleteSet.d.ts +4 -0
- package/dist/api/set/deleteSet.d.ts.map +1 -0
- package/dist/api/set/deleteSet.js +28 -0
- package/dist/api/set/deleteSet.js.map +1 -0
- package/dist/api/set/deleteValues.d.ts +4 -0
- package/dist/api/set/deleteValues.d.ts.map +1 -0
- package/dist/api/set/deleteValues.js +24 -0
- package/dist/api/set/deleteValues.js.map +1 -0
- package/dist/api/set/getValues.d.ts +4 -0
- package/dist/api/set/getValues.d.ts.map +1 -0
- package/dist/api/set/getValues.js +35 -0
- package/dist/api/set/getValues.js.map +1 -0
- package/dist/api/set/querySets.d.ts +4 -0
- package/dist/api/set/querySets.d.ts.map +1 -0
- package/dist/api/set/querySets.js +33 -0
- package/dist/api/set/querySets.js.map +1 -0
- package/dist/api/set/upsertSet.d.ts +4 -0
- package/dist/api/set/upsertSet.d.ts.map +1 -0
- package/dist/api/set/upsertSet.js +32 -0
- package/dist/api/set/upsertSet.js.map +1 -0
- package/dist/api/team/addMember.js +1 -1
- package/dist/api/team/addMember.js.map +1 -1
- package/dist/api/team/deleteMember.js +1 -1
- package/dist/api/team/deleteMember.js.map +1 -1
- package/dist/api/team/listMembers.js +1 -1
- package/dist/api/team/listMembers.js.map +1 -1
- package/dist/api/team/updateMember.js +1 -1
- package/dist/api/team/updateMember.js.map +1 -1
- package/dist/api/util.d.ts +5 -3
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/well-known.d.ts.map +1 -1
- package/dist/auth-verifier.d.ts +0 -1
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +6 -0
- package/dist/context.js.map +1 -1
- package/dist/daemon/blob-diverter.d.ts +0 -1
- package/dist/daemon/blob-diverter.d.ts.map +1 -1
- package/dist/daemon/event-pusher.d.ts +0 -1
- package/dist/daemon/event-pusher.d.ts.map +1 -1
- package/dist/daemon/event-reverser.d.ts +0 -1
- package/dist/daemon/event-reverser.d.ts.map +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/migrations/20231219T205730722Z-init.js +2 -3
- package/dist/db/migrations/20231219T205730722Z-init.js.map +1 -1
- package/dist/db/migrations/20240116T085607200Z-communication-template.js +2 -3
- package/dist/db/migrations/20240116T085607200Z-communication-template.js.map +1 -1
- package/dist/db/migrations/20240201T051104136Z-mod-event-blobs.js +2 -3
- package/dist/db/migrations/20240201T051104136Z-mod-event-blobs.js.map +1 -1
- package/dist/db/migrations/20240208T213404429Z-add-tags-column-to-moderation-subject.js +2 -3
- package/dist/db/migrations/20240208T213404429Z-add-tags-column-to-moderation-subject.js.map +1 -1
- package/dist/db/migrations/20240228T003647759Z-add-label-sigs.js +2 -3
- package/dist/db/migrations/20240228T003647759Z-add-label-sigs.js.map +1 -1
- package/dist/db/migrations/20240408T192432676Z-mute-reporting.js +2 -3
- package/dist/db/migrations/20240408T192432676Z-mute-reporting.js.map +1 -1
- package/dist/db/migrations/20240506T225055595Z-message-subject.js +2 -3
- package/dist/db/migrations/20240506T225055595Z-message-subject.js.map +1 -1
- package/dist/db/migrations/20240521T211332580Z-member.js +2 -3
- package/dist/db/migrations/20240521T211332580Z-member.js.map +1 -1
- package/dist/db/migrations/20240814T003647759Z-event-created-at-index.js +2 -3
- package/dist/db/migrations/20240814T003647759Z-event-created-at-index.js.map +1 -1
- package/dist/db/migrations/20240903T205730722Z-add-template-lang.js +2 -3
- package/dist/db/migrations/20240903T205730722Z-add-template-lang.js.map +1 -1
- package/dist/db/migrations/20240904T205730722Z-add-subject-did-index.js +2 -3
- package/dist/db/migrations/20240904T205730722Z-add-subject-did-index.js.map +1 -1
- package/dist/db/migrations/20241001T205730722Z-subject-status-review-state-index.js +2 -3
- package/dist/db/migrations/20241001T205730722Z-subject-status-review-state-index.js.map +1 -1
- package/dist/db/migrations/20241008T205730722Z-sets.d.ts +4 -0
- package/dist/db/migrations/20241008T205730722Z-sets.d.ts.map +1 -0
- package/dist/db/migrations/20241008T205730722Z-sets.js +45 -0
- package/dist/db/migrations/20241008T205730722Z-sets.js.map +1 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +2 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/db/pagination.d.ts +2 -2
- package/dist/db/pagination.d.ts.map +1 -1
- package/dist/db/schema/index.d.ts +2 -1
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/label.d.ts +0 -1
- package/dist/db/schema/label.d.ts.map +1 -1
- package/dist/db/schema/ozone_set.d.ts +21 -0
- package/dist/db/schema/ozone_set.d.ts.map +1 -0
- package/dist/db/schema/ozone_set.js +6 -0
- package/dist/db/schema/ozone_set.js.map +1 -0
- package/dist/db/types.d.ts.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/lexicon/index.d.ts +17 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +45 -2
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +339 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +347 -2
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js +48 -49
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.js +2 -3
- package/dist/lexicon/types/app/bsky/actor/profile.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/defs.js +2 -3
- package/dist/lexicon/types/app/bsky/embed/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/external.js +8 -9
- package/dist/lexicon/types/app/bsky/embed/external.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/images.js +8 -9
- package/dist/lexicon/types/app/bsky/embed/images.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/record.js +12 -13
- package/dist/lexicon/types/app/bsky/embed/record.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/recordWithMedia.js +4 -5
- package/dist/lexicon/types/app/bsky/embed/recordWithMedia.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/video.js +6 -7
- package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js +35 -35
- package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/describeFeedGenerator.js +4 -5
- package/dist/lexicon/types/app/bsky/feed/describeFeedGenerator.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/generator.js +2 -3
- package/dist/lexicon/types/app/bsky/feed/generator.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/getLikes.js +2 -3
- package/dist/lexicon/types/app/bsky/feed/getLikes.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/like.js +2 -3
- package/dist/lexicon/types/app/bsky/feed/like.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/post.js +8 -9
- package/dist/lexicon/types/app/bsky/feed/post.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/postgate.js +4 -5
- package/dist/lexicon/types/app/bsky/feed/postgate.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/repost.js +2 -3
- package/dist/lexicon/types/app/bsky/feed/repost.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/threadgate.js +8 -9
- package/dist/lexicon/types/app/bsky/feed/threadgate.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/block.js +2 -3
- package/dist/lexicon/types/app/bsky/graph/block.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/defs.js +17 -17
- package/dist/lexicon/types/app/bsky/graph/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/follow.js +2 -3
- package/dist/lexicon/types/app/bsky/graph/follow.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/list.js +2 -3
- package/dist/lexicon/types/app/bsky/graph/list.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/listblock.js +2 -3
- package/dist/lexicon/types/app/bsky/graph/listblock.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/listitem.js +2 -3
- package/dist/lexicon/types/app/bsky/graph/listitem.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/starterpack.js +4 -5
- package/dist/lexicon/types/app/bsky/graph/starterpack.js.map +1 -1
- package/dist/lexicon/types/app/bsky/labeler/defs.js +8 -9
- package/dist/lexicon/types/app/bsky/labeler/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/labeler/service.js +2 -3
- package/dist/lexicon/types/app/bsky/labeler/service.js.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.js +2 -3
- package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/lexicon/types/app/bsky/richtext/facet.js +10 -11
- package/dist/lexicon/types/app/bsky/richtext/facet.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/defs.js +4 -5
- package/dist/lexicon/types/app/bsky/unspecced/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getTaggedSuggestions.js +2 -3
- package/dist/lexicon/types/app/bsky/unspecced/getTaggedSuggestions.js.map +1 -1
- package/dist/lexicon/types/app/bsky/video/defs.js +2 -3
- package/dist/lexicon/types/app/bsky/video/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts +0 -2
- package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts.map +1 -1
- package/dist/lexicon/types/chat/bsky/actor/declaration.js +2 -3
- package/dist/lexicon/types/chat/bsky/actor/declaration.js.map +1 -1
- package/dist/lexicon/types/chat/bsky/actor/defs.js +2 -3
- package/dist/lexicon/types/chat/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/chat/bsky/actor/exportAccountData.d.ts +0 -1
- package/dist/lexicon/types/chat/bsky/actor/exportAccountData.d.ts.map +1 -1
- package/dist/lexicon/types/chat/bsky/convo/defs.js +20 -21
- package/dist/lexicon/types/chat/bsky/convo/defs.js.map +1 -1
- package/dist/lexicon/types/chat/bsky/convo/sendMessageBatch.js +2 -3
- package/dist/lexicon/types/chat/bsky/convo/sendMessageBatch.js.map +1 -1
- package/dist/lexicon/types/chat/bsky/moderation/getActorMetadata.js +2 -3
- package/dist/lexicon/types/chat/bsky/moderation/getActorMetadata.js.map +1 -1
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +8 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/admin/defs.js +18 -9
- package/dist/lexicon/types/com/atproto/admin/defs.js.map +1 -1
- package/dist/lexicon/types/com/atproto/label/defs.js +10 -11
- package/dist/lexicon/types/com/atproto/label/defs.js.map +1 -1
- package/dist/lexicon/types/com/atproto/label/subscribeLabels.d.ts +0 -3
- package/dist/lexicon/types/com/atproto/label/subscribeLabels.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/label/subscribeLabels.js +4 -5
- package/dist/lexicon/types/com/atproto/label/subscribeLabels.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/applyWrites.js +12 -13
- package/dist/lexicon/types/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/defs.js +2 -3
- package/dist/lexicon/types/com/atproto/repo/defs.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/importRepo.d.ts +0 -2
- package/dist/lexicon/types/com/atproto/repo/importRepo.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/listMissingBlobs.js +2 -3
- package/dist/lexicon/types/com/atproto/repo/listMissingBlobs.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/listRecords.js +2 -3
- package/dist/lexicon/types/com/atproto/repo/listRecords.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/strongRef.js +2 -3
- package/dist/lexicon/types/com/atproto/repo/strongRef.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/uploadBlob.d.ts +0 -2
- package/dist/lexicon/types/com/atproto/repo/uploadBlob.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/createAppPassword.js +2 -3
- package/dist/lexicon/types/com/atproto/server/createAppPassword.js.map +1 -1
- package/dist/lexicon/types/com/atproto/server/createInviteCodes.js +2 -3
- package/dist/lexicon/types/com/atproto/server/createInviteCodes.js.map +1 -1
- package/dist/lexicon/types/com/atproto/server/defs.js +4 -5
- package/dist/lexicon/types/com/atproto/server/defs.js.map +1 -1
- package/dist/lexicon/types/com/atproto/server/describeServer.js +4 -5
- package/dist/lexicon/types/com/atproto/server/describeServer.js.map +1 -1
- package/dist/lexicon/types/com/atproto/server/listAppPasswords.js +2 -3
- package/dist/lexicon/types/com/atproto/server/listAppPasswords.js.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts +0 -1
- package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts +0 -1
- package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getCheckout.d.ts +0 -1
- package/dist/lexicon/types/com/atproto/sync/getCheckout.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +0 -1
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts +0 -1
- package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/listRepos.js +2 -3
- package/dist/lexicon/types/com/atproto/sync/listRepos.js.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +0 -3
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +16 -17
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/communication/defs.js +2 -3
- package/dist/lexicon/types/tools/ozone/communication/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.js +59 -60
- package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/queryEvents.d.ts +5 -1
- package/dist/lexicon/types/tools/ozone/moderation/queryEvents.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/queryStatuses.d.ts +5 -1
- package/dist/lexicon/types/tools/ozone/moderation/queryStatuses.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.js +4 -5
- package/dist/lexicon/types/tools/ozone/server/getConfig.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/set/addValues.d.ts +32 -0
- package/dist/lexicon/types/tools/ozone/set/addValues.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/addValues.js +3 -0
- package/dist/lexicon/types/tools/ozone/set/addValues.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/defs.d.ts +22 -0
- package/dist/lexicon/types/tools/ozone/set/defs.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/defs.js +23 -0
- package/dist/lexicon/types/tools/ozone/set/defs.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/deleteSet.d.ts +41 -0
- package/dist/lexicon/types/tools/ozone/set/deleteSet.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/deleteSet.js +3 -0
- package/dist/lexicon/types/tools/ozone/set/deleteSet.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/deleteValues.d.ts +33 -0
- package/dist/lexicon/types/tools/ozone/set/deleteValues.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/deleteValues.js +3 -0
- package/dist/lexicon/types/tools/ozone/set/deleteValues.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/getValues.d.ts +41 -0
- package/dist/lexicon/types/tools/ozone/set/getValues.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/getValues.js +3 -0
- package/dist/lexicon/types/tools/ozone/set/getValues.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/querySets.d.ts +42 -0
- package/dist/lexicon/types/tools/ozone/set/querySets.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/querySets.js +3 -0
- package/dist/lexicon/types/tools/ozone/set/querySets.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/upsertSet.d.ts +35 -0
- package/dist/lexicon/types/tools/ozone/set/upsertSet.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/set/upsertSet.js +3 -0
- package/dist/lexicon/types/tools/ozone/set/upsertSet.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/signature/defs.js +2 -3
- package/dist/lexicon/types/tools/ozone/signature/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/signature/findRelatedAccounts.js +2 -3
- package/dist/lexicon/types/tools/ozone/signature/findRelatedAccounts.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.js +3 -3
- package/dist/lexicon/types/tools/ozone/team/defs.js.map +1 -1
- package/dist/lexicon/util.js +2 -3
- package/dist/lexicon/util.js.map +1 -1
- package/dist/logger.d.ts +0 -2
- package/dist/logger.d.ts.map +1 -1
- package/dist/mod-service/index.d.ts +5 -1
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +33 -3
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/subject.d.ts.map +1 -1
- package/dist/mod-service/util.d.ts +1 -1
- package/dist/mod-service/util.d.ts.map +1 -1
- package/dist/mod-service/views.js +2 -2
- package/dist/mod-service/views.js.map +1 -1
- package/dist/sequencer/outbox.d.ts +0 -1
- package/dist/sequencer/outbox.d.ts.map +1 -1
- package/dist/sequencer/sequencer.d.ts.map +1 -1
- package/dist/set/service.d.ts +46 -0
- package/dist/set/service.d.ts.map +1 -0
- package/dist/set/service.js +166 -0
- package/dist/set/service.js.map +1 -0
- package/dist/tag-service/language-data.js +2 -2
- package/dist/tag-service/language-data.js.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +3 -3
- package/dist/util.js.map +1 -1
- package/jest.config.js +3 -1
- package/package.json +4 -3
- package/src/api/index.ts +12 -0
- package/src/api/moderation/queryEvents.ts +4 -0
- package/src/api/moderation/queryStatuses.ts +4 -0
- package/src/api/proxied.ts +11 -11
- package/src/api/set/addValues.ts +28 -0
- package/src/api/set/deleteSet.ts +34 -0
- package/src/api/set/deleteValues.ts +31 -0
- package/src/api/set/getValues.ts +42 -0
- package/src/api/set/querySets.ts +36 -0
- package/src/api/set/upsertSet.ts +38 -0
- package/src/context.ts +8 -0
- package/src/db/migrations/20241008T205730722Z-sets.ts +53 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/pagination.ts +1 -1
- package/src/db/schema/index.ts +2 -0
- package/src/db/schema/ozone_set.ts +24 -0
- package/src/lexicon/index.ts +82 -0
- package/src/lexicon/lexicons.ts +354 -2
- package/src/lexicon/types/com/atproto/admin/defs.ts +19 -0
- package/src/lexicon/types/tools/ozone/moderation/queryEvents.ts +5 -1
- package/src/lexicon/types/tools/ozone/moderation/queryStatuses.ts +5 -1
- package/src/lexicon/types/tools/ozone/set/addValues.ts +41 -0
- package/src/lexicon/types/tools/ozone/set/defs.ts +44 -0
- package/src/lexicon/types/tools/ozone/set/deleteSet.ts +50 -0
- package/src/lexicon/types/tools/ozone/set/deleteValues.ts +42 -0
- package/src/lexicon/types/tools/ozone/set/getValues.ts +51 -0
- package/src/lexicon/types/tools/ozone/set/querySets.ts +52 -0
- package/src/lexicon/types/tools/ozone/set/upsertSet.ts +43 -0
- package/src/mod-service/index.ts +37 -1
- package/src/set/service.ts +227 -0
- package/tests/__snapshots__/sets.test.ts.snap +46 -0
- package/tests/moderation-events.test.ts +92 -0
- package/tests/moderation-statuses.test.ts +89 -0
- package/tests/sets.test.ts +246 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.tests.tsbuildinfo +1 -0
|
@@ -20,7 +20,11 @@ export interface QueryParams {
|
|
|
20
20
|
/** Retrieve events created before a given timestamp */
|
|
21
21
|
createdBefore?: string
|
|
22
22
|
subject?: string
|
|
23
|
-
/** If
|
|
23
|
+
/** If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. */
|
|
24
|
+
collections?: string[]
|
|
25
|
+
/** If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */
|
|
26
|
+
subjectType?: 'account' | 'record' | (string & {})
|
|
27
|
+
/** If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned. */
|
|
24
28
|
includeAllUserRecords: boolean
|
|
25
29
|
limit: number
|
|
26
30
|
/** If true, only events with comments are returned */
|
|
@@ -10,7 +10,7 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as ToolsOzoneModerationDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/** All subjects belonging to the account specified in the 'subject' param will be returned. */
|
|
13
|
+
/** All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned. */
|
|
14
14
|
includeAllUserRecords?: boolean
|
|
15
15
|
/** The subject to get the status for. */
|
|
16
16
|
subject?: string
|
|
@@ -43,6 +43,10 @@ export interface QueryParams {
|
|
|
43
43
|
tags?: string[]
|
|
44
44
|
excludeTags?: string[]
|
|
45
45
|
cursor?: string
|
|
46
|
+
/** If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored. */
|
|
47
|
+
collections?: string[]
|
|
48
|
+
/** If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */
|
|
49
|
+
subjectType?: 'account' | 'record' | (string & {})
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
export type InputSchema = undefined
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {}
|
|
12
|
+
|
|
13
|
+
export interface InputSchema {
|
|
14
|
+
/** Name of the set to add values to */
|
|
15
|
+
name: string
|
|
16
|
+
/** Array of string values to add to the set */
|
|
17
|
+
values: string[]
|
|
18
|
+
[k: string]: unknown
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HandlerInput {
|
|
22
|
+
encoding: 'application/json'
|
|
23
|
+
body: InputSchema
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface HandlerError {
|
|
27
|
+
status: number
|
|
28
|
+
message?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type HandlerOutput = HandlerError | void
|
|
32
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
33
|
+
auth: HA
|
|
34
|
+
params: QueryParams
|
|
35
|
+
input: HandlerInput
|
|
36
|
+
req: express.Request
|
|
37
|
+
res: express.Response
|
|
38
|
+
}
|
|
39
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
40
|
+
ctx: HandlerReqCtx<HA>,
|
|
41
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
+
import { lexicons } from '../../../../lexicons'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { CID } from 'multiformats/cid'
|
|
8
|
+
|
|
9
|
+
export interface Set {
|
|
10
|
+
name: string
|
|
11
|
+
description?: string
|
|
12
|
+
[k: string]: unknown
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function isSet(v: unknown): v is Set {
|
|
16
|
+
return (
|
|
17
|
+
isObj(v) && hasProp(v, '$type') && v.$type === 'tools.ozone.set.defs#set'
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function validateSet(v: unknown): ValidationResult {
|
|
22
|
+
return lexicons.validate('tools.ozone.set.defs#set', v)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SetView {
|
|
26
|
+
name: string
|
|
27
|
+
description?: string
|
|
28
|
+
setSize: number
|
|
29
|
+
createdAt: string
|
|
30
|
+
updatedAt: string
|
|
31
|
+
[k: string]: unknown
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isSetView(v: unknown): v is SetView {
|
|
35
|
+
return (
|
|
36
|
+
isObj(v) &&
|
|
37
|
+
hasProp(v, '$type') &&
|
|
38
|
+
v.$type === 'tools.ozone.set.defs#setView'
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function validateSetView(v: unknown): ValidationResult {
|
|
43
|
+
return lexicons.validate('tools.ozone.set.defs#setView', v)
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {}
|
|
12
|
+
|
|
13
|
+
export interface InputSchema {
|
|
14
|
+
/** Name of the set to delete */
|
|
15
|
+
name: string
|
|
16
|
+
[k: string]: unknown
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface OutputSchema {
|
|
20
|
+
[k: string]: unknown
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HandlerInput {
|
|
24
|
+
encoding: 'application/json'
|
|
25
|
+
body: InputSchema
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HandlerSuccess {
|
|
29
|
+
encoding: 'application/json'
|
|
30
|
+
body: OutputSchema
|
|
31
|
+
headers?: { [key: string]: string }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface HandlerError {
|
|
35
|
+
status: number
|
|
36
|
+
message?: string
|
|
37
|
+
error?: 'SetNotFound'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
41
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
42
|
+
auth: HA
|
|
43
|
+
params: QueryParams
|
|
44
|
+
input: HandlerInput
|
|
45
|
+
req: express.Request
|
|
46
|
+
res: express.Response
|
|
47
|
+
}
|
|
48
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
49
|
+
ctx: HandlerReqCtx<HA>,
|
|
50
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {}
|
|
12
|
+
|
|
13
|
+
export interface InputSchema {
|
|
14
|
+
/** Name of the set to delete values from */
|
|
15
|
+
name: string
|
|
16
|
+
/** Array of string values to delete from the set */
|
|
17
|
+
values: string[]
|
|
18
|
+
[k: string]: unknown
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HandlerInput {
|
|
22
|
+
encoding: 'application/json'
|
|
23
|
+
body: InputSchema
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface HandlerError {
|
|
27
|
+
status: number
|
|
28
|
+
message?: string
|
|
29
|
+
error?: 'SetNotFound'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type HandlerOutput = HandlerError | void
|
|
33
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
34
|
+
auth: HA
|
|
35
|
+
params: QueryParams
|
|
36
|
+
input: HandlerInput
|
|
37
|
+
req: express.Request
|
|
38
|
+
res: express.Response
|
|
39
|
+
}
|
|
40
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
41
|
+
ctx: HandlerReqCtx<HA>,
|
|
42
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ToolsOzoneSetDefs from './defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {
|
|
13
|
+
name: string
|
|
14
|
+
limit: number
|
|
15
|
+
cursor?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type InputSchema = undefined
|
|
19
|
+
|
|
20
|
+
export interface OutputSchema {
|
|
21
|
+
set: ToolsOzoneSetDefs.SetView
|
|
22
|
+
values: string[]
|
|
23
|
+
cursor?: string
|
|
24
|
+
[k: string]: unknown
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type HandlerInput = undefined
|
|
28
|
+
|
|
29
|
+
export interface HandlerSuccess {
|
|
30
|
+
encoding: 'application/json'
|
|
31
|
+
body: OutputSchema
|
|
32
|
+
headers?: { [key: string]: string }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface HandlerError {
|
|
36
|
+
status: number
|
|
37
|
+
message?: string
|
|
38
|
+
error?: 'SetNotFound'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
42
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
43
|
+
auth: HA
|
|
44
|
+
params: QueryParams
|
|
45
|
+
input: HandlerInput
|
|
46
|
+
req: express.Request
|
|
47
|
+
res: express.Response
|
|
48
|
+
}
|
|
49
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
50
|
+
ctx: HandlerReqCtx<HA>,
|
|
51
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ToolsOzoneSetDefs from './defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {
|
|
13
|
+
limit: number
|
|
14
|
+
cursor?: string
|
|
15
|
+
namePrefix?: string
|
|
16
|
+
sortBy: 'name' | 'createdAt' | 'updatedAt'
|
|
17
|
+
/** Defaults to ascending order of name field. */
|
|
18
|
+
sortDirection: 'asc' | 'desc'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type InputSchema = undefined
|
|
22
|
+
|
|
23
|
+
export interface OutputSchema {
|
|
24
|
+
sets: ToolsOzoneSetDefs.SetView[]
|
|
25
|
+
cursor?: string
|
|
26
|
+
[k: string]: unknown
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type HandlerInput = undefined
|
|
30
|
+
|
|
31
|
+
export interface HandlerSuccess {
|
|
32
|
+
encoding: 'application/json'
|
|
33
|
+
body: OutputSchema
|
|
34
|
+
headers?: { [key: string]: string }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface HandlerError {
|
|
38
|
+
status: number
|
|
39
|
+
message?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
43
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
44
|
+
auth: HA
|
|
45
|
+
params: QueryParams
|
|
46
|
+
input: HandlerInput
|
|
47
|
+
req: express.Request
|
|
48
|
+
res: express.Response
|
|
49
|
+
}
|
|
50
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
51
|
+
ctx: HandlerReqCtx<HA>,
|
|
52
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ToolsOzoneSetDefs from './defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {}
|
|
13
|
+
|
|
14
|
+
export type InputSchema = ToolsOzoneSetDefs.Set
|
|
15
|
+
export type OutputSchema = ToolsOzoneSetDefs.SetView
|
|
16
|
+
|
|
17
|
+
export interface HandlerInput {
|
|
18
|
+
encoding: 'application/json'
|
|
19
|
+
body: InputSchema
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface HandlerSuccess {
|
|
23
|
+
encoding: 'application/json'
|
|
24
|
+
body: OutputSchema
|
|
25
|
+
headers?: { [key: string]: string }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HandlerError {
|
|
29
|
+
status: number
|
|
30
|
+
message?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
|
34
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
35
|
+
auth: HA
|
|
36
|
+
params: QueryParams
|
|
37
|
+
input: HandlerInput
|
|
38
|
+
req: express.Request
|
|
39
|
+
res: express.Response
|
|
40
|
+
}
|
|
41
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
42
|
+
ctx: HandlerReqCtx<HA>,
|
|
43
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
package/src/mod-service/index.ts
CHANGED
|
@@ -146,6 +146,8 @@ export class ModerationService {
|
|
|
146
146
|
addedTags: string[]
|
|
147
147
|
removedTags: string[]
|
|
148
148
|
reportTypes?: string[]
|
|
149
|
+
collections: string[]
|
|
150
|
+
subjectType?: string
|
|
149
151
|
}): Promise<{ cursor?: string; events: ModerationEventRow[] }> {
|
|
150
152
|
const {
|
|
151
153
|
subject,
|
|
@@ -164,6 +166,8 @@ export class ModerationService {
|
|
|
164
166
|
addedTags,
|
|
165
167
|
removedTags,
|
|
166
168
|
reportTypes,
|
|
169
|
+
collections,
|
|
170
|
+
subjectType,
|
|
167
171
|
} = opts
|
|
168
172
|
const { ref } = this.db.db.dynamic
|
|
169
173
|
let builder = this.db.db.selectFrom('moderation_event').selectAll()
|
|
@@ -181,6 +185,20 @@ export class ModerationService {
|
|
|
181
185
|
.if(!subjectUri, (q) => q.where('subjectUri', 'is', null))
|
|
182
186
|
.if(!!subjectUri, (q) => q.where('subjectUri', '=', subjectUri))
|
|
183
187
|
}
|
|
188
|
+
} else if (subjectType === 'account') {
|
|
189
|
+
builder = builder.where('subjectUri', 'is', null)
|
|
190
|
+
} else if (subjectType === 'record') {
|
|
191
|
+
builder = builder.where('subjectUri', 'is not', null)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// If subjectType is set to 'account' let that take priority and ignore collections filter
|
|
195
|
+
if (collections.length && subjectType !== 'account') {
|
|
196
|
+
builder = builder.where('subjectUri', 'is not', null).where((qb) => {
|
|
197
|
+
collections.forEach((collection) => {
|
|
198
|
+
qb = qb.orWhere('subjectUri', 'like', `%/${collection}/%`)
|
|
199
|
+
})
|
|
200
|
+
return qb
|
|
201
|
+
})
|
|
184
202
|
}
|
|
185
203
|
|
|
186
204
|
if (types.length) {
|
|
@@ -748,6 +766,8 @@ export class ModerationService {
|
|
|
748
766
|
subject,
|
|
749
767
|
tags,
|
|
750
768
|
excludeTags,
|
|
769
|
+
collections,
|
|
770
|
+
subjectType,
|
|
751
771
|
}: {
|
|
752
772
|
includeAllUserRecords?: boolean
|
|
753
773
|
cursor?: string
|
|
@@ -768,6 +788,8 @@ export class ModerationService {
|
|
|
768
788
|
sortField: 'lastReviewedAt' | 'lastReportedAt'
|
|
769
789
|
tags: string[]
|
|
770
790
|
excludeTags: string[]
|
|
791
|
+
collections: string[]
|
|
792
|
+
subjectType?: string
|
|
771
793
|
}) {
|
|
772
794
|
let builder = this.db.db.selectFrom('moderation_subject_status').selectAll()
|
|
773
795
|
const { ref } = this.db.db.dynamic
|
|
@@ -787,11 +809,25 @@ export class ModerationService {
|
|
|
787
809
|
: qb.where('recordPath', '=', ''),
|
|
788
810
|
)
|
|
789
811
|
}
|
|
812
|
+
} else if (subjectType === 'account') {
|
|
813
|
+
builder = builder.where('recordPath', '=', '')
|
|
814
|
+
} else if (subjectType === 'record') {
|
|
815
|
+
builder = builder.where('recordPath', '!=', '')
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// If subjectType is set to 'account' let that take priority and ignore collections filter
|
|
819
|
+
if (collections.length && subjectType !== 'account') {
|
|
820
|
+
builder = builder.where('recordPath', '!=', '').where((qb) => {
|
|
821
|
+
collections.forEach((collection) => {
|
|
822
|
+
qb = qb.orWhere('recordPath', 'like', `${collection}/%`)
|
|
823
|
+
})
|
|
824
|
+
return qb
|
|
825
|
+
})
|
|
790
826
|
}
|
|
791
827
|
|
|
792
828
|
if (ignoreSubjects?.length) {
|
|
793
829
|
builder = builder
|
|
794
|
-
.where('
|
|
830
|
+
.where('did', 'not in', ignoreSubjects)
|
|
795
831
|
.where('recordPath', 'not in', ignoreSubjects)
|
|
796
832
|
}
|
|
797
833
|
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import Database from '../db'
|
|
2
|
+
import { Selectable } from 'kysely'
|
|
3
|
+
import { SetDetail } from '../db/schema/ozone_set'
|
|
4
|
+
import { SetView } from '../lexicon/types/tools/ozone/set/defs'
|
|
5
|
+
import { paginate, TimeIdKeyset } from '../db/pagination'
|
|
6
|
+
|
|
7
|
+
export type SetServiceCreator = (db: Database) => SetService
|
|
8
|
+
|
|
9
|
+
export class SetService {
|
|
10
|
+
constructor(public db: Database) {}
|
|
11
|
+
|
|
12
|
+
static creator() {
|
|
13
|
+
return (db: Database) => new SetService(db)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
buildQueryForSetWithSize() {
|
|
17
|
+
return this.db.db.selectFrom('set_detail as s').select([
|
|
18
|
+
's.id',
|
|
19
|
+
's.name',
|
|
20
|
+
's.description',
|
|
21
|
+
's.createdAt',
|
|
22
|
+
's.updatedAt',
|
|
23
|
+
(eb) =>
|
|
24
|
+
eb
|
|
25
|
+
.selectFrom('set_value')
|
|
26
|
+
.select((e) => e.fn.count<number>('setId').as('count'))
|
|
27
|
+
.whereRef('setId', '=', 's.id')
|
|
28
|
+
.as('setSize'),
|
|
29
|
+
])
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async query({
|
|
33
|
+
limit,
|
|
34
|
+
cursor,
|
|
35
|
+
namePrefix,
|
|
36
|
+
sortBy,
|
|
37
|
+
sortDirection,
|
|
38
|
+
}: {
|
|
39
|
+
limit: number
|
|
40
|
+
cursor?: string
|
|
41
|
+
namePrefix?: string
|
|
42
|
+
sortBy: 'name' | 'createdAt' | 'updatedAt'
|
|
43
|
+
sortDirection: 'asc' | 'desc'
|
|
44
|
+
}): Promise<{
|
|
45
|
+
sets: Selectable<SetDetail & { setSize: number }>[]
|
|
46
|
+
cursor?: string
|
|
47
|
+
}> {
|
|
48
|
+
let qb = this.buildQueryForSetWithSize().limit(limit)
|
|
49
|
+
|
|
50
|
+
if (namePrefix) {
|
|
51
|
+
qb = qb.where('s.name', 'like', `${namePrefix}%`)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (cursor) {
|
|
55
|
+
if (sortBy === 'name') {
|
|
56
|
+
qb = qb.where('s.name', sortDirection === 'asc' ? '>' : '<', cursor)
|
|
57
|
+
} else {
|
|
58
|
+
qb = qb.where(
|
|
59
|
+
`s.${sortBy}`,
|
|
60
|
+
sortDirection === 'asc' ? '>' : '<',
|
|
61
|
+
new Date(cursor),
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
qb = qb.orderBy(`s.${sortBy}`, sortDirection)
|
|
67
|
+
|
|
68
|
+
const sets = await qb.execute()
|
|
69
|
+
const lastItem = sets.at(-1)
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
sets,
|
|
73
|
+
cursor: lastItem
|
|
74
|
+
? sortBy === 'name'
|
|
75
|
+
? lastItem?.name
|
|
76
|
+
: lastItem?.[sortBy].toISOString()
|
|
77
|
+
: undefined,
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async getByName(name: string): Promise<Selectable<SetDetail> | undefined> {
|
|
82
|
+
const query = this.db.db
|
|
83
|
+
.selectFrom('set_detail')
|
|
84
|
+
.selectAll()
|
|
85
|
+
.where('name', '=', name)
|
|
86
|
+
|
|
87
|
+
return await query.executeTakeFirst()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async getByNameWithSize(
|
|
91
|
+
name: string,
|
|
92
|
+
): Promise<Selectable<SetDetail & { setSize: number }> | undefined> {
|
|
93
|
+
return await this.buildQueryForSetWithSize()
|
|
94
|
+
.where('s.name', '=', name)
|
|
95
|
+
.executeTakeFirst()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async getSetWithValues({
|
|
99
|
+
name,
|
|
100
|
+
limit,
|
|
101
|
+
cursor,
|
|
102
|
+
}: {
|
|
103
|
+
name: string
|
|
104
|
+
limit: number
|
|
105
|
+
cursor?: string
|
|
106
|
+
}): Promise<
|
|
107
|
+
| {
|
|
108
|
+
set: Selectable<SetDetail & { setSize: number }>
|
|
109
|
+
values: string[]
|
|
110
|
+
cursor?: string
|
|
111
|
+
}
|
|
112
|
+
| undefined
|
|
113
|
+
> {
|
|
114
|
+
const set = await this.getByNameWithSize(name)
|
|
115
|
+
if (!set) return undefined
|
|
116
|
+
|
|
117
|
+
const { ref } = this.db.db.dynamic
|
|
118
|
+
const qb = this.db.db
|
|
119
|
+
.selectFrom('set_value')
|
|
120
|
+
.selectAll()
|
|
121
|
+
.where('setId', '=', set.id)
|
|
122
|
+
|
|
123
|
+
const keyset = new TimeIdKeyset(ref(`createdAt`), ref('id'))
|
|
124
|
+
const paginatedBuilder = paginate(qb, {
|
|
125
|
+
limit,
|
|
126
|
+
cursor,
|
|
127
|
+
keyset,
|
|
128
|
+
direction: 'asc',
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const result = await paginatedBuilder.execute()
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
set,
|
|
135
|
+
values: result.map((v) => v.value),
|
|
136
|
+
cursor: keyset.packFromResult(result),
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async upsert({
|
|
140
|
+
name,
|
|
141
|
+
description,
|
|
142
|
+
}: Pick<SetDetail, 'name' | 'description'>): Promise<void> {
|
|
143
|
+
await this.db.db
|
|
144
|
+
.insertInto('set_detail')
|
|
145
|
+
.values({
|
|
146
|
+
name,
|
|
147
|
+
description,
|
|
148
|
+
updatedAt: new Date(),
|
|
149
|
+
})
|
|
150
|
+
.onConflict((oc) => {
|
|
151
|
+
// if description is provided as a string, even an empty one, update it
|
|
152
|
+
// otherwise, just update the updatedAt timestamp
|
|
153
|
+
return oc.column('name').doUpdateSet(
|
|
154
|
+
typeof description === 'string'
|
|
155
|
+
? {
|
|
156
|
+
description,
|
|
157
|
+
updatedAt: new Date(),
|
|
158
|
+
}
|
|
159
|
+
: { updatedAt: new Date() },
|
|
160
|
+
)
|
|
161
|
+
})
|
|
162
|
+
.execute()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async addValues(setId: number, values: string[]): Promise<void> {
|
|
166
|
+
await this.db.transaction(async (txn) => {
|
|
167
|
+
const now = new Date()
|
|
168
|
+
const query = txn.db
|
|
169
|
+
.insertInto('set_value')
|
|
170
|
+
.values(
|
|
171
|
+
values.map((value) => ({
|
|
172
|
+
setId,
|
|
173
|
+
value,
|
|
174
|
+
createdAt: now,
|
|
175
|
+
})),
|
|
176
|
+
)
|
|
177
|
+
.onConflict((oc) => oc.columns(['setId', 'value']).doNothing())
|
|
178
|
+
|
|
179
|
+
await query.execute()
|
|
180
|
+
|
|
181
|
+
// Update the set's updatedAt timestamp
|
|
182
|
+
await txn.db
|
|
183
|
+
.updateTable('set_detail')
|
|
184
|
+
.set({ updatedAt: now })
|
|
185
|
+
.where('id', '=', setId)
|
|
186
|
+
.execute()
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async removeValues(setId: number, values: string[]): Promise<void> {
|
|
191
|
+
if (values.length < 1) {
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
await this.db.transaction(async (txn) => {
|
|
195
|
+
const query = txn.db
|
|
196
|
+
.deleteFrom('set_value')
|
|
197
|
+
.where('setId', '=', setId)
|
|
198
|
+
.where('value', 'in', values)
|
|
199
|
+
|
|
200
|
+
await query.execute()
|
|
201
|
+
|
|
202
|
+
// Update the set's updatedAt timestamp
|
|
203
|
+
await txn.db
|
|
204
|
+
.updateTable('set_detail')
|
|
205
|
+
.set({ updatedAt: new Date() })
|
|
206
|
+
.where('id', '=', setId)
|
|
207
|
+
.execute()
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async removeSet(setId: number): Promise<void> {
|
|
212
|
+
await this.db.transaction(async (txn) => {
|
|
213
|
+
await txn.db.deleteFrom('set_value').where('setId', '=', setId).execute()
|
|
214
|
+
await txn.db.deleteFrom('set_detail').where('id', '=', setId).execute()
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
view(set: Selectable<SetDetail> & { setSize: number }): SetView {
|
|
219
|
+
return {
|
|
220
|
+
name: set.name,
|
|
221
|
+
description: set.description || undefined,
|
|
222
|
+
setSize: set.setSize,
|
|
223
|
+
createdAt: set.createdAt.toISOString(),
|
|
224
|
+
updatedAt: set.updatedAt.toISOString(),
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|