From 4f5d77391ffc963968ec696c7d0ec8b72333477f Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 10 May 2023 19:18:48 +0000 Subject: [PATCH] wip~~ --- packages/backend/src/core/AntennaService.ts | 2 +- .../backend/src/core/GlobalEventService.ts | 2 +- packages/backend/src/core/NoteReadService.ts | 2 +- .../src/core/PushNotificationService.ts | 2 +- packages/backend/src/core/RoleService.ts | 2 +- .../backend/src/core/UserBlockingService.ts | 7 +- .../backend/src/core/UserFollowingService.ts | 4 +- .../src/core/entities/AntennaEntityService.ts | 2 +- .../src/core/entities/AppEntityService.ts | 2 +- .../core/entities/BlockingEntityService.ts | 2 +- .../src/core/entities/ChannelEntityService.ts | 2 +- .../src/core/entities/ClipEntityService.ts | 2 +- .../core/entities/DriveFileEntityService.ts | 2 +- .../core/entities/DriveFolderEntityService.ts | 2 +- .../src/core/entities/EmojiEntityService.ts | 2 +- .../src/core/entities/FlashEntityService.ts | 2 +- .../core/entities/FollowingEntityService.ts | 2 +- .../core/entities/GalleryPostEntityService.ts | 2 +- .../src/core/entities/HashtagEntityService.ts | 2 +- .../core/entities/InstanceEntityService.ts | 2 +- .../src/core/entities/MutingEntityService.ts | 2 +- .../src/core/entities/NoteEntityService.ts | 2 +- .../entities/NoteReactionEntityService.ts | 2 +- .../entities/NotificationEntityService.ts | 2 +- .../src/core/entities/PageEntityService.ts | 2 +- .../entities/RenoteMutingEntityService.ts | 2 +- .../src/core/entities/UserEntityService.ts | 16 +- .../core/entities/UserListEntityService.ts | 2 +- packages/backend/src/misc/get-note-summary.ts | 2 +- .../backend/src/misc/is-instance-muted.ts | 2 +- .../src/models/entities/Notification.ts | 4 +- packages/backend/src/server/api/endpoints.ts | 6 +- .../backend/src/server/api/openapi/schemas.ts | 4 +- .../src/server/api/stream/channels/channel.ts | 2 +- .../api/stream/channels/global-timeline.ts | 2 +- .../src/server/api/stream/channels/hashtag.ts | 2 +- .../api/stream/channels/home-timeline.ts | 2 +- .../api/stream/channels/hybrid-timeline.ts | 2 +- .../api/stream/channels/local-timeline.ts | 2 +- .../api/stream/channels/role-timeline.ts | 2 +- .../server/api/stream/channels/user-list.ts | 2 +- .../backend/src/server/api/stream/index.ts | 2 +- .../backend/src/server/api/stream/types.ts | 2 +- packages/backend/test/e2e/clips.ts | 2 +- packages/backend/test/e2e/users.ts | 2 +- packages/misskey-js/src/schemas.ts | 6 +- packages/misskey-js/src/schemas/drive-file.ts | 2 +- packages/misskey-js/src/schemas/note.ts | 4 +- .../misskey-js/src/schemas/notification.ts | 248 ++++++++++-------- pnpm-lock.yaml | 10 +- 50 files changed, 218 insertions(+), 171 deletions(-) diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts index 2d4226a32..de89fb612 100644 --- a/packages/backend/src/core/AntennaService.ts +++ b/packages/backend/src/core/AntennaService.ts @@ -10,7 +10,7 @@ import { isUserRelated } from '@/misc/is-user-related.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { PushNotificationService } from '@/core/PushNotificationService.js'; import * as Acct from '@/misc/acct.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { DI } from '@/di-symbols.js'; import type { MutingsRepository, NotesRepository, AntennasRepository, UserListJoiningsRepository } from '@/models/index.js'; import { UtilityService } from '@/core/UtilityService.js'; diff --git a/packages/backend/src/core/GlobalEventService.ts b/packages/backend/src/core/GlobalEventService.ts index 0ed524114..93c525996 100644 --- a/packages/backend/src/core/GlobalEventService.ts +++ b/packages/backend/src/core/GlobalEventService.ts @@ -16,7 +16,7 @@ import type { UserListStreamTypes, RoleTimelineStreamTypes, } from '@/server/api/stream/types.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/NoteReadService.ts b/packages/backend/src/core/NoteReadService.ts index 1129bd159..912a49de2 100644 --- a/packages/backend/src/core/NoteReadService.ts +++ b/packages/backend/src/core/NoteReadService.ts @@ -3,7 +3,7 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { User } from '@/models/entities/User.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { Note } from '@/models/entities/Note.js'; import { IdService } from '@/core/IdService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; diff --git a/packages/backend/src/core/PushNotificationService.ts b/packages/backend/src/core/PushNotificationService.ts index a4c569bde..616adf1d7 100644 --- a/packages/backend/src/core/PushNotificationService.ts +++ b/packages/backend/src/core/PushNotificationService.ts @@ -3,7 +3,7 @@ import push from 'web-push'; import * as Redis from 'ioredis'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; -import type { Packed } from '@/misc/json-schema'; +import type { Packed } from 'misskey-js'; import { getNoteSummary } from '@/misc/get-note-summary.js'; import type { SwSubscription, SwSubscriptionsRepository } from '@/models/index.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index 68087ccc3..b7c115028 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -13,7 +13,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { StreamMessages } from '@/server/api/stream/types.js'; import { IdService } from '@/core/IdService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; -import type { Packed } from '@/misc/json-schema'; +import type { Packed } from 'misskey-js'; import type { OnApplicationShutdown } from '@nestjs/common'; export type RolePolicies = { diff --git a/packages/backend/src/core/UserBlockingService.ts b/packages/backend/src/core/UserBlockingService.ts index 3ca22f8bb..5ff885a2f 100644 --- a/packages/backend/src/core/UserBlockingService.ts +++ b/packages/backend/src/core/UserBlockingService.ts @@ -107,7 +107,10 @@ export class UserBlockingService implements OnModuleInit { if (this.userEntityService.isLocalUser(followee)) { this.userEntityService.pack(followee, followee, { detail: true, - }).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed)); + }).then(packed => { + this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed); + return packed; // somehow this is needed by typescript + }); } if (this.userEntityService.isLocalUser(follower) && !silent) { @@ -122,6 +125,8 @@ export class UserBlockingService implements OnModuleInit { user: packed, }); } + + return packed; // somehow this is needed by typescript }); } diff --git a/packages/backend/src/core/UserFollowingService.ts b/packages/backend/src/core/UserFollowingService.ts index 7d90bc2c0..f08005209 100644 --- a/packages/backend/src/core/UserFollowingService.ts +++ b/packages/backend/src/core/UserFollowingService.ts @@ -7,7 +7,7 @@ import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { IdService } from '@/core/IdService.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import InstanceChart from '@/core/chart/charts/instance.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { WebhookService } from '@/core/WebhookService.js'; @@ -267,7 +267,7 @@ export class UserFollowingService implements OnModuleInit { this.userEntityService.pack(followee.id, follower, { detail: true, }).then(async packed => { - this.globalEventService.publishMainStream(follower.id, 'follow', packed as Packed<'UserDetailedNotMe'>); + this.globalEventService.publishMainStream(follower.id, 'follow', packed); const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === follower.id && x.on.includes('follow')); for (const webhook of webhooks) { diff --git a/packages/backend/src/core/entities/AntennaEntityService.ts b/packages/backend/src/core/entities/AntennaEntityService.ts index 328511f5d..f6c1bbbc5 100644 --- a/packages/backend/src/core/entities/AntennaEntityService.ts +++ b/packages/backend/src/core/entities/AntennaEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AntennasRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { Antenna } from '@/models/entities/Antenna.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/AppEntityService.ts b/packages/backend/src/core/entities/AppEntityService.ts index 0b4c3935c..0a739d33c 100644 --- a/packages/backend/src/core/entities/AppEntityService.ts +++ b/packages/backend/src/core/entities/AppEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AccessTokensRepository, AppsRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { App } from '@/models/entities/App.js'; import type { User } from '@/models/entities/User.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/BlockingEntityService.ts b/packages/backend/src/core/entities/BlockingEntityService.ts index e169c7e90..77e8cae18 100644 --- a/packages/backend/src/core/entities/BlockingEntityService.ts +++ b/packages/backend/src/core/entities/BlockingEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { BlockingsRepository } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { Blocking } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/ChannelEntityService.ts b/packages/backend/src/core/entities/ChannelEntityService.ts index 15ffd4486..4522dc791 100644 --- a/packages/backend/src/core/entities/ChannelEntityService.ts +++ b/packages/backend/src/core/entities/ChannelEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NoteUnreadsRepository, NotesRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Channel } from '@/models/entities/Channel.js'; diff --git a/packages/backend/src/core/entities/ClipEntityService.ts b/packages/backend/src/core/entities/ClipEntityService.ts index 33d3c5380..e3dbc33c8 100644 --- a/packages/backend/src/core/entities/ClipEntityService.ts +++ b/packages/backend/src/core/entities/ClipEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { Clip } from '@/models/entities/Clip.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/DriveFileEntityService.ts b/packages/backend/src/core/entities/DriveFileEntityService.ts index d82f36d97..038caf34a 100644 --- a/packages/backend/src/core/entities/DriveFileEntityService.ts +++ b/packages/backend/src/core/entities/DriveFileEntityService.ts @@ -3,7 +3,7 @@ import { DataSource, In } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { NotesRepository, DriveFilesRepository } from '@/models/index.js'; import type { Config } from '@/config.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { User } from '@/models/entities/User.js'; import type { DriveFile } from '@/models/entities/DriveFile.js'; diff --git a/packages/backend/src/core/entities/DriveFolderEntityService.ts b/packages/backend/src/core/entities/DriveFolderEntityService.ts index 13929b145..21aca8a70 100644 --- a/packages/backend/src/core/entities/DriveFolderEntityService.ts +++ b/packages/backend/src/core/entities/DriveFolderEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { DriveFolder } from '@/models/entities/DriveFolder.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/EmojiEntityService.ts b/packages/backend/src/core/entities/EmojiEntityService.ts index 3bad048bc..ba9e4dcc1 100644 --- a/packages/backend/src/core/entities/EmojiEntityService.ts +++ b/packages/backend/src/core/entities/EmojiEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { EmojisRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.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 e52a59188..c9f2a9745 100644 --- a/packages/backend/src/core/entities/FlashEntityService.ts +++ b/packages/backend/src/core/entities/FlashEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Flash } from '@/models/entities/Flash.js'; diff --git a/packages/backend/src/core/entities/FollowingEntityService.ts b/packages/backend/src/core/entities/FollowingEntityService.ts index 55ba4e67a..2d02ce0fe 100644 --- a/packages/backend/src/core/entities/FollowingEntityService.ts +++ b/packages/backend/src/core/entities/FollowingEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Following } from '@/models/entities/Following.js'; diff --git a/packages/backend/src/core/entities/GalleryPostEntityService.ts b/packages/backend/src/core/entities/GalleryPostEntityService.ts index 632c75304..359b9e840 100644 --- a/packages/backend/src/core/entities/GalleryPostEntityService.ts +++ b/packages/backend/src/core/entities/GalleryPostEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { GalleryPost } from '@/models/entities/GalleryPost.js'; diff --git a/packages/backend/src/core/entities/HashtagEntityService.ts b/packages/backend/src/core/entities/HashtagEntityService.ts index 2cd79b8f8..2c05759d6 100644 --- a/packages/backend/src/core/entities/HashtagEntityService.ts +++ b/packages/backend/src/core/entities/HashtagEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { HashtagsRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.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'; diff --git a/packages/backend/src/core/entities/InstanceEntityService.ts b/packages/backend/src/core/entities/InstanceEntityService.ts index 3bf84ed37..56ce01d7c 100644 --- a/packages/backend/src/core/entities/InstanceEntityService.ts +++ b/packages/backend/src/core/entities/InstanceEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { InstancesRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { Instance } from '@/models/entities/Instance.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/core/entities/MutingEntityService.ts b/packages/backend/src/core/entities/MutingEntityService.ts index 561d53292..8a0387f78 100644 --- a/packages/backend/src/core/entities/MutingEntityService.ts +++ b/packages/backend/src/core/entities/MutingEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Muting } from '@/models/entities/Muting.js'; diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 32269a410..7337e3358 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -3,7 +3,7 @@ import { DataSource, In } from 'typeorm'; import * as mfm from 'mfm-js'; import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { nyaize } from '@/misc/nyaize.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { User } from '@/models/entities/User.js'; diff --git a/packages/backend/src/core/entities/NoteReactionEntityService.ts b/packages/backend/src/core/entities/NoteReactionEntityService.ts index 8f943ba24..7f927b1e1 100644 --- a/packages/backend/src/core/entities/NoteReactionEntityService.ts +++ b/packages/backend/src/core/entities/NoteReactionEntityService.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NoteReactionsRepository } from '@/models/index.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { bindThis } from '@/decorators.js'; import type { OnModuleInit } from '@nestjs/common'; import type { } from '@/models/entities/Blocking.js'; diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index d6ead0136..a5f2fe624 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -6,7 +6,7 @@ import type { AccessTokensRepository, FollowRequestsRepository, NoteReactionsRep 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { bindThis } from '@/decorators.js'; import { isNotNull } from '@/misc/is-not-null.js'; import { notificationTypes } from 'misskey-js'; diff --git a/packages/backend/src/core/entities/PageEntityService.ts b/packages/backend/src/core/entities/PageEntityService.ts index d6da85663..ee692a72b 100644 --- a/packages/backend/src/core/entities/PageEntityService.ts +++ b/packages/backend/src/core/entities/PageEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Page } from '@/models/entities/Page.js'; diff --git a/packages/backend/src/core/entities/RenoteMutingEntityService.ts b/packages/backend/src/core/entities/RenoteMutingEntityService.ts index f8871e049..ef4ea7a79 100644 --- a/packages/backend/src/core/entities/RenoteMutingEntityService.ts +++ b/packages/backend/src/core/entities/RenoteMutingEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; 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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { RenoteMuting } from '@/models/entities/RenoteMuting.js'; diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index cb0b15fac..c3339fa58 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -5,7 +5,7 @@ import Ajv from 'ajv'; import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; 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'; @@ -28,7 +28,7 @@ type IsMeAndIsUserDetailed : ExpectsMe extends false ? Packed<'UserDetailedNotMe'> : - Packed<'UserDetailed'> : + (Packed<'MeDetailed'> | Packed<'UserDetailedNotMe'>) : Packed<'UserLite'>; const ajv = new Ajv(); @@ -290,7 +290,7 @@ export class UserEntityService implements OnModuleInit { return `${this.config.url}/users/${userId}`; } - public async pack( + public async pack>( src: User['id'] | User, me?: { id: User['id']; } | null | undefined, options?: { @@ -298,7 +298,7 @@ export class UserEntityService implements OnModuleInit { includeSecrets?: boolean, userProfile?: UserProfile, }, - ): Promise> { + ): Promise { const opts = Object.assign({ detail: false, includeSecrets: false, @@ -499,19 +499,19 @@ export class UserEntityService implements OnModuleInit { isMuted: relation.isMuted, isRenoteMuted: relation.isRenoteMuted, } : {}), - } as Promiseable> as Promiseable>; + } as Promiseable; return await awaitAll(packed); } - public packMany( + public packMany>( users: (User['id'] | User)[], me?: { id: User['id'] } | null | undefined, options?: { detail?: D, includeSecrets?: boolean, }, - ): Promise[]> { - return Promise.all(users.map(u => this.pack(u, me, options))); + ): Promise { + return Promise.all(users.map(u => this.pack(u, me, options))); } } diff --git a/packages/backend/src/core/entities/UserListEntityService.ts b/packages/backend/src/core/entities/UserListEntityService.ts index 2461cb2c1..2348dd3c3 100644 --- a/packages/backend/src/core/entities/UserListEntityService.ts +++ b/packages/backend/src/core/entities/UserListEntityService.ts @@ -1,7 +1,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 '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { } from '@/models/entities/Blocking.js'; import type { UserList } from '@/models/entities/UserList.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/misc/get-note-summary.ts b/packages/backend/src/misc/get-note-summary.ts index 964f20b25..4923ecbcc 100644 --- a/packages/backend/src/misc/get-note-summary.ts +++ b/packages/backend/src/misc/get-note-summary.ts @@ -1,4 +1,4 @@ -import type { Packed } from './json-schema.js'; +import type { Packed } from 'misskey-js'; /** * 投稿を表す文字列を取得します。 diff --git a/packages/backend/src/misc/is-instance-muted.ts b/packages/backend/src/misc/is-instance-muted.ts index 73ad0b3b8..00834414f 100644 --- a/packages/backend/src/misc/is-instance-muted.ts +++ b/packages/backend/src/misc/is-instance-muted.ts @@ -1,4 +1,4 @@ -import type { Packed } from './json-schema.js'; +import type { Packed } from 'misskey-js'; export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set): boolean { if (mutedInstances.has(note.user.host ?? '')) return true; diff --git a/packages/backend/src/models/entities/Notification.ts b/packages/backend/src/models/entities/Notification.ts index e0bd80425..81cf4182a 100644 --- a/packages/backend/src/models/entities/Notification.ts +++ b/packages/backend/src/models/entities/Notification.ts @@ -1,4 +1,4 @@ -import { notificationTypes } from 'misskey-js'; +import { ACHIEVEMENT_TYPES, notificationTypes } from 'misskey-js'; import { User } from './User.js'; import { Note } from './Note.js'; import { FollowRequest } from './FollowRequest.js'; @@ -39,7 +39,7 @@ export type Notification = { choice: number | null; - achievement: string | null; + achievement: typeof ACHIEVEMENT_TYPES[number] | null; /** * アプリ通知のbody diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 09bd7cbff..391080cdf 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -1,4 +1,4 @@ -import type { Schema } from '@/misc/json-schema.js'; +import type { JSONSchema7 } from 'schema-type'; import { RolePolicies } from '@/core/RoleService.js'; import * as ep___admin_meta from './endpoints/admin/meta.js'; @@ -686,7 +686,7 @@ export interface IEndpointMeta { }; }; - readonly res?: Schema; + readonly res?: JSONSchema7; /** * このエンドポイントにリクエストするのにユーザー情報が必須か否か @@ -775,7 +775,7 @@ export interface IEndpointMeta { export interface IEndpoint { name: string; meta: IEndpointMeta; - params: Schema; + params: JSONSchema7; } const endpoints: IEndpoint[] = (eps as [string, any]).map(([name, ep]) => { diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts index 6af2ba8bd..ecde38b1e 100644 --- a/packages/backend/src/server/api/openapi/schemas.ts +++ b/packages/backend/src/server/api/openapi/schemas.ts @@ -1,7 +1,7 @@ -import type { Schema } from '@/misc/json-schema.js'; +import type { JSONSchema7 } from 'schema-type'; import { refs } from 'misskey-js'; -export function convertSchemaToOpenApiSchema(schema: Schema) { +export function convertSchemaToOpenApiSchema(schema: JSONSchema7) { const res: any = schema; if (schema.type === 'object' && schema.properties) { diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 9e5b40997..8f277918c 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { isUserRelated } from '@/misc/is-user-related.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; import Channel from '../channel.js'; diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 5454836fe..7132daffb 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { checkWordMute } from '@/misc/check-word-mute.js'; import { isInstanceMuted } from '@/misc/is-instance-muted.js'; import { isUserRelated } from '@/misc/is-user-related.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { MetaService } from '@/core/MetaService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts index 0268fdedd..f5def0e3e 100644 --- a/packages/backend/src/server/api/stream/channels/hashtag.ts +++ b/packages/backend/src/server/api/stream/channels/hashtag.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { isUserRelated } from '@/misc/is-user-related.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; import Channel from '../channel.js'; diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index ee874ad81..50ba9cb43 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { checkWordMute } from '@/misc/check-word-mute.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { isInstanceMuted } from '@/misc/is-instance-muted.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; import Channel from '../channel.js'; diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 4f7b4e78b..c238e7408 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { checkWordMute } from '@/misc/check-word-mute.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { isInstanceMuted } from '@/misc/is-instance-muted.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { MetaService } from '@/core/MetaService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 09b0005ac..b1120b72d 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { checkWordMute } from '@/misc/check-word-mute.js'; import { isUserRelated } from '@/misc/is-user-related.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { MetaService } from '@/core/MetaService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts index 9d106c8b2..fe7c84bd8 100644 --- a/packages/backend/src/server/api/stream/channels/role-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { isUserRelated } from '@/misc/is-user-related.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { bindThis } from '@/decorators.js'; import Channel from '../channel.js'; diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index 8802fc5ab..877f48585 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UserListJoiningsRepository, UserListsRepository } from '@/models/index.js'; import type { User } from '@/models/entities/User.js'; import { isUserRelated } from '@/misc/is-user-related.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/stream/index.ts b/packages/backend/src/server/api/stream/index.ts index a6f914595..20f401ccf 100644 --- a/packages/backend/src/server/api/stream/index.ts +++ b/packages/backend/src/server/api/stream/index.ts @@ -1,6 +1,6 @@ import type { User } from '@/models/entities/User.js'; import type { AccessToken } from '@/models/entities/AccessToken.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { NoteReadService } from '@/core/NoteReadService.js'; import type { NotificationService } from '@/core/NotificationService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/stream/types.ts b/packages/backend/src/server/api/stream/types.ts index d9dba682c..03884ecc1 100644 --- a/packages/backend/src/server/api/stream/types.ts +++ b/packages/backend/src/server/api/stream/types.ts @@ -9,7 +9,7 @@ import type { UserList } from '@/models/entities/UserList.js'; import type { AbuseUserReport } from '@/models/entities/AbuseUserReport.js'; import type { Signin } from '@/models/entities/Signin.js'; import type { Page } from '@/models/entities/Page.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import type { Webhook } from '@/models/entities/Webhook.js'; import type { Meta } from '@/models/entities/Meta.js'; import { Role, RoleAssignment } from '@/models'; diff --git a/packages/backend/test/e2e/clips.ts b/packages/backend/test/e2e/clips.ts index f35aae9dc..9b938342e 100644 --- a/packages/backend/test/e2e/clips.ts +++ b/packages/backend/test/e2e/clips.ts @@ -3,7 +3,7 @@ process.env.NODE_ENV = 'test'; import * as assert from 'assert'; import { JTDDataType } from 'ajv/dist/jtd'; import { DEFAULT_POLICIES } from '@/core/RoleService.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { paramDef as CreateParamDef } from '@/server/api/endpoints/clips/create.js'; import { paramDef as UpdateParamDef } from '@/server/api/endpoints/clips/update.js'; import { paramDef as DeleteParamDef } from '@/server/api/endpoints/clips/delete.js'; diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 640fa71a7..046e7d613 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -3,7 +3,7 @@ process.env.NODE_ENV = 'test'; import * as assert from 'assert'; import { inspect } from 'node:util'; import { DEFAULT_POLICIES } from '@/core/RoleService.js'; -import type { Packed } from '@/misc/json-schema.js'; +import type { Packed } from 'misskey-js'; import { signup, post, diff --git a/packages/misskey-js/src/schemas.ts b/packages/misskey-js/src/schemas.ts index ddf213a46..b0edd395f 100644 --- a/packages/misskey-js/src/schemas.ts +++ b/packages/misskey-js/src/schemas.ts @@ -8,10 +8,13 @@ import { packedUserDetailedSchema, packedUserSchema, } from './schemas/user.js'; +import { + packedNotificationSchema, + packedNotificationStrictSchema, +} from './schemas/notification.js'; import { packedNoteSchema } from './schemas/note.js'; import { packedUserListSchema } from './schemas/user-list.js'; import { packedAppSchema } from './schemas/app.js'; -import { packedNotificationSchema } from './schemas/notification.js'; import { packedDriveFileSchema } from './schemas/drive-file.js'; import { packedDriveFolderSchema } from './schemas/drive-folder.js'; import { packedFollowingSchema } from './schemas/following.js'; @@ -49,6 +52,7 @@ export const refs = { NoteReaction: packedNoteReactionSchema, NoteFavorite: packedNoteFavoriteSchema, Notification: packedNotificationSchema, + NotificationStrict: packedNotificationStrictSchema, DriveFile: packedDriveFileSchema, DriveFolder: packedDriveFolderSchema, Following: packedFollowingSchema, diff --git a/packages/misskey-js/src/schemas/drive-file.ts b/packages/misskey-js/src/schemas/drive-file.ts index 78f1e3238..35d3e1528 100644 --- a/packages/misskey-js/src/schemas/drive-file.ts +++ b/packages/misskey-js/src/schemas/drive-file.ts @@ -111,7 +111,7 @@ export const packedDriveFileSchema = { 'md5', 'size', 'isSensitive', - 'burlhash', + 'blurhash', 'properties', 'url', 'thumbnailUrl', diff --git a/packages/misskey-js/src/schemas/note.ts b/packages/misskey-js/src/schemas/note.ts index 67b1a79c8..2756a2029 100644 --- a/packages/misskey-js/src/schemas/note.ts +++ b/packages/misskey-js/src/schemas/note.ts @@ -17,10 +17,10 @@ export const packedNoteSchema = { }, { type: 'null' }], }, text: { - type: 'string', + type: ['string', 'null'], }, cw: { - oneOf: [{ type: 'string' }, { type: 'null' }], + type: ['string', 'null'], }, userId: { $ref: 'https://misskey-hub.net/api/schemas/Id', diff --git a/packages/misskey-js/src/schemas/notification.ts b/packages/misskey-js/src/schemas/notification.ts index ea566645a..ca13ade2f 100644 --- a/packages/misskey-js/src/schemas/notification.ts +++ b/packages/misskey-js/src/schemas/notification.ts @@ -1,117 +1,155 @@ import type { JSONSchema7Definition } from 'schema-type'; -import { ACHIEVEMENT_TYPES } from '../consts'; +import { ACHIEVEMENT_TYPES, notificationTypes } from '../consts'; export const packedNotificationSchema = { $id: 'https://misskey-hub.net/api/schemas/Notification', + type: 'object', + properties: { + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + createdAt: { + type: 'string', + format: 'date-time', + }, + type: { + type: 'string', + enum: [...notificationTypes], + }, + userId: { + oneOf: [ + { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + { type: 'null' }, + ] + }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + reaction: { type: ['string', 'null'] }, + achievement: { + oneOf: [ + { enum: [...ACHIEVEMENT_TYPES] }, + { type: 'null' }, + ], + }, + header: { type: ['string', 'null'] }, + body: { type: ['string', 'null'] }, + icon: { type: ['string', 'null'] }, + }, + required: ['id', 'createdAt'], +} as const satisfies JSONSchema7Definition; + +export const packedNotificationStrictSchema = { + $id: 'https://misskey-hub.net/api/schemas/PackedNotificationStrict', type: 'object', - allOf: [{ - type: 'object', - properties: { - id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - createdAt: { - type: 'string', - format: 'date-time', - }, - }, - required: ['id', 'createdAt'], - }, { - oneOf: [ + allOf: [ { type: 'object', properties: { - type: { const: 'follow' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + createdAt: { + type: 'string', + format: 'date-time', + }, }, - required: ['type', 'userId', 'user'], - }, { + required: ['id', 'createdAt'], + }, + { type: 'object', - properties: { - type: { const: 'mention' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, - }, - required: ['type', 'userId', 'user', 'note'], - }, { - type: 'object', - properties: { - type: { const: 'reply' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, - }, - required: ['type', 'userId', 'user', 'note'], - }, { - type: 'object', - properties: { - type: { const: 'renote' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, - }, - required: ['type', 'userId', 'user', 'note'], - }, { - type: 'object', - properties: { - type: { const: 'quote' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, - }, - required: ['type', 'userId', 'user', 'note'], - }, { - type: 'object', - properties: { - type: { const: 'reaction' }, - reaction: { type: 'string' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, - }, - required: ['type', 'reaction', 'userId', 'user', 'note'], - }, { - type: 'object', - properties: { - type: { const: 'pollEnded' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, - }, - required: ['type', 'userId', 'user', 'note'], - }, { - type: 'object', - properties: { - type: { const: 'receiveFollowRequest' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - }, - required: ['type', 'userId', 'user'], - }, { - type: 'object', - properties: { - type: { const: 'followRequestAccepted' }, - userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, - user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, - }, - required: ['type', 'userId', 'user'], - }, { - type: 'object', - properties: { - type: { const: 'achievementEarned' }, - achievement: { enum: [...ACHIEVEMENT_TYPES] }, - }, - required: ['type', 'achievement'], - }, { - type: 'object', - properties: { - type: { const: 'app' }, - header: { type: ['string', 'null'] }, - body: { type: 'string' }, - icon: { type: ['string', 'null'] }, - }, - required: ['type'], - }], - }], + oneOf: [{ + type: 'object', + properties: { + type: { const: 'follow' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + }, + required: ['type', 'userId', 'user'], + }, { + type: 'object', + properties: { + type: { const: 'mention' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + }, + required: ['type', 'userId', 'user', 'note'], + }, { + type: 'object', + properties: { + type: { const: 'reply' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + }, + required: ['type', 'userId', 'user', 'note'], + }, { + type: 'object', + properties: { + type: { const: 'renote' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + }, + required: ['type', 'userId', 'user', 'note'], + }, { + type: 'object', + properties: { + type: { const: 'quote' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + }, + required: ['type', 'userId', 'user', 'note'], + }, { + type: 'object', + properties: { + type: { const: 'reaction' }, + reaction: { type: 'string' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + }, + required: ['type', 'reaction', 'userId', 'user', 'note'], + }, { + type: 'object', + properties: { + type: { const: 'pollEnded' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + note: { $ref: 'https://misskey-hub.net/api/schemas/Note' }, + }, + required: ['type', 'userId', 'user', 'note'], + }, { + type: 'object', + properties: { + type: { const: 'receiveFollowRequest' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + }, + required: ['type', 'userId', 'user'], + }, { + type: 'object', + properties: { + type: { const: 'followRequestAccepted' }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, + }, + required: ['type', 'userId', 'user'], + }, { + type: 'object', + properties: { + type: { const: 'achievementEarned' }, + achievement: { enum: [...ACHIEVEMENT_TYPES] }, + }, + required: ['type', 'achievement'], + }, { + type: 'object', + properties: { + type: { const: 'app' }, + header: { type: ['string', 'null'] }, + body: { type: 'string' }, + icon: { type: ['string', 'null'] }, + }, + required: ['type'], + }], + }, + ], } as const satisfies JSONSchema7Definition; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7badfa713..da4a99a6f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -623,7 +623,7 @@ importers: version: 29.5.0 schema-type: specifier: github:misskey-dev/schema-type - version: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4) + version: github.com/misskey-dev/schema-type/95e048769927fe897731f4c4f2c9a4fefeded5fc(typescript@5.0.4) packages/frontend: dependencies: @@ -1023,7 +1023,7 @@ importers: version: 4.4.0 schema-type: specifier: github:misskey-dev/schema-type - version: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4) + version: github.com/misskey-dev/schema-type/95e048769927fe897731f4c4f2c9a4fefeded5fc(typescript@5.0.4) ts-essentials: specifier: ^9.3.2 version: 9.3.2(typescript@5.0.4) @@ -20323,9 +20323,9 @@ packages: version: 2.2.1-misskey.3 dev: false - github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4): - resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/c771673a44d514658d4d5a4dd2c201b2294f225b} - id: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b + github.com/misskey-dev/schema-type/95e048769927fe897731f4c4f2c9a4fefeded5fc(typescript@5.0.4): + resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/95e048769927fe897731f4c4f2c9a4fefeded5fc} + id: github.com/misskey-dev/schema-type/95e048769927fe897731f4c4f2c9a4fefeded5fc name: schema-type version: 1.0.0 dependencies: