そもそもPacked<'...'>は常にSerializedである
This commit is contained in:
parent
4a104af304
commit
edc38fc2c7
|
@ -6,7 +6,6 @@ import type { AbuseUserReport } from '@/models/entities/AbuseUserReport.js';
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AbuseUserReportEntityService {
|
export class AbuseUserReportEntityService {
|
||||||
|
@ -21,7 +20,7 @@ export class AbuseUserReportEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async pack(
|
public async pack(
|
||||||
src: AbuseUserReport['id'] | AbuseUserReport,
|
src: AbuseUserReport['id'] | AbuseUserReport,
|
||||||
): Promise<Serialized<Packed<'AbuseUserReport'>>> {
|
): Promise<Packed<'AbuseUserReport'>> {
|
||||||
const report = typeof src === 'object' ? src : await this.abuseUserReportsRepository.findOneByOrFail({ id: src });
|
const report = typeof src === 'object' ? src : await this.abuseUserReportsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
|
@ -48,7 +47,7 @@ export class AbuseUserReportEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public packMany(
|
public packMany(
|
||||||
reports: any[],
|
reports: any[],
|
||||||
): Promise<Serialized<Packed<'AbuseUserReport'>>[]> {
|
): Promise<Packed<'AbuseUserReport'>[]> {
|
||||||
return Promise.all(reports.map(x => this.pack(x)));
|
return Promise.all(reports.map(x => this.pack(x)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { AntennasRepository } from '@/models/index.js';
|
import type { AntennasRepository } from '@/models/index.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { Antenna } from '@/models/entities/Antenna.js';
|
import type { Antenna } from '@/models/entities/Antenna.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@ export class AntennaEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Antenna['id'] | Antenna,
|
src: Antenna['id'] | Antenna,
|
||||||
): Promise<Serialized<Packed<'Antenna'>>> {
|
): Promise<Packed<'Antenna'>> {
|
||||||
const antenna = typeof src === 'object' ? src : await this.antennasRepository.findOneByOrFail({ id: src });
|
const antenna = typeof src === 'object' ? src : await this.antennasRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class BlockingEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Blocking['id'] | Blocking,
|
src: Blocking['id'] | Blocking,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Blocking'>>> {
|
): Promise<Packed<'Blocking'>> {
|
||||||
const blocking = typeof src === 'object' ? src : await this.blockingsRepository.findOneByOrFail({ id: src });
|
const blocking = typeof src === 'object' ? src : await this.blockingsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
|
@ -40,7 +40,7 @@ export class BlockingEntityService {
|
||||||
public packMany(
|
public packMany(
|
||||||
blockings: any[],
|
blockings: any[],
|
||||||
me: { id: User['id'] },
|
me: { id: User['id'] },
|
||||||
): Promise<Serialized<Packed<'Blocking'>>[]> {
|
): Promise<Packed<'Blocking'>[]> {
|
||||||
return Promise.all(blockings.map(x => this.pack(x, me)));
|
return Promise.all(blockings.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NoteUnreadsRepository, NotesRepository } from '@/models/index.js';
|
import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NoteUnreadsRepository, NotesRepository } from '@/models/index.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { Channel } from '@/models/entities/Channel.js';
|
import type { Channel } from '@/models/entities/Channel.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -41,7 +40,7 @@ export class ChannelEntityService {
|
||||||
src: Channel['id'] | Channel,
|
src: Channel['id'] | Channel,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
detailed?: boolean,
|
detailed?: boolean,
|
||||||
): Promise<Serialized<Packed<'Channel'>>> {
|
): Promise<Packed<'Channel'>> {
|
||||||
const channel = typeof src === 'object' ? src : await this.channelsRepository.findOneByOrFail({ id: src });
|
const channel = typeof src === 'object' ? src : await this.channelsRepository.findOneByOrFail({ id: src });
|
||||||
const meId = me ? me.id : null;
|
const meId = me ? me.id : null;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { ClipFavoritesRepository, ClipsRepository, User } from '@/models/index.js';
|
import type { ClipFavoritesRepository, ClipsRepository, User } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { Clip } from '@/models/entities/Clip.js';
|
import type { Clip } from '@/models/entities/Clip.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
|
@ -25,7 +24,7 @@ export class ClipEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Clip['id'] | Clip,
|
src: Clip['id'] | Clip,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Clip'>>> {
|
): Promise<Packed<'Clip'>> {
|
||||||
const meId = me ? me.id : null;
|
const meId = me ? me.id : null;
|
||||||
const clip = typeof src === 'object' ? src : await this.clipsRepository.findOneByOrFail({ id: src });
|
const clip = typeof src === 'object' ? src : await this.clipsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ export class ClipEntityService {
|
||||||
public packMany(
|
public packMany(
|
||||||
clips: Clip[],
|
clips: Clip[],
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Clip'>>[]> {
|
): Promise<Packed<'Clip'>[]> {
|
||||||
return Promise.all(clips.map(x => this.pack(x, me)));
|
return Promise.all(clips.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { NotesRepository, DriveFilesRepository } from '@/models/index.js';
|
import type { NotesRepository, DriveFilesRepository } from '@/models/index.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
||||||
|
@ -188,7 +187,7 @@ export class DriveFileEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: DriveFile['id'] | DriveFile,
|
src: DriveFile['id'] | DriveFile,
|
||||||
options?: PackOptions,
|
options?: PackOptions,
|
||||||
): Promise<Serialized<Packed<'DriveFile'>>> {
|
): Promise<Packed<'DriveFile'>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
detail: false,
|
detail: false,
|
||||||
self: false,
|
self: false,
|
||||||
|
@ -196,7 +195,7 @@ export class DriveFileEntityService {
|
||||||
|
|
||||||
const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneByOrFail({ id: src });
|
const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return await awaitAll<Serialized<Packed<'DriveFile'>>>({
|
return await awaitAll<Packed<'DriveFile'>>({
|
||||||
id: file.id,
|
id: file.id,
|
||||||
createdAt: file.createdAt.toISOString(),
|
createdAt: file.createdAt.toISOString(),
|
||||||
name: file.name,
|
name: file.name,
|
||||||
|
@ -222,7 +221,7 @@ export class DriveFileEntityService {
|
||||||
public async packNullable(
|
public async packNullable(
|
||||||
src: DriveFile['id'] | DriveFile,
|
src: DriveFile['id'] | DriveFile,
|
||||||
options?: PackOptions,
|
options?: PackOptions,
|
||||||
): Promise<Serialized<Packed<'DriveFile'>> | null> {
|
): Promise<Packed<'DriveFile'> | null> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
detail: false,
|
detail: false,
|
||||||
self: false,
|
self: false,
|
||||||
|
@ -231,7 +230,7 @@ export class DriveFileEntityService {
|
||||||
const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneBy({ id: src });
|
const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneBy({ id: src });
|
||||||
if (file == null) return null;
|
if (file == null) return null;
|
||||||
|
|
||||||
return await awaitAll<Serialized<Packed<'DriveFile'>>>({
|
return await awaitAll<Packed<'DriveFile'>>({
|
||||||
id: file.id,
|
id: file.id,
|
||||||
createdAt: file.createdAt.toISOString(),
|
createdAt: file.createdAt.toISOString(),
|
||||||
name: file.name,
|
name: file.name,
|
||||||
|
@ -257,20 +256,20 @@ export class DriveFileEntityService {
|
||||||
public async packMany(
|
public async packMany(
|
||||||
files: DriveFile[],
|
files: DriveFile[],
|
||||||
options?: PackOptions,
|
options?: PackOptions,
|
||||||
): Promise<Serialized<Packed<'DriveFile'>>[]> {
|
): Promise<Packed<'DriveFile'>[]> {
|
||||||
const items = await Promise.all(files.map(f => this.packNullable(f, options)));
|
const items = await Promise.all(files.map(f => this.packNullable(f, options)));
|
||||||
return items.filter((x): x is Serialized<Packed<'DriveFile'>> => x != null);
|
return items.filter((x): x is Packed<'DriveFile'> => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async packManyByIdsMap(
|
public async packManyByIdsMap(
|
||||||
fileIds: DriveFile['id'][],
|
fileIds: DriveFile['id'][],
|
||||||
options?: PackOptions,
|
options?: PackOptions,
|
||||||
): Promise<Map<Serialized<Packed<'DriveFile'>>['id'], Serialized<Packed<'DriveFile'>> | null>> {
|
): Promise<Map<Packed<'DriveFile'>>['id'], Serialized<Packed<'DriveFile'> | null>> {
|
||||||
if (fileIds.length === 0) return new Map();
|
if (fileIds.length === 0) return new Map();
|
||||||
const files = await this.driveFilesRepository.findBy({ id: In(fileIds) });
|
const files = await this.driveFilesRepository.findBy({ id: In(fileIds) });
|
||||||
const packedFiles = await this.packMany(files, options);
|
const packedFiles = await this.packMany(files, options);
|
||||||
const map = new Map<Serialized<Packed<'DriveFile'>>['id'], Serialized<Packed<'DriveFile'>> | null>(packedFiles.map(f => [f.id, f]));
|
const map = new Map<Packed<'DriveFile'>>['id'], Serialized<Packed<'DriveFile'> | null>(packedFiles.map(f => [f.id, f]));
|
||||||
for (const id of fileIds) {
|
for (const id of fileIds) {
|
||||||
if (!map.has(id)) map.set(id, null);
|
if (!map.has(id)) map.set(id, null);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +280,7 @@ export class DriveFileEntityService {
|
||||||
public async packManyByIds(
|
public async packManyByIds(
|
||||||
fileIds: DriveFile['id'][],
|
fileIds: DriveFile['id'][],
|
||||||
options?: PackOptions,
|
options?: PackOptions,
|
||||||
): Promise<Serialized<Packed<'DriveFile'>>[]> {
|
): Promise<Packed<'DriveFile'>[]> {
|
||||||
if (fileIds.length === 0) return [];
|
if (fileIds.length === 0) return [];
|
||||||
const filesMap = await this.packManyByIdsMap(fileIds, options);
|
const filesMap = await this.packManyByIdsMap(fileIds, options);
|
||||||
return fileIds.map(id => filesMap.get(id)).filter(isNotNull);
|
return fileIds.map(id => filesMap.get(id)).filter(isNotNull);
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { DriveFilesRepository, DriveFoldersRepository } from '@/models/index.js';
|
import type { DriveFilesRepository, DriveFoldersRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { DriveFolder } from '@/models/entities/DriveFolder.js';
|
import type { DriveFolder } from '@/models/entities/DriveFolder.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
||||||
|
@ -24,7 +23,7 @@ export class DriveFolderEntityService {
|
||||||
options?: {
|
options?: {
|
||||||
detail: boolean
|
detail: boolean
|
||||||
},
|
},
|
||||||
): Promise<Serialized<Packed<'DriveFolder'>>> {
|
): Promise<Packed<'DriveFolder'>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
detail: false,
|
detail: false,
|
||||||
}, options);
|
}, options);
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { FlashsRepository, FlashLikesRepository } from '@/models/index.js';
|
import type { FlashsRepository, FlashLikesRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { Flash } from '@/models/entities/Flash.js';
|
import type { Flash } from '@/models/entities/Flash.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -26,7 +25,7 @@ export class FlashEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Flash['id'] | Flash,
|
src: Flash['id'] | Flash,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Flash'>>> {
|
): Promise<Packed<'Flash'>> {
|
||||||
const meId = me ? me.id : null;
|
const meId = me ? me.id : null;
|
||||||
const flash = typeof src === 'object' ? src : await this.flashsRepository.findOneByOrFail({ id: src });
|
const flash = typeof src === 'object' ? src : await this.flashsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { FollowingsRepository } from '@/models/index.js';
|
import type { FollowingsRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { Following } from '@/models/entities/Following.js';
|
import type { Following } from '@/models/entities/Following.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -71,7 +70,7 @@ export class FollowingEntityService {
|
||||||
populateFollowee?: boolean;
|
populateFollowee?: boolean;
|
||||||
populateFollower?: boolean;
|
populateFollower?: boolean;
|
||||||
},
|
},
|
||||||
): Promise<Serialized<Packed<'Following'>>> {
|
): Promise<Packed<'Following'>> {
|
||||||
const following = typeof src === 'object' ? src : await this.followingsRepository.findOneByOrFail({ id: src });
|
const following = typeof src === 'object' ? src : await this.followingsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
if (opts == null) opts = {};
|
if (opts == null) opts = {};
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { GalleryLikesRepository, GalleryPostsRepository } from '@/models/index.js';
|
import type { GalleryLikesRepository, GalleryPostsRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { GalleryPost } from '@/models/entities/GalleryPost.js';
|
import type { GalleryPost } from '@/models/entities/GalleryPost.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -28,7 +27,7 @@ export class GalleryPostEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: GalleryPost['id'] | GalleryPost,
|
src: GalleryPost['id'] | GalleryPost,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'GalleryPost'>>> {
|
): Promise<Packed<'GalleryPost'>> {
|
||||||
const meId = me ? me.id : null;
|
const meId = me ? me.id : null;
|
||||||
const post = typeof src === 'object' ? src : await this.galleryPostsRepository.findOneByOrFail({ id: src });
|
const post = typeof src === 'object' ? src : await this.galleryPostsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { InstancesRepository } from '@/models/index.js';
|
import type { InstancesRepository } from '@/models/index.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { Instance } from '@/models/entities/Instance.js';
|
import type { Instance } from '@/models/entities/Instance.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -23,7 +22,7 @@ export class InstanceEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async pack(
|
public async pack(
|
||||||
instance: Instance,
|
instance: Instance,
|
||||||
): Promise<Serialized<Packed<'FederationInstance'>>> {
|
): Promise<Packed<'FederationInstance'>> {
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
return {
|
return {
|
||||||
id: instance.id,
|
id: instance.id,
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type { ModerationLog } from '@/models/entities/ModerationLog.js';
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ModerationLogEntityService {
|
export class ModerationLogEntityService {
|
||||||
|
@ -21,7 +20,7 @@ export class ModerationLogEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async pack(
|
public async pack(
|
||||||
src: ModerationLog['id'] | ModerationLog,
|
src: ModerationLog['id'] | ModerationLog,
|
||||||
): Promise<Serialized<Packed<'ModerationLog'>>> {
|
): Promise<Packed<'ModerationLog'>> {
|
||||||
const log = typeof src === 'object' ? src : await this.moderationLogsRepository.findOneByOrFail({ id: src });
|
const log = typeof src === 'object' ? src : await this.moderationLogsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
|
@ -39,7 +38,7 @@ export class ModerationLogEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public packMany(
|
public packMany(
|
||||||
reports: any[],
|
reports: any[],
|
||||||
): Promise<Serialized<Packed<'ModerationLog'>>[]> {
|
): Promise<Packed<'ModerationLog'>[]> {
|
||||||
return Promise.all(reports.map(x => this.pack(x)));
|
return Promise.all(reports.map(x => this.pack(x)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { MutingsRepository } from '@/models/index.js';
|
import type { MutingsRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { Muting } from '@/models/entities/Muting.js';
|
import type { Muting } from '@/models/entities/Muting.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -23,7 +22,7 @@ export class MutingEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Muting['id'] | Muting,
|
src: Muting['id'] | Muting,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Muting'>>> {
|
): Promise<Packed<'Muting'>> {
|
||||||
const muting = typeof src === 'object' ? src : await this.mutingsRepository.findOneByOrFail({ id: src });
|
const muting = typeof src === 'object' ? src : await this.mutingsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
|
|
|
@ -4,7 +4,6 @@ import * as mfm from 'mfm-js';
|
||||||
import { ModuleRef } from '@nestjs/core';
|
import { ModuleRef } from '@nestjs/core';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import { nyaize } from '@/misc/nyaize.js';
|
import { nyaize } from '@/misc/nyaize.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
|
@ -71,7 +70,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async hideNote(packedNote: Serialized<Packed<'Note'>>, meId: User['id'] | null) {
|
private async hideNote(packedNote: Packed<'Note'>, meId: User['id'] | null) {
|
||||||
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
|
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
|
||||||
let hide = false;
|
let hide = false;
|
||||||
|
|
||||||
|
@ -256,7 +255,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async packAttachedFiles(fileIds: Note['fileIds'], packedFiles: Map<Note['fileIds'][number], Serialized<Packed<'DriveFile'>> | null>): Promise<Serialized<Packed<'DriveFile'>>[]> {
|
public async packAttachedFiles(fileIds: Note['fileIds'], packedFiles: Map<Note['fileIds'][number], Packed<'DriveFile'> | null>): Promise<Packed<'DriveFile'>[]> {
|
||||||
const missingIds = [];
|
const missingIds = [];
|
||||||
for (const id of fileIds) {
|
for (const id of fileIds) {
|
||||||
if (!packedFiles.has(id)) missingIds.push(id);
|
if (!packedFiles.has(id)) missingIds.push(id);
|
||||||
|
@ -279,10 +278,10 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
skipHide?: boolean;
|
skipHide?: boolean;
|
||||||
_hint_?: {
|
_hint_?: {
|
||||||
myReactions: Map<Note['id'], NoteReaction | null>;
|
myReactions: Map<Note['id'], NoteReaction | null>;
|
||||||
packedFiles: Map<Note['fileIds'][number], Serialized<Packed<'DriveFile'>> | null>;
|
packedFiles: Map<Note['fileIds'][number], Packed<'DriveFile'> | null>;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
): Promise<Serialized<Packed<'Note'>>> {
|
): Promise<Packed<'Note'>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
detail: true,
|
detail: true,
|
||||||
skipHide: false,
|
skipHide: false,
|
||||||
|
@ -309,7 +308,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
.map(x => this.reactionService.decodeReaction(x).reaction.replaceAll(':', ''));
|
.map(x => this.reactionService.decodeReaction(x).reaction.replaceAll(':', ''));
|
||||||
const packedFiles = options?._hint_?.packedFiles;
|
const packedFiles = options?._hint_?.packedFiles;
|
||||||
|
|
||||||
const packed: Serialized<Packed<'Note'>> = await awaitAll({
|
const packed: Packed<'Note'> = await awaitAll({
|
||||||
id: note.id,
|
id: note.id,
|
||||||
createdAt: note.createdAt.toISOString(),
|
createdAt: note.createdAt.toISOString(),
|
||||||
userId: note.userId,
|
userId: note.userId,
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { NoteFavoritesRepository } from '@/models/index.js';
|
import type { NoteFavoritesRepository } from '@/models/index.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { NoteFavorite } from '@/models/entities/NoteFavorite.js';
|
import type { NoteFavorite } from '@/models/entities/NoteFavorite.js';
|
||||||
import { NoteEntityService } from './NoteEntityService.js';
|
import { NoteEntityService } from './NoteEntityService.js';
|
||||||
|
@ -22,7 +21,7 @@ export class NoteFavoriteEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: NoteFavorite['id'] | NoteFavorite,
|
src: NoteFavorite['id'] | NoteFavorite,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'NoteFavorite'>>> {
|
): Promise<Packed<'NoteFavorite'>> {
|
||||||
const favorite = typeof src === 'object' ? src : await this.noteFavoritesRepository.findOneByOrFail({ id: src });
|
const favorite = typeof src === 'object' ? src : await this.noteFavoritesRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { NoteReactionsRepository } from '@/models/index.js';
|
import type { NoteReactionsRepository } from '@/models/index.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { OnModuleInit } from '@nestjs/common';
|
import type { OnModuleInit } from '@nestjs/common';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
|
@ -43,7 +42,7 @@ export class NoteReactionEntityService implements OnModuleInit {
|
||||||
options?: {
|
options?: {
|
||||||
withNote: boolean;
|
withNote: boolean;
|
||||||
},
|
},
|
||||||
): Promise<Serialized<Packed<'NoteReaction'>>> {
|
): Promise<Packed<'NoteReaction'>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
withNote: false,
|
withNote: false,
|
||||||
}, options);
|
}, options);
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Notification } from '@/models/entities/Notification.js';
|
import type { Notification } from '@/models/entities/Notification.js';
|
||||||
import type { Note } from '@/models/entities/Note.js';
|
import type { Note } from '@/models/entities/Note.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
import { isNotNull } from '@/misc/is-not-null.js';
|
||||||
import { notificationTypes } from 'misskey-js';
|
import { notificationTypes } from 'misskey-js';
|
||||||
|
@ -63,10 +62,10 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
|
|
||||||
},
|
},
|
||||||
hint?: {
|
hint?: {
|
||||||
packedNotes: Map<Note['id'], Serialized<Packed<'Note'>>>;
|
packedNotes: Map<Note['id'], Packed<'Note'>>;
|
||||||
packedUsers: Map<User['id'], Serialized<Packed<'User'>>>;
|
packedUsers: Map<User['id'], Packed<'User'>>;
|
||||||
},
|
},
|
||||||
): Promise<Serialized<Packed<'Notification'>>> {
|
): Promise<Packed<'Notification'>> {
|
||||||
const notification = src;
|
const notification = src;
|
||||||
const token = notification.appAccessTokenId ? await this.accessTokensRepository.findOneByOrFail({ id: notification.appAccessTokenId }) : null;
|
const token = notification.appAccessTokenId ? await this.accessTokensRepository.findOneByOrFail({ id: notification.appAccessTokenId }) : null;
|
||||||
const noteIfNeed = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && notification.noteId != null ? (
|
const noteIfNeed = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && notification.noteId != null ? (
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { DriveFilesRepository, PagesRepository, PageLikesRepository } from '@/models/index.js';
|
import type { DriveFilesRepository, PagesRepository, PageLikesRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { Page } from '@/models/entities/Page.js';
|
import type { Page } from '@/models/entities/Page.js';
|
||||||
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
||||||
|
@ -32,7 +31,7 @@ export class PageEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Page['id'] | Page,
|
src: Page['id'] | Page,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Page'>>> {
|
): Promise<Packed<'Page'>> {
|
||||||
const meId = me ? me.id : null;
|
const meId = me ? me.id : null;
|
||||||
const page = typeof src === 'object' ? src : await this.pagesRepository.findOneByOrFail({ id: src });
|
const page = typeof src === 'object' ? src : await this.pagesRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DI } from '@/di-symbols.js';
|
||||||
import type { RenoteMutingsRepository } from '@/models/index.js';
|
import type { RenoteMutingsRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { RenoteMuting } from '@/models/entities/RenoteMuting.js';
|
import type { RenoteMuting } from '@/models/entities/RenoteMuting.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -23,7 +22,7 @@ export class RenoteMutingEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: RenoteMuting['id'] | RenoteMuting,
|
src: RenoteMuting['id'] | RenoteMuting,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'RenoteMuting'>>> {
|
): Promise<Packed<'RenoteMuting'>> {
|
||||||
const muting = typeof src === 'object' ? src : await this.renoteMutingsRepository.findOneByOrFail({ id: src });
|
const muting = typeof src === 'object' ? src : await this.renoteMutingsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
|
|
|
@ -9,7 +9,6 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RoleEntityService {
|
export class RoleEntityService {
|
||||||
|
@ -28,7 +27,7 @@ export class RoleEntityService {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Role['id'] | Role,
|
src: Role['id'] | Role,
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
): Promise<Serialized<Packed<'Role'>>> {
|
): Promise<Packed<'Role'>> {
|
||||||
const role = typeof src === 'object' ? src : await this.rolesRepository.findOneByOrFail({ id: src });
|
const role = typeof src === 'object' ? src : await this.rolesRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
const assignedCount = await this.roleAssignmentsRepository.createQueryBuilder('assign')
|
const assignedCount = await this.roleAssignmentsRepository.createQueryBuilder('assign')
|
||||||
|
@ -74,7 +73,7 @@ export class RoleEntityService {
|
||||||
public packMany(
|
public packMany(
|
||||||
roles: any[],
|
roles: any[],
|
||||||
me: { id: User['id'] },
|
me: { id: User['id'] },
|
||||||
): Promise<Serialized<Packed<'Role'>>[]> {
|
): Promise<Packed<'Role'>[]> {
|
||||||
return Promise.all(roles.map(x => this.pack(x, me)));
|
return Promise.all(roles.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { ModuleRef } from '@nestjs/core';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { Promiseable } from '@/misc/prelude/await-all.js';
|
import type { Promiseable } from '@/misc/prelude/await-all.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||||
|
@ -24,13 +23,13 @@ import type { NoteEntityService } from './NoteEntityService.js';
|
||||||
import type { DriveFileEntityService } from './DriveFileEntityService.js';
|
import type { DriveFileEntityService } from './DriveFileEntityService.js';
|
||||||
import type { PageEntityService } from './PageEntityService.js';
|
import type { PageEntityService } from './PageEntityService.js';
|
||||||
|
|
||||||
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Serialized<Packed<'UserDetailed'>> : Serialized<Packed<'UserLite'>>;
|
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
|
||||||
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
|
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
|
||||||
Detailed extends true ?
|
Detailed extends true ?
|
||||||
ExpectsMe extends true ? Serialized<Packed<'MeDetailed'>> :
|
ExpectsMe extends true ? Packed<'MeDetailed'> :
|
||||||
ExpectsMe extends false ? Serialized<Packed<'UserDetailedNotMe'>> :
|
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
|
||||||
(Packed<'MeDetailed'> | Serialized<Packed<'UserDetailedNotMe'>>) :
|
(Packed<'MeDetailed'> | Packed<'UserDetailedNotMe'>) :
|
||||||
Serialized<Packed<'UserLite'>>;
|
Packed<'UserLite'>;
|
||||||
|
|
||||||
const ajv = new Ajv();
|
const ajv = new Ajv();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { UserListJoiningsRepository, UserListsRepository } from '@/models/index.js';
|
import type { UserListJoiningsRepository, UserListsRepository } from '@/models/index.js';
|
||||||
import type { Packed } from 'misskey-js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { Serialized } from 'schema-type';
|
|
||||||
import type { UserList } from '@/models/entities/UserList.js';
|
import type { UserList } from '@/models/entities/UserList.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
|
@ -23,7 +22,7 @@ export class UserListEntityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async pack(
|
public async pack(
|
||||||
src: UserList['id'] | UserList,
|
src: UserList['id'] | UserList,
|
||||||
): Promise<Serialized<Packed<'UserList'>>> {
|
): Promise<Packed<'UserList'>> {
|
||||||
const userList = typeof src === 'object' ? src : await this.userListsRepository.findOneByOrFail({ id: src });
|
const userList = typeof src === 'object' ? src : await this.userListsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
const users = await this.userListJoiningsRepository.findBy({
|
const users = await this.userListJoiningsRepository.findBy({
|
||||||
|
|
|
@ -227,7 +227,7 @@ export type StreamMessages = {
|
||||||
};
|
};
|
||||||
notes: {
|
notes: {
|
||||||
name: 'notesStream';
|
name: 'notesStream';
|
||||||
payload: Serialized<Packed<'Note'>>;
|
payload: Packed<'Note'>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { Serialized } from "schema-type";
|
|
||||||
import { Packed } from "./schemas";
|
import { Packed } from "./schemas";
|
||||||
|
|
||||||
export type ID = Packed<'Id'>;
|
export type ID = Packed<'Id'>;
|
||||||
|
@ -7,21 +6,21 @@ export type DateString = string;
|
||||||
type TODO = Record<string, any>;
|
type TODO = Record<string, any>;
|
||||||
|
|
||||||
// NOTE: 極力この型を使うのは避け、UserLite か UserDetailed か明示するように
|
// NOTE: 極力この型を使うのは避け、UserLite か UserDetailed か明示するように
|
||||||
export type User = Serialized<Packed<'User'>>;
|
export type User = Packed<'User'>;
|
||||||
|
|
||||||
export type UserLite = Serialized<Packed<'UserLite'>>;
|
export type UserLite = Packed<'UserLite'>;
|
||||||
export type UserDetailed = Serialized<Packed<'UserDetailed'>>;
|
export type UserDetailed = Packed<'UserDetailed'>;
|
||||||
export type UserList = Serialized<Packed<'UserList'>>;
|
export type UserList = Packed<'UserList'>;
|
||||||
export type MeDetailed = Serialized<Packed<'MeDetailed'>>;
|
export type MeDetailed = Packed<'MeDetailed'>;
|
||||||
export type DriveFile = Serialized<Packed<'DriveFile'>>;
|
export type DriveFile = Packed<'DriveFile'>;
|
||||||
export type DriveFolder = Serialized<Packed<'DriveFolder'>>;
|
export type DriveFolder = Packed<'DriveFolder'>;
|
||||||
export type GalleryPost = Serialized<Packed<'GalleryPost'>>;
|
export type GalleryPost = Packed<'GalleryPost'>;
|
||||||
export type Note = Serialized<Packed<'Note'>>;
|
export type Note = Packed<'Note'>;
|
||||||
export type NoteReaction = Serialized<Packed<'NoteReaction'>>;
|
export type NoteReaction = Packed<'NoteReaction'>;
|
||||||
export type NoteFavorite = Serialized<Packed<'NoteFavorite'>>;
|
export type NoteFavorite = Packed<'NoteFavorite'>;
|
||||||
export type Notification = Serialized<Packed<'NotificationStrict'>>;
|
export type Notification = Packed<'NotificationStrict'>;
|
||||||
export type CustomEmoji = Serialized<Packed<'EmojiSimple'> | Packed<'EmojiDetailed'>>;
|
export type CustomEmoji = Packed<'EmojiSimple'> | Packed<'EmojiDetailed'>;
|
||||||
export type Page = Serialized<Packed<'Page'>>;
|
export type Page = Packed<'Page'>;
|
||||||
|
|
||||||
export type PageEvent = {
|
export type PageEvent = {
|
||||||
pageId: Page['id'];
|
pageId: Page['id'];
|
||||||
|
@ -31,19 +30,19 @@ export type PageEvent = {
|
||||||
user: User;
|
user: User;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Announcement = Serialized<Packed<'Announcement'>>;
|
export type Announcement = Packed<'Announcement'>;
|
||||||
export type Antenna = Serialized<Packed<'Antenna'>>;
|
export type Antenna = Packed<'Antenna'>;
|
||||||
export type App = Serialized<Packed<'App'>>;
|
export type App = Packed<'App'>;
|
||||||
export type Ad = Serialized<Packed<'Ad'>>;
|
export type Ad = Packed<'Ad'>;
|
||||||
export type Clip = Serialized<Packed<'Clip'>>;
|
export type Clip = Packed<'Clip'>;
|
||||||
export type Channel = Serialized<Packed<'Channel'>>;
|
export type Channel = Packed<'Channel'>;
|
||||||
export type Following = Serialized<Packed<'Following'>>;
|
export type Following = Packed<'Following'>;
|
||||||
export type Blocking = Serialized<Packed<'Blocking'>>;
|
export type Blocking = Packed<'Blocking'>;
|
||||||
export type Relay = Serialized<Packed<'Relay'>>;
|
export type Relay = Packed<'Relay'>;
|
||||||
export type Role = Serialized<Packed<'Role'>>;
|
export type Role = Packed<'Role'>;
|
||||||
export type RoleAssign = Serialized<Packed<'RoleAssign'>>;
|
export type RoleAssign = Packed<'RoleAssign'>;
|
||||||
export type RolePolicy = Serialized<Packed<'RolePolicy'>>;
|
export type RolePolicy = Packed<'RolePolicy'>;
|
||||||
export type RoleCondFormula = Serialized<Packed<'RoleCondFormula'>>;
|
export type RoleCondFormula = Packed<'RoleCondFormula'>;
|
||||||
|
|
||||||
export type LiteInstanceMetadata = {
|
export type LiteInstanceMetadata = {
|
||||||
maintainerName: string | null;
|
maintainerName: string | null;
|
||||||
|
@ -107,7 +106,7 @@ export type DetailedInstanceMetadata = LiteInstanceMetadata & {
|
||||||
|
|
||||||
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
||||||
|
|
||||||
export type ServerInfo = Serialized<Packed<'ServerInfo'>>;
|
export type ServerInfo = Packed<'ServerInfo'>;
|
||||||
|
|
||||||
export type Stats = {
|
export type Stats = {
|
||||||
notesCount: number;
|
notesCount: number;
|
||||||
|
@ -119,7 +118,7 @@ export type Stats = {
|
||||||
driveUsageRemote: number;
|
driveUsageRemote: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AuthSession = Serialized<Packed<'AuthSession'>>;
|
export type AuthSession = Packed<'AuthSession'>;
|
||||||
|
|
||||||
export type FollowRequest = {
|
export type FollowRequest = {
|
||||||
id: ID;
|
id: ID;
|
||||||
|
@ -164,7 +163,7 @@ export type Instance = {
|
||||||
infoUpdatedAt: DateString | null;
|
infoUpdatedAt: DateString | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Signin = Serialized<Packed<'SignIn'>>;
|
export type Signin = Packed<'SignIn'>;
|
||||||
|
|
||||||
export type UserSorting =
|
export type UserSorting =
|
||||||
| '+follower'
|
| '+follower'
|
||||||
|
|
|
@ -58,7 +58,7 @@ import {
|
||||||
import { packedModerationLogSchema } from './schemas/moderation-log.js';
|
import { packedModerationLogSchema } from './schemas/moderation-log.js';
|
||||||
import { packedAuthSessionSchema } from './schemas/auth-session.js';
|
import { packedAuthSessionSchema } from './schemas/auth-session.js';
|
||||||
import { Error, ApiError } from './schemas/error.js';
|
import { Error, ApiError } from './schemas/error.js';
|
||||||
import type { JSONSchema7, JSONSchema7Definition, GetDef, GetRefs, GetKeys, UnionToArray } from 'schema-type';
|
import type { JSONSchema7, JSONSchema7Definition, GetDef, GetRefs, GetKeys, UnionToArray, Serialized } from 'schema-type';
|
||||||
|
|
||||||
export const refs = {
|
export const refs = {
|
||||||
Id: IdSchema,
|
Id: IdSchema,
|
||||||
|
@ -118,5 +118,5 @@ export const refs = {
|
||||||
|
|
||||||
export type References = GetRefs<typeof refs>;
|
export type References = GetRefs<typeof refs>;
|
||||||
|
|
||||||
export type Packed<x extends GetKeys<References, 'https://misskey-hub.net/api/schemas/'>> = GetDef<References, x, false, 'https://misskey-hub.net/api/schemas/'>;
|
export type Packed<x extends GetKeys<References, 'https://misskey-hub.net/api/schemas/'>> = Serialized<GetDef<References, x, false, 'https://misskey-hub.net/api/schemas/'>>;
|
||||||
export type Def<x extends GetKeys<References>> = GetDef<References, x>;
|
export type Def<x extends GetKeys<References>> = GetDef<References, x>;
|
||||||
|
|
Loading…
Reference in a new issue