diff --git a/packages/backend/src/core/entities/AbuseUserReportEntityService.ts b/packages/backend/src/core/entities/AbuseUserReportEntityService.ts index 163d612f4..9bc47a90a 100644 --- a/packages/backend/src/core/entities/AbuseUserReportEntityService.ts +++ b/packages/backend/src/core/entities/AbuseUserReportEntityService.ts @@ -5,8 +5,8 @@ import { awaitAll } from '@/misc/prelude/await-all.js'; import type { AbuseUserReport } from '@/models/entities/AbuseUserReport.js'; import { UserEntityService } from './UserEntityService.js'; import { bindThis } from '@/decorators.js'; -import { Packed } from 'misskey-js'; -import { Serialized } from 'schema-type'; +import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; @Injectable() export class AbuseUserReportEntityService { diff --git a/packages/backend/src/core/entities/AntennaEntityService.ts b/packages/backend/src/core/entities/AntennaEntityService.ts index f6c1bbbc5..c99a99d52 100644 --- a/packages/backend/src/core/entities/AntennaEntityService.ts +++ b/packages/backend/src/core/entities/AntennaEntityService.ts @@ -2,6 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AntennasRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import type { Antenna } from '@/models/entities/Antenna.js'; import { bindThis } from '@/decorators.js'; @@ -16,7 +17,7 @@ export class AntennaEntityService { @bindThis public async pack( src: Antenna['id'] | Antenna, - ): Promise> { + ): Promise>> { const antenna = typeof src === 'object' ? src : await this.antennasRepository.findOneByOrFail({ id: src }); return { diff --git a/packages/backend/src/core/entities/AuthSessionEntityService.ts b/packages/backend/src/core/entities/AuthSessionEntityService.ts index 60e22ba0e..5fd36d869 100644 --- a/packages/backend/src/core/entities/AuthSessionEntityService.ts +++ b/packages/backend/src/core/entities/AuthSessionEntityService.ts @@ -6,7 +6,7 @@ import type { AuthSession } from '@/models/entities/AuthSession.js'; import type { User } from '@/models/entities/User.js'; import { AppEntityService } from './AppEntityService.js'; import { bindThis } from '@/decorators.js'; -import { Packed } from 'misskey-js'; +import type { Packed } from 'misskey-js'; @Injectable() export class AuthSessionEntityService { diff --git a/packages/backend/src/core/entities/BlockingEntityService.ts b/packages/backend/src/core/entities/BlockingEntityService.ts index 25d31ad45..92a792aee 100644 --- a/packages/backend/src/core/entities/BlockingEntityService.ts +++ b/packages/backend/src/core/entities/BlockingEntityService.ts @@ -7,7 +7,7 @@ import type { Blocking } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; -import { Serialized } from 'schema-type'; +import type { Serialized } from 'schema-type'; @Injectable() export class BlockingEntityService { diff --git a/packages/backend/src/core/entities/ChannelEntityService.ts b/packages/backend/src/core/entities/ChannelEntityService.ts index 2b768ead3..8e0be563e 100644 --- a/packages/backend/src/core/entities/ChannelEntityService.ts +++ b/packages/backend/src/core/entities/ChannelEntityService.ts @@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js'; import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NoteUnreadsRepository, NotesRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; import type { Serialized } from 'schema-type'; -import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Channel } from '@/models/entities/Channel.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/ClipEntityService.ts b/packages/backend/src/core/entities/ClipEntityService.ts index e3dbc33c8..3e686f5a1 100644 --- a/packages/backend/src/core/entities/ClipEntityService.ts +++ b/packages/backend/src/core/entities/ClipEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { ClipFavoritesRepository, ClipsRepository, User } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { Clip } from '@/models/entities/Clip.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; @@ -25,7 +25,7 @@ export class ClipEntityService { public async pack( src: Clip['id'] | Clip, me?: { id: User['id'] } | null | undefined, - ): Promise> { + ): Promise>> { const meId = me ? me.id : null; const clip = typeof src === 'object' ? src : await this.clipsRepository.findOneByOrFail({ id: src }); @@ -47,7 +47,7 @@ export class ClipEntityService { public packMany( clips: Clip[], me?: { id: User['id'] } | null | undefined, - ) { + ): Promise>[]> { return Promise.all(clips.map(x => this.pack(x, me))); } } diff --git a/packages/backend/src/core/entities/DriveFileEntityService.ts b/packages/backend/src/core/entities/DriveFileEntityService.ts index 038caf34a..bcb6a2bf9 100644 --- a/packages/backend/src/core/entities/DriveFileEntityService.ts +++ b/packages/backend/src/core/entities/DriveFileEntityService.ts @@ -4,6 +4,7 @@ import { DI } from '@/di-symbols.js'; import type { NotesRepository, DriveFilesRepository } from '@/models/index.js'; import type { Config } from '@/config.js'; import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { User } from '@/models/entities/User.js'; import type { DriveFile } from '@/models/entities/DriveFile.js'; @@ -187,7 +188,7 @@ export class DriveFileEntityService { public async pack( src: DriveFile['id'] | DriveFile, options?: PackOptions, - ): Promise> { + ): Promise>> { const opts = Object.assign({ detail: false, self: false, @@ -195,7 +196,7 @@ export class DriveFileEntityService { const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneByOrFail({ id: src }); - return await awaitAll>({ + return await awaitAll>>({ id: file.id, createdAt: file.createdAt.toISOString(), name: file.name, @@ -221,7 +222,7 @@ export class DriveFileEntityService { public async packNullable( src: DriveFile['id'] | DriveFile, options?: PackOptions, - ): Promise | null> { + ): Promise> | null> { const opts = Object.assign({ detail: false, self: false, @@ -230,7 +231,7 @@ export class DriveFileEntityService { const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneBy({ id: src }); if (file == null) return null; - return await awaitAll>({ + return await awaitAll>>({ id: file.id, createdAt: file.createdAt.toISOString(), name: file.name, @@ -256,20 +257,20 @@ export class DriveFileEntityService { public async packMany( files: DriveFile[], options?: PackOptions, - ): Promise[]> { + ): Promise>[]> { const items = await Promise.all(files.map(f => this.packNullable(f, options))); - return items.filter((x): x is Packed<'DriveFile'> => x != null); + return items.filter((x): x is Serialized> => x != null); } @bindThis public async packManyByIdsMap( fileIds: DriveFile['id'][], options?: PackOptions, - ): Promise['id'], Packed<'DriveFile'> | null>> { + ): Promise>['id'], Serialized> | null>> { if (fileIds.length === 0) return new Map(); const files = await this.driveFilesRepository.findBy({ id: In(fileIds) }); const packedFiles = await this.packMany(files, options); - const map = new Map['id'], Packed<'DriveFile'> | null>(packedFiles.map(f => [f.id, f])); + const map = new Map>['id'], Serialized> | null>(packedFiles.map(f => [f.id, f])); for (const id of fileIds) { if (!map.has(id)) map.set(id, null); } @@ -280,7 +281,7 @@ export class DriveFileEntityService { public async packManyByIds( fileIds: DriveFile['id'][], options?: PackOptions, - ): Promise[]> { + ): Promise>[]> { if (fileIds.length === 0) return []; const filesMap = await this.packManyByIdsMap(fileIds, options); return fileIds.map(id => filesMap.get(id)).filter(isNotNull); diff --git a/packages/backend/src/core/entities/DriveFolderEntityService.ts b/packages/backend/src/core/entities/DriveFolderEntityService.ts index 21aca8a70..8ee5ff528 100644 --- a/packages/backend/src/core/entities/DriveFolderEntityService.ts +++ b/packages/backend/src/core/entities/DriveFolderEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, DriveFoldersRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { DriveFolder } from '@/models/entities/DriveFolder.js'; import { bindThis } from '@/decorators.js'; @@ -24,7 +24,7 @@ export class DriveFolderEntityService { options?: { detail: boolean }, - ): Promise> { + ): Promise>> { const opts = Object.assign({ detail: false, }, options); diff --git a/packages/backend/src/core/entities/EmojiEntityService.ts b/packages/backend/src/core/entities/EmojiEntityService.ts index 4f6c76f18..41e12053b 100644 --- a/packages/backend/src/core/entities/EmojiEntityService.ts +++ b/packages/backend/src/core/entities/EmojiEntityService.ts @@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { EmojisRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; import type { Emoji } from '@/models/entities/Emoji.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/FlashEntityService.ts b/packages/backend/src/core/entities/FlashEntityService.ts index c9f2a9745..05e366bec 100644 --- a/packages/backend/src/core/entities/FlashEntityService.ts +++ b/packages/backend/src/core/entities/FlashEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { FlashsRepository, FlashLikesRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { Flash } from '@/models/entities/Flash.js'; import { bindThis } from '@/decorators.js'; @@ -26,7 +26,7 @@ export class FlashEntityService { public async pack( src: Flash['id'] | Flash, me?: { id: User['id'] } | null | undefined, - ): Promise> { + ): Promise>> { const meId = me ? me.id : null; const flash = typeof src === 'object' ? src : await this.flashsRepository.findOneByOrFail({ id: src }); diff --git a/packages/backend/src/core/entities/FlashLikeEntityService.ts b/packages/backend/src/core/entities/FlashLikeEntityService.ts index 0351ec301..f7534ecb0 100644 --- a/packages/backend/src/core/entities/FlashLikeEntityService.ts +++ b/packages/backend/src/core/entities/FlashLikeEntityService.ts @@ -1,7 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { FlashLikesRepository } from '@/models/index.js'; -import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { FlashLike } from '@/models/entities/FlashLike.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/FollowRequestEntityService.ts b/packages/backend/src/core/entities/FollowRequestEntityService.ts index c2edc6a13..d67408873 100644 --- a/packages/backend/src/core/entities/FollowRequestEntityService.ts +++ b/packages/backend/src/core/entities/FollowRequestEntityService.ts @@ -1,7 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { FollowRequestsRepository } from '@/models/index.js'; -import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { FollowRequest } from '@/models/entities/FollowRequest.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/FollowingEntityService.ts b/packages/backend/src/core/entities/FollowingEntityService.ts index 2d02ce0fe..cb04da239 100644 --- a/packages/backend/src/core/entities/FollowingEntityService.ts +++ b/packages/backend/src/core/entities/FollowingEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { FollowingsRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { Following } from '@/models/entities/Following.js'; import { bindThis } from '@/decorators.js'; @@ -71,7 +71,7 @@ export class FollowingEntityService { populateFollowee?: boolean; populateFollower?: boolean; }, - ): Promise> { + ): Promise>> { const following = typeof src === 'object' ? src : await this.followingsRepository.findOneByOrFail({ id: src }); if (opts == null) opts = {}; diff --git a/packages/backend/src/core/entities/GalleryLikeEntityService.ts b/packages/backend/src/core/entities/GalleryLikeEntityService.ts index db46045db..33126a286 100644 --- a/packages/backend/src/core/entities/GalleryLikeEntityService.ts +++ b/packages/backend/src/core/entities/GalleryLikeEntityService.ts @@ -1,7 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { GalleryLikesRepository } from '@/models/index.js'; -import type { } from '@/models/entities/Blocking.js'; import type { GalleryLike } from '@/models/entities/GalleryLike.js'; import { GalleryPostEntityService } from './GalleryPostEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/GalleryPostEntityService.ts b/packages/backend/src/core/entities/GalleryPostEntityService.ts index 359b9e840..e2308f66c 100644 --- a/packages/backend/src/core/entities/GalleryPostEntityService.ts +++ b/packages/backend/src/core/entities/GalleryPostEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { GalleryLikesRepository, GalleryPostsRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { GalleryPost } from '@/models/entities/GalleryPost.js'; import { bindThis } from '@/decorators.js'; @@ -28,7 +28,7 @@ export class GalleryPostEntityService { public async pack( src: GalleryPost['id'] | GalleryPost, me?: { id: User['id'] } | null | undefined, - ): Promise> { + ): Promise>> { const meId = me ? me.id : null; const post = typeof src === 'object' ? src : await this.galleryPostsRepository.findOneByOrFail({ id: src }); diff --git a/packages/backend/src/core/entities/HashtagEntityService.ts b/packages/backend/src/core/entities/HashtagEntityService.ts index 2c05759d6..bb3e8925c 100644 --- a/packages/backend/src/core/entities/HashtagEntityService.ts +++ b/packages/backend/src/core/entities/HashtagEntityService.ts @@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { HashtagsRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; import type { Hashtag } from '@/models/entities/Hashtag.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/InstanceEntityService.ts b/packages/backend/src/core/entities/InstanceEntityService.ts index 56ce01d7c..3e8f1c594 100644 --- a/packages/backend/src/core/entities/InstanceEntityService.ts +++ b/packages/backend/src/core/entities/InstanceEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { InstancesRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { Instance } from '@/models/entities/Instance.js'; import { MetaService } from '@/core/MetaService.js'; import { bindThis } from '@/decorators.js'; @@ -23,7 +23,7 @@ export class InstanceEntityService { @bindThis public async pack( instance: Instance, - ): Promise> { + ): Promise>> { const meta = await this.metaService.fetch(); return { id: instance.id, diff --git a/packages/backend/src/core/entities/ModerationLogEntityService.ts b/packages/backend/src/core/entities/ModerationLogEntityService.ts index c4ce5aa75..ea54e1259 100644 --- a/packages/backend/src/core/entities/ModerationLogEntityService.ts +++ b/packages/backend/src/core/entities/ModerationLogEntityService.ts @@ -2,12 +2,11 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { ModerationLogsRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { } from '@/models/entities/Blocking.js'; import type { ModerationLog } from '@/models/entities/ModerationLog.js'; import { UserEntityService } from './UserEntityService.js'; import { bindThis } from '@/decorators.js'; -import { Serialized } from 'schema-type'; -import { Packed } from 'misskey-js'; +import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; @Injectable() export class ModerationLogEntityService { diff --git a/packages/backend/src/core/entities/MutingEntityService.ts b/packages/backend/src/core/entities/MutingEntityService.ts index 8a0387f78..7a02a1328 100644 --- a/packages/backend/src/core/entities/MutingEntityService.ts +++ b/packages/backend/src/core/entities/MutingEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { MutingsRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { Muting } from '@/models/entities/Muting.js'; import { bindThis } from '@/decorators.js'; @@ -23,7 +23,7 @@ export class MutingEntityService { public async pack( src: Muting['id'] | Muting, me?: { id: User['id'] } | null | undefined, - ): Promise> { + ): Promise>> { const muting = typeof src === 'object' ? src : await this.mutingsRepository.findOneByOrFail({ id: src }); return await awaitAll({ diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 7337e3358..2ef11840d 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -4,6 +4,7 @@ import * as mfm from 'mfm-js'; import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import { nyaize } from '@/misc/nyaize.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { User } from '@/models/entities/User.js'; @@ -70,7 +71,7 @@ export class NoteEntityService implements OnModuleInit { } @bindThis - private async hideNote(packedNote: Packed<'Note'>, meId: User['id'] | null) { + private async hideNote(packedNote: Serialized>, meId: User['id'] | null) { // TODO: isVisibleForMe を使うようにしても良さそう(型違うけど) let hide = false; @@ -255,7 +256,7 @@ export class NoteEntityService implements OnModuleInit { } @bindThis - public async packAttachedFiles(fileIds: Note['fileIds'], packedFiles: Map | null>): Promise[]> { + public async packAttachedFiles(fileIds: Note['fileIds'], packedFiles: Map> | null>): Promise>[]> { const missingIds = []; for (const id of fileIds) { if (!packedFiles.has(id)) missingIds.push(id); @@ -278,10 +279,10 @@ export class NoteEntityService implements OnModuleInit { skipHide?: boolean; _hint_?: { myReactions: Map; - packedFiles: Map | null>; + packedFiles: Map> | null>; }; }, - ): Promise> { + ): Promise>> { const opts = Object.assign({ detail: true, skipHide: false, @@ -308,7 +309,7 @@ export class NoteEntityService implements OnModuleInit { .map(x => this.reactionService.decodeReaction(x).reaction.replaceAll(':', '')); const packedFiles = options?._hint_?.packedFiles; - const packed: Packed<'Note'> = await awaitAll({ + const packed: Serialized> = await awaitAll({ id: note.id, createdAt: note.createdAt.toISOString(), userId: note.userId, diff --git a/packages/backend/src/core/entities/NoteFavoriteEntityService.ts b/packages/backend/src/core/entities/NoteFavoriteEntityService.ts index 8a7727b4c..4563e8998 100644 --- a/packages/backend/src/core/entities/NoteFavoriteEntityService.ts +++ b/packages/backend/src/core/entities/NoteFavoriteEntityService.ts @@ -1,7 +1,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NoteFavoritesRepository } from '@/models/index.js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { NoteFavorite } from '@/models/entities/NoteFavorite.js'; import { NoteEntityService } from './NoteEntityService.js'; @@ -21,7 +22,7 @@ export class NoteFavoriteEntityService { public async pack( src: NoteFavorite['id'] | NoteFavorite, me?: { id: User['id'] } | null | undefined, - ) { + ): Promise>> { const favorite = typeof src === 'object' ? src : await this.noteFavoritesRepository.findOneByOrFail({ id: src }); return { diff --git a/packages/backend/src/core/entities/NoteReactionEntityService.ts b/packages/backend/src/core/entities/NoteReactionEntityService.ts index 7f927b1e1..3105ebc99 100644 --- a/packages/backend/src/core/entities/NoteReactionEntityService.ts +++ b/packages/backend/src/core/entities/NoteReactionEntityService.ts @@ -2,9 +2,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NoteReactionsRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import { bindThis } from '@/decorators.js'; import type { OnModuleInit } from '@nestjs/common'; -import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { NoteReaction } from '@/models/entities/NoteReaction.js'; import type { ReactionService } from '../ReactionService.js'; @@ -43,7 +43,7 @@ export class NoteReactionEntityService implements OnModuleInit { options?: { withNote: boolean; }, - ): Promise> { + ): Promise>> { const opts = Object.assign({ withNote: false, }, options); diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index a5f2fe624..af1f5a171 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -7,6 +7,7 @@ import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Notification } from '@/models/entities/Notification.js'; import type { Note } from '@/models/entities/Note.js'; import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import { bindThis } from '@/decorators.js'; import { isNotNull } from '@/misc/is-not-null.js'; import { notificationTypes } from 'misskey-js'; @@ -62,10 +63,10 @@ export class NotificationEntityService implements OnModuleInit { }, hint?: { - packedNotes: Map>; - packedUsers: Map>; + packedNotes: Map>>; + packedUsers: Map>>; }, - ): Promise> { + ): Promise>> { const notification = src; const token = notification.appAccessTokenId ? await this.accessTokensRepository.findOneByOrFail({ id: notification.appAccessTokenId }) : null; const noteIfNeed = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && notification.noteId != null ? ( diff --git a/packages/backend/src/core/entities/PageEntityService.ts b/packages/backend/src/core/entities/PageEntityService.ts index ee692a72b..b12e70426 100644 --- a/packages/backend/src/core/entities/PageEntityService.ts +++ b/packages/backend/src/core/entities/PageEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, PagesRepository, PageLikesRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { Page } from '@/models/entities/Page.js'; import type { DriveFile } from '@/models/entities/DriveFile.js'; @@ -32,7 +32,7 @@ export class PageEntityService { public async pack( src: Page['id'] | Page, me?: { id: User['id'] } | null | undefined, - ): Promise> { + ): Promise>> { const meId = me ? me.id : null; const page = typeof src === 'object' ? src : await this.pagesRepository.findOneByOrFail({ id: src }); diff --git a/packages/backend/src/core/entities/PageLikeEntityService.ts b/packages/backend/src/core/entities/PageLikeEntityService.ts index 3460c1e42..16275c21f 100644 --- a/packages/backend/src/core/entities/PageLikeEntityService.ts +++ b/packages/backend/src/core/entities/PageLikeEntityService.ts @@ -1,7 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { PageLikesRepository } from '@/models/index.js'; -import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { PageLike } from '@/models/entities/PageLike.js'; import { PageEntityService } from './PageEntityService.js'; diff --git a/packages/backend/src/core/entities/RenoteMutingEntityService.ts b/packages/backend/src/core/entities/RenoteMutingEntityService.ts index ef4ea7a79..5bdf80463 100644 --- a/packages/backend/src/core/entities/RenoteMutingEntityService.ts +++ b/packages/backend/src/core/entities/RenoteMutingEntityService.ts @@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js'; import type { RenoteMutingsRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { User } from '@/models/entities/User.js'; import type { RenoteMuting } from '@/models/entities/RenoteMuting.js'; import { bindThis } from '@/decorators.js'; @@ -23,7 +23,7 @@ export class RenoteMutingEntityService { public async pack( src: RenoteMuting['id'] | RenoteMuting, me?: { id: User['id'] } | null | undefined, - ): Promise> { + ): Promise>> { const muting = typeof src === 'object' ? src : await this.renoteMutingsRepository.findOneByOrFail({ id: src }); return await awaitAll({ diff --git a/packages/backend/src/core/entities/RoleEntityService.ts b/packages/backend/src/core/entities/RoleEntityService.ts index fde9f7d08..716ff671e 100644 --- a/packages/backend/src/core/entities/RoleEntityService.ts +++ b/packages/backend/src/core/entities/RoleEntityService.ts @@ -8,8 +8,8 @@ import type { Role } from '@/models/entities/Role.js'; import { bindThis } from '@/decorators.js'; import { DEFAULT_POLICIES } from '@/core/RoleService.js'; import { UserEntityService } from './UserEntityService.js'; -import { Packed } from 'misskey-js'; -import { Serialized } from 'schema-type'; +import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; @Injectable() export class RoleEntityService { diff --git a/packages/backend/src/core/entities/SigninEntityService.ts b/packages/backend/src/core/entities/SigninEntityService.ts index 51fa7543d..a94d2ef01 100644 --- a/packages/backend/src/core/entities/SigninEntityService.ts +++ b/packages/backend/src/core/entities/SigninEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { SigninsRepository } from '@/models/index.js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Packed } from 'misskey-js'; import type { Signin } from '@/models/entities/Signin.js'; import { UserEntityService } from './UserEntityService.js'; import { bindThis } from '@/decorators.js'; @@ -19,8 +19,7 @@ export class SigninEntityService { @bindThis public async pack( src: Signin, - ) { + ): Promise> { return src; } } - diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 0ff08ef67..a12d2b526 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -6,6 +6,7 @@ import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import type { Packed } from 'misskey-js'; +import type { Serialized } from 'schema-type'; import type { Promiseable } from '@/misc/prelude/await-all.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js'; @@ -23,13 +24,13 @@ import type { NoteEntityService } from './NoteEntityService.js'; import type { DriveFileEntityService } from './DriveFileEntityService.js'; import type { PageEntityService } from './PageEntityService.js'; -type IsUserDetailed = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>; +type IsUserDetailed = Detailed extends true ? Serialized> : Serialized>; type IsMeAndIsUserDetailed = Detailed extends true ? - ExpectsMe extends true ? Packed<'MeDetailed'> : - ExpectsMe extends false ? Packed<'UserDetailedNotMe'> : - (Packed<'MeDetailed'> | Packed<'UserDetailedNotMe'>) : - Packed<'UserLite'>; + ExpectsMe extends true ? Serialized> : + ExpectsMe extends false ? Serialized> : + (Packed<'MeDetailed'> | Serialized>) : + Serialized>; const ajv = new Ajv(); diff --git a/packages/backend/src/core/entities/UserListEntityService.ts b/packages/backend/src/core/entities/UserListEntityService.ts index b3a9e3f96..60a6a112e 100644 --- a/packages/backend/src/core/entities/UserListEntityService.ts +++ b/packages/backend/src/core/entities/UserListEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { UserListJoiningsRepository, UserListsRepository } from '@/models/index.js'; import type { Packed } from 'misskey-js'; -import type { } from '@/models/entities/Blocking.js'; +import type { Serialized } from 'schema-type'; import type { UserList } from '@/models/entities/UserList.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; @@ -23,7 +23,7 @@ export class UserListEntityService { @bindThis public async pack( src: UserList['id'] | UserList, - ): Promise> { + ): Promise>> { const userList = typeof src === 'object' ? src : await this.userListsRepository.findOneByOrFail({ id: src }); const users = await this.userListJoiningsRepository.findBy({ @@ -39,4 +39,3 @@ export class UserListEntityService { }; } } - diff --git a/packages/misskey-js/src/schemas/note.ts b/packages/misskey-js/src/schemas/note.ts index 2756a2029..adf4a7494 100644 --- a/packages/misskey-js/src/schemas/note.ts +++ b/packages/misskey-js/src/schemas/note.ts @@ -88,7 +88,7 @@ export const packedNoteSchema = { }, reactionAcceptance: { oneOf: [{ - enum: ['likeOnly', 'likeOnlyForRemote'] + enum: ['likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'] }, { type: 'null' }], }, reactions: { @@ -107,7 +107,7 @@ export const packedNoteSchema = { type: 'string', }, myReaction: { - type: 'object', + type: 'string', }, }, required: [ diff --git a/packages/misskey-js/src/schemas/page.ts b/packages/misskey-js/src/schemas/page.ts index cf0bd8614..5e8ec82ca 100644 --- a/packages/misskey-js/src/schemas/page.ts +++ b/packages/misskey-js/src/schemas/page.ts @@ -25,6 +25,9 @@ export const packedPageSchema = { }, content: { type: 'array', + items: { + type: 'object', + }, }, variables: { type: 'array', diff --git a/packages/misskey-js/src/schemas/user-list.ts b/packages/misskey-js/src/schemas/user-list.ts index 7ebda6527..f4c68506e 100644 --- a/packages/misskey-js/src/schemas/user-list.ts +++ b/packages/misskey-js/src/schemas/user-list.ts @@ -17,10 +17,15 @@ export const packedUserListSchema = { type: 'array', items: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, }, + isPublic: { + type: 'boolean', + }, }, required: [ 'id', 'createdAt', 'name', + 'userIds', + 'isPublic', ], } as const satisfies JSONSchema7Definition; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b35ce30e4..9771b89af 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -630,7 +630,7 @@ importers: version: 29.5.0 schema-type: specifier: github:misskey-dev/schema-type - version: github.com/misskey-dev/schema-type/65413af4ef676dafb5d06ebc04dce39c74b3a8f9(typescript@5.1.3) + version: github.com/misskey-dev/schema-type/82e703e9b263916e8a1a6453384f41e378a24e3e(typescript@5.1.3) packages/frontend: dependencies: @@ -1036,7 +1036,7 @@ importers: version: 4.4.0 schema-type: specifier: github:misskey-dev/schema-type - version: github.com/misskey-dev/schema-type/65413af4ef676dafb5d06ebc04dce39c74b3a8f9(typescript@5.0.4) + version: github.com/misskey-dev/schema-type/82e703e9b263916e8a1a6453384f41e378a24e3e(typescript@5.0.4) ts-essentials: specifier: ^9.3.2 version: 9.3.2(typescript@5.0.4) @@ -21755,9 +21755,9 @@ packages: version: 0.0.0 dev: false - github.com/misskey-dev/schema-type/65413af4ef676dafb5d06ebc04dce39c74b3a8f9(typescript@5.0.4): - resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/65413af4ef676dafb5d06ebc04dce39c74b3a8f9} - id: github.com/misskey-dev/schema-type/65413af4ef676dafb5d06ebc04dce39c74b3a8f9 + github.com/misskey-dev/schema-type/82e703e9b263916e8a1a6453384f41e378a24e3e(typescript@5.0.4): + resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/82e703e9b263916e8a1a6453384f41e378a24e3e} + id: github.com/misskey-dev/schema-type/82e703e9b263916e8a1a6453384f41e378a24e3e name: schema-type version: 1.0.0 dependencies: @@ -21768,9 +21768,9 @@ packages: - typescript dev: false - github.com/misskey-dev/schema-type/65413af4ef676dafb5d06ebc04dce39c74b3a8f9(typescript@5.1.3): - resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/65413af4ef676dafb5d06ebc04dce39c74b3a8f9} - id: github.com/misskey-dev/schema-type/65413af4ef676dafb5d06ebc04dce39c74b3a8f9 + github.com/misskey-dev/schema-type/82e703e9b263916e8a1a6453384f41e378a24e3e(typescript@5.1.3): + resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/82e703e9b263916e8a1a6453384f41e378a24e3e} + id: github.com/misskey-dev/schema-type/82e703e9b263916e8a1a6453384f41e378a24e3e name: schema-type version: 1.0.0 dependencies: