diff --git a/package.json b/package.json index 264b50d66352b630ae812d911632ed57d8996405..7943d8187eb81049d3d963c2170622e661fc3f4c 100644 --- a/package.json +++ b/package.json @@ -226,7 +226,7 @@ "tslint": "5.15.0", "tslint-sonarts": "1.9.0", "typeorm": "0.2.16-rc.1", - "typescript": "3.3.3333", + "typescript": "3.5.2", "typescript-eslint-parser": "22.0.0", "uglify-es": "3.3.9", "ulid": "2.3.0", diff --git a/src/misc/schema.ts b/src/misc/schema.ts index 442c95ad988102685feacb084eca88cdefe10b79..e14e6e0dd79fab8a90bfe74ff2175a15656f5e47 100644 --- a/src/misc/schema.ts +++ b/src/misc/schema.ts @@ -1,17 +1,3 @@ -export const types = { - boolean: 'boolean' as 'boolean', - string: 'string' as 'string', - number: 'number' as 'number', - array: 'array' as 'array', - object: 'object' as 'object', - any: 'any' as 'any', -}; - -export const bool = { - true: true as true, - false: false as false, -}; - export type Schema = { type: 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any'; nullable: boolean; diff --git a/src/models/repositories/app.ts b/src/models/repositories/app.ts index 6562a470be698f71ca38317672b9feda345da597..45d8d16c516e353869cb037d61cf806e1695c814 100644 --- a/src/models/repositories/app.ts +++ b/src/models/repositories/app.ts @@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { App } from '../entities/app'; import { AccessTokens } from '..'; import { ensure } from '../../prelude/ensure'; -import { types, bool, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedApp = SchemaType<typeof packedAppSchema>; @@ -42,37 +42,37 @@ export class AppRepository extends Repository<App> { } export const packedAppSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this Note.', example: 'xxxxxxxxxx', }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'アプリケーションã®åå‰' }, callbackUrl: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, description: 'コールãƒãƒƒã‚¯ã™ã‚‹URL' }, permission: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, } }, secret: { - type: types.string, - optional: bool.true, nullable: bool.false, + type: 'string' as const, + optional: true as const, nullable: false as const, description: 'アプリケーションã®ã‚·ãƒ¼ã‚¯ãƒ¬ãƒƒãƒˆã‚ー' } }, diff --git a/src/models/repositories/blocking.ts b/src/models/repositories/blocking.ts index 6ee31cece82f302d2595768984b0d69c8a2e292f..9ebe6bbf59bcff0b880a6ed0a7e9452a19865687 100644 --- a/src/models/repositories/blocking.ts +++ b/src/models/repositories/blocking.ts @@ -3,7 +3,7 @@ import { Users } from '..'; import { Blocking } from '../entities/blocking'; import { ensure } from '../../prelude/ensure'; import { awaitAll } from '../../prelude/await-all'; -import { SchemaType, types, bool } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedBlocking = SchemaType<typeof packedBlockingSchema>; @@ -34,30 +34,30 @@ export class BlockingRepository extends Repository<Blocking> { } export const packedBlockingSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this blocking.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the blocking was created.' }, blockeeId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, blockee: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', description: 'The blockee.' }, diff --git a/src/models/repositories/drive-file.ts b/src/models/repositories/drive-file.ts index 5e7e1d40f4825e8145f23f8e7b34f49dcfa87e10..702f195e9da893f2cde2b976b3732c79323912f3 100644 --- a/src/models/repositories/drive-file.ts +++ b/src/models/repositories/drive-file.ts @@ -5,7 +5,7 @@ import { User } from '../entities/user'; import { toPuny } from '../../misc/convert-host'; import { ensure } from '../../prelude/ensure'; import { awaitAll } from '../../prelude/await-all'; -import { types, bool, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedDriveFile = SchemaType<typeof packedDriveFileSchema>; @@ -114,63 +114,63 @@ export class DriveFileRepository extends Repository<DriveFile> { } export const packedDriveFileSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this Drive file.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the Drive file was created on Misskey.' }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The file name with extension.', example: 'lenna.jpg' }, type: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The MIME type of this Drive file.', example: 'image/jpeg' }, md5: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'md5', description: 'The MD5 hash of this Drive file.', example: '15eca7fba0480996e2245f5185bf39f2' }, size: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'The size of this Drive file. (bytes)', example: 51469 }, url: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, format: 'url', description: 'The URL of this Drive file.', }, folderId: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, format: 'id', description: 'The parent folder ID of this Drive file.', example: 'xxxxxxxxxx', }, isSensitive: { - type: types.boolean, - optional: bool.false, nullable: bool.false, + type: 'boolean' as const, + optional: false as const, nullable: false as const, description: 'Whether this Drive file is sensitive.', }, }, diff --git a/src/models/repositories/drive-folder.ts b/src/models/repositories/drive-folder.ts index ef920c432683d809c22f409ae49a2660ad02a0ed..dee424cccbc84a00737035ea3ef4dd4d231a1443 100644 --- a/src/models/repositories/drive-folder.ts +++ b/src/models/repositories/drive-folder.ts @@ -3,7 +3,7 @@ import { DriveFolders, DriveFiles } from '..'; import { DriveFolder } from '../entities/drive-folder'; import { ensure } from '../../prelude/ensure'; import { awaitAll } from '../../prelude/await-all'; -import { SchemaType, types, bool } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedDriveFolder = SchemaType<typeof packedDriveFolderSchema>; @@ -53,47 +53,47 @@ export class DriveFolderRepository extends Repository<DriveFolder> { } export const packedDriveFolderSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this Drive folder.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the Drive folder was created.' }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The folder name.', }, foldersCount: { - type: types.number, - optional: bool.true, nullable: bool.false, + type: 'number' as const, + optional: true as const, nullable: false as const, description: 'The count of child folders.', }, filesCount: { - type: types.number, - optional: bool.true, nullable: bool.false, + type: 'number' as const, + optional: true as const, nullable: false as const, description: 'The count of child files.', }, parentId: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, format: 'id', description: 'The parent folder ID of this folder.', example: 'xxxxxxxxxx', }, parent: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, ref: 'DriveFolder' }, }, diff --git a/src/models/repositories/following.ts b/src/models/repositories/following.ts index 88fee749ae8e3be970cbe6a6356a817afdb29ac3..58728a338043a9e9ae2f0daf52561596f4cbb29e 100644 --- a/src/models/repositories/following.ts +++ b/src/models/repositories/following.ts @@ -3,7 +3,7 @@ import { Users } from '..'; import { Following } from '../entities/following'; import { ensure } from '../../prelude/ensure'; import { awaitAll } from '../../prelude/await-all'; -import { SchemaType, types, bool } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; type LocalFollowerFollowing = Following & { followerHost: null; @@ -88,41 +88,41 @@ export class FollowingRepository extends Repository<Following> { } export const packedFollowingSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this following.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the following was created.' }, followeeId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, followee: { - type: types.object, - optional: bool.true, nullable: bool.false, + type: 'object' as const, + optional: true as const, nullable: false as const, ref: 'User', description: 'The followee.' }, followerId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, follower: { - type: types.object, - optional: bool.true, nullable: bool.false, + type: 'object' as const, + optional: true as const, nullable: false as const, ref: 'User', description: 'The follower.' }, diff --git a/src/models/repositories/hashtag.ts b/src/models/repositories/hashtag.ts index a990fa3dcff2a65366a1172052d82d9b5564c145..fb54a12e136867a1b5806baf1fdd3f5f25a7d91d 100644 --- a/src/models/repositories/hashtag.ts +++ b/src/models/repositories/hashtag.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; import { Hashtag } from '../entities/hashtag'; -import { SchemaType, types, bool } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedHashtag = SchemaType<typeof packedHashtagSchema>; @@ -28,43 +28,43 @@ export class HashtagRepository extends Repository<Hashtag> { } export const packedHashtagSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { tag: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The hashtag name. No # prefixed.', example: 'misskey', }, mentionedUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Number of all users using this hashtag.' }, mentionedLocalUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Number of local users using this hashtag.' }, mentionedRemoteUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Number of remote users using this hashtag.' }, attachedUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Number of all users who attached this hashtag to profile.' }, attachedLocalUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Number of local users who attached this hashtag to profile.' }, attachedRemoteUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Number of remote users who attached this hashtag to profile.' }, } diff --git a/src/models/repositories/messaging-message.ts b/src/models/repositories/messaging-message.ts index 7f0b2047ad27654415e1375dab1bcb4c1ee4975f..d70e95bc122da7b0f8b34c1f0b9bc38751a6bb1e 100644 --- a/src/models/repositories/messaging-message.ts +++ b/src/models/repositories/messaging-message.ts @@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { MessagingMessage } from '../entities/messaging-message'; import { Users, DriveFiles, UserGroups } from '..'; import { ensure } from '../../prelude/ensure'; -import { types, bool, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedMessagingMessage = SchemaType<typeof packedMessagingMessageSchema>; @@ -46,76 +46,76 @@ export class MessagingMessageRepository extends Repository<MessagingMessage> { } export const packedMessagingMessageSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this MessagingMessage.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the MessagingMessage was created.' }, userId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, user: { - type: types.object, + type: 'object' as const, ref: 'User', - optional: bool.true, nullable: bool.false, + optional: true as const, nullable: false as const, }, text: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, }, fileId: { - type: types.string, - optional: bool.true, nullable: bool.true, + type: 'string' as const, + optional: true as const, nullable: true as const, format: 'id', }, file: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, ref: 'DriveFile', }, recipientId: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, format: 'id', }, recipient: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, ref: 'User' }, groupId: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, format: 'id', }, group: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, ref: 'UserGroup' }, isRead: { - type: types.boolean, - optional: bool.true, nullable: bool.false, + type: 'boolean' as const, + optional: true as const, nullable: false as const, }, reads: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id' } }, diff --git a/src/models/repositories/muting.ts b/src/models/repositories/muting.ts index 9d99e08a7c8a607b7dd48f67a6ddc63097bcb2d2..763e04bb3d7943dd3cf4c43106477ee40b515b81 100644 --- a/src/models/repositories/muting.ts +++ b/src/models/repositories/muting.ts @@ -3,7 +3,7 @@ import { Users } from '..'; import { Muting } from '../entities/muting'; import { ensure } from '../../prelude/ensure'; import { awaitAll } from '../../prelude/await-all'; -import { types, bool, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedMuting = SchemaType<typeof packedMutingSchema>; @@ -34,30 +34,30 @@ export class MutingRepository extends Repository<Muting> { } export const packedMutingSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this muting.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the muting was created.' }, muteeId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, mutee: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', description: 'The mutee.' }, diff --git a/src/models/repositories/note-favorite.ts b/src/models/repositories/note-favorite.ts index 01064f3065367d4ee03bbfcc2d5813925cf7a958..37cfbc0025b1a86c1c20df57fe6d0fefa7dd2248 100644 --- a/src/models/repositories/note-favorite.ts +++ b/src/models/repositories/note-favorite.ts @@ -2,7 +2,6 @@ import { EntityRepository, Repository } from 'typeorm'; import { NoteFavorite } from '../entities/note-favorite'; import { Notes } from '..'; import { ensure } from '../../prelude/ensure'; -import { types, bool } from '../../misc/schema'; @EntityRepository(NoteFavorite) export class NoteFavoriteRepository extends Repository<NoteFavorite> { @@ -29,30 +28,30 @@ export class NoteFavoriteRepository extends Repository<NoteFavorite> { } export const packedNoteFavoriteSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this favorite.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the favorite was created.' }, note: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', }, noteId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, }, diff --git a/src/models/repositories/note-reaction.ts b/src/models/repositories/note-reaction.ts index 85e5b6b0a1f15900a2f848c7fd01f4a780658331..79b4989a20851d20dd3fbdd183a0e44cfc9e7265 100644 --- a/src/models/repositories/note-reaction.ts +++ b/src/models/repositories/note-reaction.ts @@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { NoteReaction } from '../entities/note-reaction'; import { Users } from '..'; import { ensure } from '../../prelude/ensure'; -import { types, bool, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedNoteReaction = SchemaType<typeof packedNoteReactionSchema>; @@ -24,31 +24,31 @@ export class NoteReactionRepository extends Repository<NoteReaction> { } export const packedNoteReactionSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this reaction.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the reaction was created.' }, user: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', description: 'User who performed this reaction.' }, type: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The reaction type.' }, }, diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts index e5bf8d3f3a7191de1fab91e05c2c90d25dcbf1d4..3ac490b0016a7515bdab72fe7c9e1deedddf1038 100644 --- a/src/models/repositories/note.ts +++ b/src/models/repositories/note.ts @@ -5,7 +5,7 @@ import { unique, concat } from '../../prelude/array'; import { nyaize } from '../../misc/nyaize'; import { Emojis, Users, Apps, PollVotes, DriveFiles, NoteReactions, Followings, Polls } from '..'; import { ensure } from '../../prelude/ensure'; -import { SchemaType, types, bool } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; import { awaitAll } from '../../prelude/await-all'; export type PackedNote = SchemaType<typeof packedNoteSchema>; @@ -218,125 +218,125 @@ export class NoteRepository extends Repository<Note> { } export const packedNoteSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this Note.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the Note was created on Misskey.' }, text: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, }, cw: { - type: types.string, - optional: bool.true, nullable: bool.true, + type: 'string' as const, + optional: true as const, nullable: true as const, }, userId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, user: { - type: types.object, + type: 'object' as const, ref: 'User', - optional: bool.false, nullable: bool.false, + optional: false as const, nullable: false as const, }, replyId: { - type: types.string, - optional: bool.true, nullable: bool.true, + type: 'string' as const, + optional: true as const, nullable: true as const, format: 'id', example: 'xxxxxxxxxx', }, renoteId: { - type: types.string, - optional: bool.true, nullable: bool.true, + type: 'string' as const, + optional: true as const, nullable: true as const, format: 'id', example: 'xxxxxxxxxx', }, reply: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, ref: 'Note' }, renote: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, ref: 'Note' }, viaMobile: { - type: types.boolean, - optional: bool.true, nullable: bool.false, + type: 'boolean' as const, + optional: true as const, nullable: false as const, }, isHidden: { - type: types.boolean, - optional: bool.true, nullable: bool.false, + type: 'boolean' as const, + optional: true as const, nullable: false as const, }, visibility: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, }, mentions: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id' } }, visibleUserIds: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id' } }, fileIds: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id' } }, files: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile' } }, tags: { - type: types.array, - optional: bool.true, nullable: bool.false, + type: 'array' as const, + optional: true as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, } }, poll: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, }, geo: { - type: types.object, - optional: bool.true, nullable: bool.true, + type: 'object' as const, + optional: true as const, nullable: true as const, }, }, }; diff --git a/src/models/repositories/notification.ts b/src/models/repositories/notification.ts index 54eec87cfff3509add56f69f3cc90df3e5e94ff5..96293d4a68c396da38de656061f9447402e4bd65 100644 --- a/src/models/repositories/notification.ts +++ b/src/models/repositories/notification.ts @@ -3,7 +3,7 @@ import { Users, Notes } from '..'; import { Notification } from '../entities/notification'; import { ensure } from '../../prelude/ensure'; import { awaitAll } from '../../prelude/await-all'; -import { types, bool, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedNotification = SchemaType<typeof packedNotificationSchema>; @@ -51,37 +51,37 @@ export class NotificationRepository extends Repository<Notification> { } export const packedNotificationSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this notification.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the notification was created.' }, type: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, enum: ['follow', 'receiveFollowRequest', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote'], description: 'The type of the notification.' }, userId: { - type: types.string, - optional: bool.true, nullable: bool.true, + type: 'string' as const, + optional: true as const, nullable: true as const, format: 'id', }, user: { - type: types.object, + type: 'object' as const, ref: 'User', - optional: bool.true, nullable: bool.true, + optional: true as const, nullable: true as const, }, } }; diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts index 3b41420025456e134eb1939a4b20704732646b5c..33126274a11afa6c68ecb103ab1dfda2d970d6bb 100644 --- a/src/models/repositories/page.ts +++ b/src/models/repositories/page.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; import { Page } from '../entities/page'; -import { SchemaType, types, bool } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; import { Users, DriveFiles, PageLikes } from '..'; import { awaitAll } from '../../prelude/await-all'; import { DriveFile } from '../entities/drive-file'; @@ -89,54 +89,54 @@ export class PageRepository extends Repository<Page> { } export const packedPageSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', }, updatedAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', }, title: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, }, summary: { - type: types.string, - optional: bool.false, nullable: bool.true, + type: 'string' as const, + optional: false as const, nullable: true as const, }, content: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, }, variables: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, }, userId: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', }, user: { - type: types.object, + type: 'object' as const, ref: 'User', - optional: bool.false, nullable: bool.false, + optional: false as const, nullable: false as const, }, } }; diff --git a/src/models/repositories/user-group.ts b/src/models/repositories/user-group.ts index 38174ce235fdb640f0824f6362b9c0c12d9bf953..5ff75047c876d7a3044886ed3703b0827f179983 100644 --- a/src/models/repositories/user-group.ts +++ b/src/models/repositories/user-group.ts @@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { UserGroup } from '../entities/user-group'; import { ensure } from '../../prelude/ensure'; import { UserGroupJoinings } from '..'; -import { bool, types, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedUserGroup = SchemaType<typeof packedUserGroupSchema>; @@ -28,38 +28,38 @@ export class UserGroupRepository extends Repository<UserGroup> { } export const packedUserGroupSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this UserGroup.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the UserGroup was created.' }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The name of the UserGroup.' }, ownerId: { - type: types.string, - nullable: bool.false, optional: bool.false, + type: 'string' as const, + nullable: false as const, optional: false as const, format: 'id', }, userIds: { - type: types.array, - nullable: bool.false, optional: bool.true, + type: 'array' as const, + nullable: false as const, optional: true as const, items: { - type: types.string, - nullable: bool.false, optional: bool.false, + type: 'string' as const, + nullable: false as const, optional: false as const, format: 'id', } }, diff --git a/src/models/repositories/user-list.ts b/src/models/repositories/user-list.ts index 54231c7f851e803044b675b24c3a29ee5d8cfd17..8842118be44e4e49e3a0ae503151148a3fd709fe 100644 --- a/src/models/repositories/user-list.ts +++ b/src/models/repositories/user-list.ts @@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { UserList } from '../entities/user-list'; import { ensure } from '../../prelude/ensure'; import { UserListJoinings } from '..'; -import { bool, types, SchemaType } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; export type PackedUserList = SchemaType<typeof packedUserListSchema>; @@ -27,33 +27,33 @@ export class UserListRepository extends Repository<UserList> { } export const packedUserListSchema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { id: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'id', description: 'The unique identifier for this UserList.', example: 'xxxxxxxxxx', }, createdAt: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'date-time', description: 'The date that the UserList was created.' }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The name of the UserList.' }, userIds: { - type: types.array, - nullable: bool.false, optional: bool.true, + type: 'array' as const, + nullable: false as const, optional: true as const, items: { - type: types.string, - nullable: bool.false, optional: bool.false, + type: 'string' as const, + nullable: false as const, optional: false as const, format: 'id', } }, diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index bd48f04ea3d5d126aec2298a068a706c505c5f44..5da7ee78327733afeb130a42fcc17c64910d368f 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -4,7 +4,7 @@ import { User, ILocalUser, IRemoteUser } from '../entities/user'; import { Emojis, Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserGroupJoinings } from '..'; import { ensure } from '../../prelude/ensure'; import config from '../../config'; -import { SchemaType, bool, types } from '../../misc/schema'; +import { SchemaType } from '../../misc/schema'; import { awaitAll } from '../../prelude/await-all'; export type PackedUser = SchemaType<typeof packedUserSchema>; @@ -243,150 +243,150 @@ export class UserRepository extends Repository<User> { } export const packedUserSchema = { - type: types.object, - nullable: bool.false, optional: bool.false, + type: 'object' as const, + nullable: false as const, optional: false as const, properties: { id: { - type: types.string, - nullable: bool.false, optional: bool.false, + type: 'string' as const, + nullable: false as const, optional: false as const, format: 'id', description: 'The unique identifier for this User.', example: 'xxxxxxxxxx', }, username: { - type: types.string, - nullable: bool.false, optional: bool.false, + type: 'string' as const, + nullable: false as const, optional: false as const, description: 'The screen name, handle, or alias that this user identifies themselves with.', example: 'ai' }, name: { - type: types.string, - nullable: bool.true, optional: bool.false, + type: 'string' as const, + nullable: true as const, optional: false as const, description: 'The name of the user, as they’ve defined it.', example: 'è—' }, url: { - type: types.string, + type: 'string' as const, format: 'url', - nullable: bool.true, optional: bool.true, + nullable: true as const, optional: true as const, }, avatarUrl: { - type: types.string, + type: 'string' as const, format: 'url', - nullable: bool.true, optional: bool.false, + nullable: true as const, optional: false as const, }, avatarColor: { - type: types.any, - nullable: bool.true, optional: bool.false, + type: 'any' as const, + nullable: true as const, optional: false as const, }, bannerUrl: { - type: types.string, + type: 'string' as const, format: 'url', - nullable: bool.true, optional: bool.true, + nullable: true as const, optional: true as const, }, bannerColor: { - type: types.any, - nullable: bool.true, optional: bool.true, + type: 'any' as const, + nullable: true as const, optional: true as const, }, emojis: { - type: types.any, - nullable: bool.true, optional: bool.false, + type: 'any' as const, + nullable: true as const, optional: false as const, }, host: { - type: types.string, - nullable: bool.true, optional: bool.false, + type: 'string' as const, + nullable: true as const, optional: false as const, example: 'misskey.example.com' }, description: { - type: types.string, - nullable: bool.true, optional: bool.true, + type: 'string' as const, + nullable: true as const, optional: true as const, description: 'The user-defined UTF-8 string describing their account.', example: 'Hi masters, I am Ai!' }, birthday: { - type: types.string, - nullable: bool.true, optional: bool.true, + type: 'string' as const, + nullable: true as const, optional: true as const, example: '2018-03-12' }, createdAt: { - type: types.string, - nullable: bool.false, optional: bool.true, + type: 'string' as const, + nullable: false as const, optional: true as const, format: 'date-time', description: 'The date that the user account was created on Misskey.' }, updatedAt: { - type: types.string, - nullable: bool.true, optional: bool.true, + type: 'string' as const, + nullable: true as const, optional: true as const, format: 'date-time', }, location: { - type: types.string, - nullable: bool.true, optional: bool.true, + type: 'string' as const, + nullable: true as const, optional: true as const, }, followersCount: { - type: types.number, - nullable: bool.false, optional: bool.true, + type: 'number' as const, + nullable: false as const, optional: true as const, description: 'The number of followers this account currently has.' }, followingCount: { - type: types.number, - nullable: bool.false, optional: bool.true, + type: 'number' as const, + nullable: false as const, optional: true as const, description: 'The number of users this account is following.' }, notesCount: { - type: types.number, - nullable: bool.false, optional: bool.true, + type: 'number' as const, + nullable: false as const, optional: true as const, description: 'The number of Notes (including renotes) issued by the user.' }, isBot: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, description: 'Whether this account is a bot.' }, pinnedNoteIds: { - type: types.array, - nullable: bool.false, optional: bool.true, + type: 'array' as const, + nullable: false as const, optional: true as const, items: { - type: types.string, - nullable: bool.false, optional: bool.false, + type: 'string' as const, + nullable: false as const, optional: false as const, format: 'id', } }, pinnedNotes: { - type: types.array, - nullable: bool.false, optional: bool.true, + type: 'array' as const, + nullable: false as const, optional: true as const, items: { - type: types.object, - nullable: bool.false, optional: bool.false, + type: 'object' as const, + nullable: false as const, optional: false as const, ref: 'Note' } }, isCat: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, description: 'Whether this account is a cat.' }, isAdmin: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, description: 'Whether this account is the admin.' }, isModerator: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, description: 'Whether this account is a moderator.' }, isLocked: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, }, hasUnreadSpecifiedNotes: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, }, hasUnreadMentions: { - type: types.boolean, - nullable: bool.false, optional: bool.true, + type: 'boolean' as const, + nullable: false as const, optional: true as const, }, }, }; diff --git a/src/server/api/endpoints/app/create.ts b/src/server/api/endpoints/app/create.ts index 833d5060c50293547648ab118c75cb5e57902779..81c851f3a3ab4b5a63e5e17f51f13899881185fa 100644 --- a/src/server/api/endpoints/app/create.ts +++ b/src/server/api/endpoints/app/create.ts @@ -4,7 +4,6 @@ import define from '../../define'; import { Apps } from '../../../../models'; import { genId } from '../../../../misc/gen-id'; import { unique } from '../../../../prelude/array'; -import { types, bool } from '../../../../misc/schema'; export const meta = { tags: ['app'], @@ -53,8 +52,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'App', }, }; diff --git a/src/server/api/endpoints/app/show.ts b/src/server/api/endpoints/app/show.ts index e7d3e84388a6c313162ae6d8c086a85411291959..2c8cdbe39633fabd49e96d358d7e586a2a411a16 100644 --- a/src/server/api/endpoints/app/show.ts +++ b/src/server/api/endpoints/app/show.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Apps } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { tags: ['app'], @@ -15,8 +14,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'App', }, diff --git a/src/server/api/endpoints/auth/session/generate.ts b/src/server/api/endpoints/auth/session/generate.ts index 9bf27c8e77c6c1a77045cfde000c4411ce18b193..b38c275deb3fea7d3ecef4cfdc4d8e0b587f9525 100644 --- a/src/server/api/endpoints/auth/session/generate.ts +++ b/src/server/api/endpoints/auth/session/generate.ts @@ -5,7 +5,6 @@ import define from '../../../define'; import { ApiError } from '../../../error'; import { Apps, AuthSessions } from '../../../../../models'; import { genId } from '../../../../../misc/gen-id'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { tags: ['auth'], @@ -28,17 +27,17 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { token: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'セッションã®ãƒˆãƒ¼ã‚¯ãƒ³' }, url: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, format: 'url', description: 'セッションã®URL' }, diff --git a/src/server/api/endpoints/auth/session/userkey.ts b/src/server/api/endpoints/auth/session/userkey.ts index b7a58c475039c1241c42694fae99b24cf67368a2..1dc78eeabd7566de21b10921ad839c59816c29f1 100644 --- a/src/server/api/endpoints/auth/session/userkey.ts +++ b/src/server/api/endpoints/auth/session/userkey.ts @@ -3,7 +3,6 @@ import define from '../../../define'; import { ApiError } from '../../../error'; import { Apps, AuthSessions, AccessTokens, Users } from '../../../../../models'; import { ensure } from '../../../../../prelude/ensure'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { tags: ['auth'], @@ -29,18 +28,18 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { accessToken: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'ユーザーã®ã‚¢ã‚¯ã‚»ã‚¹ãƒˆãƒ¼ã‚¯ãƒ³', }, user: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', description: 'èªè¨¼ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼' }, diff --git a/src/server/api/endpoints/blocking/list.ts b/src/server/api/endpoints/blocking/list.ts index 5ff1dc0c49ec18f52a09d15e2525ed6e3d8ca9f8..c99ba09df0a48e8ddec36918e972fff63948d00f 100644 --- a/src/server/api/endpoints/blocking/list.ts +++ b/src/server/api/endpoints/blocking/list.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { Blockings } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -33,11 +32,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Blocking', } }, diff --git a/src/server/api/endpoints/drive.ts b/src/server/api/endpoints/drive.ts index 4d4516bd8030c60b18247a8d094e1328a7e33570..bb85bab148f10de1aa28621d857bf776617f9268 100644 --- a/src/server/api/endpoints/drive.ts +++ b/src/server/api/endpoints/drive.ts @@ -1,7 +1,6 @@ import define from '../define'; import { fetchMeta } from '../../../misc/fetch-meta'; import { DriveFiles } from '../../../models'; -import { types, bool } from '../../../misc/schema'; export const meta = { desc: { @@ -16,16 +15,16 @@ export const meta = { kind: 'read:drive', res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { capacity: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, }, usage: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, } } } diff --git a/src/server/api/endpoints/drive/files.ts b/src/server/api/endpoints/drive/files.ts index d10c2a3ef46ce8a2642df52a53ff40aae21b6fe5..77cefdfbe35dc39b67758a1ec473aa3ecea56aaf 100644 --- a/src/server/api/endpoints/drive/files.ts +++ b/src/server/api/endpoints/drive/files.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { DriveFiles } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -42,11 +41,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile', } }, diff --git a/src/server/api/endpoints/drive/files/attached-notes.ts b/src/server/api/endpoints/drive/files/attached-notes.ts index f770bc7136d6e75cca1d02aa0175400bdf252728..2b84e114b373357fd8837069f65b97ec7676d347 100644 --- a/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/src/server/api/endpoints/drive/files/attached-notes.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFiles, Notes } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { stability: 'stable', @@ -30,11 +29,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/drive/files/check-existence.ts b/src/server/api/endpoints/drive/files/check-existence.ts index ab19566f1cef2a555d93a60db5779f065b175c1e..a6cd14caf2ba170341a5ca43626457d4e0d256aa 100644 --- a/src/server/api/endpoints/drive/files/check-existence.ts +++ b/src/server/api/endpoints/drive/files/check-existence.ts @@ -1,7 +1,6 @@ import $ from 'cafy'; import define from '../../../define'; import { DriveFiles } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -25,8 +24,8 @@ export const meta = { }, res: { - type: types.boolean, - optional: bool.false, nullable: bool.false, + type: 'boolean' as const, + optional: false as const, nullable: false as const, }, }; diff --git a/src/server/api/endpoints/drive/files/create.ts b/src/server/api/endpoints/drive/files/create.ts index 0f81a1da9922dc6c4384bd73cc1f06e4d654f5e2..664a2b87b2e80fb6d795d9e06411c33d3c596f7f 100644 --- a/src/server/api/endpoints/drive/files/create.ts +++ b/src/server/api/endpoints/drive/files/create.ts @@ -6,7 +6,6 @@ import define from '../../../define'; import { apiLogger } from '../../../logger'; import { ApiError } from '../../../error'; import { DriveFiles } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -57,8 +56,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile', }, diff --git a/src/server/api/endpoints/drive/files/find-by-hash.ts b/src/server/api/endpoints/drive/files/find-by-hash.ts index d56e63bc59c583d994a0c74b14fc14ce63bdec25..84cc4f92b10a01e2087e48c890b95e74c80807ad 100644 --- a/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -1,7 +1,6 @@ import $ from 'cafy'; import define from '../../../define'; import { DriveFiles } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -24,11 +23,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile', } }, diff --git a/src/server/api/endpoints/drive/files/find.ts b/src/server/api/endpoints/drive/files/find.ts index 82b9a97b6d555a6c0a1725552225c1050fafc372..732596a33feb4e477ba4b8b4efcca6b4442680e8 100644 --- a/src/server/api/endpoints/drive/files/find.ts +++ b/src/server/api/endpoints/drive/files/find.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { DriveFiles } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { requireCredential: true, @@ -26,11 +25,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile', } }, diff --git a/src/server/api/endpoints/drive/files/show.ts b/src/server/api/endpoints/drive/files/show.ts index 8e74361f9ce1084659e1a67f4194c5aa649b0372..4384b2114dbd497f1acef52861d20fd946c78b50 100644 --- a/src/server/api/endpoints/drive/files/show.ts +++ b/src/server/api/endpoints/drive/files/show.ts @@ -4,7 +4,6 @@ import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFile } from '../../../../../models/entities/drive-file'; import { DriveFiles } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { stability: 'stable', @@ -39,8 +38,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile', }, diff --git a/src/server/api/endpoints/drive/folders.ts b/src/server/api/endpoints/drive/folders.ts index dc3174cd2a09b21a49db77c4f2240b611e99a2d1..e2d22e708117a9819ed17a1bf97f159437053cc5 100644 --- a/src/server/api/endpoints/drive/folders.ts +++ b/src/server/api/endpoints/drive/folders.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { DriveFolders } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -38,11 +37,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFolder', } }, diff --git a/src/server/api/endpoints/drive/folders/find.ts b/src/server/api/endpoints/drive/folders/find.ts index 0368d026c3b5b5c813246c8c1412ac05c6348b48..04bec1b170d729d32fabade65810be9b3b0c60dc 100644 --- a/src/server/api/endpoints/drive/folders/find.ts +++ b/src/server/api/endpoints/drive/folders/find.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { DriveFolders } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { tags: ['drive'], @@ -26,11 +25,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFolder', } }, diff --git a/src/server/api/endpoints/drive/folders/show.ts b/src/server/api/endpoints/drive/folders/show.ts index a020b46aa93c13990d42f0f2988a8d85f9b31989..f48f21d73027a9bffc8c29bdf7e3652a38b64291 100644 --- a/src/server/api/endpoints/drive/folders/show.ts +++ b/src/server/api/endpoints/drive/folders/show.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFolders } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { stability: 'stable', @@ -30,8 +29,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFolder', }, diff --git a/src/server/api/endpoints/drive/stream.ts b/src/server/api/endpoints/drive/stream.ts index f75c4273c344cba6825016c89379278b129bd232..b93ee11a141ff1de39dcbe246ca54f3944be7e8e 100644 --- a/src/server/api/endpoints/drive/stream.ts +++ b/src/server/api/endpoints/drive/stream.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { DriveFiles } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { tags: ['drive'], @@ -32,11 +31,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'DriveFile', } }, diff --git a/src/server/api/endpoints/hashtags/list.ts b/src/server/api/endpoints/hashtags/list.ts index 9023f1191365891a0caafa309a7a1f744ab0948f..9bc2677793224544938f133dccf8721acc8e73a0 100644 --- a/src/server/api/endpoints/hashtags/list.ts +++ b/src/server/api/endpoints/hashtags/list.ts @@ -1,7 +1,6 @@ import $ from 'cafy'; import define from '../../define'; import { Hashtags } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { tags: ['hashtags'], @@ -48,11 +47,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Hashtag', } }, diff --git a/src/server/api/endpoints/hashtags/search.ts b/src/server/api/endpoints/hashtags/search.ts index 0d2704d01c04568f35a9fc3a79c785aef1339400..7caaf3484647734101fa4da1d79ac11777ff9467 100644 --- a/src/server/api/endpoints/hashtags/search.ts +++ b/src/server/api/endpoints/hashtags/search.ts @@ -1,7 +1,6 @@ import $ from 'cafy'; import define from '../../define'; import { Hashtags } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -38,11 +37,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, } }, }; diff --git a/src/server/api/endpoints/hashtags/show.ts b/src/server/api/endpoints/hashtags/show.ts index 72a4cc7c876e1149558f69888191b71344516e67..5de906fb1f89ad6bc555ec8844db0d3871df8e18 100644 --- a/src/server/api/endpoints/hashtags/show.ts +++ b/src/server/api/endpoints/hashtags/show.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { Hashtags } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -24,8 +23,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Hashtag', }, diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index 53a351471814ba409d10c85f967ccdfa67d4d6eb..3154461e5a3268464b724227e82127dbc764bd72 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -2,7 +2,6 @@ import define from '../../define'; import { fetchMeta } from '../../../../misc/fetch-meta'; import { Notes } from '../../../../models'; import { Note } from '../../../../models/entities/note'; -import { types, bool } from '../../../../misc/schema'; /* トレンドã«è¼‰ã‚‹ãŸã‚ã«ã¯ã€Œã€Žç›´è¿‘a分間ã®ãƒ¦ãƒ‹ãƒ¼ã‚¯æŠ•ç¨¿æ•°ãŒä»Šã‹ã‚‰a分å‰ï½žä»Šã‹ã‚‰b分å‰ã®é–“ã®ãƒ¦ãƒ‹ãƒ¼ã‚¯æŠ•ç¨¿æ•°ã®nå€ä»¥ä¸Šã€ã®ãƒãƒƒã‚·ãƒ¥ã‚¿ã‚°ã®ä¸Šä½5ä½ä»¥å†…ã«å…¥ã‚‹ã€ã“ã¨ãŒå¿…è¦ @@ -24,27 +23,27 @@ export const meta = { requireCredential: false, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { tag: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, }, chart: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, } }, usersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, } } } diff --git a/src/server/api/endpoints/hashtags/users.ts b/src/server/api/endpoints/hashtags/users.ts index b842f9de64386a7b268a38359345f7956ab933d0..59210f4604e70b344b3f60c20af094d133ca8f84 100644 --- a/src/server/api/endpoints/hashtags/users.ts +++ b/src/server/api/endpoints/hashtags/users.ts @@ -1,7 +1,6 @@ import $ from 'cafy'; import define from '../../define'; import { Users } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { requireCredential: false, @@ -48,11 +47,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', } }, diff --git a/src/server/api/endpoints/i.ts b/src/server/api/endpoints/i.ts index 4ecd507e165f1c74548810e3fc69beb18e5734f9..20a0c604f673d7ef6b22c06133d927c6570c8bb1 100644 --- a/src/server/api/endpoints/i.ts +++ b/src/server/api/endpoints/i.ts @@ -1,6 +1,5 @@ import define from '../define'; import { Users } from '../../../models'; -import { types, bool } from '../../../misc/schema'; export const meta = { stability: 'stable', @@ -16,8 +15,8 @@ export const meta = { params: {}, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', }, }; diff --git a/src/server/api/endpoints/i/favorites.ts b/src/server/api/endpoints/i/favorites.ts index d1e90dd15c9e40014985bf3b519a549d24ec8de7..1bbc16256a7ad656b6fe3c55c9880fc70a83cc92 100644 --- a/src/server/api/endpoints/i/favorites.ts +++ b/src/server/api/endpoints/i/favorites.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { NoteFavorites } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -33,11 +32,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'NoteFavorite', } }, diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts index 41513e5daa0f98d4f9d4651cebdda0129958aa24..aa72e9a176f98750c62b4b0302ec2c865a2a15bc 100644 --- a/src/server/api/endpoints/i/notifications.ts +++ b/src/server/api/endpoints/i/notifications.ts @@ -4,7 +4,6 @@ import { readNotification } from '../../common/read-notification'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notifications, Followings, Mutings } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -54,11 +53,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Notification', } }, diff --git a/src/server/api/endpoints/messaging/history.ts b/src/server/api/endpoints/messaging/history.ts index 833ec37e4cf438fe5a811e88a4700e478c105f44..2c143c26b5bb198f7482a5dc63632543dbfd4189 100644 --- a/src/server/api/endpoints/messaging/history.ts +++ b/src/server/api/endpoints/messaging/history.ts @@ -3,7 +3,6 @@ import define from '../../define'; import { MessagingMessage } from '../../../../models/entities/messaging-message'; import { MessagingMessages, Mutings, UserGroupJoinings } from '../../../../models'; import { Brackets } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -30,11 +29,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'MessagingMessage', } }, diff --git a/src/server/api/endpoints/messaging/messages.ts b/src/server/api/endpoints/messaging/messages.ts index ffd58c714e65770c84149d5ee995870143a7fa17..b0b3e20d02ed0124887e9f35f455a1840064b7d6 100644 --- a/src/server/api/endpoints/messaging/messages.ts +++ b/src/server/api/endpoints/messaging/messages.ts @@ -5,7 +5,6 @@ import { ApiError } from '../../error'; import { getUser } from '../../common/getters'; import { MessagingMessages, UserGroups, UserGroupJoinings } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; -import { types, bool } from '../../../../misc/schema'; import { Brackets } from 'typeorm'; import { readUserMessagingMessage, readGroupMessagingMessage } from '../../common/read-messaging-message'; @@ -58,11 +57,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'MessagingMessage', } }, diff --git a/src/server/api/endpoints/messaging/messages/create.ts b/src/server/api/endpoints/messaging/messages/create.ts index feffc9a0c60648a66c327f5051ee52a5ab9ae024..d0c1ee49410b8dd3b25f82ded86d0bd8cfc9bf5d 100644 --- a/src/server/api/endpoints/messaging/messages/create.ts +++ b/src/server/api/endpoints/messaging/messages/create.ts @@ -9,7 +9,6 @@ import { getUser } from '../../../common/getters'; import { MessagingMessages, DriveFiles, Mutings, UserGroups, UserGroupJoinings } from '../../../../../models'; import { MessagingMessage } from '../../../../../models/entities/messaging-message'; import { genId } from '../../../../../misc/gen-id'; -import { types, bool } from '../../../../../misc/schema'; import { User } from '../../../../../models/entities/user'; import { UserGroup } from '../../../../../models/entities/user-group'; import { Not } from 'typeorm'; @@ -53,8 +52,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'MessagingMessage', }, diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 1aa9a855ddb2103ec280f362d0320e17d7bd7545..a3390a011d3f364f370018ee04e5133a2d0e4090 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -5,7 +5,6 @@ import define from '../define'; import { fetchMeta } from '../../../misc/fetch-meta'; import * as pkg from '../../../../package.json'; import { Emojis } from '../../../models'; -import { types, bool } from '../../../misc/schema'; import { getConnection } from 'typeorm'; import redis from '../../../db/redis'; @@ -29,40 +28,40 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { version: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The version of Misskey of this instance.', example: pkg.version }, name: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The name of this instance.', }, description: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The description of this instance.', }, announcements: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { title: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The title of the announcement.', }, text: { - type: types.string, - optional: bool.false, nullable: bool.false, + type: 'string' as const, + optional: false as const, nullable: false as const, description: 'The text of the announcement. (can be HTML)', }, } @@ -70,23 +69,23 @@ export const meta = { description: 'The announcements of this instance.', }, disableRegistration: { - type: types.boolean, - optional: bool.false, nullable: bool.false, + type: 'boolean' as const, + optional: false as const, nullable: false as const, description: 'Whether disabled open registration.', }, disableLocalTimeline: { - type: types.boolean, - optional: bool.false, nullable: bool.false, + type: 'boolean' as const, + optional: false as const, nullable: false as const, description: 'Whether disabled LTL and STL.', }, disableGlobalTimeline: { - type: types.boolean, - optional: bool.false, nullable: bool.false, + type: 'boolean' as const, + optional: false as const, nullable: false as const, description: 'Whether disabled GTL.', }, enableEmojiReaction: { - type: types.boolean, - optional: bool.false, nullable: bool.false, + type: 'boolean' as const, + optional: false as const, nullable: false as const, description: 'Whether enabled emoji reaction.', }, } diff --git a/src/server/api/endpoints/mute/list.ts b/src/server/api/endpoints/mute/list.ts index f9ea380c762719d86fa6e5b73b7d84b90d0eb3b5..1afc120f5f12b74cd8c5d4c13448b91c95fa0baf 100644 --- a/src/server/api/endpoints/mute/list.ts +++ b/src/server/api/endpoints/mute/list.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Mutings } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -33,11 +32,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Muting', } }, diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index 7aa19c9a2b024fbe06a5fc70673110807e3af21d..fab8455d78b4af2cb2a2704caadd2aecae634403 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -3,7 +3,6 @@ import { ID } from '../../../misc/cafy-id'; import define from '../define'; import { makePaginationQuery } from '../common/make-pagination-query'; import { Notes } from '../../../models'; -import { types, bool } from '../../../misc/schema'; export const meta = { desc: { @@ -63,11 +62,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/children.ts b/src/server/api/endpoints/notes/children.ts index e8861eafa136c0cd0707615619582bbdbcd75fe5..bc8407f31ca4dc4f2dbdb3abd5643bea75adc8f6 100644 --- a/src/server/api/endpoints/notes/children.ts +++ b/src/server/api/endpoints/notes/children.ts @@ -6,7 +6,6 @@ import { generateVisibilityQuery } from '../../common/generate-visibility-query' import { generateMuteQuery } from '../../common/generate-mute-query'; import { Brackets } from 'typeorm'; import { Notes } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -42,11 +41,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/conversation.ts b/src/server/api/endpoints/notes/conversation.ts index acd3ac75ef1d371dd07848233f3932c0a10ac6e7..245d427923f0f48e02ff095d68fb762135715334 100644 --- a/src/server/api/endpoints/notes/conversation.ts +++ b/src/server/api/endpoints/notes/conversation.ts @@ -5,7 +5,6 @@ import { ApiError } from '../../error'; import { getNote } from '../../common/getters'; import { Note } from '../../../../models/entities/note'; import { Notes } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -38,11 +37,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index 46db2745815d62b45d4f3aa5cab548ee95a543da..1650de90719d8a2dba0d95cd1c256c00e3cd9938 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -10,7 +10,6 @@ import { User } from '../../../../models/entities/user'; import { Users, DriveFiles, Notes } from '../../../../models'; import { DriveFile } from '../../../../models/entities/drive-file'; import { Note } from '../../../../models/entities/note'; -import { types, bool } from '../../../../misc/schema'; let maxNoteTextLength = 1000; @@ -175,12 +174,12 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { createdNote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', description: '作æˆã—ãŸæŠ•ç¨¿' } diff --git a/src/server/api/endpoints/notes/featured.ts b/src/server/api/endpoints/notes/featured.ts index 64750815b0b725a3c591adc1541b84f3acb90d0f..0a1d8668b0c4d98edb5c9a2660a72811b42fd8d3 100644 --- a/src/server/api/endpoints/notes/featured.ts +++ b/src/server/api/endpoints/notes/featured.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import define from '../../define'; import { generateMuteQuery } from '../../common/generate-mute-query'; import { Notes } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -25,11 +24,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/global-timeline.ts b/src/server/api/endpoints/notes/global-timeline.ts index f46fa208df53e857249b025afbdf533dc1254e8c..8654cf889a42ef1e05627dc21160f0a26d34bdc8 100644 --- a/src/server/api/endpoints/notes/global-timeline.ts +++ b/src/server/api/endpoints/notes/global-timeline.ts @@ -7,7 +7,6 @@ import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notes } from '../../../../models'; import { generateMuteQuery } from '../../common/generate-mute-query'; import { activeUsersChart } from '../../../../services/chart'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -47,11 +46,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts index 7be13fc47f98af595675a5bb95708aa20a81dbd8..8c4c7a60b98e474d7c4b1e910260f49fdd8ce11c 100644 --- a/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -9,7 +9,6 @@ import { Brackets } from 'typeorm'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { generateMuteQuery } from '../../common/generate-mute-query'; import { activeUsersChart } from '../../../../services/chart'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -90,11 +89,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts index 73cbebace25a0c46ca0e6c64892e104956788420..c688b9325e964b0b71e04a59666ab418361ec0f7 100644 --- a/src/server/api/endpoints/notes/local-timeline.ts +++ b/src/server/api/endpoints/notes/local-timeline.ts @@ -9,7 +9,6 @@ import { makePaginationQuery } from '../../common/make-pagination-query'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { activeUsersChart } from '../../../../services/chart'; import { Brackets } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -64,11 +63,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts index 02e44492ba3e4cb4d54337828c761cd4fb3e785f..fd3767f6329885779fe6d9ff0e578db15830183e 100644 --- a/src/server/api/endpoints/notes/mentions.ts +++ b/src/server/api/endpoints/notes/mentions.ts @@ -7,7 +7,6 @@ import { generateVisibilityQuery } from '../../common/generate-visibility-query' import { generateMuteQuery } from '../../common/generate-mute-query'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Brackets } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -44,11 +43,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/reactions.ts b/src/server/api/endpoints/notes/reactions.ts index 0773b4faa27abb034d4941e1cda8801082843976..7bea24d316a73ad15e32ef5a8954ef6fcccb3cb5 100644 --- a/src/server/api/endpoints/notes/reactions.ts +++ b/src/server/api/endpoints/notes/reactions.ts @@ -4,7 +4,6 @@ import define from '../../define'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; import { NoteReactions } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -45,11 +44,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'NoteReaction', } }, diff --git a/src/server/api/endpoints/notes/renotes.ts b/src/server/api/endpoints/notes/renotes.ts index 00dfac377095e542ed31e4af5d07021dfbb46e90..a5db706e32284e50834d8c5771b5a1ecfeb1d03f 100644 --- a/src/server/api/endpoints/notes/renotes.ts +++ b/src/server/api/endpoints/notes/renotes.ts @@ -7,7 +7,6 @@ import { generateVisibilityQuery } from '../../common/generate-visibility-query' import { generateMuteQuery } from '../../common/generate-mute-query'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notes } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -43,11 +42,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/replies.ts b/src/server/api/endpoints/notes/replies.ts index 5fb0fd989fd0bd48ab27e0a19c5085d0f194254d..cd38d41652c83f8a5b1a8b8109ac90e7cee8014c 100644 --- a/src/server/api/endpoints/notes/replies.ts +++ b/src/server/api/endpoints/notes/replies.ts @@ -5,7 +5,6 @@ import { Notes } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { generateMuteQuery } from '../../common/generate-mute-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -47,11 +46,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/search-by-tag.ts b/src/server/api/endpoints/notes/search-by-tag.ts index 0b49f896ad6c5a1bc6fa3d1c904c28aafa722c72..7f53b269956a374aa8390b0bb916f0f6d5c3b51a 100644 --- a/src/server/api/endpoints/notes/search-by-tag.ts +++ b/src/server/api/endpoints/notes/search-by-tag.ts @@ -6,7 +6,6 @@ import { Notes } from '../../../../models'; import { generateMuteQuery } from '../../common/generate-mute-query'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { Brackets } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -82,11 +81,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/search.ts b/src/server/api/endpoints/notes/search.ts index 65ce20074acb0456958a56ddd365e378df94d128..d3fb33c420aac079cb79a1a58f1b140eeb6b4bf6 100644 --- a/src/server/api/endpoints/notes/search.ts +++ b/src/server/api/endpoints/notes/search.ts @@ -4,7 +4,6 @@ import define from '../../define'; import { ApiError } from '../../error'; import { Notes } from '../../../../models'; import { In } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; import { ID } from '../../../../misc/cafy-id'; export const meta = { @@ -44,11 +43,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/show.ts b/src/server/api/endpoints/notes/show.ts index 54b420813d3fd6c8a7eab1050a346c8b9a53bf9d..75abbae55fb15fc841773732b851bf9946cacd61 100644 --- a/src/server/api/endpoints/notes/show.ts +++ b/src/server/api/endpoints/notes/show.ts @@ -4,7 +4,6 @@ import define from '../../define'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; import { Notes } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { stability: 'stable', @@ -29,8 +28,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', }, diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index f9442f8b90684dcb60911b30d58e53e854725101..25876f655a4902b58e78a269c00d8536cea8e957 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -7,7 +7,6 @@ import { generateVisibilityQuery } from '../../common/generate-visibility-query' import { generateMuteQuery } from '../../common/generate-mute-query'; import { activeUsersChart } from '../../../../services/chart'; import { Brackets } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -89,11 +88,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/notes/user-list-timeline.ts b/src/server/api/endpoints/notes/user-list-timeline.ts index c16018d434e2717d20a807fa41013496edc2ea7b..f66221537d209db6020900cf284438c30a2479ec 100644 --- a/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/src/server/api/endpoints/notes/user-list-timeline.ts @@ -6,7 +6,6 @@ import { UserLists, UserListJoinings, Notes } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { activeUsersChart } from '../../../../services/chart'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -95,11 +94,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/pages/create.ts b/src/server/api/endpoints/pages/create.ts index e6b813648b9b3460e95d0a9ac96a1464194df784..ffe0d38ea691d24d1ce469ac9e1ab2e0f8f47321 100644 --- a/src/server/api/endpoints/pages/create.ts +++ b/src/server/api/endpoints/pages/create.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import * as ms from 'ms'; import define from '../../define'; import { ID } from '../../../../misc/cafy-id'; -import { types, bool } from '../../../../misc/schema'; import { Pages, DriveFiles } from '../../../../models'; import { genId } from '../../../../misc/gen-id'; import { Page } from '../../../../models/entities/page'; @@ -61,8 +60,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Page', }, diff --git a/src/server/api/endpoints/pages/show.ts b/src/server/api/endpoints/pages/show.ts index e3d6e6a15ff402aef369e0118ad3da14817f2025..84808418f3a8286fdc6b80adda19eb9c9c33ec41 100644 --- a/src/server/api/endpoints/pages/show.ts +++ b/src/server/api/endpoints/pages/show.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { Pages, Users } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; import { ID } from '../../../../misc/cafy-id'; import { Page } from '../../../../models/entities/page'; @@ -34,8 +33,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Page', }, diff --git a/src/server/api/endpoints/pinned-users.ts b/src/server/api/endpoints/pinned-users.ts index de0e17a2ecc9ea0f800c48f1e78a38e5fb02f381..853e1cd4b8bc8bdf042f63b0bfbe91c1de16bd99 100644 --- a/src/server/api/endpoints/pinned-users.ts +++ b/src/server/api/endpoints/pinned-users.ts @@ -1,6 +1,5 @@ import define from '../define'; import { Users } from '../../../models'; -import { types, bool } from '../../../misc/schema'; import { fetchMeta } from '../../../misc/fetch-meta'; import parseAcct from '../../../misc/acct/parse'; import { User } from '../../../models/entities/user'; @@ -14,11 +13,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', } }, diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts index 4dca62445ff4b80f6810baedabc8323a0809344d..c86d893d5ec2c87ed57950f1ba75706b329088ce 100644 --- a/src/server/api/endpoints/stats.ts +++ b/src/server/api/endpoints/stats.ts @@ -1,7 +1,6 @@ import define from '../define'; import { Notes, Users } from '../../../models'; import { federationChart, driveChart } from '../../../services/chart'; -import { bool, types } from '../../../misc/schema'; export const meta = { requireCredential: false, @@ -16,32 +15,32 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { notesCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'The count of all (local/remote) notes of this instance.', }, originalNotesCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'The count of all local notes of this instance.', }, usersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'The count of all (local/remote) accounts of this instance.', }, originalUsersCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'The count of all local accounts of this instance.', }, instances: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'The count of federated instances.', }, } diff --git a/src/server/api/endpoints/users.ts b/src/server/api/endpoints/users.ts index 539f2ef897a91035a2b269d88b644aec111db0ab..93cf01a6f8669d9e3759b5deda6516ac5bfc2435 100644 --- a/src/server/api/endpoints/users.ts +++ b/src/server/api/endpoints/users.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import define from '../define'; import { Users } from '../../../models'; import { generateMuteQueryForUsers } from '../common/generate-mute-query'; -import { types, bool } from '../../../misc/schema'; export const meta = { tags: ['users'], @@ -53,11 +52,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', } }, diff --git a/src/server/api/endpoints/users/followers.ts b/src/server/api/endpoints/users/followers.ts index 465b71e2e6e369517bf235bfe3ac2921a3983fcd..68c32fe983ee891a69b35428a884bbb88cff25a2 100644 --- a/src/server/api/endpoints/users/followers.ts +++ b/src/server/api/endpoints/users/followers.ts @@ -5,7 +5,6 @@ import { ApiError } from '../../error'; import { Users, Followings } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { toPunyNullable } from '../../../../misc/convert-host'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -49,11 +48,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Following', } }, diff --git a/src/server/api/endpoints/users/following.ts b/src/server/api/endpoints/users/following.ts index 2a7748ac64b6177ea6cd3d918dcb093dbda79569..eb699b29037fd784c89a0b5613365c5df98ab0be 100644 --- a/src/server/api/endpoints/users/following.ts +++ b/src/server/api/endpoints/users/following.ts @@ -5,7 +5,6 @@ import { ApiError } from '../../error'; import { Users, Followings } from '../../../../models'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { toPunyNullable } from '../../../../misc/convert-host'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -49,11 +48,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Following', } }, diff --git a/src/server/api/endpoints/users/get-frequently-replied-users.ts b/src/server/api/endpoints/users/get-frequently-replied-users.ts index 24d1bd194cd127811f2f53181285e5a21f768d12..1a17b488f09aec71add2eaac22ba4e5c08d9a0e6 100644 --- a/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -6,7 +6,6 @@ import { ApiError } from '../../error'; import { getUser } from '../../common/getters'; import { Not, In, IsNull } from 'typeorm'; import { Notes, Users } from '../../../../models'; -import { types, bool } from '../../../../misc/schema'; export const meta = { tags: ['users'], @@ -29,11 +28,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', } }, diff --git a/src/server/api/endpoints/users/groups/create.ts b/src/server/api/endpoints/users/groups/create.ts index ee6cade8d07f54afed3543eb83cea765404188d3..2a6e5135e55732c5c29463abe5f013f4d5ca2675 100644 --- a/src/server/api/endpoints/users/groups/create.ts +++ b/src/server/api/endpoints/users/groups/create.ts @@ -3,7 +3,6 @@ import define from '../../../define'; import { UserGroups, UserGroupJoinings } from '../../../../../models'; import { genId } from '../../../../../misc/gen-id'; import { UserGroup } from '../../../../../models/entities/user-group'; -import { types, bool } from '../../../../../misc/schema'; import { UserGroupJoining } from '../../../../../models/entities/user-group-joining'; export const meta = { @@ -25,8 +24,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserGroup', }, }; diff --git a/src/server/api/endpoints/users/groups/joined.ts b/src/server/api/endpoints/users/groups/joined.ts index 97d168e527360b4449212c6d8a0e349fa92e5d42..c60ba57c0912c8255b752c07d94587db691c4927 100644 --- a/src/server/api/endpoints/users/groups/joined.ts +++ b/src/server/api/endpoints/users/groups/joined.ts @@ -1,6 +1,5 @@ import define from '../../../define'; import { UserGroups, UserGroupJoinings } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; import { Not, In } from 'typeorm'; export const meta = { @@ -15,11 +14,11 @@ export const meta = { kind: 'read:user-groups', res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserGroup', } }, diff --git a/src/server/api/endpoints/users/groups/owned.ts b/src/server/api/endpoints/users/groups/owned.ts index 6cf39a142b7d5f96e180883bdea4b1d72fe93b43..e2c0bf2fc1802b4b7f2d4e97939021e23ac0f711 100644 --- a/src/server/api/endpoints/users/groups/owned.ts +++ b/src/server/api/endpoints/users/groups/owned.ts @@ -1,6 +1,5 @@ import define from '../../../define'; import { UserGroups } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -14,11 +13,11 @@ export const meta = { kind: 'read:user-groups', res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserGroup', } }, diff --git a/src/server/api/endpoints/users/groups/show.ts b/src/server/api/endpoints/users/groups/show.ts index 4f8374a22234b01ee23fd1c4ef9073876dcc7c52..643f1acf7a611cd43c4f5844c065b923db1a95ac 100644 --- a/src/server/api/endpoints/users/groups/show.ts +++ b/src/server/api/endpoints/users/groups/show.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserGroups, UserGroupJoinings } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -24,8 +23,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserGroup', }, diff --git a/src/server/api/endpoints/users/groups/transfer.ts b/src/server/api/endpoints/users/groups/transfer.ts index b4284ab4845832d9429d79a968ef7872996551bc..012f9f4ef3755ac2f45cc6c2f2564045d977026f 100644 --- a/src/server/api/endpoints/users/groups/transfer.ts +++ b/src/server/api/endpoints/users/groups/transfer.ts @@ -4,7 +4,6 @@ import define from '../../../define'; import { ApiError } from '../../../error'; import { getUser } from '../../../common/getters'; import { UserGroups, UserGroupJoinings } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -33,8 +32,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserGroup', }, diff --git a/src/server/api/endpoints/users/groups/update.ts b/src/server/api/endpoints/users/groups/update.ts index bc974621a34f3984577fd4369d9d4a8358f1dc62..2fc0a803a19403d33fbef1b8f6960664ff41299c 100644 --- a/src/server/api/endpoints/users/groups/update.ts +++ b/src/server/api/endpoints/users/groups/update.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserGroups } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -36,8 +35,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserGroup', }, diff --git a/src/server/api/endpoints/users/lists/create.ts b/src/server/api/endpoints/users/lists/create.ts index 79efffbf9ec31507d57318f7a72c5ebf1d93ad9c..28af3c8d86e9f0c15997ac23fded67dc53a27a75 100644 --- a/src/server/api/endpoints/users/lists/create.ts +++ b/src/server/api/endpoints/users/lists/create.ts @@ -3,7 +3,6 @@ import define from '../../../define'; import { UserLists } from '../../../../../models'; import { genId } from '../../../../../misc/gen-id'; import { UserList } from '../../../../../models/entities/user-list'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -24,8 +23,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserList', }, }; diff --git a/src/server/api/endpoints/users/lists/list.ts b/src/server/api/endpoints/users/lists/list.ts index 684086b5c6c7a8e9230652fc0068fc6c68dd74aa..7b89d34314f1b7cc9e167db27b25cd6c2ddc426b 100644 --- a/src/server/api/endpoints/users/lists/list.ts +++ b/src/server/api/endpoints/users/lists/list.ts @@ -1,6 +1,5 @@ import define from '../../../define'; import { UserLists } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -14,11 +13,11 @@ export const meta = { kind: 'read:account', res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserList', } }, diff --git a/src/server/api/endpoints/users/lists/show.ts b/src/server/api/endpoints/users/lists/show.ts index 395f9352d42ebc9f0a7f75142f9917d7683ea3b3..01d03d1bfb4860a5768897f5e4c20c0dd103b49a 100644 --- a/src/server/api/endpoints/users/lists/show.ts +++ b/src/server/api/endpoints/users/lists/show.ts @@ -3,7 +3,6 @@ import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserLists } from '../../../../../models'; -import { types, bool } from '../../../../../misc/schema'; export const meta = { desc: { @@ -24,8 +23,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'UserList', }, diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index fdc50e4dae55b5255fc856b687e23bfd1d8f6fe4..ef564b3c3457882231a41da132276ba8b864111e 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -8,7 +8,6 @@ import { generateVisibilityQuery } from '../../common/generate-visibility-query' import { Notes } from '../../../../models'; import { generateMuteQuery } from '../../common/generate-mute-query'; import { Brackets } from 'typeorm'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -120,11 +119,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'Note', } }, diff --git a/src/server/api/endpoints/users/recommendation.ts b/src/server/api/endpoints/users/recommendation.ts index 38b420c332f480f02fccb43cac913d2466625884..73d8fe6208f5194f895d8ac04e4cf31585ccb87f 100644 --- a/src/server/api/endpoints/users/recommendation.ts +++ b/src/server/api/endpoints/users/recommendation.ts @@ -3,7 +3,6 @@ import $ from 'cafy'; import define from '../../define'; import { Users, Followings } from '../../../../models'; import { generateMuteQueryForUsers } from '../../common/generate-mute-query'; -import { types, bool } from '../../../../misc/schema'; export const meta = { desc: { @@ -29,11 +28,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', } }, diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index 5c413defbcd9fb9e656eeba3f8bb5cf9b17004a2..9aa9e398e31eb26a318394242b49f3447cd6897a 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -2,7 +2,6 @@ import $ from 'cafy'; import define from '../../define'; import { Users } from '../../../../models'; import { User } from '../../../../models/entities/user'; -import { bool, types } from '../../../../misc/schema'; export const meta = { desc: { @@ -55,11 +54,11 @@ export const meta = { }, res: { - type: types.array, - optional: bool.false, nullable: bool.false, + type: 'array' as const, + optional: false as const, nullable: false as const, items: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', } }, diff --git a/src/server/api/endpoints/users/show.ts b/src/server/api/endpoints/users/show.ts index 820c44e81ba8179bb3e4532a4868cf5ba471e6c4..30660aed3af9c6343ab6d435eff5431f8eea3fbc 100644 --- a/src/server/api/endpoints/users/show.ts +++ b/src/server/api/endpoints/users/show.ts @@ -6,7 +6,6 @@ import { ApiError } from '../../error'; import { ID } from '../../../../misc/cafy-id'; import { Users } from '../../../../models'; import { In } from 'typeorm'; -import { bool, types } from '../../../../misc/schema'; export const meta = { desc: { @@ -43,8 +42,8 @@ export const meta = { }, res: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, ref: 'User', }, diff --git a/src/services/chart/charts/schemas/active-users.ts b/src/services/chart/charts/schemas/active-users.ts index f10393bc36db5ce3cc42a2de36f958b7c46adce7..6e26bb469815ad98aa43e27e9292e61ab988f922 100644 --- a/src/services/chart/charts/schemas/active-users.ts +++ b/src/services/chart/charts/schemas/active-users.ts @@ -1,12 +1,10 @@ -import { types, bool } from '../../../../misc/schema'; - export const logSchema = { /** * アクティブユーザー数 */ count: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'アクティブユーザー数', }, }; @@ -15,17 +13,17 @@ export const logSchema = { * アクティブユーザーã«é–¢ã™ã‚‹ãƒãƒ£ãƒ¼ãƒˆ */ export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/charts/schemas/drive.ts b/src/services/chart/charts/schemas/drive.ts index 3327950635ded57fb641daac85fd1d8bde6f2918..dcc50df8cf984786a402f7f6bad72bd7d08136d0 100644 --- a/src/services/chart/charts/schemas/drive.ts +++ b/src/services/chart/charts/schemas/drive.ts @@ -1,12 +1,10 @@ -import { types, bool } from '../../../../misc/schema'; - const logSchema = { /** * 集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイル数 */ totalCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, @@ -14,8 +12,8 @@ const logSchema = { * 集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイルã®åˆè¨ˆã‚µã‚¤ã‚º */ totalSize: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイルã®åˆè¨ˆã‚µã‚¤ã‚º' }, @@ -23,8 +21,8 @@ const logSchema = { * å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数 */ incCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, @@ -32,8 +30,8 @@ const logSchema = { * å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ä½¿ç”¨é‡ */ incSize: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–使用é‡' }, @@ -41,8 +39,8 @@ const logSchema = { * 減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数 */ decCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, @@ -50,24 +48,24 @@ const logSchema = { * 減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ä½¿ç”¨é‡ */ decSize: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–使用é‡' }, }; export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/charts/schemas/federation.ts b/src/services/chart/charts/schemas/federation.ts index 41ae977cbd200a0408981541a3fa7999bacea0a4..2f2d22c0d385f17760df16ed91bbeb02ed22e1b3 100644 --- a/src/services/chart/charts/schemas/federation.ts +++ b/src/services/chart/charts/schemas/federation.ts @@ -1,29 +1,27 @@ -import { types, bool } from '../../../../misc/schema'; - /** * フェデレーションã«é–¢ã™ã‚‹ãƒãƒ£ãƒ¼ãƒˆ */ export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { instance: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'インスタンス数ã®åˆè¨ˆ' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少インスタンス数' }, } diff --git a/src/services/chart/charts/schemas/hashtag.ts b/src/services/chart/charts/schemas/hashtag.ts index 918242f66e3cb670345265e8fbc65f318e6514d6..4dfd61c97fe6a49e660e9912e0a44cbf2315264c 100644 --- a/src/services/chart/charts/schemas/hashtag.ts +++ b/src/services/chart/charts/schemas/hashtag.ts @@ -1,12 +1,10 @@ -import { types, bool } from '../../../../misc/schema'; - export const logSchema = { /** * 投稿ã•ã‚ŒãŸæ•° */ count: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '投稿ã•ã‚ŒãŸæ•°', }, }; @@ -15,17 +13,17 @@ export const logSchema = { * ãƒãƒƒã‚·ãƒ¥ã‚¿ã‚°ã«é–¢ã™ã‚‹ãƒãƒ£ãƒ¼ãƒˆ */ export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/charts/schemas/instance.ts b/src/services/chart/charts/schemas/instance.ts index d97f49ea7226a5ef5f36c2dd6db6dea3fd8f371e..d2152a4ae7b5651afc4a8e3652a0720dda3dc37a 100644 --- a/src/services/chart/charts/schemas/instance.ts +++ b/src/services/chart/charts/schemas/instance.ts @@ -1,73 +1,71 @@ -import { types, bool } from '../../../../misc/schema'; - /** * インスタンスã”ã¨ã®ãƒãƒ£ãƒ¼ãƒˆ */ export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { requests: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { failed: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '失敗ã—ãŸãƒªã‚¯ã‚¨ã‚¹ãƒˆæ•°' }, succeeded: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'æˆåŠŸã—ãŸãƒªã‚¯ã‚¨ã‚¹ãƒˆæ•°' }, received: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å—ä¿¡ã—ãŸãƒªã‚¯ã‚¨ã‚¹ãƒˆæ•°' }, } }, notes: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨æŠ•ç¨¿æ•°' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸæŠ•ç¨¿æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸæŠ•ç¨¿æ•°' }, diffs: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { normal: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '通常ã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, reply: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'リプライã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, renote: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Renoteã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, } @@ -76,103 +74,103 @@ export const schema = { }, users: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ¦ãƒ¼ã‚¶ãƒ¼æ•°' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼æ•°' }, } }, following: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ•ã‚©ãƒãƒ¼æ•°' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ•ã‚©ãƒãƒ¼æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ•ã‚©ãƒãƒ¼æ•°' }, } }, followers: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ•ã‚©ãƒãƒ¯ãƒ¼æ•°' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ•ã‚©ãƒãƒ¯ãƒ¼æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ•ã‚©ãƒãƒ¯ãƒ¼æ•°' }, } }, drive: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { totalFiles: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, totalUsage: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイルã®åˆè¨ˆã‚µã‚¤ã‚º' }, incFiles: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, incUsage: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–使用é‡' }, decFiles: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, decUsage: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–使用é‡' }, } diff --git a/src/services/chart/charts/schemas/network.ts b/src/services/chart/charts/schemas/network.ts index 819e2a145e783d0701c6ca5163eb9f64643a5ba3..30123c5d904d304a06f9dbdb2664dc3f3a854d9c 100644 --- a/src/services/chart/charts/schemas/network.ts +++ b/src/services/chart/charts/schemas/network.ts @@ -1,35 +1,33 @@ -import { types, bool } from '../../../../misc/schema'; - /** * ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ã«é–¢ã™ã‚‹ãƒãƒ£ãƒ¼ãƒˆ */ export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { incomingRequests: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å—ä¿¡ã—ãŸãƒªã‚¯ã‚¨ã‚¹ãƒˆæ•°' }, outgoingRequests: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'é€ä¿¡ã—ãŸãƒªã‚¯ã‚¨ã‚¹ãƒˆæ•°' }, totalTime: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¿œç”時間ã®åˆè¨ˆ' // TIP: (totalTime / incomingRequests) ã§ã²ã¨ã¤ã®ãƒªã‚¯ã‚¨ã‚¹ãƒˆã«å¹³å‡ã§ã©ã‚Œãらã„ã®æ™‚é–“ãŒã‹ã‹ã£ãŸã‹çŸ¥ã‚Œã‚‹ }, incomingBytes: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'åˆè¨ˆå—信データé‡' }, outgoingBytes: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'åˆè¨ˆé€ä¿¡ãƒ‡ãƒ¼ã‚¿é‡' }, } diff --git a/src/services/chart/charts/schemas/notes.ts b/src/services/chart/charts/schemas/notes.ts index aabe49edd91f660b122433ef457f17a4efc528f4..6dbf321b7c2e67779a2050e824e9b7c80fe94a52 100644 --- a/src/services/chart/charts/schemas/notes.ts +++ b/src/services/chart/charts/schemas/notes.ts @@ -1,43 +1,41 @@ -import { types, bool } from '../../../../misc/schema'; - const logSchema = { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨æŠ•ç¨¿æ•°' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸæŠ•ç¨¿æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸæŠ•ç¨¿æ•°' }, diffs: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { normal: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '通常ã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, reply: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'リプライã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, renote: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Renoteã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, } @@ -45,17 +43,17 @@ const logSchema = { }; export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/charts/schemas/per-user-drive.ts b/src/services/chart/charts/schemas/per-user-drive.ts index 62e77951677bae7fe246b2088fdf2ef5d9fb4fce..21312e82d8751d82211b414c66e1012a81e9ec4a 100644 --- a/src/services/chart/charts/schemas/per-user-drive.ts +++ b/src/services/chart/charts/schemas/per-user-drive.ts @@ -1,15 +1,13 @@ -import { types, bool } from '../../../../misc/schema'; - export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { /** * 集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイル数 */ totalCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, @@ -17,8 +15,8 @@ export const schema = { * 集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイルã®åˆè¨ˆã‚µã‚¤ã‚º */ totalSize: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ‰ãƒ©ã‚¤ãƒ–ファイルã®åˆè¨ˆã‚µã‚¤ã‚º' }, @@ -26,8 +24,8 @@ export const schema = { * å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数 */ incCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, @@ -35,8 +33,8 @@ export const schema = { * å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ä½¿ç”¨é‡ */ incSize: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–使用é‡' }, @@ -44,8 +42,8 @@ export const schema = { * 減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数 */ decCount: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ファイル数' }, @@ -53,8 +51,8 @@ export const schema = { * 減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–ä½¿ç”¨é‡ */ decSize: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ‰ãƒ©ã‚¤ãƒ–使用é‡' }, } diff --git a/src/services/chart/charts/schemas/per-user-following.ts b/src/services/chart/charts/schemas/per-user-following.ts index e57869e79a99346ec0c9badaf846b2c5efe7ee1f..dffd9c2572170c21b2efd018c082e154df84b25a 100644 --- a/src/services/chart/charts/schemas/per-user-following.ts +++ b/src/services/chart/charts/schemas/per-user-following.ts @@ -1,19 +1,17 @@ -import { types, bool } from '../../../../misc/schema'; - export const logSchema = { /** * フォãƒãƒ¼ã—ã¦ã„ã‚‹ */ followings: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { /** * フォãƒãƒ¼ã—ã¦ã„ã‚‹åˆè¨ˆ */ total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'フォãƒãƒ¼ã—ã¦ã„ã‚‹åˆè¨ˆ', }, @@ -21,8 +19,8 @@ export const logSchema = { * フォãƒãƒ¼ã—ãŸæ•° */ inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'フォãƒãƒ¼ã—ãŸæ•°', }, @@ -30,8 +28,8 @@ export const logSchema = { * フォãƒãƒ¼è§£é™¤ã—ãŸæ•° */ dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'フォãƒãƒ¼è§£é™¤ã—ãŸæ•°', }, } @@ -41,15 +39,15 @@ export const logSchema = { * フォãƒãƒ¼ã•ã‚Œã¦ã„ã‚‹ */ followers: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { /** * フォãƒãƒ¼ã•ã‚Œã¦ã„ã‚‹åˆè¨ˆ */ total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'フォãƒãƒ¼ã•ã‚Œã¦ã„ã‚‹åˆè¨ˆ', }, @@ -57,8 +55,8 @@ export const logSchema = { * フォãƒãƒ¼ã•ã‚ŒãŸæ•° */ inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'フォãƒãƒ¼ã•ã‚ŒãŸæ•°', }, @@ -66,8 +64,8 @@ export const logSchema = { * フォãƒãƒ¼è§£é™¤ã•ã‚ŒãŸæ•° */ dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'フォãƒãƒ¼è§£é™¤ã•ã‚ŒãŸæ•°', }, } @@ -75,17 +73,17 @@ export const logSchema = { }; export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/charts/schemas/per-user-notes.ts b/src/services/chart/charts/schemas/per-user-notes.ts index 76324500739fde3b631b79bdb549cea9df081f34..778f498c6e824552dade33573d7a2e5ded50e560 100644 --- a/src/services/chart/charts/schemas/per-user-notes.ts +++ b/src/services/chart/charts/schemas/per-user-notes.ts @@ -1,46 +1,44 @@ -import { types, bool } from '../../../../misc/schema'; - export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨æŠ•ç¨¿æ•°' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸæŠ•ç¨¿æ•°' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸæŠ•ç¨¿æ•°' }, diffs: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { normal: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '通常ã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, reply: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'リプライã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, renote: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'Renoteã®æŠ•ç¨¿æ•°ã®å·®åˆ†' }, } diff --git a/src/services/chart/charts/schemas/per-user-reactions.ts b/src/services/chart/charts/schemas/per-user-reactions.ts index df7d5a6dbb11cc8ad701c270831aa666b90c3702..d103124ccba189559d70974b686e4c77ebf5ce0b 100644 --- a/src/services/chart/charts/schemas/per-user-reactions.ts +++ b/src/services/chart/charts/schemas/per-user-reactions.ts @@ -1,12 +1,10 @@ -import { types, bool } from '../../../../misc/schema'; - export const logSchema = { /** * フォãƒãƒ¼ã—ã¦ã„ã‚‹åˆè¨ˆ */ count: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'リアクションã•ã‚ŒãŸæ•°', }, }; @@ -15,17 +13,17 @@ export const logSchema = { * ユーザーã”ã¨ã®ãƒªã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã«é–¢ã™ã‚‹ãƒãƒ£ãƒ¼ãƒˆ */ export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/charts/schemas/test-grouped.ts b/src/services/chart/charts/schemas/test-grouped.ts index 893458e90a17be3bebaca451381c9a4132b67762..163ec5bba3773ed946081727ace1956fbe28ac2c 100644 --- a/src/services/chart/charts/schemas/test-grouped.ts +++ b/src/services/chart/charts/schemas/test-grouped.ts @@ -1,28 +1,26 @@ -import { types, bool } from '../../../../misc/schema'; - export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { foo: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, } diff --git a/src/services/chart/charts/schemas/test-unique.ts b/src/services/chart/charts/schemas/test-unique.ts index 2b3f445ff02edcb8c4093285f0717ba48e787bf8..075a8092d94368975d385a30d158463e12ece506 100644 --- a/src/services/chart/charts/schemas/test-unique.ts +++ b/src/services/chart/charts/schemas/test-unique.ts @@ -1,12 +1,10 @@ -import { types, bool } from '../../../../misc/schema'; - export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { foo: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, } diff --git a/src/services/chart/charts/schemas/test.ts b/src/services/chart/charts/schemas/test.ts index 9bdc05990b6a29097278d3fdad1878afe262f52a..6142434a89cc205eac948176fe3a0134f5d7d01b 100644 --- a/src/services/chart/charts/schemas/test.ts +++ b/src/services/chart/charts/schemas/test.ts @@ -1,28 +1,26 @@ -import { types, bool } from '../../../../misc/schema'; - export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { foo: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '' }, } diff --git a/src/services/chart/charts/schemas/users.ts b/src/services/chart/charts/schemas/users.ts index 6ae61333503db198e99b9121d4715a7f453f43d4..11533699836237f8da6f0fa73fdbaa1c2339c284 100644 --- a/src/services/chart/charts/schemas/users.ts +++ b/src/services/chart/charts/schemas/users.ts @@ -1,12 +1,10 @@ -import { types, bool } from '../../../../misc/schema'; - const logSchema = { /** * 集計期間時点ã§ã®ã€å…¨ãƒ¦ãƒ¼ã‚¶ãƒ¼æ•° */ total: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '集計期間時点ã§ã®ã€å…¨ãƒ¦ãƒ¼ã‚¶ãƒ¼æ•°' }, @@ -14,8 +12,8 @@ const logSchema = { * å¢—åŠ ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼æ•° */ inc: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: 'å¢—åŠ ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼æ•°' }, @@ -23,24 +21,24 @@ const logSchema = { * 減少ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼æ•° */ dec: { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, description: '減少ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼æ•°' }, }; export const schema = { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: { local: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, remote: { - type: types.object, - optional: bool.false, nullable: bool.false, + type: 'object' as const, + optional: false as const, nullable: false as const, properties: logSchema }, } diff --git a/src/services/chart/core.ts b/src/services/chart/core.ts index 6564ef781395667a76b5f33d5d826e8c9e49cc64..d5fd9a5c5cc26ced5b4135550ded48ddbfd08ff7 100644 --- a/src/services/chart/core.ts +++ b/src/services/chart/core.ts @@ -8,7 +8,7 @@ import * as moment from 'moment'; import * as nestedProperty from 'nested-property'; import autobind from 'autobind-decorator'; import Logger from '../logger'; -import { Schema, bool, types } from '../../misc/schema'; +import { Schema } from '../../misc/schema'; import { EntitySchema, getRepository, Repository, LessThan, MoreThanOrEqual } from 'typeorm'; import { isDuplicateKeyValueError } from '../../misc/is-duplicate-key-value-error'; @@ -462,8 +462,8 @@ export function convertLog(logSchema: Schema): Schema { if (v.type === 'number') { v.type = 'array'; v.items = { - type: types.number, - optional: bool.false, nullable: bool.false, + type: 'number' as const, + optional: false as const, nullable: false as const, }; } else if (v.type === 'object') { for (const k of Object.keys(v.properties!)) {