From 37bae7b929cf46f8999b1c5789ff579444680ad7 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 14 Jan 2022 19:55:09 +0900 Subject: [PATCH] Ensure enum schema and Make "as const" put once --- packages/backend/src/misc/schema.ts | 29 +- .../src/models/repositories/antenna.ts | 4 +- packages/backend/src/models/schema/antenna.ts | 82 ++--- packages/backend/src/models/schema/app.ts | 34 +-- .../backend/src/models/schema/blocking.ts | 24 +- packages/backend/src/models/schema/channel.ts | 46 +-- packages/backend/src/models/schema/clip.ts | 36 +-- .../backend/src/models/schema/drive-file.ts | 90 +++--- .../backend/src/models/schema/drive-folder.ts | 36 +-- packages/backend/src/models/schema/emoji.ts | 34 +-- .../src/models/schema/federation-instance.ts | 94 +++--- .../backend/src/models/schema/following.ts | 34 +-- .../backend/src/models/schema/gallery-post.ts | 66 ++-- packages/backend/src/models/schema/hashtag.ts | 34 +-- .../src/models/schema/messaging-message.ts | 70 ++--- packages/backend/src/models/schema/muting.ts | 24 +- .../src/models/schema/note-favorite.ts | 24 +- .../src/models/schema/note-reaction.ts | 24 +- packages/backend/src/models/schema/note.ts | 170 +++++------ .../backend/src/models/schema/notification.ts | 62 ++-- packages/backend/src/models/schema/page.ts | 48 +-- packages/backend/src/models/schema/queue.ts | 26 +- .../backend/src/models/schema/user-group.ts | 30 +- .../backend/src/models/schema/user-list.ts | 26 +- packages/backend/src/models/schema/user.ts | 282 +++++++++--------- 25 files changed, 716 insertions(+), 713 deletions(-) diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index 3dbc0239ca..b4486fbd03 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -50,18 +50,18 @@ export const refs = { export type Packed = ObjType<(typeof refs[x])['properties']>; -export interface Schema { - type: 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any'; - nullable: boolean; - optional: boolean; - items?: Schema; - properties?: Obj; - description?: string; - example?: any; - format?: string; - ref?: keyof typeof refs; - enum?: string[]; - default?: boolean | null; +export type Schema = { + readonly type: 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any'; + readonly nullable: boolean; + readonly optional: boolean; + readonly items?: Schema; + readonly properties?: Obj; + readonly description?: string; + readonly example?: any; + readonly format?: string; + readonly ref?: keyof typeof refs; + readonly enum?: ReadonlyArray; + readonly default?: boolean | null; } type NonUndefinedPropertyNames = { @@ -98,7 +98,10 @@ type NullOrUndefined

= export type SchemaType

= p['type'] extends 'number' ? NullOrUndefined : - p['type'] extends 'string' ? NullOrUndefined : + p['type'] extends 'string' ? + p['enum'] extends ReadonlyArray ? + NullOrUndefined : + NullOrUndefined : p['type'] extends 'boolean' ? NullOrUndefined : p['type'] extends 'array' ? NullOrUndefined>[]> : p['type'] extends 'object' ? ( diff --git a/packages/backend/src/models/repositories/antenna.ts b/packages/backend/src/models/repositories/antenna.ts index 3bf0645a7f..29f939374b 100644 --- a/packages/backend/src/models/repositories/antenna.ts +++ b/packages/backend/src/models/repositories/antenna.ts @@ -19,7 +19,7 @@ export class AntennaRepository extends Repository { name: antenna.name, keywords: antenna.keywords, excludeKeywords: antenna.excludeKeywords, - src: antenna.src, + src: antenna.src as Packed<'Antenna'>['src'], userListId: antenna.userListId, userGroupId: userGroupJoining ? userGroupJoining.userGroupId : null, users: antenna.users, @@ -28,6 +28,6 @@ export class AntennaRepository extends Repository { withReplies: antenna.withReplies, withFile: antenna.withFile, hasUnreadNote, - }; + } as Packed<'Antenna'>; } } diff --git a/packages/backend/src/models/schema/antenna.ts b/packages/backend/src/models/schema/antenna.ts index e2fe300f2b..38e4a74ef1 100644 --- a/packages/backend/src/models/schema/antenna.ts +++ b/packages/backend/src/models/schema/antenna.ts @@ -1,90 +1,90 @@ export const packedAntennaSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, keywords: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, }, excludeKeywords: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, }, src: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, enum: ['home', 'all', 'users', 'list', 'group'], }, userListId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', }, userGroupId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', }, users: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, caseSensitive: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, default: false, }, notify: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, withReplies: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, default: false, }, withFile: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, hasUnreadNote: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, default: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/app.ts b/packages/backend/src/models/schema/app.ts index c7c151606f..8446f1a93d 100644 --- a/packages/backend/src/models/schema/app.ts +++ b/packages/backend/src/models/schema/app.ts @@ -1,34 +1,34 @@ export const packedAppSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, callbackUrl: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, permission: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, secret: { - type: 'string' as const, - optional: true as const, nullable: false as const, + type: 'string', + optional: true, nullable: false, }, isAuthorized: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/blocking.ts b/packages/backend/src/models/schema/blocking.ts index 9bbce7c7a4..fb5e1958e2 100644 --- a/packages/backend/src/models/schema/blocking.ts +++ b/packages/backend/src/models/schema/blocking.ts @@ -1,27 +1,27 @@ export const packedBlockingSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, blockeeId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, blockee: { - type: 'object' as const, - optional: false as const, nullable: false as const, - ref: 'User' as const, + type: 'object', + optional: false, nullable: false, + ref: 'User', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/channel.ts b/packages/backend/src/models/schema/channel.ts index 47a3755eda..5c4cc79445 100644 --- a/packages/backend/src/models/schema/channel.ts +++ b/packages/backend/src/models/schema/channel.ts @@ -1,52 +1,52 @@ export const packedChannelSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, lastNotedAt: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'date-time', }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, description: { - type: 'string' as const, - nullable: true as const, optional: false as const, + type: 'string', + nullable: true, optional: false, }, bannerUrl: { - type: 'string' as const, + type: 'string', format: 'url', - nullable: true as const, optional: false as const, + nullable: true, optional: false, }, notesCount: { - type: 'number' as const, - nullable: false as const, optional: false as const, + type: 'number', + nullable: false, optional: false, }, usersCount: { - type: 'number' as const, - nullable: false as const, optional: false as const, + type: 'number', + nullable: false, optional: false, }, isFollowing: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, userId: { - type: 'string' as const, - nullable: true as const, optional: false as const, + type: 'string', + nullable: true, optional: false, format: 'id', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/clip.ts b/packages/backend/src/models/schema/clip.ts index 34ba773c7e..edbc4ae134 100644 --- a/packages/backend/src/models/schema/clip.ts +++ b/packages/backend/src/models/schema/clip.ts @@ -1,39 +1,39 @@ export const packedClipSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, userId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, user: { - type: 'object' as const, - ref: 'User' as const, - optional: false as const, nullable: false as const, + type: 'object', + ref: 'User', + optional: false, nullable: false, }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, description: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, isPublic: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/drive-file.ts b/packages/backend/src/models/schema/drive-file.ts index 25576f75c3..1ed33f54db 100644 --- a/packages/backend/src/models/schema/drive-file.ts +++ b/packages/backend/src/models/schema/drive-file.ts @@ -1,108 +1,108 @@ export const packedDriveFileSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, example: 'lenna.jpg', }, type: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, example: 'image/jpeg', }, md5: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'md5', example: '15eca7fba0480996e2245f5185bf39f2', }, size: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, example: 51469, }, isSensitive: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, blurhash: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, properties: { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { width: { - type: 'number' as const, - optional: true as const, nullable: false as const, + type: 'number', + optional: true, nullable: false, example: 1280, }, height: { - type: 'number' as const, - optional: true as const, nullable: false as const, + type: 'number', + optional: true, nullable: false, example: 720, }, orientation: { - type: 'number' as const, - optional: true as const, nullable: false as const, + type: 'number', + optional: true, nullable: false, example: 8, }, avgColor: { - type: 'string' as const, - optional: true as const, nullable: false as const, + type: 'string', + optional: true, nullable: false, example: 'rgb(40,65,87)', }, }, }, url: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'url', }, thumbnailUrl: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'url', }, comment: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, folderId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', example: 'xxxxxxxxxx', }, folder: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'DriveFolder' as const, + type: 'object', + optional: true, nullable: true, + ref: 'DriveFolder', }, userId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', example: 'xxxxxxxxxx', }, user: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'User' as const, + type: 'object', + optional: true, nullable: true, + ref: 'User', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/drive-folder.ts b/packages/backend/src/models/schema/drive-folder.ts index 64c23dd75c..3767e72302 100644 --- a/packages/backend/src/models/schema/drive-folder.ts +++ b/packages/backend/src/models/schema/drive-folder.ts @@ -1,40 +1,40 @@ export const packedDriveFolderSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, foldersCount: { - type: 'number' as const, - optional: true as const, nullable: false as const, + type: 'number', + optional: true, nullable: false, }, filesCount: { - type: 'number' as const, - optional: true as const, nullable: false as const, + type: 'number', + optional: true, nullable: false, }, parentId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', example: 'xxxxxxxxxx', }, parent: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'DriveFolder' as const, + type: 'object', + optional: true, nullable: true, + ref: 'DriveFolder', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/emoji.ts b/packages/backend/src/models/schema/emoji.ts index 08a8ae8392..a5905f3225 100644 --- a/packages/backend/src/models/schema/emoji.ts +++ b/packages/backend/src/models/schema/emoji.ts @@ -1,37 +1,37 @@ export const packedEmojiSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, aliases: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, category: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, host: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, url: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/federation-instance.ts b/packages/backend/src/models/schema/federation-instance.ts index ea2e77140b..40eb3b0ff2 100644 --- a/packages/backend/src/models/schema/federation-instance.ts +++ b/packages/backend/src/models/schema/federation-instance.ts @@ -1,106 +1,106 @@ import config from "@/config"; export const packedFederationInstanceSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, caughtAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, host: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, example: 'misskey.example.com', }, usersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, notesCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, followingCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, followersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, driveUsage: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, driveFiles: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, latestRequestSentAt: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'date-time', }, lastCommunicatedAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, isNotResponding: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, isSuspended: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, softwareName: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, example: 'misskey', }, softwareVersion: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, example: config.version, }, openRegistrations: { - type: 'boolean' as const, - optional: false as const, nullable: true as const, + type: 'boolean', + optional: false, nullable: true, example: true, }, name: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, description: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, maintainerName: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, maintainerEmail: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, iconUrl: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'url', }, infoUpdatedAt: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'date-time', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/following.ts b/packages/backend/src/models/schema/following.ts index f82ae68cb6..ffcf36ab05 100644 --- a/packages/backend/src/models/schema/following.ts +++ b/packages/backend/src/models/schema/following.ts @@ -1,37 +1,37 @@ export const packedFollowingSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, followeeId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, followee: { - type: 'object' as const, - optional: true as const, nullable: false as const, - ref: 'User' as const, + type: 'object', + optional: true, nullable: false, + ref: 'User', }, followerId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, follower: { - type: 'object' as const, - optional: true as const, nullable: false as const, - ref: 'User' as const, + type: 'object', + optional: true, nullable: false, + ref: 'User', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/gallery-post.ts b/packages/backend/src/models/schema/gallery-post.ts index e45c60f136..b2b28948bd 100644 --- a/packages/backend/src/models/schema/gallery-post.ts +++ b/packages/backend/src/models/schema/gallery-post.ts @@ -1,70 +1,70 @@ export const packedGalleryPostSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, updatedAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, title: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, description: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, userId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, user: { - type: 'object' as const, - ref: 'User' as const, - optional: false as const, nullable: false as const, + type: 'object', + ref: 'User', + optional: false, nullable: false, }, fileIds: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, files: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'object' as const, - optional: false as const, nullable: false as const, - ref: 'DriveFile' as const, + type: 'object', + optional: false, nullable: false, + ref: 'DriveFile', }, }, tags: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, isSensitive: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/hashtag.ts b/packages/backend/src/models/schema/hashtag.ts index 910a55e9cc..7d3264e6a5 100644 --- a/packages/backend/src/models/schema/hashtag.ts +++ b/packages/backend/src/models/schema/hashtag.ts @@ -1,35 +1,35 @@ export const packedHashtagSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { tag: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, example: 'misskey', }, mentionedUsersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, mentionedLocalUsersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, mentionedRemoteUsersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, attachedUsersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, attachedLocalUsersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, attachedRemoteUsersCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/messaging-message.ts b/packages/backend/src/models/schema/messaging-message.ts index f85f859173..2bb1c2c734 100644 --- a/packages/backend/src/models/schema/messaging-message.ts +++ b/packages/backend/src/models/schema/messaging-message.ts @@ -1,74 +1,74 @@ export const packedMessagingMessageSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, userId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, user: { - type: 'object' as const, - ref: 'User' as const, - optional: true as const, nullable: false as const, + type: 'object', + ref: 'User', + optional: true, nullable: false, }, text: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, fileId: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, format: 'id', }, file: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'DriveFile' as const, + type: 'object', + optional: true, nullable: true, + ref: 'DriveFile', }, recipientId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', }, recipient: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'User' as const, + type: 'object', + optional: true, nullable: true, + ref: 'User', }, groupId: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, format: 'id', }, group: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'UserGroup' as const, + type: 'object', + optional: true, nullable: true, + ref: 'UserGroup', }, isRead: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, reads: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/muting.ts b/packages/backend/src/models/schema/muting.ts index ecab528129..525425dbc1 100644 --- a/packages/backend/src/models/schema/muting.ts +++ b/packages/backend/src/models/schema/muting.ts @@ -1,27 +1,27 @@ export const packedMutingSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, muteeId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, mutee: { - type: 'object' as const, - optional: false as const, nullable: false as const, - ref: 'User' as const, + type: 'object', + optional: false, nullable: false, + ref: 'User', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/note-favorite.ts b/packages/backend/src/models/schema/note-favorite.ts index e5bc748a39..69d82ec68d 100644 --- a/packages/backend/src/models/schema/note-favorite.ts +++ b/packages/backend/src/models/schema/note-favorite.ts @@ -1,27 +1,27 @@ export const packedNoteFavoriteSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, note: { - type: 'object' as const, - optional: false as const, nullable: false as const, - ref: 'Note' as const, + type: 'object', + optional: false, nullable: false, + ref: 'Note', }, noteId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/note-reaction.ts b/packages/backend/src/models/schema/note-reaction.ts index cf8f48375e..f048ac37a8 100644 --- a/packages/backend/src/models/schema/note-reaction.ts +++ b/packages/backend/src/models/schema/note-reaction.ts @@ -1,26 +1,26 @@ export const packedNoteReactionSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, user: { - type: 'object' as const, - optional: false as const, nullable: false as const, - ref: 'User' as const, + type: 'object', + optional: false, nullable: false, + ref: 'User', }, type: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/note.ts b/packages/backend/src/models/schema/note.ts index 554b176928..9e97815944 100644 --- a/packages/backend/src/models/schema/note.ts +++ b/packages/backend/src/models/schema/note.ts @@ -1,184 +1,184 @@ export const packedNoteSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, text: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, cw: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, }, userId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, user: { - type: 'object' as const, - ref: 'User' as const, - optional: false as const, nullable: false as const, + type: 'object', + ref: 'User', + optional: false, nullable: false, }, replyId: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, format: 'id', example: 'xxxxxxxxxx', }, renoteId: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, format: 'id', example: 'xxxxxxxxxx', }, reply: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'Note' as const, + type: 'object', + optional: true, nullable: true, + ref: 'Note', }, renote: { - type: 'object' as const, - optional: true as const, nullable: true as const, - ref: 'Note' as const, + type: 'object', + optional: true, nullable: true, + ref: 'Note', }, isHidden: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, visibility: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, mentions: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, visibleUserIds: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, fileIds: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, }, files: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'object' as const, - optional: false as const, nullable: false as const, - ref: 'DriveFile' as const, + type: 'object', + optional: false, nullable: false, + ref: 'DriveFile', }, }, tags: { - type: 'array' as const, - optional: true as const, nullable: false as const, + type: 'array', + optional: true, nullable: false, items: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, }, poll: { - type: 'object' as const, - optional: true as const, nullable: true as const, + type: 'object', + optional: true, nullable: true, }, channelId: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, format: 'id', example: 'xxxxxxxxxx', }, channel: { - type: 'object' as const, - optional: true as const, nullable: true as const, + type: 'object', + optional: true, nullable: true, items: { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, name: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, }, }, }, localOnly: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, emojis: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, items: { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, url: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, }, }, }, reactions: { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, }, renoteCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, repliesCount: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, uri: { - type: 'string' as const, - optional: true as const, nullable: false as const, + type: 'string', + optional: true, nullable: false, }, url: { - type: 'string' as const, - optional: true as const, nullable: false as const, + type: 'string', + optional: true, nullable: false, }, myReaction: { - type: 'object' as const, - optional: true as const, nullable: true as const, + type: 'object', + optional: true, nullable: true, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/notification.ts b/packages/backend/src/models/schema/notification.ts index 4afb17c35b..47083386ae 100644 --- a/packages/backend/src/models/schema/notification.ts +++ b/packages/backend/src/models/schema/notification.ts @@ -1,67 +1,67 @@ import { notificationTypes } from "@/types"; export const packedNotificationSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, isRead: { - type: 'boolean' as const, - optional: false as const, nullable: false as const, + type: 'boolean', + optional: false, nullable: false, }, type: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, enum: [...notificationTypes], }, user: { - type: 'object' as const, - ref: 'User' as const, - optional: true as const, nullable: true as const, + type: 'object', + ref: 'User', + optional: true, nullable: true, }, userId: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, format: 'id', }, note: { - type: 'object' as const, - ref: 'Note' as const, - optional: true as const, nullable: true as const, + type: 'object', + ref: 'Note', + optional: true, nullable: true, }, reaction: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, }, choice: { - type: 'number' as const, - optional: true as const, nullable: true as const, + type: 'number', + optional: true, nullable: true, }, invitation: { - type: 'object' as const, - optional: true as const, nullable: true as const, + type: 'object', + optional: true, nullable: true, }, body: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, }, header: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, }, icon: { - type: 'string' as const, - optional: true as const, nullable: true as const, + type: 'string', + optional: true, nullable: true, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/page.ts b/packages/backend/src/models/schema/page.ts index 262f83da2f..6df44a7201 100644 --- a/packages/backend/src/models/schema/page.ts +++ b/packages/backend/src/models/schema/page.ts @@ -1,52 +1,52 @@ export const packedPageSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, updatedAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, title: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, summary: { - type: 'string' as const, - optional: false as const, nullable: true as const, + type: 'string', + optional: false, nullable: true, }, content: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, }, variables: { - type: 'array' as const, - optional: false as const, nullable: false as const, + type: 'array', + optional: false, nullable: false, }, userId: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', }, user: { - type: 'object' as const, - ref: 'User' as const, - optional: false as const, nullable: false as const, + type: 'object', + ref: 'User', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/queue.ts b/packages/backend/src/models/schema/queue.ts index 7ec4ecd3b6..fdf2f2e56f 100644 --- a/packages/backend/src/models/schema/queue.ts +++ b/packages/backend/src/models/schema/queue.ts @@ -1,26 +1,26 @@ export const packedQueueCountSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { waiting: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, active: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, completed: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, failed: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, delayed: { - type: 'number' as const, - optional: false as const, nullable: false as const, + type: 'number', + optional: false, nullable: false, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/user-group.ts b/packages/backend/src/models/schema/user-group.ts index 895da141e2..2d67530c20 100644 --- a/packages/backend/src/models/schema/user-group.ts +++ b/packages/backend/src/models/schema/user-group.ts @@ -1,35 +1,35 @@ export const packedUserGroupSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, ownerId: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, format: 'id', }, userIds: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, items: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, format: 'id', }, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/user-list.ts b/packages/backend/src/models/schema/user-list.ts index 75965f8258..0eb538ad81 100644 --- a/packages/backend/src/models/schema/user-list.ts +++ b/packages/backend/src/models/schema/user-list.ts @@ -1,30 +1,30 @@ export const packedUserListSchema = { - type: 'object' as const, - optional: false as const, nullable: false as const, + type: 'object', + optional: false, nullable: false, properties: { id: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'id', example: 'xxxxxxxxxx', }, createdAt: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, format: 'date-time', }, name: { - type: 'string' as const, - optional: false as const, nullable: false as const, + type: 'string', + optional: false, nullable: false, }, userIds: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, items: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, format: 'id', }, }, }, -}; +} as const; diff --git a/packages/backend/src/models/schema/user.ts b/packages/backend/src/models/schema/user.ts index 89e33e8510..7b1b17373c 100644 --- a/packages/backend/src/models/schema/user.ts +++ b/packages/backend/src/models/schema/user.ts @@ -1,309 +1,309 @@ export const packedUserSchema = { - type: 'object' as const, - nullable: false as const, optional: false as const, + type: 'object', + nullable: false, optional: false, properties: { id: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, format: 'id', example: 'xxxxxxxxxx', }, name: { - type: 'string' as const, - nullable: true as const, optional: false as const, + type: 'string', + nullable: true, optional: false, example: '藍', }, username: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, example: 'ai', }, host: { - type: 'string' as const, - nullable: true as const, optional: false as const, + type: 'string', + nullable: true, optional: false, example: 'misskey.example.com', }, avatarUrl: { - type: 'string' as const, + type: 'string', format: 'url', - nullable: true as const, optional: false as const, + nullable: true, optional: false, }, avatarBlurhash: { - type: 'any' as const, - nullable: true as const, optional: false as const, + type: 'any', + nullable: true, optional: false, }, avatarColor: { - type: 'any' as const, - nullable: true as const, optional: false as const, + type: 'any', + nullable: true, optional: false, default: null, }, isAdmin: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, default: false, }, isModerator: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, default: false, }, isBot: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, isCat: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, emojis: { - type: 'array' as const, - nullable: false as const, optional: false as const, + type: 'array', + nullable: false, optional: false, items: { - type: 'object' as const, - nullable: false as const, optional: false as const, + type: 'object', + nullable: false, optional: false, properties: { name: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, }, url: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, format: 'url', }, }, }, }, url: { - type: 'string' as const, + type: 'string', format: 'url', - nullable: true as const, optional: true as const, + nullable: true, optional: true, }, createdAt: { - type: 'string' as const, - nullable: false as const, optional: true as const, + type: 'string', + nullable: false, optional: true, format: 'date-time', }, updatedAt: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, format: 'date-time', }, bannerUrl: { - type: 'string' as const, + type: 'string', format: 'url', - nullable: true as const, optional: true as const, + nullable: true, optional: true, }, bannerBlurhash: { - type: 'any' as const, - nullable: true as const, optional: true as const, + type: 'any', + nullable: true, optional: true, }, bannerColor: { - type: 'any' as const, - nullable: true as const, optional: true as const, + type: 'any', + nullable: true, optional: true, default: null, }, isLocked: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, isSuspended: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, example: false, }, description: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, example: 'Hi masters, I am Ai!', }, location: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, }, birthday: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, example: '2018-03-12', }, fields: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, items: { - type: 'object' as const, - nullable: false as const, optional: false as const, + type: 'object', + nullable: false, optional: false, properties: { name: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, }, value: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, }, }, maxLength: 4, }, }, followersCount: { - type: 'number' as const, - nullable: false as const, optional: true as const, + type: 'number', + nullable: false, optional: true, }, followingCount: { - type: 'number' as const, - nullable: false as const, optional: true as const, + type: 'number', + nullable: false, optional: true, }, notesCount: { - type: 'number' as const, - nullable: false as const, optional: true as const, + type: 'number', + nullable: false, optional: true, }, pinnedNoteIds: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, items: { - type: 'string' as const, - nullable: false as const, optional: false as const, + type: 'string', + nullable: false, optional: false, format: 'id', }, }, pinnedNotes: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, items: { - type: 'object' as const, - nullable: false as const, optional: false as const, - ref: 'Note' as const, + type: 'object', + nullable: false, optional: false, + ref: 'Note', }, }, pinnedPageId: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, }, pinnedPage: { - type: 'object' as const, - nullable: true as const, optional: true as const, - ref: 'Page' as const, + type: 'object', + nullable: true, optional: true, + ref: 'Page', }, twoFactorEnabled: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, default: false, }, usePasswordLessLogin: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, default: false, }, securityKeys: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, default: false, }, avatarId: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, format: 'id', }, bannerId: { - type: 'string' as const, - nullable: true as const, optional: true as const, + type: 'string', + nullable: true, optional: true, format: 'id', }, autoWatch: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, injectFeaturedNote: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, alwaysMarkNsfw: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, carefulBot: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, autoAcceptFollowed: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadSpecifiedNotes: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadMentions: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadAnnouncement: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadAntenna: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadChannel: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadMessagingMessage: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasUnreadNotification: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, hasPendingReceivedFollowRequest: { - type: 'boolean' as const, - nullable: false as const, optional: true as const, + type: 'boolean', + nullable: false, optional: true, }, integrations: { - type: 'object' as const, - nullable: false as const, optional: true as const, + type: 'object', + nullable: false, optional: true, }, mutedWords: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, }, mutedInstances: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, }, mutingNotificationTypes: { - type: 'array' as const, - nullable: false as const, optional: true as const, + type: 'array', + nullable: false, optional: true, }, isFollowing: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, hasPendingFollowRequestFromYou: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, hasPendingFollowRequestToYou: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, isFollowed: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, isBlocking: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, isBlocked: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, isMuted: { - type: 'boolean' as const, - optional: true as const, nullable: false as const, + type: 'boolean', + optional: true, nullable: false, }, }, -}; +} as const;