From c22dd6358ba4e068c49be033a07d9fbb001f2347 Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Thu, 18 Jul 2024 21:13:55 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=9E=8B=E5=90=88=E3=82=8F?= =?UTF-8?q?=E3=81=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/misskey-js/src/consts.ts | 95 ++++++++++++++++++------------- 1 file changed, 55 insertions(+), 40 deletions(-) diff --git a/packages/misskey-js/src/consts.ts b/packages/misskey-js/src/consts.ts index a6a90fa84a..63e05f2d68 100644 --- a/packages/misskey-js/src/consts.ts +++ b/packages/misskey-js/src/consts.ts @@ -1,3 +1,13 @@ +import type { + AbuseReportNotificationRecipient, Ad, + Announcement, + EmojiDetailed, InviteCode, + MetaDetailed, + Note, + Role, SystemWebhook, UserLite +} from "./autogen/models.js"; +import { operations } from './autogen/types.js'; + export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'roleAssigned', 'achievementEarned'] as const; export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const; @@ -135,12 +145,18 @@ export const moderationLogTypes = [ 'unsetUserBanner', ] as const; +type AvatarDecoration = UserLite['avatarDecorations'][number]; + +type ReceivedAbuseReport = { + reportId: AbuseReportNotificationRecipient['id']; + report: operations['admin___abuse-user-reports']['responses'][200]['content']['application/json']; + forwarded: boolean; +}; + export type ModerationLogPayloads = { updateServerSettings: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - before: any | null; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - after: any | null; + before: MetaDetailed | null; + after: MetaDetailed | null; }; suspend: { userId: string; @@ -161,17 +177,16 @@ export type ModerationLogPayloads = { }; addCustomEmoji: { emojiId: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - emoji: any; + emoji: EmojiDetailed; }; updateCustomEmoji: { emojiId: string; - before: any; - after: any; + before: EmojiDetailed; + after: EmojiDetailed; }; deleteCustomEmoji: { emojiId: string; - emoji: any; + emoji: EmojiDetailed; }; assignRole: { userId: string; @@ -190,16 +205,16 @@ export type ModerationLogPayloads = { }; createRole: { roleId: string; - role: any; + role: Role; }; updateRole: { roleId: string; - before: any; - after: any; + before: Role; + after: Role; }; deleteRole: { roleId: string; - role: any; + role: Role; }; clearQueue: Record; promoteQueue: Record; @@ -214,39 +229,39 @@ export type ModerationLogPayloads = { noteUserId: string; noteUserUsername: string; noteUserHost: string | null; - note: any; + note: Note; }; createGlobalAnnouncement: { announcementId: string; - announcement: any; + announcement: Announcement; }; createUserAnnouncement: { announcementId: string; - announcement: any; + announcement: Announcement; userId: string; userUsername: string; userHost: string | null; }; updateGlobalAnnouncement: { announcementId: string; - before: any; - after: any; + before: Announcement; + after: Announcement; }; updateUserAnnouncement: { announcementId: string; - before: any; - after: any; + before: Announcement; + after: Announcement; userId: string; userUsername: string; userHost: string | null; }; deleteGlobalAnnouncement: { announcementId: string; - announcement: any; + announcement: Announcement; }; deleteUserAnnouncement: { announcementId: string; - announcement: any; + announcement: Announcement; userId: string; userUsername: string; userHost: string | null; @@ -284,37 +299,37 @@ export type ModerationLogPayloads = { }; resolveAbuseReport: { reportId: string; - report: any; + report: ReceivedAbuseReport; forwarded: boolean; }; createInvitation: { - invitations: any[]; + invitations: InviteCode[]; }; createAd: { adId: string; - ad: any; + ad: Ad; }; updateAd: { adId: string; - before: any; - after: any; + before: Ad; + after: Ad; }; deleteAd: { adId: string; - ad: any; + ad: Ad; }; createAvatarDecoration: { avatarDecorationId: string; - avatarDecoration: any; + avatarDecoration: AvatarDecoration; }; updateAvatarDecoration: { avatarDecorationId: string; - before: any; - after: any; + before: AvatarDecoration; + after: AvatarDecoration; }; deleteAvatarDecoration: { avatarDecorationId: string; - avatarDecoration: any; + avatarDecoration: AvatarDecoration; }; unsetUserAvatar: { userId: string; @@ -330,28 +345,28 @@ export type ModerationLogPayloads = { }; createSystemWebhook: { systemWebhookId: string; - webhook: any; + webhook: SystemWebhook; }; updateSystemWebhook: { systemWebhookId: string; - before: any; - after: any; + before: SystemWebhook; + after: SystemWebhook; }; deleteSystemWebhook: { systemWebhookId: string; - webhook: any; + webhook: SystemWebhook; }; createAbuseReportNotificationRecipient: { recipientId: string; - recipient: any; + recipient: AbuseReportNotificationRecipient; }; updateAbuseReportNotificationRecipient: { recipientId: string; - before: any; - after: any; + before: AbuseReportNotificationRecipient; + after: AbuseReportNotificationRecipient; }; deleteAbuseReportNotificationRecipient: { recipientId: string; - recipient: any; + recipient: AbuseReportNotificationRecipient; }; };