wip~~
This commit is contained in:
parent
ac99cdce8b
commit
4f5d77391f
50 changed files with 218 additions and 171 deletions
|
@ -10,7 +10,7 @@ import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { PushNotificationService } from '@/core/PushNotificationService.js';
|
import { PushNotificationService } from '@/core/PushNotificationService.js';
|
||||||
import * as Acct from '@/misc/acct.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 { DI } from '@/di-symbols.js';
|
||||||
import type { MutingsRepository, NotesRepository, AntennasRepository, UserListJoiningsRepository } from '@/models/index.js';
|
import type { MutingsRepository, NotesRepository, AntennasRepository, UserListJoiningsRepository } from '@/models/index.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
|
|
|
@ -16,7 +16,7 @@ import type {
|
||||||
UserListStreamTypes,
|
UserListStreamTypes,
|
||||||
RoleTimelineStreamTypes,
|
RoleTimelineStreamTypes,
|
||||||
} from '@/server/api/stream/types.js';
|
} 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 { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { User } from '@/models/entities/User.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 type { Note } from '@/models/entities/Note.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import push from 'web-push';
|
||||||
import * as Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
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 '@/misc/json-schema';
|
import type { Packed } from 'misskey-js';
|
||||||
import { getNoteSummary } from '@/misc/get-note-summary.js';
|
import { getNoteSummary } from '@/misc/get-note-summary.js';
|
||||||
import type { SwSubscription, SwSubscriptionsRepository } from '@/models/index.js';
|
import type { SwSubscription, SwSubscriptionsRepository } from '@/models/index.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { StreamMessages } from '@/server/api/stream/types.js';
|
import { StreamMessages } from '@/server/api/stream/types.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.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';
|
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||||
|
|
||||||
export type RolePolicies = {
|
export type RolePolicies = {
|
||||||
|
|
|
@ -107,7 +107,10 @@ export class UserBlockingService implements OnModuleInit {
|
||||||
if (this.userEntityService.isLocalUser(followee)) {
|
if (this.userEntityService.isLocalUser(followee)) {
|
||||||
this.userEntityService.pack(followee, followee, {
|
this.userEntityService.pack(followee, followee, {
|
||||||
detail: true,
|
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) {
|
if (this.userEntityService.isLocalUser(follower) && !silent) {
|
||||||
|
@ -122,6 +125,8 @@ export class UserBlockingService implements OnModuleInit {
|
||||||
user: packed,
|
user: packed,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return packed; // somehow this is needed by typescript
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.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 InstanceChart from '@/core/chart/charts/instance.js';
|
||||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||||
import { WebhookService } from '@/core/WebhookService.js';
|
import { WebhookService } from '@/core/WebhookService.js';
|
||||||
|
@ -267,7 +267,7 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
this.userEntityService.pack(followee.id, follower, {
|
this.userEntityService.pack(followee.id, follower, {
|
||||||
detail: true,
|
detail: true,
|
||||||
}).then(async packed => {
|
}).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'));
|
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === follower.id && x.on.includes('follow'));
|
||||||
for (const webhook of webhooks) {
|
for (const webhook of webhooks) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
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';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { AccessTokensRepository, AppsRepository } from '@/models/index.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 { App } from '@/models/entities/App.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { BlockingsRepository } from '@/models/index.js';
|
import type { BlockingsRepository } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.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 { Blocking } from '@/models/entities/Blocking.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { DataSource, In } from 'typeorm';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-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';
|
||||||
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
import type { DriveFile } from '@/models/entities/DriveFile.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { EmojisRepository } from '@/models/index.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 { } from '@/models/entities/Blocking.js';
|
||||||
import type { Emoji } from '@/models/entities/Emoji.js';
|
import type { Emoji } from '@/models/entities/Emoji.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { HashtagsRepository } from '@/models/index.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 { } from '@/models/entities/Blocking.js';
|
||||||
import type { Hashtag } from '@/models/entities/Hashtag.js';
|
import type { Hashtag } from '@/models/entities/Hashtag.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { DataSource, In } from 'typeorm';
|
||||||
import * as mfm from 'mfm-js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
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';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { OnModuleInit } from '@nestjs/common';
|
import type { OnModuleInit } from '@nestjs/common';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
|
|
|
@ -6,7 +6,7 @@ import type { AccessTokensRepository, FollowRequestsRepository, NoteReactionsRep
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
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';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Ajv from 'ajv';
|
||||||
import { ModuleRef } from '@nestjs/core';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
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';
|
||||||
|
@ -28,7 +28,7 @@ type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends bo
|
||||||
Detailed extends true ?
|
Detailed extends true ?
|
||||||
ExpectsMe extends true ? Packed<'MeDetailed'> :
|
ExpectsMe extends true ? Packed<'MeDetailed'> :
|
||||||
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
|
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
|
||||||
Packed<'UserDetailed'> :
|
(Packed<'MeDetailed'> | Packed<'UserDetailedNotMe'>) :
|
||||||
Packed<'UserLite'>;
|
Packed<'UserLite'>;
|
||||||
|
|
||||||
const ajv = new Ajv();
|
const ajv = new Ajv();
|
||||||
|
@ -290,7 +290,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
return `${this.config.url}/users/${userId}`;
|
return `${this.config.url}/users/${userId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async pack<ExpectsMe extends boolean | null = null, D extends boolean = false>(
|
public async pack<ExpectsMe extends boolean | null = null, D extends boolean = false, R = IsMeAndIsUserDetailed<ExpectsMe, D>>(
|
||||||
src: User['id'] | User,
|
src: User['id'] | User,
|
||||||
me?: { id: User['id']; } | null | undefined,
|
me?: { id: User['id']; } | null | undefined,
|
||||||
options?: {
|
options?: {
|
||||||
|
@ -298,7 +298,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
includeSecrets?: boolean,
|
includeSecrets?: boolean,
|
||||||
userProfile?: UserProfile,
|
userProfile?: UserProfile,
|
||||||
},
|
},
|
||||||
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> {
|
): Promise<R> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
detail: false,
|
detail: false,
|
||||||
includeSecrets: false,
|
includeSecrets: false,
|
||||||
|
@ -499,19 +499,19 @@ export class UserEntityService implements OnModuleInit {
|
||||||
isMuted: relation.isMuted,
|
isMuted: relation.isMuted,
|
||||||
isRenoteMuted: relation.isRenoteMuted,
|
isRenoteMuted: relation.isRenoteMuted,
|
||||||
} : {}),
|
} : {}),
|
||||||
} as Promiseable<Packed<'User'>> as Promiseable<IsMeAndIsUserDetailed<ExpectsMe, D>>;
|
} as Promiseable<R>;
|
||||||
|
|
||||||
return await awaitAll(packed);
|
return await awaitAll(packed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public packMany<D extends boolean = false>(
|
public packMany<D extends boolean = false, R = IsUserDetailed<D>>(
|
||||||
users: (User['id'] | User)[],
|
users: (User['id'] | User)[],
|
||||||
me?: { id: User['id'] } | null | undefined,
|
me?: { id: User['id'] } | null | undefined,
|
||||||
options?: {
|
options?: {
|
||||||
detail?: D,
|
detail?: D,
|
||||||
includeSecrets?: boolean,
|
includeSecrets?: boolean,
|
||||||
},
|
},
|
||||||
): Promise<IsUserDetailed<D>[]> {
|
): Promise<R[]> {
|
||||||
return Promise.all(users.map(u => this.pack(u, me, options)));
|
return Promise.all(users.map(u => this.pack<null, D, R>(u, me, options)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
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 '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import type { } from '@/models/entities/Blocking.js';
|
import type { } from '@/models/entities/Blocking.js';
|
||||||
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';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Packed } from './json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投稿を表す文字列を取得します。
|
* 投稿を表す文字列を取得します。
|
||||||
|
|
|
@ -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<string>): boolean {
|
export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean {
|
||||||
if (mutedInstances.has(note.user.host ?? '')) return true;
|
if (mutedInstances.has(note.user.host ?? '')) return true;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { notificationTypes } from 'misskey-js';
|
import { ACHIEVEMENT_TYPES, notificationTypes } from 'misskey-js';
|
||||||
import { User } from './User.js';
|
import { User } from './User.js';
|
||||||
import { Note } from './Note.js';
|
import { Note } from './Note.js';
|
||||||
import { FollowRequest } from './FollowRequest.js';
|
import { FollowRequest } from './FollowRequest.js';
|
||||||
|
@ -39,7 +39,7 @@ export type Notification = {
|
||||||
|
|
||||||
choice: number | null;
|
choice: number | null;
|
||||||
|
|
||||||
achievement: string | null;
|
achievement: typeof ACHIEVEMENT_TYPES[number] | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* アプリ通知のbody
|
* アプリ通知のbody
|
||||||
|
|
|
@ -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 { RolePolicies } from '@/core/RoleService.js';
|
||||||
|
|
||||||
import * as ep___admin_meta from './endpoints/admin/meta.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 {
|
export interface IEndpoint {
|
||||||
name: string;
|
name: string;
|
||||||
meta: IEndpointMeta;
|
meta: IEndpointMeta;
|
||||||
params: Schema;
|
params: JSONSchema7;
|
||||||
}
|
}
|
||||||
|
|
||||||
const endpoints: IEndpoint[] = (eps as [string, any]).map(([name, ep]) => {
|
const endpoints: IEndpoint[] = (eps as [string, any]).map(([name, ep]) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Schema } from '@/misc/json-schema.js';
|
import type { JSONSchema7 } from 'schema-type';
|
||||||
import { refs } from 'misskey-js';
|
import { refs } from 'misskey-js';
|
||||||
|
|
||||||
export function convertSchemaToOpenApiSchema(schema: Schema) {
|
export function convertSchemaToOpenApiSchema(schema: JSONSchema7) {
|
||||||
const res: any = schema;
|
const res: any = schema;
|
||||||
|
|
||||||
if (schema.type === 'object' && schema.properties) {
|
if (schema.type === 'object' && schema.properties) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import Channel from '../channel.js';
|
import Channel from '../channel.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.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 { MetaService } from '@/core/MetaService.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import Channel from '../channel.js';
|
import Channel from '../channel.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import Channel from '../channel.js';
|
import Channel from '../channel.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.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 { MetaService } from '@/core/MetaService.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.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 { MetaService } from '@/core/MetaService.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import Channel from '../channel.js';
|
import Channel from '../channel.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { UserListJoiningsRepository, UserListsRepository } from '@/models/index.js';
|
import type { UserListJoiningsRepository, UserListsRepository } from '@/models/index.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { AccessToken } from '@/models/entities/AccessToken.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 { NoteReadService } from '@/core/NoteReadService.js';
|
||||||
import type { NotificationService } from '@/core/NotificationService.js';
|
import type { NotificationService } from '@/core/NotificationService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type { UserList } from '@/models/entities/UserList.js';
|
||||||
import type { AbuseUserReport } from '@/models/entities/AbuseUserReport.js';
|
import type { AbuseUserReport } from '@/models/entities/AbuseUserReport.js';
|
||||||
import type { Signin } from '@/models/entities/Signin.js';
|
import type { Signin } from '@/models/entities/Signin.js';
|
||||||
import type { Page } from '@/models/entities/Page.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 { Webhook } from '@/models/entities/Webhook.js';
|
||||||
import type { Meta } from '@/models/entities/Meta.js';
|
import type { Meta } from '@/models/entities/Meta.js';
|
||||||
import { Role, RoleAssignment } from '@/models';
|
import { Role, RoleAssignment } from '@/models';
|
||||||
|
|
|
@ -3,7 +3,7 @@ process.env.NODE_ENV = 'test';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { JTDDataType } from 'ajv/dist/jtd';
|
import { JTDDataType } from 'ajv/dist/jtd';
|
||||||
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
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 CreateParamDef } from '@/server/api/endpoints/clips/create.js';
|
||||||
import { paramDef as UpdateParamDef } from '@/server/api/endpoints/clips/update.js';
|
import { paramDef as UpdateParamDef } from '@/server/api/endpoints/clips/update.js';
|
||||||
import { paramDef as DeleteParamDef } from '@/server/api/endpoints/clips/delete.js';
|
import { paramDef as DeleteParamDef } from '@/server/api/endpoints/clips/delete.js';
|
||||||
|
|
|
@ -3,7 +3,7 @@ process.env.NODE_ENV = 'test';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { inspect } from 'node:util';
|
import { inspect } from 'node:util';
|
||||||
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from 'misskey-js';
|
||||||
import {
|
import {
|
||||||
signup,
|
signup,
|
||||||
post,
|
post,
|
||||||
|
|
|
@ -8,10 +8,13 @@ import {
|
||||||
packedUserDetailedSchema,
|
packedUserDetailedSchema,
|
||||||
packedUserSchema,
|
packedUserSchema,
|
||||||
} from './schemas/user.js';
|
} from './schemas/user.js';
|
||||||
|
import {
|
||||||
|
packedNotificationSchema,
|
||||||
|
packedNotificationStrictSchema,
|
||||||
|
} from './schemas/notification.js';
|
||||||
import { packedNoteSchema } from './schemas/note.js';
|
import { packedNoteSchema } from './schemas/note.js';
|
||||||
import { packedUserListSchema } from './schemas/user-list.js';
|
import { packedUserListSchema } from './schemas/user-list.js';
|
||||||
import { packedAppSchema } from './schemas/app.js';
|
import { packedAppSchema } from './schemas/app.js';
|
||||||
import { packedNotificationSchema } from './schemas/notification.js';
|
|
||||||
import { packedDriveFileSchema } from './schemas/drive-file.js';
|
import { packedDriveFileSchema } from './schemas/drive-file.js';
|
||||||
import { packedDriveFolderSchema } from './schemas/drive-folder.js';
|
import { packedDriveFolderSchema } from './schemas/drive-folder.js';
|
||||||
import { packedFollowingSchema } from './schemas/following.js';
|
import { packedFollowingSchema } from './schemas/following.js';
|
||||||
|
@ -49,6 +52,7 @@ export const refs = {
|
||||||
NoteReaction: packedNoteReactionSchema,
|
NoteReaction: packedNoteReactionSchema,
|
||||||
NoteFavorite: packedNoteFavoriteSchema,
|
NoteFavorite: packedNoteFavoriteSchema,
|
||||||
Notification: packedNotificationSchema,
|
Notification: packedNotificationSchema,
|
||||||
|
NotificationStrict: packedNotificationStrictSchema,
|
||||||
DriveFile: packedDriveFileSchema,
|
DriveFile: packedDriveFileSchema,
|
||||||
DriveFolder: packedDriveFolderSchema,
|
DriveFolder: packedDriveFolderSchema,
|
||||||
Following: packedFollowingSchema,
|
Following: packedFollowingSchema,
|
||||||
|
|
|
@ -111,7 +111,7 @@ export const packedDriveFileSchema = {
|
||||||
'md5',
|
'md5',
|
||||||
'size',
|
'size',
|
||||||
'isSensitive',
|
'isSensitive',
|
||||||
'burlhash',
|
'blurhash',
|
||||||
'properties',
|
'properties',
|
||||||
'url',
|
'url',
|
||||||
'thumbnailUrl',
|
'thumbnailUrl',
|
||||||
|
|
|
@ -17,10 +17,10 @@ export const packedNoteSchema = {
|
||||||
}, { type: 'null' }],
|
}, { type: 'null' }],
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
type: 'string',
|
type: ['string', 'null'],
|
||||||
},
|
},
|
||||||
cw: {
|
cw: {
|
||||||
oneOf: [{ type: 'string' }, { type: 'null' }],
|
type: ['string', 'null'],
|
||||||
},
|
},
|
||||||
userId: {
|
userId: {
|
||||||
$ref: 'https://misskey-hub.net/api/schemas/Id',
|
$ref: 'https://misskey-hub.net/api/schemas/Id',
|
||||||
|
|
|
@ -1,11 +1,47 @@
|
||||||
import type { JSONSchema7Definition } from 'schema-type';
|
import type { JSONSchema7Definition } from 'schema-type';
|
||||||
import { ACHIEVEMENT_TYPES } from '../consts';
|
import { ACHIEVEMENT_TYPES, notificationTypes } from '../consts';
|
||||||
|
|
||||||
export const packedNotificationSchema = {
|
export const packedNotificationSchema = {
|
||||||
$id: 'https://misskey-hub.net/api/schemas/Notification',
|
$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',
|
type: 'object',
|
||||||
allOf: [{
|
allOf: [
|
||||||
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||||
|
@ -15,9 +51,10 @@ export const packedNotificationSchema = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: ['id', 'createdAt'],
|
required: ['id', 'createdAt'],
|
||||||
}, {
|
},
|
||||||
oneOf: [
|
|
||||||
{
|
{
|
||||||
|
type: 'object',
|
||||||
|
oneOf: [{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
type: { const: 'follow' },
|
type: { const: 'follow' },
|
||||||
|
@ -113,5 +150,6 @@ export const packedNotificationSchema = {
|
||||||
},
|
},
|
||||||
required: ['type'],
|
required: ['type'],
|
||||||
}],
|
}],
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
} as const satisfies JSONSchema7Definition;
|
} as const satisfies JSONSchema7Definition;
|
||||||
|
|
|
@ -623,7 +623,7 @@ importers:
|
||||||
version: 29.5.0
|
version: 29.5.0
|
||||||
schema-type:
|
schema-type:
|
||||||
specifier: github:misskey-dev/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:
|
packages/frontend:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -1023,7 +1023,7 @@ importers:
|
||||||
version: 4.4.0
|
version: 4.4.0
|
||||||
schema-type:
|
schema-type:
|
||||||
specifier: github:misskey-dev/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:
|
ts-essentials:
|
||||||
specifier: ^9.3.2
|
specifier: ^9.3.2
|
||||||
version: 9.3.2(typescript@5.0.4)
|
version: 9.3.2(typescript@5.0.4)
|
||||||
|
@ -20323,9 +20323,9 @@ packages:
|
||||||
version: 2.2.1-misskey.3
|
version: 2.2.1-misskey.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4):
|
github.com/misskey-dev/schema-type/95e048769927fe897731f4c4f2c9a4fefeded5fc(typescript@5.0.4):
|
||||||
resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/c771673a44d514658d4d5a4dd2c201b2294f225b}
|
resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/95e048769927fe897731f4c4f2c9a4fefeded5fc}
|
||||||
id: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b
|
id: github.com/misskey-dev/schema-type/95e048769927fe897731f4c4f2c9a4fefeded5fc
|
||||||
name: schema-type
|
name: schema-type
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue