From 51aad804d61ec54f6927addfe4f93783e06de3f5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 13 Feb 2022 01:39:58 +0900 Subject: [PATCH 01/95] refactor: fix types --- packages/backend/src/services/chart/core.ts | 135 +++++++++++--------- 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index 61a7575706..04e98f97e8 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -17,8 +17,27 @@ const columnPrefix = '___' as const; const uniqueTempColumnPrefix = 'unique_temp___' as const; const columnDot = '_' as const; +type Schema = Record; + + range?: 'big' | 'small' | 'medium'; + + // previousな値を引き継ぐかどうか + accumulate?: boolean; +}>; + type KeyToColumnName = T extends `${infer R1}.${infer R2}` ? `${R1}${typeof columnDot}${KeyToColumnName}` : T; +type Columns = { + [K in keyof S as `${typeof columnPrefix}${KeyToColumnName}`]: number; +}; + +type TempColumnsForUnique = { + [K in keyof S as `${typeof uniqueTempColumnPrefix}${KeyToColumnName}`]: S[K]['uniqueIncrement'] extends true ? string[] : never; +}; + type RawRecord = { id: number; @@ -31,11 +50,7 @@ type RawRecord = { * 集計日時のUnixタイムスタンプ(秒) */ date: number; -} & { - [K in keyof S as `${typeof uniqueTempColumnPrefix}${KeyToColumnName}`]: S[K]['uniqueIncrement'] extends true ? string[] : never; -} & { - [K in keyof S as `${typeof columnPrefix}${KeyToColumnName}`]: number; -}; +} & TempColumnsForUnique & Columns; const camelToSnake = (str: string): string => { return str.replace(/([A-Z])/g, s => '_' + s.charAt(0).toLowerCase()); @@ -43,17 +58,6 @@ const camelToSnake = (str: string): string => { const removeDuplicates = (array: any[]) => Array.from(new Set(array)); -type Schema = Record; - - range?: 'big' | 'small' | 'medium'; - - // previousな値を引き継ぐかどうか - accumulate?: boolean; -}>; - type Commit = { [K in keyof S]?: S[K]['uniqueIncrement'] extends true ? string[] : number; }; @@ -78,8 +82,11 @@ export default abstract class Chart { diff: Commit; group: string | null; }[] = []; - protected repositoryForHour: Repository>; - protected repositoryForDay: Repository>; + // ↓にしたいけどfindOneとかで型エラーになる + //private repositoryForHour: Repository>; + //private repositoryForDay: Repository>; + private repositoryForHour: Repository<{ id: number; group?: string | null; date: number; }>; + private repositoryForDay: Repository<{ id: number; group?: string | null; date: number; }>; /** * 1日に一回程度実行されれば良いような計算処理を入れる(主にCASCADE削除などアプリケーション側で感知できない変動によるズレの修正用) @@ -196,23 +203,23 @@ export default abstract class Chart { this.schema = schema; const { hour, day } = Chart.schemaToEntity(name, schema, grouped); - this.repositoryForHour = getRepository>(hour); - this.repositoryForDay = getRepository>(day); + this.repositoryForHour = getRepository<{ id: number; group?: string | null; date: number; }>(hour); + this.repositoryForDay = getRepository<{ id: number; group?: string | null; date: number; }>(day); } @autobind private convertRawRecord(x: RawRecord): KVs { - const kvs = {} as KVs; - for (const k of Object.keys(x).filter(k => k.startsWith(columnPrefix))) { - kvs[k.substr(columnPrefix.length).split(columnDot).join('.')] = x[k]; + const kvs = {} as Record; + for (const k of Object.keys(x).filter((k) => k.startsWith(columnPrefix)) as (keyof Columns)[]) { + kvs[(k as string).substr(columnPrefix.length).split(columnDot).join('.')] = x[k]; } - return kvs; + return kvs as KVs; } @autobind private getNewLog(latest: KVs | null): KVs { const log = {} as Record; - for (const [k, v] of Object.entries(this.schema)) { + for (const [k, v] of Object.entries(this.schema) as ([keyof typeof this['schema'], this['schema'][string]])[]) { if (v.accumulate && latest) { log[k] = latest[k]; } else { @@ -235,7 +242,7 @@ export default abstract class Chart { order: { date: -1, }, - }).then(x => x || null); + }).then(x => x ?? null) as Promise | null>; } /** @@ -259,7 +266,7 @@ export default abstract class Chart { const currentLog = await repository.findOne({ date: Chart.dateToTimestamp(current), ...(group ? { group: group } : {}), - }); + }) as RawRecord; // ログがあればそれを返して終了 if (currentLog != null) { @@ -299,7 +306,7 @@ export default abstract class Chart { const currentLog = await repository.findOne({ date: date, ...(group ? { group: group } : {}), - }); + }) as RawRecord; // ログがあればそれを返して終了 if (currentLog != null) return currentLog; @@ -315,7 +322,7 @@ export default abstract class Chart { date: date, ...(group ? { group: group } : {}), ...columns, - }).then(x => repository.findOneOrFail(x.identifiers[0])); + }).then(x => repository.findOneOrFail(x.identifiers[0])) as RawRecord; logger.info(`${this.name + (group ? `:${group}` : '')}(${span}): New commit created`); @@ -349,7 +356,7 @@ export default abstract class Chart { // これを回避するための実装は複雑になりそうなため、一旦保留。 const update = async (logHour: RawRecord, logDay: RawRecord): Promise => { - const finalDiffs = {} as Record; + const finalDiffs = {} as Record; for (const diff of this.buffer.filter(q => q.group == null || (q.group === logHour.group)).map(q => q.diff)) { for (const [k, v] of Object.entries(diff)) { @@ -359,23 +366,23 @@ export default abstract class Chart { if (typeof finalDiffs[k] === 'number') { (finalDiffs[k] as number) += v as number; } else { - (finalDiffs[k] as unknown[]) = (finalDiffs[k] as unknown[]).concat(v); + (finalDiffs[k] as string[]) = (finalDiffs[k] as string[]).concat(v); } } } } - const queryForHour: Record string)> = {}; - const queryForDay: Record string)> = {}; + const queryForHour: Record, number | (() => string)> = {} as any; + const queryForDay: Record, number | (() => string)> = {} as any; for (const [k, v] of Object.entries(finalDiffs)) { if (typeof v === 'number') { - const name = columnPrefix + k.replaceAll('.', columnDot); + const name = columnPrefix + k.replaceAll('.', columnDot) as keyof Columns; if (v > 0) queryForHour[name] = () => `"${name}" + ${v}`; if (v < 0) queryForHour[name] = () => `"${name}" - ${Math.abs(v)}`; if (v > 0) queryForDay[name] = () => `"${name}" + ${v}`; if (v < 0) queryForDay[name] = () => `"${name}" - ${Math.abs(v)}`; } else if (Array.isArray(v) && v.length > 0) { // ユニークインクリメント - const tempColumnName = uniqueTempColumnPrefix + k.replaceAll('.', columnDot); + const tempColumnName = uniqueTempColumnPrefix + k.replaceAll('.', columnDot) as keyof TempColumnsForUnique; // TODO: item をSQLエスケープ const itemsForHour = v.filter(item => !logHour[tempColumnName].includes(item)).map(item => `"${item}"`); const itemsForDay = v.filter(item => !logDay[tempColumnName].includes(item)).map(item => `"${item}"`); @@ -387,10 +394,10 @@ export default abstract class Chart { // bake unique count for (const [k, v] of Object.entries(finalDiffs)) { if (this.schema[k].uniqueIncrement) { - const name = columnPrefix + k.replaceAll('.', columnDot); - const tempColumnName = uniqueTempColumnPrefix + k.replaceAll('.', columnDot); - queryForHour[name] = new Set([...v, ...logHour[tempColumnName]]).size; - queryForDay[name] = new Set([...v, ...logDay[tempColumnName]]).size; + const name = columnPrefix + k.replaceAll('.', columnDot) as keyof Columns; + const tempColumnName = uniqueTempColumnPrefix + k.replaceAll('.', columnDot) as keyof TempColumnsForUnique; + queryForHour[name] = new Set([...(v as string[]), ...logHour[tempColumnName]]).size; + queryForDay[name] = new Set([...(v as string[]), ...logDay[tempColumnName]]).size; } } @@ -399,16 +406,18 @@ export default abstract class Chart { for (const [k, v] of Object.entries(this.schema)) { const intersection = v.intersection; if (intersection) { - const name = columnPrefix + k.replaceAll('.', columnDot); + const name = columnPrefix + k.replaceAll('.', columnDot) as keyof Columns; const firstKey = intersection[0]; - const firstTempColumnName = uniqueTempColumnPrefix + firstKey.replaceAll('.', columnDot); - const currentValuesForHour = new Set([...(finalDiffs[firstKey] ?? []), ...logHour[firstTempColumnName]]); - const currentValuesForDay = new Set([...(finalDiffs[firstKey] ?? []), ...logDay[firstTempColumnName]]); + const firstTempColumnName = uniqueTempColumnPrefix + firstKey.replaceAll('.', columnDot) as keyof TempColumnsForUnique; + const firstValues = finalDiffs[firstKey] as string[] | undefined; + const currentValuesForHour = new Set([...(firstValues ?? []), ...logHour[firstTempColumnName]]); + const currentValuesForDay = new Set([...(firstValues ?? []), ...logDay[firstTempColumnName]]); for (let i = 1; i < intersection.length; i++) { const targetKey = intersection[i]; - const targetTempColumnName = uniqueTempColumnPrefix + targetKey.replaceAll('.', columnDot); - const targetValuesForHour = new Set([...(finalDiffs[targetKey] ?? []), ...logHour[targetTempColumnName]]); - const targetValuesForDay = new Set([...(finalDiffs[targetKey] ?? []), ...logDay[targetTempColumnName]]); + const targetTempColumnName = uniqueTempColumnPrefix + targetKey.replaceAll('.', columnDot) as keyof TempColumnsForUnique; + const targetValues = finalDiffs[targetKey] as string[] | undefined; + const targetValuesForHour = new Set([...(targetValues ?? []), ...logHour[targetTempColumnName]]); + const targetValuesForDay = new Set([...(targetValues ?? []), ...logDay[targetTempColumnName]]); currentValuesForHour.forEach(v => { if (!targetValuesForHour.has(v)) currentValuesForHour.delete(v); }); @@ -425,12 +434,12 @@ export default abstract class Chart { await Promise.all([ this.repositoryForHour.createQueryBuilder() .update() - .set(queryForHour) + .set(queryForHour as any) .where('id = :id', { id: logHour.id }) .execute(), this.repositoryForDay.createQueryBuilder() .update() - .set(queryForDay) + .set(queryForDay as any) .where('id = :id', { id: logDay.id }) .execute(), ]); @@ -456,10 +465,10 @@ export default abstract class Chart { public async tick(major: boolean, group: string | null = null): Promise { const data = major ? await this.tickMajor(group) : await this.tickMinor(group); - const columns = {} as Record; - for (const [k, v] of Object.entries(data)) { - const name = k.replaceAll('.', columnDot); - columns[columnPrefix + name] = v; + const columns = {} as Record, number>; + for (const [k, v] of Object.entries(data) as ([keyof typeof data, number])[]) { + const name = columnPrefix + (k as string).replaceAll('.', columnDot) as keyof Columns; + columns[name] = v; } if (Object.keys(columns).length === 0) { @@ -470,12 +479,12 @@ export default abstract class Chart { await Promise.all([ this.repositoryForHour.createQueryBuilder() .update() - .set(columns as any) + .set(columns) .where('id = :id', { id: logHour.id }) .execute(), this.repositoryForDay.createQueryBuilder() .update() - .set(columns as any) + .set(columns) .where('id = :id', { id: logDay.id }) .execute(), ]); @@ -501,11 +510,11 @@ export default abstract class Chart { const gt = Chart.dateToTimestamp(current) - (60 * 60 * 24 * 3); const lt = Chart.dateToTimestamp(current) - (60 * 60 * 24); - const columns = {} as Record; + const columns = {} as Record, []>; for (const [k, v] of Object.entries(this.schema)) { if (v.uniqueIncrement) { - const name = k.replaceAll('.', columnDot); - columns[uniqueTempColumnPrefix + name] = []; + const name = uniqueTempColumnPrefix + k.replaceAll('.', columnDot) as keyof TempColumnsForUnique; + columns[name] = []; } } @@ -516,13 +525,13 @@ export default abstract class Chart { await Promise.all([ this.repositoryForHour.createQueryBuilder() .update() - .set(columns as any) + .set(columns) .where('date > :gt', { gt }) .andWhere('date < :lt', { lt }) .execute(), this.repositoryForDay.createQueryBuilder() .update() - .set(columns as any) + .set(columns) .where('date > :gt', { gt }) .andWhere('date < :lt', { lt }) .execute(), @@ -555,7 +564,7 @@ export default abstract class Chart { order: { date: -1, }, - }); + }) as RawRecord[]; // 要求された範囲にログがひとつもなかったら if (logs.length === 0) { @@ -567,7 +576,7 @@ export default abstract class Chart { order: { date: -1, }, - }); + }) as RawRecord; if (recentLog) { logs = [recentLog]; @@ -584,7 +593,7 @@ export default abstract class Chart { order: { date: -1, }, - }); + }) as RawRecord; if (outdatedLog) { logs.push(outdatedLog); @@ -620,7 +629,7 @@ export default abstract class Chart { * にする */ for (const record of chart) { - for (const [k, v] of Object.entries(record)) { + for (const [k, v] of Object.entries(record) as ([keyof typeof record, number])[]) { if (res[k]) { res[k].push(v); } else { From 93cb26e8795e1b4c32616f56bc1f9a209c13ad8a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 13 Feb 2022 12:46:52 +0900 Subject: [PATCH 02/95] refactor: fix types --- packages/backend/src/services/chart/core.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index 04e98f97e8..ddcedba94b 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -266,7 +266,7 @@ export default abstract class Chart { const currentLog = await repository.findOne({ date: Chart.dateToTimestamp(current), ...(group ? { group: group } : {}), - }) as RawRecord; + }) as RawRecord | undefined; // ログがあればそれを返して終了 if (currentLog != null) { @@ -306,7 +306,7 @@ export default abstract class Chart { const currentLog = await repository.findOne({ date: date, ...(group ? { group: group } : {}), - }) as RawRecord; + }) as RawRecord | undefined; // ログがあればそれを返して終了 if (currentLog != null) return currentLog; @@ -576,7 +576,7 @@ export default abstract class Chart { order: { date: -1, }, - }) as RawRecord; + }) as RawRecord | undefined; if (recentLog) { logs = [recentLog]; @@ -593,7 +593,7 @@ export default abstract class Chart { order: { date: -1, }, - }) as RawRecord; + }) as RawRecord | undefined; if (outdatedLog) { logs.push(outdatedLog); From 9d7352a9e43e1326b1dd7f4068ffa366c818b2be Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 13 Feb 2022 16:35:53 +0900 Subject: [PATCH 03/95] =?UTF-8?q?fix(client):=20=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=94=E3=83=83=E3=82=AB?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E9=AB=98=E3=81=95=E3=81=8C=E4=BD=8E=E3=81=8F?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=9F=E3=81=BE=E3=81=BE=E6=88=BB=E3=82=89?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #8071 --- CHANGELOG.md | 8 +++++++ packages/client/src/components/ui/modal.vue | 23 +++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f070909f..677fb5698b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ You should also include the user name that made the change. --> +## 12.x.x (unreleased) + +### Improvements +- + +### Bugfixes +- Client: リアクションピッカーの高さが低くなったまま戻らないことがあるのを修正 @syuilo + ## 12.107.0 (2022/02/12) ### Improvements diff --git a/packages/client/src/components/ui/modal.vue b/packages/client/src/components/ui/modal.vue index b42c0e4d42..c83453924e 100644 --- a/packages/client/src/components/ui/modal.vue +++ b/packages/client/src/components/ui/modal.vue @@ -102,7 +102,6 @@ const align = () => { if (type.value === 'drawer') return; const popover = content.value!; - if (popover == null) return; const rect = props.src.getBoundingClientRect(); @@ -131,20 +130,23 @@ const align = () => { left = window.innerWidth - width; } + const underSpace = (window.innerHeight - MARGIN) - top; + const upperSpace = (rect.top - MARGIN); + // 画面から縦にはみ出る場合 if (top + height > (window.innerHeight - MARGIN)) { if (props.noOverlap) { - const underSpace = (window.innerHeight - MARGIN) - top; - const upperSpace = (rect.top - MARGIN); if (underSpace >= (upperSpace / 3)) { - maxHeight.value = underSpace; + maxHeight.value = underSpace; } else { - maxHeight.value = upperSpace; + maxHeight.value = upperSpace; top = (upperSpace + MARGIN) - height; } } else { top = (window.innerHeight - MARGIN) - height; } + } else { + maxHeight.value = underSpace; } } else { // 画面から横にはみ出る場合 @@ -152,20 +154,23 @@ const align = () => { left = window.innerWidth - width + window.pageXOffset - 1; } + const underSpace = (window.innerHeight - MARGIN) - (top - window.pageYOffset); + const upperSpace = (rect.top - MARGIN); + // 画面から縦にはみ出る場合 if (top + height - window.pageYOffset > (window.innerHeight - MARGIN)) { if (props.noOverlap) { - const underSpace = (window.innerHeight - MARGIN) - (top - window.pageYOffset); - const upperSpace = (rect.top - MARGIN); if (underSpace >= (upperSpace / 3)) { - maxHeight.value = underSpace; + maxHeight.value = underSpace; } else { - maxHeight.value = upperSpace; + maxHeight.value = upperSpace; top = window.pageYOffset + ((upperSpace + MARGIN) - height); } } else { top = (window.innerHeight - MARGIN) - height + window.pageYOffset - 1; } + } else { + maxHeight.value = underSpace; } } From 7492a158d2f75303fe8e791835be4f6fdc359216 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 15 Feb 2022 23:08:50 +0900 Subject: [PATCH 04/95] refactor: fix types --- .../backend/src/server/api/common/generate-replies-query.ts | 2 +- packages/backend/src/server/api/define.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/common/generate-replies-query.ts b/packages/backend/src/server/api/common/generate-replies-query.ts index 249064d589..fac425b761 100644 --- a/packages/backend/src/server/api/common/generate-replies-query.ts +++ b/packages/backend/src/server/api/common/generate-replies-query.ts @@ -10,7 +10,7 @@ export function generateRepliesQuery(q: SelectQueryBuilder, me?: Pick { qb .where(`note.replyId IS NULL`) // 返信ではない .orWhere('note.replyUserId = :meId', { meId: me.id }) // 返信だけど自分のノートへの返信 diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index e0720e2adb..b6bb2da8ac 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -18,6 +18,7 @@ type SimpleUserInfo = { isAdmin: ILocalUser['isAdmin']; isModerator: ILocalUser['isModerator']; isSilenced: ILocalUser['isSilenced']; + showTimelineReplies: ILocalUser['showTimelineReplies']; }; type Params = { From debef43111a91cd34355e0cfbcc3146c1ebcfa9e Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 18 Feb 2022 20:30:22 +0900 Subject: [PATCH 05/95] Delete jobs.ts --- .../server/api/endpoints/admin/queue/jobs.ts | 82 ------------------- 1 file changed, 82 deletions(-) delete mode 100644 packages/backend/src/server/api/endpoints/admin/queue/jobs.ts diff --git a/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts b/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts deleted file mode 100644 index df0b4a8f13..0000000000 --- a/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; -import $ from 'cafy'; -import define from '../../../define'; - -export const meta = { - tags: ['admin'], - - requireCredential: true, - requireModerator: true, - - params: { - domain: { - validator: $.str.or(['deliver', 'inbox', 'db', 'objectStorage']), - }, - - state: { - validator: $.str.or(['active', 'waiting', 'delayed']), - }, - - limit: { - validator: $.optional.num, - default: 50, - }, - }, - - res: { - type: 'array', - optional: false, nullable: false, - items: { - type: 'object', - optional: false, nullable: false, - properties: { - id: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - data: { - type: 'object', - optional: false, nullable: false, - }, - attempts: { - type: 'number', - optional: false, nullable: false, - }, - maxAttempts: { - type: 'number', - optional: false, nullable: false, - }, - timestamp: { - type: 'number', - optional: false, nullable: false, - }, - }, - }, - }, -} as const; - -// eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - const queue = - ps.domain === 'deliver' ? deliverQueue : - ps.domain === 'inbox' ? inboxQueue : - ps.domain === 'db' ? dbQueue : - ps.domain === 'objectStorage' ? objectStorageQueue : - null as never; - - const jobs = await queue.getJobs([ps.state], 0, ps.limit!); - - return jobs.map(job => { - const data = job.data; - delete data.content; - delete data.user; - return { - id: job.id, - data, - attempts: job.attemptsMade, - maxAttempts: job.opts ? job.opts.attempts : 0, - timestamp: job.timestamp, - }; - }); -}); From 0d3757f2d32f85c456138851f438927300594180 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 18 Feb 2022 20:43:50 +0900 Subject: [PATCH 06/95] refactor: add InstanceRepository --- packages/backend/src/models/index.ts | 3 +- .../repositories/federation-instance.ts | 2 - .../src/models/repositories/instance.ts | 39 +++++++++++++++++++ .../src/models/schema/federation-instance.ts | 8 ---- 4 files changed, 41 insertions(+), 11 deletions(-) delete mode 100644 packages/backend/src/models/repositories/federation-instance.ts create mode 100644 packages/backend/src/models/repositories/instance.ts diff --git a/packages/backend/src/models/index.ts b/packages/backend/src/models/index.ts index 67da347395..da64063cef 100644 --- a/packages/backend/src/models/index.ts +++ b/packages/backend/src/models/index.ts @@ -61,6 +61,7 @@ import { RegistryItem } from './entities/registry-item'; import { Ad } from './entities/ad'; import { PasswordResetRequest } from './entities/password-reset-request'; import { UserPending } from './entities/user-pending'; +import { InstanceRepository } from './repositories/instance'; export const Announcements = getRepository(Announcement); export const AnnouncementReads = getRepository(AnnouncementRead); @@ -89,7 +90,7 @@ export const UserNotePinings = getRepository(UserNotePining); export const UsedUsernames = getRepository(UsedUsername); export const Followings = getCustomRepository(FollowingRepository); export const FollowRequests = getCustomRepository(FollowRequestRepository); -export const Instances = getRepository(Instance); +export const Instances = getCustomRepository(InstanceRepository); export const Emojis = getCustomRepository(EmojiRepository); export const DriveFiles = getCustomRepository(DriveFileRepository); export const DriveFolders = getCustomRepository(DriveFolderRepository); diff --git a/packages/backend/src/models/repositories/federation-instance.ts b/packages/backend/src/models/repositories/federation-instance.ts deleted file mode 100644 index 426fd5bfc3..0000000000 --- a/packages/backend/src/models/repositories/federation-instance.ts +++ /dev/null @@ -1,2 +0,0 @@ -import config from '@/config/index'; - diff --git a/packages/backend/src/models/repositories/instance.ts b/packages/backend/src/models/repositories/instance.ts new file mode 100644 index 0000000000..6097f58ba6 --- /dev/null +++ b/packages/backend/src/models/repositories/instance.ts @@ -0,0 +1,39 @@ +import { EntityRepository, Repository } from 'typeorm'; +import { Instance } from '@/models/entities/instance'; +import { Packed } from '@/misc/schema'; + +@EntityRepository(Instance) +export class InstanceRepository extends Repository { + public async pack( + instance: Instance, + ): Promise> { + return { + id: instance.id, + caughtAt: instance.caughtAt.toISOString(), + host: instance.host, + usersCount: instance.usersCount, + notesCount: instance.notesCount, + followingCount: instance.followingCount, + followersCount: instance.followersCount, + latestRequestSentAt: instance.latestRequestSentAt ? instance.latestRequestSentAt.toISOString() : null, + lastCommunicatedAt: instance.lastCommunicatedAt.toISOString(), + isNotResponding: instance.isNotResponding, + isSuspended: instance.isSuspended, + softwareName: instance.softwareName, + softwareVersion: instance.softwareVersion, + openRegistrations: instance.openRegistrations, + name: instance.name, + description: instance.description, + maintainerName: instance.maintainerName, + maintainerEmail: instance.maintainerEmail, + iconUrl: instance.iconUrl, + infoUpdatedAt: instance.infoUpdatedAt ? instance.infoUpdatedAt.toISOString() : null, + }; + } + + public packMany( + instances: Instance[], + ) { + return Promise.all(instances.map(x => this.pack(x))); + } +} diff --git a/packages/backend/src/models/schema/federation-instance.ts b/packages/backend/src/models/schema/federation-instance.ts index eef2f9e24f..41fc9d3ef7 100644 --- a/packages/backend/src/models/schema/federation-instance.ts +++ b/packages/backend/src/models/schema/federation-instance.ts @@ -34,14 +34,6 @@ export const packedFederationInstanceSchema = { type: 'number', optional: false, nullable: false, }, - driveUsage: { - type: 'number', - optional: false, nullable: false, - }, - driveFiles: { - type: 'number', - optional: false, nullable: false, - }, latestRequestSentAt: { type: 'string', optional: false, nullable: true, From 0cee1dfbd6b60ff80d2ac3cc0612f2753a08ac6c Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 18 Feb 2022 22:29:23 +0900 Subject: [PATCH 07/95] refactor: better getChart result type --- packages/backend/src/services/chart/core.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index ddcedba94b..cc10900e9f 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -70,6 +70,18 @@ type ChartResult = { [P in keyof T]: number[]; }; +type UnionToIntersection = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never; + +type UnflattenSingleton = K extends `${infer A}.${infer B}` + ? { [_ in A]: UnflattenSingleton; } + : { [_ in K]: V; }; + +type Unflatten> = UnionToIntersection< + { + [K in Extract]: UnflattenSingleton; + }[Extract] +>; + /** * 様々なチャートの管理を司るクラス */ @@ -642,12 +654,12 @@ export default abstract class Chart { } @autobind - public async getChart(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise> { + public async getChart(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise>> { const result = await this.getChartRaw(span, amount, cursor, group); const object = {}; for (const [k, v] of Object.entries(result)) { nestedProperty.set(object, k, v); } - return object; + return object as Unflatten>; } } From 59785ea04cee105ac0188c5090f81b570c0c2b08 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 19 Feb 2022 00:48:04 +0900 Subject: [PATCH 08/95] update deps --- package.json | 6 +- packages/backend/package.json | 39 +- packages/backend/yarn.lock | 411 ++++++------ packages/client/package.json | 57 +- packages/client/yarn.lock | 1170 ++++++++++++++------------------- yarn.lock | 152 +---- 6 files changed, 780 insertions(+), 1055 deletions(-) diff --git a/package.json b/package.json index 621b590037..68421f0e37 100644 --- a/package.json +++ b/package.json @@ -42,11 +42,9 @@ "js-yaml": "4.1.0" }, "devDependencies": { - "@redocly/openapi-core": "1.0.0-beta.79", - "@types/fluent-ffmpeg": "2.1.20", - "@typescript-eslint/parser": "5.10.0", + "@typescript-eslint/parser": "5.12.0", "cross-env": "7.0.3", - "cypress": "9.4.1", + "cypress": "9.5.0", "start-server-and-test": "1.14.0", "typescript": "4.5.5" } diff --git a/packages/backend/package.json b/packages/backend/package.json index c331da7324..d143846f6f 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -22,7 +22,7 @@ "@sinonjs/fake-timers": "9.1.0", "@syuilo/aiscript": "0.11.1", "@types/bcryptjs": "2.4.2", - "@types/bull": "3.15.7", + "@types/bull": "3.15.8", "@types/cbor": "6.0.0", "@types/escape-regexp": "0.0.1", "@types/glob": "7.2.0", @@ -41,8 +41,8 @@ "@types/koa__cors": "3.1.1", "@types/koa__multer": "2.0.4", "@types/koa__router": "8.0.11", - "@types/mocha": "8.2.3", - "@types/node": "17.0.14", + "@types/mocha": "9.1.0", + "@types/node": "17.0.18", "@types/node-fetch": "3.0.3", "@types/nodemailer": "6.4.4", "@types/oauth": "0.9.1", @@ -67,28 +67,27 @@ "@types/web-push": "3.3.2", "@types/websocket": "1.0.5", "@types/ws": "8.2.2", - "@typescript-eslint/eslint-plugin": "5.10.2", - "@typescript-eslint/parser": "5.10.2", + "@typescript-eslint/eslint-plugin": "5.12.0", + "@typescript-eslint/parser": "5.12.0", "abort-controller": "3.0.0", "archiver": "5.3.0", "autobind-decorator": "2.4.0", "autwh": "0.1.0", "aws-sdk": "2.1067.0", "bcryptjs": "2.4.3", - "blurhash": "1.1.4", - "broadcast-channel": "4.9.0", - "bull": "4.5.0", + "blurhash": "1.1.5", + "broadcast-channel": "4.10.0", + "bull": "4.5.5", "cacheable-lookup": "6.0.4", "cafy": "15.2.1", "cbor": "8.1.0", "chalk": "4.1.2", "cli-highlight": "2.1.11", "content-disposition": "0.5.4", - "crc-32": "1.2.1", "date-fns": "2.28.0", "deep-email-validator": "0.1.21", "escape-regexp": "0.0.1", - "eslint": "8.8.0", + "eslint": "8.9.0", "eslint-plugin-import": "2.25.4", "eventemitter3": "4.0.7", "feed": "4.2.2", @@ -119,7 +118,7 @@ "mfm-js": "0.21.0", "mime-types": "2.1.34", "misskey-js": "0.0.14", - "mocha": "8.4.0", + "mocha": "9.2.0", "ms": "3.0.0-canary.1", "multer": "1.4.4", "nested-property": "4.0.0", @@ -127,7 +126,7 @@ "nodemailer": "6.7.2", "os-utils": "0.0.14", "parse5": "6.0.1", - "pg": "8.7.1", + "pg": "8.7.3", "portscanner": "2.2.0", "private-ip": "2.3.3", "probe-image-size": "7.2.3", @@ -146,38 +145,38 @@ "require-all": "3.0.0", "rndstr": "1.0.0", "s-age": "1.1.2", - "sanitize-html": "2.6.1", + "sanitize-html": "2.7.0", "seedrandom": "3.0.5", - "sharp": "0.30.0", + "sharp": "0.30.1", "speakeasy": "2.0.0", "strict-event-emitter-types": "2.0.0", "stringz": "2.1.0", "style-loader": "3.3.1", "summaly": "2.5.0", "syslog-pro": "1.0.0", - "systeminformation": "5.11.0", + "systeminformation": "5.11.3", "throttle-debounce": "3.0.1", "tinycolor2": "1.4.2", "tmp": "0.2.1", "ts-loader": "9.2.6", - "ts-node": "10.4.0", + "ts-node": "10.5.0", "tsc-alias": "1.4.1", "tsconfig-paths": "3.12.0", "twemoji-parser": "13.1.0", - "typeorm": "0.2.41", + "typeorm": "0.2.43", "typescript": "4.5.5", "ulid": "2.3.0", "unzipper": "0.10.11", "uuid": "8.3.2", "web-push": "3.4.5", "websocket": "1.0.34", - "ws": "8.4.2", + "ws": "8.5.0", "xev": "2.0.1" }, "devDependencies": { - "@redocly/openapi-core": "1.0.0-beta.79", + "@redocly/openapi-core": "1.0.0-beta.82", "@types/fluent-ffmpeg": "2.1.20", "cross-env": "7.0.3", - "execa": "6.0.0" + "execa": "6.1.0" } } diff --git a/packages/backend/yarn.lock b/packages/backend/yarn.lock index 878ba11f7f..aa7a66f86b 100644 --- a/packages/backend/yarn.lock +++ b/packages/backend/yarn.lock @@ -82,14 +82,14 @@ pump "^3.0.0" secure-json-parse "^2.1.0" -"@eslint/eslintrc@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.0.5.tgz#33f1b838dbf1f923bfa517e008362b78ddbbf318" - integrity sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ== +"@eslint/eslintrc@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.1.0.tgz#583d12dbec5d4f22f333f9669f7d0b7c7815b4d3" + integrity sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.2.0" + espree "^9.3.1" globals "^13.9.0" ignore "^4.0.6" import-fresh "^3.2.1" @@ -216,10 +216,10 @@ require-from-string "^2.0.2" uri-js "^4.2.2" -"@redocly/openapi-core@1.0.0-beta.79": - version "1.0.0-beta.79" - resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.0.0-beta.79.tgz#7512b3507ab99dc78226f9069669c5302abb0969" - integrity sha512-do79vGt3iiHsaVG9LKY8dH+d1E7TLHr+3T+CQ1lqagtWVjYOxqGaoxAT8tRD7R1W0z8BmS4e2poNON6c1sxP5g== +"@redocly/openapi-core@1.0.0-beta.82": + version "1.0.0-beta.82" + resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.0.0-beta.82.tgz#5f232e9c8f82499c2d96d9268b22423c8f859fe2" + integrity sha512-bJ0WclpgkFv4aa5QWU83ARCv3VQJy9U94reb1chOTg9s2bsTHbYuUwRv6G370a7lFXX86AyB3dT5IzS6GytLlA== dependencies: "@redocly/ajv" "^8.6.4" "@types/node" "^14.11.8" @@ -334,10 +334,10 @@ "@types/connect" "*" "@types/node" "*" -"@types/bull@3.15.7": - version "3.15.7" - resolved "https://registry.yarnpkg.com/@types/bull/-/bull-3.15.7.tgz#a9d7fb332cc02dc021d0eb234b9604b356e9e6de" - integrity sha512-7NC7XN5NoS0A+leJ/dR69ZfKaegOlCZaii/xGgKnCyh1UYisRncibImb7VMwrc3OdJcbDJt6+4om70TeNl3J7g== +"@types/bull@3.15.8": + version "3.15.8" + resolved "https://registry.yarnpkg.com/@types/bull/-/bull-3.15.8.tgz#ae2139f94490d740b37c8da5d828ce75dd82ce7c" + integrity sha512-8DbSPMSsZH5PWPnGEkAZLYgJEH4ghHJNKF7LB6Wr5R0/v6g+Vs+JoaA7kcvLtHE936xg2WpFPkaoaJgExOmKDw== dependencies: "@types/ioredis" "*" "@types/redis" "^2.8.0" @@ -617,10 +617,10 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/mocha@8.2.3": - version "8.2.3" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.3.tgz#bbeb55fbc73f28ea6de601fbfa4613f58d785323" - integrity sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw== +"@types/mocha@9.1.0": + version "9.1.0" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.0.tgz#baf17ab2cca3fcce2d322ebc30454bff487efad5" + integrity sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg== "@types/node-fetch@3.0.3": version "3.0.3" @@ -634,10 +634,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50" integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA== -"@types/node@17.0.14": - version "17.0.14" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.14.tgz#33b9b94f789a8fedd30a68efdbca4dbb06b61f20" - integrity sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng== +"@types/node@17.0.18": + version "17.0.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.18.tgz#3b4fed5cfb58010e3a2be4b6e74615e4847f1074" + integrity sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA== "@types/node@^14.11.8": version "14.17.9" @@ -836,14 +836,14 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== -"@typescript-eslint/eslint-plugin@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.2.tgz#f8c1d59fc37bd6d9d11c97267fdfe722c4777152" - integrity sha512-4W/9lLuE+v27O/oe7hXJKjNtBLnZE8tQAFpapdxwSVHqtmIoPB1gph3+ahNwVuNL37BX7YQHyGF9Xv6XCnIX2Q== +"@typescript-eslint/eslint-plugin@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz#bb46dd7ce7015c0928b98af1e602118e97df6c70" + integrity sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ== dependencies: - "@typescript-eslint/scope-manager" "5.10.2" - "@typescript-eslint/type-utils" "5.10.2" - "@typescript-eslint/utils" "5.10.2" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/type-utils" "5.12.0" + "@typescript-eslint/utils" "5.12.0" debug "^4.3.2" functional-red-black-tree "^1.0.1" ignore "^5.1.8" @@ -851,69 +851,69 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/parser@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.2.tgz#b6076d27cc5499ce3f2c625f5ccde946ecb7db9a" - integrity sha512-JaNYGkaQVhP6HNF+lkdOr2cAs2wdSZBoalE22uYWq8IEv/OVH0RksSGydk+sW8cLoSeYmC+OHvRyv2i4AQ7Czg== +"@typescript-eslint/parser@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.0.tgz#0ca669861813df99ce54916f66f524c625ed2434" + integrity sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog== dependencies: - "@typescript-eslint/scope-manager" "5.10.2" - "@typescript-eslint/types" "5.10.2" - "@typescript-eslint/typescript-estree" "5.10.2" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/typescript-estree" "5.12.0" debug "^4.3.2" -"@typescript-eslint/scope-manager@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz#92c0bc935ec00f3d8638cdffb3d0e70c9b879639" - integrity sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw== +"@typescript-eslint/scope-manager@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e" + integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ== dependencies: - "@typescript-eslint/types" "5.10.2" - "@typescript-eslint/visitor-keys" "5.10.2" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/visitor-keys" "5.12.0" -"@typescript-eslint/type-utils@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.10.2.tgz#ad5acdf98a7d2ab030bea81f17da457519101ceb" - integrity sha512-uRKSvw/Ccs5FYEoXW04Z5VfzF2iiZcx8Fu7DGIB7RHozuP0VbKNzP1KfZkHBTM75pCpsWxIthEH1B33dmGBKHw== +"@typescript-eslint/type-utils@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz#aaf45765de71c6d9707c66ccff76ec2b9aa31bb6" + integrity sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q== dependencies: - "@typescript-eslint/utils" "5.10.2" + "@typescript-eslint/utils" "5.12.0" debug "^4.3.2" tsutils "^3.21.0" -"@typescript-eslint/types@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.2.tgz#604d15d795c4601fffba6ecb4587ff9fdec68ce8" - integrity sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w== +"@typescript-eslint/types@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8" + integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ== -"@typescript-eslint/typescript-estree@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz#810906056cd3ddcb35aa333fdbbef3713b0fe4a7" - integrity sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ== +"@typescript-eslint/typescript-estree@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2" + integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ== dependencies: - "@typescript-eslint/types" "5.10.2" - "@typescript-eslint/visitor-keys" "5.10.2" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/visitor-keys" "5.12.0" debug "^4.3.2" globby "^11.0.4" is-glob "^4.0.3" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/utils@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.2.tgz#1fcd37547c32c648ab11aea7173ec30060ee87a8" - integrity sha512-vuJaBeig1NnBRkf7q9tgMLREiYD7zsMrsN1DA3wcoMDvr3BTFiIpKjGiYZoKPllfEwN7spUjv7ZqD+JhbVjEPg== +"@typescript-eslint/utils@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af" + integrity sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.10.2" - "@typescript-eslint/types" "5.10.2" - "@typescript-eslint/typescript-estree" "5.10.2" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/typescript-estree" "5.12.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@5.10.2": - version "5.10.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz#fdbf272d8e61c045d865bd6c8b41bea73d222f3d" - integrity sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q== +"@typescript-eslint/visitor-keys@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16" + integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg== dependencies: - "@typescript-eslint/types" "5.10.2" + "@typescript-eslint/types" "5.12.0" eslint-visitor-keys "^3.0.0" "@ungap/promise-all-settled@1.1.2": @@ -1350,10 +1350,10 @@ bluebird@~3.4.1: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" integrity sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM= -blurhash@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/blurhash/-/blurhash-1.1.4.tgz#a7010ceb3019cd2c9809b17c910ebf6175d29244" - integrity sha512-MXIPz6zwYUKayju+Uidf83KhH0vodZfeRl6Ich8Gu+KGl0JgKiFq9LsfqV7cVU5fKD/AotmduZqvOfrGKOfTaA== +blurhash@1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/blurhash/-/blurhash-1.1.5.tgz#3034104cd5dce5a3e5caa871ae2f0f1f2d0ab566" + integrity sha512-a+LO3A2DfxTaTztsmkbLYmUzUeApi0LZuKalwbNmqAHR6HhJGMt1qSV/R3wc+w4DL28holjqO3Bg74aUGavGjg== bn.js@^4.0.0: version "4.11.8" @@ -1380,10 +1380,10 @@ braces@^3.0.1, braces@~3.0.2: dependencies: fill-range "^7.0.1" -broadcast-channel@4.9.0: - version "4.9.0" - resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.9.0.tgz#8af337d4ea19aeb6b819ec2eb3dda942b28c724c" - integrity sha512-xWzFb3wrOZGJF2kOSs2D3KvHXdLDMVb+WypEIoNvwblcHgUBydVy65pDJ9RS4WN9Kyvs0UVQuCCzfKme0G6Qjw== +broadcast-channel@4.10.0: + version "4.10.0" + resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.10.0.tgz#d19fb902df227df40b1b580351713d30c302d198" + integrity sha512-hOUh312XyHk6JTVyX9cyXaH1UYs+2gHVtnW16oQAu9FL7ALcXGXc/YoJWqlkV8vUn14URQPMmRi4A9q4UrwVEQ== dependencies: "@babel/runtime" "^7.16.0" detect-node "^2.1.0" @@ -1466,10 +1466,10 @@ bufferutil@^4.0.1: dependencies: node-gyp-build "~3.7.0" -bull@4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/bull/-/bull-4.5.0.tgz#d6106b011b711ffb76c687d7f2db416955225f64" - integrity sha512-BejJxGwNNQPIrK1jFTN74kymFORYQ6ZyXWNsZx+6jtDtafQNUMHNSdoepabLLmeldmUvgAHvZDDIJWFGEo2MYg== +bull@4.5.5: + version "4.5.5" + resolved "https://registry.yarnpkg.com/bull/-/bull-4.5.5.tgz#6521e514aaff77d3d40f780dd0214e1738c16b32" + integrity sha512-4GX9zoDwkSgdITGWUWGb1kwddgffOyeTLxeBzANbXhBGFb5/HypwsMrInyWQ4GmpZG/oM3oQpUqr+KGX8s7K4Q== dependencies: cron-parser "^4.2.1" debuglog "^1.0.0" @@ -1671,7 +1671,7 @@ cheerio@0.22.0: lodash.reject "^4.4.0" lodash.some "^4.4.0" -chokidar@3.5.1, chokidar@^3.3.1, chokidar@^3.5.2: +chokidar@3.5.3, chokidar@^3.3.1, chokidar@^3.5.2: version "3.3.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" integrity sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg== @@ -1939,14 +1939,6 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -crc-32@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.1.tgz#436d2bcaad27bcb6bd073a2587139d3024a16460" - integrity sha512-Dn/xm/1vFFgs3nfrpEVScHoIslO9NZRITWGz/1E/St6u4xw99vfZzVkW0OSnzx2h9egej9xwMCEut6sqwokM/w== - dependencies: - exit-on-epipe "~1.0.1" - printj "~1.3.1" - crc-32@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.0.tgz#cb2db6e29b88508e32d9dd0ec1693e7b41a18208" @@ -2069,7 +2061,7 @@ debug@2, debug@^2.2.0, debug@^2.5.2, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4, debug@4.3.1, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -2615,10 +2607,10 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.0.tgz#c1f6ea30ac583031f203d65c73e723b01298f153" - integrity sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg== +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -2640,17 +2632,17 @@ eslint-visitor-keys@^3.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== -eslint-visitor-keys@^3.1.0, eslint-visitor-keys@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz#6fbb166a6798ee5991358bc2daa1ba76cc1254a1" - integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.8.0.tgz#9762b49abad0cb4952539ffdb0a046392e571a2d" - integrity sha512-H3KXAzQGBH1plhYS3okDix2ZthuYJlQQEGE5k0IKuEqUSiyu4AmxxlJ2MtTYeJ3xB4jDhcYCwGOg2TXYdnDXlQ== +eslint@8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.9.0.tgz#a2a8227a99599adc4342fd9b854cb8d8d6412fdb" + integrity sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q== dependencies: - "@eslint/eslintrc" "^1.0.5" + "@eslint/eslintrc" "^1.1.0" "@humanwhocodes/config-array" "^0.9.2" ajv "^6.10.0" chalk "^4.0.0" @@ -2658,10 +2650,10 @@ eslint@8.8.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.0" + eslint-scope "^7.1.1" eslint-utils "^3.0.0" - eslint-visitor-keys "^3.2.0" - espree "^9.3.0" + eslint-visitor-keys "^3.3.0" + espree "^9.3.1" esquery "^1.4.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -2691,14 +2683,14 @@ esm@^3.2.22: resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== -espree@^9.2.0, espree@^9.3.0: - version "9.3.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.0.tgz#c1240d79183b72aaee6ccfa5a90bc9111df085a8" - integrity sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ== +espree@^9.3.1: + version "9.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.1.tgz#8793b4bc27ea4c778c19908e0719e7b8f4115bcd" + integrity sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ== dependencies: acorn "^8.7.0" acorn-jsx "^5.3.1" - eslint-visitor-keys "^3.1.0" + eslint-visitor-keys "^3.3.0" esprima@^4.0.1: version "4.0.1" @@ -2754,19 +2746,19 @@ events@1.1.1: resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ= -execa@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-6.0.0.tgz#598b46f09ae44f5d8097a30cfb1681d0f0371503" - integrity sha512-m4wU9j4Z9nXXoqT8RSfl28JSwmMNLFF69OON8H/lL3NeU0tNpGz313bcOfYoBBHokB0dC2tMl3VUcKgHELhL2Q== +execa@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-6.1.0.tgz#cea16dee211ff011246556388effa0818394fb20" + integrity sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA== dependencies: cross-spawn "^7.0.3" get-stream "^6.0.1" human-signals "^3.0.1" is-stream "^3.0.0" merge-stream "^2.0.0" - npm-run-path "^5.0.1" + npm-run-path "^5.1.0" onetime "^6.0.0" - signal-exit "^3.0.5" + signal-exit "^3.0.7" strip-final-newline "^3.0.0" exit-on-epipe@~1.0.1: @@ -3147,10 +3139,10 @@ glob-parent@^6.0.1: dependencies: is-glob "^4.0.3" -glob@7.1.6, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3159,10 +3151,10 @@ glob@7.1.6, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== +glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3862,6 +3854,11 @@ is-typedarray@^1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + is-weakref@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2" @@ -3925,13 +3922,6 @@ js-stringify@^1.0.2: resolved "https://registry.yarnpkg.com/js-stringify/-/js-stringify-1.0.2.tgz#1736fddfd9724f28a3682adc6230ae7e4e9679db" integrity sha1-Fzb939lyTyijaCrcYjCufk6Weds= -js-yaml@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.0.0.tgz#f426bc0ff4b4051926cd588c71113183409a121f" - integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q== - dependencies: - argparse "^2.0.1" - js-yaml@4.1.0, js-yaml@^4.0.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -4432,12 +4422,13 @@ lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" - integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== +log-symbols@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== dependencies: - chalk "^4.0.0" + chalk "^4.1.0" + is-unicode-supported "^0.1.0" lowercase-keys@^2.0.0: version "2.0.0" @@ -4682,33 +4673,32 @@ mkdirp@^1.0.3, mkdirp@^1.0.4, mkdirp@~1.0.3: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mocha@8.4.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff" - integrity sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ== +mocha@9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.0.tgz#2bfba73d46e392901f877ab9a47b7c9c5d0275cc" + integrity sha512-kNn7E8g2SzVcq0a77dkphPsDSN7P+iYkqE0ZsGCYWRsoiKjOt+NvXfaagik8vuDa6W5Zw3qxe8Jfpt5qKf+6/Q== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" - chokidar "3.5.1" - debug "4.3.1" + chokidar "3.5.3" + debug "4.3.3" diff "5.0.0" escape-string-regexp "4.0.0" find-up "5.0.0" - glob "7.1.6" + glob "7.2.0" growl "1.10.5" he "1.2.0" - js-yaml "4.0.0" - log-symbols "4.0.0" + js-yaml "4.1.0" + log-symbols "4.1.0" minimatch "3.0.4" ms "2.1.3" - nanoid "3.1.20" - serialize-javascript "5.0.1" + nanoid "3.2.0" + serialize-javascript "6.0.0" strip-json-comments "3.1.1" supports-color "8.1.1" which "2.0.2" - wide-align "1.1.3" - workerpool "6.1.0" + workerpool "6.2.0" yargs "16.2.0" yargs-parser "20.2.4" yargs-unparser "2.0.0" @@ -4793,10 +4783,10 @@ nano-time@1.0.0: dependencies: big-integer "^1.6.16" -nanoid@3.1.20: - version "3.1.20" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" - integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== +nanoid@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.2.0.tgz#62667522da6673971cca916a6d3eff3f415ff80c" + integrity sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA== nanoid@^3.1.30: version "3.1.30" @@ -4951,10 +4941,10 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA== -npm-run-path@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.0.1.tgz#748dd68ed7de377bb1f7132c7dafe657be5ab400" - integrity sha512-ybBJQUSyFwEEhqO2lXmyKOl9ucHtyZBWVM0h0FiMfT/+WKxCUZFa95qAR2X3w/w6oigN3B0b2UNHZbD+kdfD5w== +npm-run-path@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" + integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== dependencies: path-key "^4.0.0" @@ -5310,10 +5300,10 @@ pg-int8@1.0.1: resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== -pg-pool@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.4.1.tgz#0e71ce2c67b442a5e862a9c182172c37eda71e9c" - integrity sha512-TVHxR/gf3MeJRvchgNHxsYsTCHQ+4wm3VIHSS19z8NC0+gioEhq1okDY1sm/TYbfoP6JLFx01s0ShvZ3puP/iQ== +pg-pool@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.5.1.tgz#f499ce76f9bf5097488b3b83b19861f28e4ed905" + integrity sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ== pg-protocol@^1.5.0: version "1.5.0" @@ -5331,15 +5321,15 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@8.7.1: - version "8.7.1" - resolved "https://registry.yarnpkg.com/pg/-/pg-8.7.1.tgz#9ea9d1ec225980c36f94e181d009ab9f4ce4c471" - integrity sha512-7bdYcv7V6U3KAtWjpQJJBww0UEsWuh4yQ/EjNf2HeO/NnvKjpvhEIe/A/TleP6wtmSKnUnghs5A9jUoK6iDdkA== +pg@8.7.3: + version "8.7.3" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.7.3.tgz#8a5bdd664ca4fda4db7997ec634c6e5455b27c44" + integrity sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw== dependencies: buffer-writer "2.0.0" packet-reader "1.0.0" pg-connection-string "^2.5.0" - pg-pool "^3.4.1" + pg-pool "^3.5.1" pg-protocol "^1.5.0" pg-types "^2.1.0" pgpass "1.x" @@ -5463,11 +5453,6 @@ printj@~1.1.0: resolved "https://registry.yarnpkg.com/printj/-/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222" integrity sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ== -printj@~1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/printj/-/printj-1.3.1.tgz#9af6b1d55647a1587ac44f4c1654a4b95b8e12cb" - integrity sha512-GA3TdL8szPK4AQ2YnOe/b+Y1jUFwmmGMMK/qbY7VcE3Z7FU8JstbKiKRzO6CIiAKPhTO8m01NoQ0V5f3jc4OGg== - private-ip@2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/private-ip/-/private-ip-2.3.3.tgz#1e80ff8443e5ac78f555631aec3ea6ff027fa6aa" @@ -5999,10 +5984,10 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sanitize-html@2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-2.6.1.tgz#5d37c08e189c61c0631560a889b10d9d155d000e" - integrity sha512-DzjSz3H5qDntD7s1TcWCSoRPmNR8UmA+y+xZQOvWgjATe2Br9ZW73+vD3Pj6Snrg0RuEuJdXgrKvnYuiuixRkA== +sanitize-html@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-2.7.0.tgz#e106205b468aca932e2f9baf241f24660d34e279" + integrity sha512-jfQelabOn5voO7FAfnQF7v+jsA6z9zC/O4ec0z3E35XPEtHYJT/OdUziVWlKW4irCr2kXaQAyXTXDHWAibg1tA== dependencies: deepmerge "^4.2.2" escape-string-regexp "^4.0.0" @@ -6071,10 +6056,10 @@ semver@^7.3.5: dependencies: lru-cache "^6.0.0" -serialize-javascript@5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" - integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== +serialize-javascript@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" + integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== dependencies: randombytes "^2.1.0" @@ -6106,10 +6091,10 @@ sha.js@^2.4.11: inherits "^2.0.1" safe-buffer "^5.0.1" -sharp@0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.30.0.tgz#b2dd62d5f14088b11c72212354f31dff6511b070" - integrity sha512-L3m/l6yQFr3oGBUzcSAlN/R9yGFPYqM9FpMUe6Z4nHg4sWtP3hW1rcz+aaHklhD4wX5Jqh5PY9z+A1d4Qt3Hfg== +sharp@0.30.1: + version "0.30.1" + resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.30.1.tgz#203efaf9acfc5c15c8a343800254621e56011c12" + integrity sha512-ycpz81q8AeVjz1pGvvirQBeJcYE2sXAjcLXR/69LWOe/oxavBLOrenZcTzvTXn83jqAGqY+OuwF+2kFXzbKtDA== dependencies: color "^4.2.0" detect-libc "^2.0.0" @@ -6151,10 +6136,10 @@ signal-exit@^3.0.0: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== -signal-exit@^3.0.5: - version "3.0.6" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af" - integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ== +signal-exit@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== simple-concat@^1.0.0: version "1.0.1" @@ -6469,10 +6454,10 @@ syslog-pro@1.0.0: dependencies: moment "^2.22.2" -systeminformation@5.11.0: - version "5.11.0" - resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-5.11.0.tgz#2060779e1e7c7372192dbcd850c65cfd85f4ea71" - integrity sha512-mI/5nFK7NUe9Qbmy65WoB5TlCWKAhP4kG0w6uR2mZM8Mpdi8b45b3hTIK3W5+kQYZnYFWeS9/O5nn5rdcSvqfA== +systeminformation@5.11.3: + version "5.11.3" + resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-5.11.3.tgz#8d14a444d398eadce5cb973a3d3d0ebb454ffcd9" + integrity sha512-sjvlk4SUefhwrONUeLijXt+NQyptAiqShd5v6bFJFNr9EVJUr3YSnNxDqCz0gp5EJBUj88pL1ssc8ZHPtngBOw== tapable@^2.2.0: version "2.2.0" @@ -6645,10 +6630,10 @@ ts-loader@9.2.6: micromatch "^4.0.0" semver "^7.3.4" -ts-node@10.4.0: - version "10.4.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" - integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== +ts-node@10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.5.0.tgz#618bef5854c1fbbedf5e31465cbb224a1d524ef9" + integrity sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw== dependencies: "@cspotcode/source-map-support" "0.7.0" "@tsconfig/node10" "^1.0.7" @@ -6661,6 +6646,7 @@ ts-node@10.4.0: create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" + v8-compile-cache-lib "^3.0.0" yn "3.1.1" tsc-alias@1.4.1: @@ -6778,10 +6764,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typeorm@0.2.41: - version "0.2.41" - resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.41.tgz#88758101ac158dc0a0a903d70eaacea2974281cc" - integrity sha512-/d8CLJJxKPgsnrZWiMyPI0rz2MFZnBQrnQ5XP3Vu3mswv2WPexb58QM6BEtmRmlTMYN5KFWUz8SKluze+wS9xw== +typeorm@0.2.43: + version "0.2.43" + resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.43.tgz#110d629ed5d0b014c735f0213f06b34abb32d298" + integrity sha512-j4SU8I0PsMWtF64s/9tOJmlexzfDsvXhTjSE2GXdSseUN8TYyfbCm/fJnC6lx3uHgBJL4z9bE8U/7qyC/FVmNw== dependencies: "@sqltools/formatter" "^1.2.2" app-root-path "^3.0.0" @@ -6796,6 +6782,7 @@ typeorm@0.2.41: reflect-metadata "^0.1.13" sha.js "^2.4.11" tslib "^2.1.0" + uuid "^8.3.2" xml2js "^0.4.23" yargs "^17.0.1" zen-observable-ts "^1.0.0" @@ -6910,11 +6897,16 @@ uuid@7.0.3: resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== -uuid@8.3.2, uuid@^8.3.0: +uuid@8.3.2, uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +v8-compile-cache-lib@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" + integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== + v8-compile-cache@^2.0.3: version "2.2.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" @@ -7050,7 +7042,7 @@ which@^1.1.1, which@^1.2.14: dependencies: isexe "^2.0.0" -wide-align@1.1.3, wide-align@^1.1.0: +wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== @@ -7079,10 +7071,10 @@ word-wrap@^1.2.3, word-wrap@~1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== -workerpool@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.0.tgz#a8e038b4c94569596852de7a8ea4228eefdeb37b" - integrity sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg== +workerpool@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.0.tgz#827d93c9ba23ee2019c3ffaff5c27fccea289e8b" + integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== wrap-ansi@^6.2.0: version "6.2.0" @@ -7107,7 +7099,12 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@8.4.2, ws@^8.2.3: +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== + +ws@^8.2.3: version "8.4.2" resolved "https://registry.yarnpkg.com/ws/-/ws-8.4.2.tgz#18e749868d8439f2268368829042894b6907aa0b" integrity sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA== diff --git a/packages/client/package.json b/packages/client/package.json index cf4214e72b..2957251bfc 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@discordapp/twemoji": "13.1.0", - "@fortawesome/fontawesome-free": "6.0.0-beta3", + "@fortawesome/fontawesome-free": "6.0.0", "@syuilo/aiscript": "0.11.1", "@types/escape-regexp": "0.0.1", "@types/glob": "7.2.0", @@ -19,8 +19,8 @@ "@types/gulp-rename": "2.0.1", "@types/is-url": "1.2.30", "@types/katex": "0.11.1", - "@types/matter-js": "0.17.6", - "@types/mocha": "8.2.3", + "@types/matter-js": "0.17.7", + "@types/mocha": "9.1.0", "@types/oauth": "0.9.1", "@types/parse5": "6.0.3", "@types/punycode": "2.1.0", @@ -29,34 +29,32 @@ "@types/seedrandom": "2.4.28", "@types/throttle-debounce": "2.1.0", "@types/tinycolor2": "1.4.3", - "@types/tmp": "0.2.3", "@types/uuid": "8.3.4", "@types/web-push": "3.3.2", "@types/webpack": "5.28.0", "@types/webpack-stream": "3.2.12", - "@types/websocket": "1.0.4", + "@types/websocket": "1.0.5", "@types/ws": "8.2.2", - "@typescript-eslint/parser": "5.10.0", - "@vue/compiler-sfc": "3.2.29", + "@typescript-eslint/parser": "5.12.0", + "@vue/compiler-sfc": "3.2.31", "abort-controller": "3.0.0", "autobind-decorator": "2.4.0", "autosize": "5.0.1", "autwh": "0.1.0", - "blurhash": "1.1.4", - "broadcast-channel": "4.9.0", - "chart.js": "3.7.0", + "blurhash": "1.1.5", + "broadcast-channel": "4.10.0", + "chart.js": "3.7.1", "chartjs-adapter-date-fns": "2.0.0", "chartjs-plugin-gradient": "0.2.1", "chartjs-plugin-zoom": "1.2.0", "compare-versions": "4.1.3", "content-disposition": "0.5.4", - "crc-32": "1.2.0", - "css-loader": "6.5.1", - "cssnano": "5.0.15", + "css-loader": "6.6.0", + "cssnano": "5.0.17", "date-fns": "2.28.0", "escape-regexp": "0.0.1", - "eslint": "8.7.0", - "eslint-plugin-vue": "8.3.0", + "eslint": "8.9.0", + "eslint-plugin-vue": "8.4.1", "eventemitter3": "4.0.7", "feed": "4.2.2", "glob": "7.2.0", @@ -70,15 +68,15 @@ "matter-js": "0.18.0", "mfm-js": "0.21.0", "misskey-js": "0.0.14", - "mocha": "8.4.0", + "mocha": "9.2.0", "ms": "2.1.3", "nested-property": "4.0.0", "parse5": "6.0.1", "photoswipe": "git+https://github.com/dimsemenov/photoswipe#v5-beta", "portscanner": "2.2.0", - "postcss": "8.4.5", + "postcss": "8.4.6", "postcss-loader": "6.2.1", - "prismjs": "1.26.0", + "prismjs": "1.27.0", "private-ip": "2.3.3", "promise-limit": "2.7.0", "pug": "3.0.2", @@ -89,8 +87,8 @@ "reflect-metadata": "0.1.13", "rndstr": "1.0.0", "s-age": "1.1.2", - "sass": "1.49.0", - "sass-loader": "12.4.0", + "sass": "1.49.8", + "sass-loader": "12.6.0", "seedrandom": "3.0.5", "strict-event-emitter-types": "2.0.0", "stringz": "2.1.0", @@ -100,9 +98,8 @@ "three": "0.136.0", "throttle-debounce": "3.0.1", "tinycolor2": "1.4.2", - "tmp": "0.2.1", "ts-loader": "9.2.6", - "ts-node": "10.4.0", + "ts-node": "10.5.0", "tsc-alias": "1.5.0", "tsconfig-paths": "3.12.0", "twemoji-parser": "13.1.0", @@ -110,25 +107,23 @@ "uuid": "8.3.2", "v-debounce": "0.1.2", "vanilla-tilt": "1.7.2", - "vue": "3.2.29", + "vue": "3.2.31", "vue-loader": "17.0.0", "vue-prism-editor": "2.0.0-alpha.2", - "vue-router": "4.0.5", + "vue-router": "4.0.12", "vue-style-loader": "4.1.3", "vue-svg-loader": "0.17.0-beta.2", "vuedraggable": "4.0.1", "web-push": "3.4.5", - "webpack": "5.66.0", - "webpack-cli": "4.9.1", + "webpack": "5.69.1", + "webpack-cli": "4.9.2", "websocket": "1.0.34", - "ws": "8.4.2" + "ws": "8.5.0" }, "devDependencies": { - "@redocly/openapi-core": "1.0.0-beta.79", - "@types/fluent-ffmpeg": "2.1.20", - "@typescript-eslint/eslint-plugin": "5.10.0", + "@typescript-eslint/eslint-plugin": "5.12.0", "cross-env": "7.0.3", - "cypress": "9.3.1", + "cypress": "9.5.0", "eslint-plugin-import": "2.25.4", "start-server-and-test": "1.14.0" } diff --git a/packages/client/yarn.lock b/packages/client/yarn.lock index 63ca920696..38f9906080 100644 --- a/packages/client/yarn.lock +++ b/packages/client/yarn.lock @@ -115,14 +115,14 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz#8f03a22a04de437254e8ce8cc84ba39689288752" integrity sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg== -"@eslint/eslintrc@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.0.5.tgz#33f1b838dbf1f923bfa517e008362b78ddbbf318" - integrity sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ== +"@eslint/eslintrc@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.1.0.tgz#583d12dbec5d4f22f333f9669f7d0b7c7815b4d3" + integrity sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.2.0" + espree "^9.3.1" globals "^13.9.0" ignore "^4.0.6" import-fresh "^3.2.1" @@ -130,10 +130,10 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@fortawesome/fontawesome-free@6.0.0-beta3": - version "6.0.0-beta3" - resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.0.0-beta3.tgz#120e4a158a0de983924ce151bc35f27de46398b7" - integrity sha512-4SqOuhC8tSLeQvbW1nDmq6T7+8vdSgHy/w7PRwCFzMQCbKuYFIir/3UuWsV1QblX1lt7SGlSgwbaCv9XhRt8HA== +"@fortawesome/fontawesome-free@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.0.0.tgz#6f3bd8e42997c7d536a1246877ed8bcd4f005a54" + integrity sha512-6LB4PYBST1Rx40klypw1SmSDArjFOcfBf2LeX9Zg5EKJT2eXiyiJq+CyBYKeXyK0sXS2FsCJWSPr/luyhuvh0Q== "@hapi/hoek@^9.0.0": version "9.2.0" @@ -182,32 +182,6 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" -"@redocly/ajv@^8.6.4": - version "8.6.4" - resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.6.4.tgz#94053e7a9d4146d1a4feacd3813892873f229a85" - integrity sha512-y9qNj0//tZtWB2jfXNK3BX18BSBp9zNR7KE7lMysVHwbZtY392OJCjm6Rb/h4UHH2r1AqjNEHFD6bRn+DqU9Mw== - dependencies: - fast-deep-equal "^3.1.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - uri-js "^4.2.2" - -"@redocly/openapi-core@1.0.0-beta.79": - version "1.0.0-beta.79" - resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.0.0-beta.79.tgz#7512b3507ab99dc78226f9069669c5302abb0969" - integrity sha512-do79vGt3iiHsaVG9LKY8dH+d1E7TLHr+3T+CQ1lqagtWVjYOxqGaoxAT8tRD7R1W0z8BmS4e2poNON6c1sxP5g== - dependencies: - "@redocly/ajv" "^8.6.4" - "@types/node" "^14.11.8" - colorette "^1.2.0" - js-levenshtein "^1.1.6" - js-yaml "^4.1.0" - lodash.isequal "^4.5.0" - minimatch "^3.0.4" - node-fetch "^2.6.1" - pluralize "^8.0.0" - yaml-ast-parser "0.0.43" - "@sideway/address@^4.1.0": version "4.1.2" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1" @@ -284,6 +258,14 @@ "@types/eslint" "*" "@types/estree" "*" +"@types/eslint-scope@^3.7.3": + version "3.7.3" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.3.tgz#125b88504b61e3c8bc6f870882003253005c3224" + integrity sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g== + dependencies: + "@types/eslint" "*" + "@types/estree" "*" + "@types/eslint@*": version "7.2.0" resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.2.0.tgz#eb5c5b575237334df24c53195e37b53d66478d7b" @@ -297,10 +279,10 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.46.tgz#0fb6bfbbeabd7a30880504993369c4bf1deab1fe" integrity sha512-laIjwTQaD+5DukBZaygQ79K1Z0jb1bPEMRrkXSLjtCcZm+abyp5YbrqpSLzD42FwWW6gK/aS4NYpJ804nG2brg== -"@types/estree@^0.0.50": - version "0.0.50" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" - integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== +"@types/estree@^0.0.51": + version "0.0.51" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" + integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== "@types/events@*": version "3.0.0" @@ -312,13 +294,6 @@ resolved "https://registry.yarnpkg.com/@types/expect/-/expect-1.20.4.tgz#8288e51737bf7e3ab5d7c77bfa695883745264e5" integrity sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg== -"@types/fluent-ffmpeg@2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.20.tgz#3b5f42fc8263761d58284fa46ee6759a64ce54ac" - integrity sha512-B+OvhCdJ3LgEq2PhvWNOiB/EfwnXLElfMCgc4Z1K5zXgSfo9I6uGKwR/lqmNPFQuebNnes7re3gqkV77SyypLg== - dependencies: - "@types/node" "*" - "@types/glob-stream@*": version "6.1.0" resolved "https://registry.yarnpkg.com/@types/glob-stream/-/glob-stream-6.1.0.tgz#7ede8a33e59140534f8d8adfb8ac9edfb31897bc" @@ -396,27 +371,27 @@ resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.11.1.tgz#34de04477dcf79e2ef6c8d23b41a3d81f9ebeaf5" integrity sha512-DUlIj2nk0YnJdlWgsFuVKcX27MLW0KbKmGVoUHmFr+74FYYNUDAaj9ZqTADvsbE8rfxuVmSFc7KczYn5Y09ozg== -"@types/matter-js@0.17.6": - version "0.17.6" - resolved "https://registry.yarnpkg.com/@types/matter-js/-/matter-js-0.17.6.tgz#525bb33a7289105e1981ef51b987972fa9739011" - integrity sha512-i6WLNuM7/89SLqO2aOyaUkom9tc3B/qo4ekh7BD99xQ8+wOVVZO0F4RzKNYZCaFwr+xp3pK3oIb6sSVjLpz+pA== +"@types/matter-js@0.17.7": + version "0.17.7" + resolved "https://registry.yarnpkg.com/@types/matter-js/-/matter-js-0.17.7.tgz#4919813a91fb0424ea8aa4f4c6eaf9b79cf65ff5" + integrity sha512-LHx3Kf1vY68wEgSAuQkMShfGxB9YVKtcFYqPTMAcmUCnHuvcPkfnlbveMkH8xG/s1EIYcbBVTnUNDV/CA5B2RA== "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/mocha@8.2.3": - version "8.2.3" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.3.tgz#bbeb55fbc73f28ea6de601fbfa4613f58d785323" - integrity sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw== +"@types/mocha@9.1.0": + version "9.1.0" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.0.tgz#baf17ab2cca3fcce2d322ebc30454bff487efad5" + integrity sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg== "@types/node@*": version "16.6.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50" integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA== -"@types/node@^14.11.8", "@types/node@^14.14.31": +"@types/node@^14.14.31": version "14.17.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.9.tgz#b97c057e6138adb7b720df2bd0264b03c9f504fd" integrity sha512-CMjgRNsks27IDwI785YMY0KLt3co/c0cQ5foxHYv/shC2w8oOnVwz5Ubq1QG5KzrcW+AXk6gzdnxIkDnTvzu3g== @@ -495,11 +470,6 @@ resolved "https://registry.yarnpkg.com/@types/tinycolor2/-/tinycolor2-1.4.3.tgz#ed4a0901f954b126e6a914b4839c77462d56e706" integrity sha512-Kf1w9NE5HEgGxCRyIcRXR/ZYtDv0V8FVPtYHwLxl0O+maGX0erE77pQlD0gpP+/KByMZ87mOA79SjifhSB3PjQ== -"@types/tmp@0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.3.tgz#908bfb113419fd6a42273674c00994d40902c165" - integrity sha512-dDZH/tXzwjutnuk4UacGgFRwV+JSLaXL1ikvidfJprkb7L9Nx1njcRHHmi3Dsvt7pgqqTEeucQuOrWHPFgzVHA== - "@types/uglify-js@*": version "3.9.0" resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.9.0.tgz#4490a140ca82aa855ad68093829e7fd6ae94ea87" @@ -586,10 +556,10 @@ "@types/webpack-sources" "*" source-map "^0.6.0" -"@types/websocket@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.4.tgz#1dc497280d8049a5450854dd698ee7e6ea9e60b8" - integrity sha512-qn1LkcFEKK8RPp459jkjzsfpbsx36BBt3oC3pITYtkoBw/aVX+EZFa5j3ThCRTNpLFvIMr5dSTD4RaMdilIOpA== +"@types/websocket@1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.5.tgz#3fb80ed8e07f88e51961211cd3682a3a4a81569c" + integrity sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== dependencies: "@types/node" "*" @@ -607,14 +577,14 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz#e90afea96dff8620892ad216b0e4ccdf8ee32d3a" - integrity sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ== +"@typescript-eslint/eslint-plugin@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz#bb46dd7ce7015c0928b98af1e602118e97df6c70" + integrity sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ== dependencies: - "@typescript-eslint/scope-manager" "5.10.0" - "@typescript-eslint/type-utils" "5.10.0" - "@typescript-eslint/utils" "5.10.0" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/type-utils" "5.12.0" + "@typescript-eslint/utils" "5.12.0" debug "^4.3.2" functional-red-black-tree "^1.0.1" ignore "^5.1.8" @@ -622,69 +592,69 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/parser@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.0.tgz#8f59e036f5f1cffc178cacbd5ccdd02aeb96c91c" - integrity sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw== +"@typescript-eslint/parser@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.0.tgz#0ca669861813df99ce54916f66f524c625ed2434" + integrity sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog== dependencies: - "@typescript-eslint/scope-manager" "5.10.0" - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/typescript-estree" "5.10.0" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/typescript-estree" "5.12.0" debug "^4.3.2" -"@typescript-eslint/scope-manager@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz#bb5d872e8b9e36203908595507fbc4d3105329cb" - integrity sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg== +"@typescript-eslint/scope-manager@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e" + integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ== dependencies: - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/visitor-keys" "5.10.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/visitor-keys" "5.12.0" -"@typescript-eslint/type-utils@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz#8524b9479c19c478347a7df216827e749e4a51e5" - integrity sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ== +"@typescript-eslint/type-utils@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz#aaf45765de71c6d9707c66ccff76ec2b9aa31bb6" + integrity sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q== dependencies: - "@typescript-eslint/utils" "5.10.0" + "@typescript-eslint/utils" "5.12.0" debug "^4.3.2" tsutils "^3.21.0" -"@typescript-eslint/types@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.0.tgz#beb3cb345076f5b088afe996d57bcd1dfddaa75c" - integrity sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ== +"@typescript-eslint/types@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8" + integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ== -"@typescript-eslint/typescript-estree@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz#4be24a3dea0f930bb1397c46187d0efdd955a224" - integrity sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA== +"@typescript-eslint/typescript-estree@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2" + integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ== dependencies: - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/visitor-keys" "5.10.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/visitor-keys" "5.12.0" debug "^4.3.2" globby "^11.0.4" is-glob "^4.0.3" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/utils@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.0.tgz#c3d152a85da77c400e37281355561c72fb1b5a65" - integrity sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg== +"@typescript-eslint/utils@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af" + integrity sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.10.0" - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/typescript-estree" "5.10.0" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/typescript-estree" "5.12.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz#770215497ad67cd15a572b52089991d5dfe06281" - integrity sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ== +"@typescript-eslint/visitor-keys@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16" + integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg== dependencies: - "@typescript-eslint/types" "5.10.0" + "@typescript-eslint/types" "5.12.0" eslint-visitor-keys "^3.0.0" "@ungap/promise-all-settled@1.1.2": @@ -692,95 +662,100 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -"@vue/compiler-core@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.29.tgz#b06097ab8ff0493177c68c5ea5b63d379a061097" - integrity sha512-RePZ/J4Ub3sb7atQw6V6Rez+/5LCRHGFlSetT3N4VMrejqJnNPXKUt5AVm/9F5MJriy2w/VudEIvgscCfCWqxw== +"@vue/compiler-core@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.31.tgz#d38f06c2cf845742403b523ab4596a3fda152e89" + integrity sha512-aKno00qoA4o+V/kR6i/pE+aP+esng5siNAVQ422TkBNM6qA4veXiZbSe8OTXHXquEi/f6Akc+nLfB4JGfe4/WQ== dependencies: "@babel/parser" "^7.16.4" - "@vue/shared" "3.2.29" + "@vue/shared" "3.2.31" estree-walker "^2.0.2" source-map "^0.6.1" -"@vue/compiler-dom@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.29.tgz#ad0ead405bd2f2754161335aad9758aa12430715" - integrity sha512-y26vK5khdNS9L3ckvkqJk/78qXwWb75Ci8iYLb67AkJuIgyKhIOcR1E8RIt4mswlVCIeI9gQ+fmtdhaiTAtrBQ== +"@vue/compiler-dom@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.31.tgz#b1b7dfad55c96c8cc2b919cd7eb5fd7e4ddbf00e" + integrity sha512-60zIlFfzIDf3u91cqfqy9KhCKIJgPeqxgveH2L+87RcGU/alT6BRrk5JtUso0OibH3O7NXuNOQ0cDc9beT0wrg== dependencies: - "@vue/compiler-core" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/compiler-core" "3.2.31" + "@vue/shared" "3.2.31" -"@vue/compiler-sfc@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.29.tgz#f76d556cd5fca6a55a3ea84c88db1a2a53a36ead" - integrity sha512-X9+0dwsag2u6hSOP/XsMYqFti/edvYvxamgBgCcbSYuXx1xLZN+dS/GvQKM4AgGS4djqo0jQvWfIXdfZ2ET68g== +"@vue/compiler-sfc@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.31.tgz#d02b29c3fe34d599a52c5ae1c6937b4d69f11c2f" + integrity sha512-748adc9msSPGzXgibHiO6T7RWgfnDcVQD+VVwYgSsyyY8Ans64tALHZANrKtOzvkwznV/F4H7OAod/jIlp/dkQ== dependencies: "@babel/parser" "^7.16.4" - "@vue/compiler-core" "3.2.29" - "@vue/compiler-dom" "3.2.29" - "@vue/compiler-ssr" "3.2.29" - "@vue/reactivity-transform" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/compiler-core" "3.2.31" + "@vue/compiler-dom" "3.2.31" + "@vue/compiler-ssr" "3.2.31" + "@vue/reactivity-transform" "3.2.31" + "@vue/shared" "3.2.31" estree-walker "^2.0.2" magic-string "^0.25.7" postcss "^8.1.10" source-map "^0.6.1" -"@vue/compiler-ssr@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.29.tgz#37b15b32dcd2f6b410bb61fca3f37b1a92b7eb1e" - integrity sha512-LrvQwXlx66uWsB9/VydaaqEpae9xtmlUkeSKF6aPDbzx8M1h7ukxaPjNCAXuFd3fUHblcri8k42lfimHfzMICA== +"@vue/compiler-ssr@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.31.tgz#4fa00f486c9c4580b40a4177871ebbd650ecb99c" + integrity sha512-mjN0rqig+A8TVDnsGPYJM5dpbjlXeHUm2oZHZwGyMYiGT/F4fhJf/cXy8QpjnLQK4Y9Et4GWzHn9PS8AHUnSkw== dependencies: - "@vue/compiler-dom" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/compiler-dom" "3.2.31" + "@vue/shared" "3.2.31" -"@vue/reactivity-transform@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.29.tgz#a08d606e10016b7cf588d1a43dae4db2953f9354" - integrity sha512-YF6HdOuhdOw6KyRm59+3rML8USb9o8mYM1q+SH0G41K3/q/G7uhPnHGKvspzceD7h9J3VR1waOQ93CUZj7J7OA== +"@vue/devtools-api@^6.0.0-beta.18": + version "6.0.12" + resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.12.tgz#7b57cce215ae9f37a86984633b3aa3d595aa5b46" + integrity sha512-iO/4FIezHKXhiDBdKySCvJVh8/mZPxHpiQrTy+PXVqJZgpTPTdHy4q8GXulaY+UKEagdkBb0onxNQZ0LNiqVhw== + +"@vue/reactivity-transform@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.31.tgz#0f5b25c24e70edab2b613d5305c465b50fc00911" + integrity sha512-uS4l4z/W7wXdI+Va5pgVxBJ345wyGFKvpPYtdSgvfJfX/x2Ymm6ophQlXXB6acqGHtXuBqNyyO3zVp9b1r0MOA== dependencies: "@babel/parser" "^7.16.4" - "@vue/compiler-core" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/compiler-core" "3.2.31" + "@vue/shared" "3.2.31" estree-walker "^2.0.2" magic-string "^0.25.7" -"@vue/reactivity@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.29.tgz#afdc9c111d4139b14600be17ad80267212af6052" - integrity sha512-Ryhb6Gy62YolKXH1gv42pEqwx7zs3n8gacRVZICSgjQz8Qr8QeCcFygBKYfJm3o1SccR7U+bVBQDWZGOyG1k4g== +"@vue/reactivity@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.31.tgz#fc90aa2cdf695418b79e534783aca90d63a46bbd" + integrity sha512-HVr0l211gbhpEKYr2hYe7hRsV91uIVGFYNHj73njbARVGHQvIojkImKMaZNDdoDZOIkMsBc9a1sMqR+WZwfSCw== dependencies: - "@vue/shared" "3.2.29" + "@vue/shared" "3.2.31" -"@vue/runtime-core@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.29.tgz#fb8577b2fcf52e8d967bd91cdf49ab9fb91f9417" - integrity sha512-VMvQuLdzoTGmCwIKTKVwKmIL0qcODIqe74JtK1pVr5lnaE0l25hopodmPag3RcnIcIXe+Ye3B2olRCn7fTCgig== +"@vue/runtime-core@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.31.tgz#9d284c382f5f981b7a7b5971052a1dc4ef39ac7a" + integrity sha512-Kcog5XmSY7VHFEMuk4+Gap8gUssYMZ2+w+cmGI6OpZWYOEIcbE0TPzzPHi+8XTzAgx1w/ZxDFcXhZeXN5eKWsA== dependencies: - "@vue/reactivity" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/reactivity" "3.2.31" + "@vue/shared" "3.2.31" -"@vue/runtime-dom@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.29.tgz#35e9a2bf04ef80b86ac2ca0e7b2ceaccf1e18f01" - integrity sha512-YJgLQLwr+SQyORzTsBQLL5TT/5UiV83tEotqjL7F9aFDIQdFBTCwpkCFvX9jqwHoyi9sJqM9XtTrMcc8z/OjPA== +"@vue/runtime-dom@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.31.tgz#79ce01817cb3caf2c9d923f669b738d2d7953eff" + integrity sha512-N+o0sICVLScUjfLG7u9u5XCjvmsexAiPt17GNnaWHJUfsKed5e85/A3SWgKxzlxx2SW/Hw7RQxzxbXez9PtY3g== dependencies: - "@vue/runtime-core" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/runtime-core" "3.2.31" + "@vue/shared" "3.2.31" csstype "^2.6.8" -"@vue/server-renderer@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.2.29.tgz#ea6afa361b9c781a868c8da18c761f9b7bc89102" - integrity sha512-lpiYx7ciV7rWfJ0tPkoSOlLmwqBZ9FTmQm33S+T4g0j1fO/LmhJ9b9Ctl1o5xvIFVDk9QkSUWANZn7H2pXuxVw== +"@vue/server-renderer@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.2.31.tgz#201e9d6ce735847d5989403af81ef80960da7141" + integrity sha512-8CN3Zj2HyR2LQQBHZ61HexF5NReqngLT3oahyiVRfSSvak+oAvVmu8iNLSu6XR77Ili2AOpnAt1y8ywjjqtmkg== dependencies: - "@vue/compiler-ssr" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/compiler-ssr" "3.2.31" + "@vue/shared" "3.2.31" -"@vue/shared@3.2.29": - version "3.2.29" - resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.29.tgz#07dac7051117236431d2f737d16932aa38bbb925" - integrity sha512-BjNpU8OK6Z0LVzGUppEk0CMYm/hKDnZfYdjSmPOs0N+TR1cLKJAkDwW8ASZUvaaSLEi6d3hVM7jnWnX+6yWnHw== +"@vue/shared@3.2.31": + version "3.2.31" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.31.tgz#c90de7126d833dcd3a4c7534d534be2fb41faa4e" + integrity sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ== "@webassemblyjs/ast@1.11.0": version "1.11.0" @@ -1024,22 +999,22 @@ "@webassemblyjs/ast" "1.11.1" "@xtuc/long" "4.2.2" -"@webpack-cli/configtest@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.1.0.tgz#8342bef0badfb7dfd3b576f2574ab80c725be043" - integrity sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg== +"@webpack-cli/configtest@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.1.1.tgz#9f53b1b7946a6efc2a749095a4f450e2932e8356" + integrity sha512-1FBc1f9G4P/AxMqIgfZgeOTuRnwZMten8E7zap5zgpPInnCrP8D4Q81+4CWIch8i/Nf7nXjP0v6CjjbHOrXhKg== -"@webpack-cli/info@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.4.0.tgz#b9179c3227ab09cbbb149aa733475fcf99430223" - integrity sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw== +"@webpack-cli/info@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.4.1.tgz#2360ea1710cbbb97ff156a3f0f24556e0fc1ebea" + integrity sha512-PKVGmazEq3oAo46Q63tpMr4HipI3OPfP7LiNOEJg963RMgT0rqheag28NCML0o3GIzA3DmxP1ZIAv9oTX1CUIA== dependencies: envinfo "^7.7.3" -"@webpack-cli/serve@^1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.6.0.tgz#2c275aa05c895eccebbfc34cfb223c6e8bd591a2" - integrity sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA== +"@webpack-cli/serve@^1.6.1": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.6.1.tgz#0de2875ac31b46b6c5bb1ae0a7d7f0ba5678dffe" + integrity sha512-gNGTiTrjEVQ0OcVnzsRSqTxaBSr+dmTfm+qJsCDluky8uhdLWep7Gcr62QsAKHTMxjCS/8nEITsmFAhfIx+QSw== "@xtuc/ieee754@^1.2.0": version "1.2.0" @@ -1093,11 +1068,6 @@ acorn@^8.5.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== -acorn@^8.6.0: - version "8.6.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.6.0.tgz#e3692ba0eb1a0c83eaa4f37f5fa7368dd7142895" - integrity sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw== - acorn@^8.7.0: version "8.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" @@ -1133,11 +1103,6 @@ ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -alphanum-sort@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" - integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= - ansi-colors@4.1.1, ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" @@ -1150,11 +1115,6 @@ ansi-escapes@^4.3.0: dependencies: type-fest "^0.21.3" -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= - ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" @@ -1377,10 +1337,10 @@ bluebird@3.7.2, bluebird@^3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -blurhash@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/blurhash/-/blurhash-1.1.4.tgz#a7010ceb3019cd2c9809b17c910ebf6175d29244" - integrity sha512-MXIPz6zwYUKayju+Uidf83KhH0vodZfeRl6Ich8Gu+KGl0JgKiFq9LsfqV7cVU5fKD/AotmduZqvOfrGKOfTaA== +blurhash@1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/blurhash/-/blurhash-1.1.5.tgz#3034104cd5dce5a3e5caa871ae2f0f1f2d0ab566" + integrity sha512-a+LO3A2DfxTaTztsmkbLYmUzUeApi0LZuKalwbNmqAHR6HhJGMt1qSV/R3wc+w4DL28holjqO3Bg74aUGavGjg== bn.js@^4.0.0: version "4.11.8" @@ -1407,10 +1367,10 @@ braces@^3.0.1, braces@~3.0.2: dependencies: fill-range "^7.0.1" -broadcast-channel@4.9.0: - version "4.9.0" - resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.9.0.tgz#8af337d4ea19aeb6b819ec2eb3dda942b28c724c" - integrity sha512-xWzFb3wrOZGJF2kOSs2D3KvHXdLDMVb+WypEIoNvwblcHgUBydVy65pDJ9RS4WN9Kyvs0UVQuCCzfKme0G6Qjw== +broadcast-channel@4.10.0: + version "4.10.0" + resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.10.0.tgz#d19fb902df227df40b1b580351713d30c302d198" + integrity sha512-hOUh312XyHk6JTVyX9cyXaH1UYs+2gHVtnW16oQAu9FL7ALcXGXc/YoJWqlkV8vUn14URQPMmRi4A9q4UrwVEQ== dependencies: "@babel/runtime" "^7.16.0" detect-node "^2.1.0" @@ -1426,7 +1386,7 @@ browser-stdout@1.3.1: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.16.0, browserslist@^4.16.6: +browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.16.6: version "4.19.1" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== @@ -1552,10 +1512,10 @@ character-parser@^2.2.0: dependencies: is-regex "^1.0.3" -chart.js@3.7.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.7.0.tgz#7a19c93035341df801d613993c2170a1fcf1d882" - integrity sha512-31gVuqqKp3lDIFmzpKIrBeum4OpZsQjSIAqlOpgjosHDJZlULtvwLEZKtEhIAZc7JMPaHlYMys40Qy9Mf+1AAg== +chart.js@3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.7.1.tgz#0516f690c6a8680c6c707e31a4c1807a6f400ada" + integrity sha512-8knRegQLFnPQAheZV8MjxIXc5gQEfDFD897BJgv/klO/vtIyFFmgMXrNfgrXpbTr/XbTturxRgxIXx/Y+ASJBA== chartjs-adapter-date-fns@2.0.0: version "2.0.0" @@ -1579,7 +1539,7 @@ check-more-types@2.24.0, check-more-types@^2.24.0: resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" integrity sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA= -chokidar@3.5.1, "chokidar@>=3.0.0 <4.0.0", chokidar@^3.3.1, chokidar@^3.5.2: +chokidar@3.5.3, "chokidar@>=3.0.0 <4.0.0", chokidar@^3.3.1, chokidar@^3.5.2: version "3.3.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" integrity sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg== @@ -1700,7 +1660,7 @@ colord@^2.9.1: resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.1.tgz#c961ea0efeb57c9f0f4834458f26cb9cc4a3f90e" integrity sha512-4LBMSt09vR0uLnPVkOUBnmxgoaeN4ewRbx801wY/bXcltXfpR/G46OdWn96XpYmCWuYvO46aBZP4NgX8HpNAcw== -colorette@^1.2.0, colorette@^1.2.2: +colorette@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== @@ -1793,14 +1753,6 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -crc-32@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.0.tgz#cb2db6e29b88508e32d9dd0ec1693e7b41a18208" - integrity sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA== - dependencies: - exit-on-epipe "~1.0.1" - printj "~1.1.0" - create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -1829,18 +1781,18 @@ css-declaration-sorter@^6.0.3: dependencies: timsort "^0.3.0" -css-loader@6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.5.1.tgz#0c43d4fbe0d97f699c91e9818cb585759091d1b1" - integrity sha512-gEy2w9AnJNnD9Kuo4XAP9VflW/ujKoS9c/syO+uWMlm5igc7LysKzPXaDoR2vroROkSwsTS2tGr1yGGEbZOYZQ== +css-loader@6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.6.0.tgz#c792ad5510bd1712618b49381bd0310574fafbd3" + integrity sha512-FK7H2lisOixPT406s5gZM1S3l8GrfhEBT3ZiL2UX1Ng1XWs0y2GPllz/OTyvbaHe12VgQrIXIzuEGVlbUhodqg== dependencies: icss-utils "^5.1.0" - postcss "^8.2.15" + postcss "^8.4.5" postcss-modules-extract-imports "^3.0.0" postcss-modules-local-by-default "^4.0.0" postcss-modules-scope "^3.0.0" postcss-modules-values "^4.0.0" - postcss-value-parser "^4.1.0" + postcss-value-parser "^4.2.0" semver "^7.3.5" css-select-base-adapter@^0.1.1: @@ -1908,52 +1860,52 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -cssnano-preset-default@^5.1.10: - version "5.1.10" - resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.1.10.tgz#9350765fdf3c49bf78fac7673354fa58fa95daa4" - integrity sha512-BcpSzUVygHMOnp9uG5rfPzTOCb0GAHQkqtUQx8j1oMNF9A1Q8hziOOhiM4bdICpmrBIU85BE64RD5XGYsVQZNA== +cssnano-preset-default@^5.1.12: + version "5.1.12" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.1.12.tgz#64e2ad8e27a279e1413d2d2383ef89a41c909be9" + integrity sha512-rO/JZYyjW1QNkWBxMGV28DW7d98UDLaF759frhli58QFehZ+D/LSmwQ2z/ylBAe2hUlsIWTq6NYGfQPq65EF9w== dependencies: css-declaration-sorter "^6.0.3" - cssnano-utils "^3.0.0" + cssnano-utils "^3.0.2" postcss-calc "^8.2.0" - postcss-colormin "^5.2.3" - postcss-convert-values "^5.0.2" - postcss-discard-comments "^5.0.1" - postcss-discard-duplicates "^5.0.1" - postcss-discard-empty "^5.0.1" - postcss-discard-overridden "^5.0.2" - postcss-merge-longhand "^5.0.4" - postcss-merge-rules "^5.0.4" - postcss-minify-font-values "^5.0.2" - postcss-minify-gradients "^5.0.4" - postcss-minify-params "^5.0.3" - postcss-minify-selectors "^5.1.1" - postcss-normalize-charset "^5.0.1" - postcss-normalize-display-values "^5.0.2" - postcss-normalize-positions "^5.0.2" - postcss-normalize-repeat-style "^5.0.2" - postcss-normalize-string "^5.0.2" - postcss-normalize-timing-functions "^5.0.2" - postcss-normalize-unicode "^5.0.2" - postcss-normalize-url "^5.0.4" - postcss-normalize-whitespace "^5.0.2" - postcss-ordered-values "^5.0.3" - postcss-reduce-initial "^5.0.2" - postcss-reduce-transforms "^5.0.2" - postcss-svgo "^5.0.3" - postcss-unique-selectors "^5.0.2" + postcss-colormin "^5.2.5" + postcss-convert-values "^5.0.4" + postcss-discard-comments "^5.0.3" + postcss-discard-duplicates "^5.0.3" + postcss-discard-empty "^5.0.3" + postcss-discard-overridden "^5.0.4" + postcss-merge-longhand "^5.0.6" + postcss-merge-rules "^5.0.6" + postcss-minify-font-values "^5.0.4" + postcss-minify-gradients "^5.0.6" + postcss-minify-params "^5.0.5" + postcss-minify-selectors "^5.1.3" + postcss-normalize-charset "^5.0.3" + postcss-normalize-display-values "^5.0.3" + postcss-normalize-positions "^5.0.4" + postcss-normalize-repeat-style "^5.0.4" + postcss-normalize-string "^5.0.4" + postcss-normalize-timing-functions "^5.0.3" + postcss-normalize-unicode "^5.0.4" + postcss-normalize-url "^5.0.5" + postcss-normalize-whitespace "^5.0.4" + postcss-ordered-values "^5.0.5" + postcss-reduce-initial "^5.0.3" + postcss-reduce-transforms "^5.0.4" + postcss-svgo "^5.0.4" + postcss-unique-selectors "^5.0.4" -cssnano-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cssnano-utils/-/cssnano-utils-3.0.0.tgz#c0b9fcd6e4f05c5155b07e9ab11bf94b97163057" - integrity sha512-Pzs7/BZ6OgT+tXXuF12DKR8SmSbzUeVYCtMBbS8lI0uAm3mrYmkyqCXXPsQESI6kmLfEVBppbdVY/el3hg3nAA== +cssnano-utils@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/cssnano-utils/-/cssnano-utils-3.0.2.tgz#d82b4991a27ba6fec644b39bab35fe027137f516" + integrity sha512-KhprijuQv2sP4kT92sSQwhlK3SJTbDIsxcfIEySB0O+3m9esFOai7dP9bMx5enHAh2MwarVIcnwiWoOm01RIbQ== -cssnano@5.0.15: - version "5.0.15" - resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.0.15.tgz#8779eaf60e3665e6a12687c814d375cc9f78db76" - integrity sha512-ppZsS7oPpi2sfiyV5+i+NbB/3GtQ+ab2Vs1azrZaXWujUSN4o+WdTxlCZIMcT9yLW3VO/5yX3vpyDaQ1nIn8CQ== +cssnano@5.0.17: + version "5.0.17" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.0.17.tgz#ff45713c05cfc780a1aeb3e663b6f224d091cabf" + integrity sha512-fmjLP7k8kL18xSspeXTzRhaFtRI7DL9b8IcXR80JgtnWBpvAzHT7sCR/6qdn0tnxIaINUN6OEQu83wF57Gs3Xw== dependencies: - cssnano-preset-default "^5.1.10" + cssnano-preset-default "^5.1.12" lilconfig "^2.0.3" yaml "^1.10.2" @@ -1976,10 +1928,10 @@ csstype@^2.6.8: resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.13.tgz#a6893015b90e84dd6e85d0e3b442a1e84f2dbe0f" integrity sha512-ul26pfSQTZW8dcOnD2iiJssfXw0gdNVX9IJDH/X3K5DGPfj+fUYe3kB+swUY6BF3oZDxaID3AJt+9/ojSAE05A== -cypress@9.3.1: - version "9.3.1" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.3.1.tgz#8116f52d49d6daf90a91e88f3eafd940234d2958" - integrity sha512-BODdPesxX6bkVUnH8BVsV8I/jn57zQtO1FEOUTiuG2us3kslW7g0tcuwiny7CKCmJUZz8S/D587ppC+s58a+5Q== +cypress@9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.5.0.tgz#704a79f0d3d4e775f433334eb8f5ae065e3bea31" + integrity sha512-rC5QPolKsVjJ8QJZ7IeZ6HlKM4gswBGZc0XvoAJNL8urQCSL8zTX0A/ai/h35WfF47NQ0iSZnwIXBlHX3MOUIQ== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -2018,10 +1970,10 @@ cypress@9.3.1: pretty-bytes "^5.6.0" proxy-from-env "1.0.0" request-progress "^3.0.0" + semver "^7.3.2" supports-color "^8.1.1" tmp "~0.2.1" untildify "^4.0.0" - url "^0.11.0" yauzl "^2.10.0" d@1, d@^1.0.1: @@ -2049,7 +2001,7 @@ dayjs@^1.10.4: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63" integrity sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw== -debug@4, debug@4.3.1, debug@^4.1.1: +debug@4, debug@^4.1.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -2063,6 +2015,13 @@ debug@4.3.2, debug@^4.3.2: dependencies: ms "2.1.2" +debug@4.3.3: + version "4.3.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + debug@^2.2.0, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -2456,10 +2415,10 @@ eslint-plugin-import@2.25.4: resolve "^1.20.0" tsconfig-paths "^3.12.0" -eslint-plugin-vue@8.3.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-8.3.0.tgz#2ae4f915ed3541a58c4a4c1145c1e60b86aa7e85" - integrity sha512-IIuLHw4vQxGlHcoP2dG6t/2OVdQf2qoyAzEGAxreU1afZOHGA7y3TWq8I+r3ZA6Wjs6xpeUWGHlT31QGr9Rb5g== +eslint-plugin-vue@8.4.1: + version "8.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-8.4.1.tgz#0a25493bbfee6baa21614e637e3fd390617c0bb4" + integrity sha512-nmWOhNmDx9TZ+yP9ZhezTkZUupSHsYA2TocRm+efPSXMOyFrVczVlaIuQcLBjCtI8CbkBiUQ3VcyQsjlIhDrhA== dependencies: eslint-utils "^3.0.0" natural-compare "^1.4.0" @@ -2482,10 +2441,10 @@ eslint-scope@^6.0.0: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-scope@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.0.tgz#c1f6ea30ac583031f203d65c73e723b01298f153" - integrity sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg== +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -2507,22 +2466,17 @@ eslint-visitor-keys@^3.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== -eslint-visitor-keys@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz#eee4acea891814cda67a7d8812d9647dd0179af2" - integrity sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA== +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint-visitor-keys@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz#6fbb166a6798ee5991358bc2daa1ba76cc1254a1" - integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== - -eslint@8.7.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.7.0.tgz#22e036842ee5b7cf87b03fe237731675b4d3633c" - integrity sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w== +eslint@8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.9.0.tgz#a2a8227a99599adc4342fd9b854cb8d8d6412fdb" + integrity sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q== dependencies: - "@eslint/eslintrc" "^1.0.5" + "@eslint/eslintrc" "^1.1.0" "@humanwhocodes/config-array" "^0.9.2" ajv "^6.10.0" chalk "^4.0.0" @@ -2530,10 +2484,10 @@ eslint@8.7.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.0" + eslint-scope "^7.1.1" eslint-utils "^3.0.0" - eslint-visitor-keys "^3.2.0" - espree "^9.3.0" + eslint-visitor-keys "^3.3.0" + espree "^9.3.1" esquery "^1.4.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -2567,23 +2521,14 @@ espree@^9.0.0: acorn-jsx "^5.3.1" eslint-visitor-keys "^3.0.0" -espree@^9.2.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.2.0.tgz#c50814e01611c2d0f8bd4daa83c369eabba80dbc" - integrity sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg== - dependencies: - acorn "^8.6.0" - acorn-jsx "^5.3.1" - eslint-visitor-keys "^3.1.0" - -espree@^9.3.0: - version "9.3.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.0.tgz#c1240d79183b72aaee6ccfa5a90bc9111df085a8" - integrity sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ== +espree@^9.3.1: + version "9.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.1.tgz#8793b4bc27ea4c778c19908e0719e7b8f4115bcd" + integrity sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ== dependencies: acorn "^8.7.0" acorn-jsx "^5.3.1" - eslint-visitor-keys "^3.1.0" + eslint-visitor-keys "^3.3.0" esprima@^4.0.0: version "4.0.1" @@ -2714,11 +2659,6 @@ executable@^4.1.1: dependencies: pify "^2.2.0" -exit-on-epipe@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692" - integrity sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw== - expand-tilde@^2.0.0, expand-tilde@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" @@ -3027,10 +2967,10 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@7.1.6, glob@^7.1.3: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3039,10 +2979,10 @@ glob@7.1.6, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== +glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3448,11 +3388,6 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= - is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -3638,11 +3573,6 @@ joi@^17.4.0: "@sideway/formula" "^3.0.0" "@sideway/pinpoint" "^2.0.0" -js-levenshtein@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" - integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== - js-stringify@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/js-stringify/-/js-stringify-1.0.2.tgz#1736fddfd9724f28a3682adc6230ae7e4e9679db" @@ -3653,10 +3583,10 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.0.0.tgz#f426bc0ff4b4051926cd588c71113183409a121f" - integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q== +js-yaml@4.1.0, js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" @@ -3668,13 +3598,6 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - jsbn@1.1.0, jsbn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" @@ -3700,11 +3623,6 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - json-schema@0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" @@ -3918,11 +3836,6 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash.isequal@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= - lodash.isfinite@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz#fb89b65a9a80281833f0b7478b3a5104f898ebb3" @@ -3953,14 +3866,7 @@ lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" - integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== - dependencies: - chalk "^4.0.0" - -log-symbols@^4.0.0: +log-symbols@4.1.0, log-symbols@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -4107,33 +4013,32 @@ mkdirp@~0.5.1: dependencies: minimist "^1.2.5" -mocha@8.4.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff" - integrity sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ== +mocha@9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.0.tgz#2bfba73d46e392901f877ab9a47b7c9c5d0275cc" + integrity sha512-kNn7E8g2SzVcq0a77dkphPsDSN7P+iYkqE0ZsGCYWRsoiKjOt+NvXfaagik8vuDa6W5Zw3qxe8Jfpt5qKf+6/Q== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" - chokidar "3.5.1" - debug "4.3.1" + chokidar "3.5.3" + debug "4.3.3" diff "5.0.0" escape-string-regexp "4.0.0" find-up "5.0.0" - glob "7.1.6" + glob "7.2.0" growl "1.10.5" he "1.2.0" - js-yaml "4.0.0" - log-symbols "4.0.0" + js-yaml "4.1.0" + log-symbols "4.1.0" minimatch "3.0.4" ms "2.1.3" - nanoid "3.1.20" - serialize-javascript "5.0.1" + nanoid "3.2.0" + serialize-javascript "6.0.0" strip-json-comments "3.1.1" supports-color "8.1.1" which "2.0.2" - wide-align "1.1.3" - workerpool "6.1.0" + workerpool "6.2.0" yargs "16.2.0" yargs-parser "20.2.4" yargs-unparser "2.0.0" @@ -4165,20 +4070,20 @@ nano-time@1.0.0: dependencies: big-integer "^1.6.16" -nanoid@3.1.20, nanoid@^3.1.20: +nanoid@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.2.0.tgz#62667522da6673971cca916a6d3eff3f415ff80c" + integrity sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA== + +nanoid@^3.1.20: version "3.1.20" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== -nanoid@^3.1.23: - version "3.1.23" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81" - integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw== - -nanoid@^3.1.30: - version "3.1.30" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" - integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== +nanoid@^3.2.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35" + integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw== natural-compare@^1.4.0: version "1.4.0" @@ -4205,13 +4110,6 @@ next-tick@~1.0.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -node-fetch@^2.6.1: - version "2.6.7" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" - integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== - dependencies: - whatwg-url "^5.0.0" - node-gyp-build@~3.7.0: version "3.7.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-3.7.0.tgz#daa77a4f547b9aed3e2aac779eaf151afd60ec8d" @@ -4547,11 +4445,6 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -pluralize@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" - integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== - pngjs@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-5.0.0.tgz#e79dd2b215767fd9c04561c01236df960bce7fbb" @@ -4573,42 +4466,42 @@ postcss-calc@^8.2.0: postcss-selector-parser "^6.0.2" postcss-value-parser "^4.0.2" -postcss-colormin@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.2.3.tgz#da7fb80e81ad80d2867ea9e38672a892add5df15" - integrity sha512-dra4xoAjub2wha6RUXAgadHEn2lGxbj8drhFcIGLOMn914Eu7DkPUurugDXgstwttCYkJtZ/+PkWRWdp3UHRIA== +postcss-colormin@^5.2.5: + version "5.2.5" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.2.5.tgz#d1fc269ac2ad03fe641d462b5d1dada35c69968a" + integrity sha512-+X30aDaGYq81mFqwyPpnYInsZQnNpdxMX0ajlY7AExCexEFkPVV+KrO7kXwayqEWL2xwEbNQ4nUO0ZsRWGnevg== dependencies: browserslist "^4.16.6" caniuse-api "^3.0.0" colord "^2.9.1" postcss-value-parser "^4.2.0" -postcss-convert-values@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-5.0.2.tgz#879b849dc3677c7d6bc94b6a2c1a3f0808798059" - integrity sha512-KQ04E2yadmfa1LqXm7UIDwW1ftxU/QWZmz6NKnHnUvJ3LEYbbcX6i329f/ig+WnEByHegulocXrECaZGLpL8Zg== +postcss-convert-values@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-5.0.4.tgz#3e74dd97c581f475ae7b4500bc0a7c4fb3a6b1b6" + integrity sha512-bugzSAyjIexdObovsPZu/sBCTHccImJxLyFgeV0MmNBm/Lw5h5XnjfML6gzEmJ3A6nyfCW7hb1JXzcsA4Zfbdw== dependencies: - postcss-value-parser "^4.1.0" + postcss-value-parser "^4.2.0" -postcss-discard-comments@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-5.0.1.tgz#9eae4b747cf760d31f2447c27f0619d5718901fe" - integrity sha512-lgZBPTDvWrbAYY1v5GYEv8fEO/WhKOu/hmZqmCYfrpD6eyDWWzAOsl2rF29lpvziKO02Gc5GJQtlpkTmakwOWg== +postcss-discard-comments@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-5.0.3.tgz#011acb63418d600fdbe18804e1bbecb543ad2f87" + integrity sha512-6W5BemziRoqIdAKT+1QjM4bNcJAQ7z7zk073730NHg4cUXh3/rQHHj7pmYxUB9aGhuRhBiUf0pXvIHkRwhQP0Q== -postcss-discard-duplicates@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-5.0.1.tgz#68f7cc6458fe6bab2e46c9f55ae52869f680e66d" - integrity sha512-svx747PWHKOGpAXXQkCc4k/DsWo+6bc5LsVrAsw+OU+Ibi7klFZCyX54gjYzX4TH+f2uzXjRviLARxkMurA2bA== +postcss-discard-duplicates@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-5.0.3.tgz#10f202a4cfe9d407b73dfea7a477054d21ea0c1f" + integrity sha512-vPtm1Mf+kp7iAENTG7jI1MN1lk+fBqL5y+qxyi4v3H+lzsXEdfS3dwUZD45KVhgzDEgduur8ycB4hMegyMTeRw== -postcss-discard-empty@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-5.0.1.tgz#ee136c39e27d5d2ed4da0ee5ed02bc8a9f8bf6d8" - integrity sha512-vfU8CxAQ6YpMxV2SvMcMIyF2LX1ZzWpy0lqHDsOdaKKLQVQGVP1pzhrI9JlsO65s66uQTfkQBKBD/A5gp9STFw== +postcss-discard-empty@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-5.0.3.tgz#ec185af4a3710b88933b0ff751aa157b6041dd6a" + integrity sha512-xGJugpaXKakwKI7sSdZjUuN4V3zSzb2Y0LOlmTajFbNinEjTfVs9PFW2lmKBaC/E64WwYppfqLD03P8l9BuueA== -postcss-discard-overridden@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-5.0.2.tgz#e6f51d83e66feffcf05ed94c4ad20b814d0aab5f" - integrity sha512-+56BLP6NSSUuWUXjRgAQuho1p5xs/hU5Sw7+xt9S3JSg+7R6+WMGnJW7Hre/6tTuZ2xiXMB42ObkiZJ2hy/Pew== +postcss-discard-overridden@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-5.0.4.tgz#cc999d6caf18ea16eff8b2b58f48ec3ddee35c9c" + integrity sha512-3j9QH0Qh1KkdxwiZOW82cId7zdwXVQv/gRXYDnwx5pBtR1sTkU4cXRK9lp5dSdiM0r0OICO/L8J6sV1/7m0kHg== postcss-loader@6.2.1: version "6.2.1" @@ -4619,56 +4512,54 @@ postcss-loader@6.2.1: klona "^2.0.5" semver "^7.3.5" -postcss-merge-longhand@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-5.0.4.tgz#41f4f3270282ea1a145ece078b7679f0cef21c32" - integrity sha512-2lZrOVD+d81aoYkZDpWu6+3dTAAGkCKbV5DoRhnIR7KOULVrI/R7bcMjhrH9KTRy6iiHKqmtG+n/MMj1WmqHFw== +postcss-merge-longhand@^5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-5.0.6.tgz#090e60d5d3b3caad899f8774f8dccb33217d2166" + integrity sha512-rkmoPwQO6ymJSmWsX6l2hHeEBQa7C4kJb9jyi5fZB1sE8nSCv7sqchoYPixRwX/yvLoZP2y6FA5kcjiByeJqDg== dependencies: - postcss-value-parser "^4.1.0" - stylehacks "^5.0.1" + postcss-value-parser "^4.2.0" + stylehacks "^5.0.3" -postcss-merge-rules@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.0.4.tgz#a50640fd832380f322bd2861a9b33fbde4219f9b" - integrity sha512-yOj7bW3NxlQxaERBB0lEY1sH5y+RzevjbdH4DBJurjKERNpknRByFNdNe+V72i5pIZL12woM9uGdS5xbSB+kDQ== +postcss-merge-rules@^5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.0.6.tgz#26b37411fe1e80202fcef61cab027265b8925f2b" + integrity sha512-nzJWJ9yXWp8AOEpn/HFAW72WKVGD2bsLiAmgw4hDchSij27bt6TF+sIK0cJUBAYT3SGcjtGGsOR89bwkkMuMgQ== dependencies: browserslist "^4.16.6" caniuse-api "^3.0.0" - cssnano-utils "^3.0.0" + cssnano-utils "^3.0.2" postcss-selector-parser "^6.0.5" -postcss-minify-font-values@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-5.0.2.tgz#4603e956d85cd0719156e2b3eb68e3cd2f917092" - integrity sha512-R6MJZryq28Cw0AmnyhXrM7naqJZZLoa1paBltIzh2wM7yb4D45TLur+eubTQ4jCmZU9SGeZdWsc5KcSoqTMeTg== +postcss-minify-font-values@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-5.0.4.tgz#627d824406b0712243221891f40a44fffe1467fd" + integrity sha512-RN6q3tyuEesvyCYYFCRGJ41J1XFvgV+dvYGHr0CeHv8F00yILlN8Slf4t8XW4IghlfZYCeyRrANO6HpJ948ieA== dependencies: postcss-value-parser "^4.2.0" -postcss-minify-gradients@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-5.0.4.tgz#f13146950513f5a201015306914e3c76d10b591d" - integrity sha512-RVwZA7NC4R4J76u8X0Q0j+J7ItKUWAeBUJ8oEEZWmtv3Xoh19uNJaJwzNpsydQjk6PkuhRrK+YwwMf+c+68EYg== +postcss-minify-gradients@^5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-5.0.6.tgz#b07cef51a93f075e94053fd972ff1cba2eaf6503" + integrity sha512-E/dT6oVxB9nLGUTiY/rG5dX9taugv9cbLNTFad3dKxOO+BQg25Q/xo2z2ddG+ZB1CbkZYaVwx5blY8VC7R/43A== dependencies: colord "^2.9.1" - cssnano-utils "^3.0.0" + cssnano-utils "^3.0.2" postcss-value-parser "^4.2.0" -postcss-minify-params@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-5.0.3.tgz#9f933d37098ef1dcf007e159a47bb2c1cf06989d" - integrity sha512-NY92FUikE+wralaiVexFd5gwb7oJTIDhgTNeIw89i1Ymsgt4RWiPXfz3bg7hDy4NL6gepcThJwOYNtZO/eNi7Q== +postcss-minify-params@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-5.0.5.tgz#86cb624358cd45c21946f8c317893f0449396646" + integrity sha512-YBNuq3Rz5LfLFNHb9wrvm6t859b8qIqfXsWeK7wROm3jSKNpO1Y5e8cOyBv6Acji15TgSrAwb3JkVNCqNyLvBg== dependencies: - alphanum-sort "^1.0.2" browserslist "^4.16.6" - cssnano-utils "^3.0.0" + cssnano-utils "^3.0.2" postcss-value-parser "^4.2.0" -postcss-minify-selectors@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-5.1.1.tgz#20ae03b411f7fb397451e3d7d85b989f944b871c" - integrity sha512-TOzqOPXt91O2luJInaVPiivh90a2SIK5Nf1Ea7yEIM/5w+XA5BGrZGUSW8aEx9pJ/oNj7ZJBhjvigSiBV+bC1Q== +postcss-minify-selectors@^5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-5.1.3.tgz#6ac12d52aa661fd509469d87ab2cebb0a1e3a1b5" + integrity sha512-9RJfTiQEKA/kZhMaEXND893nBqmYQ8qYa/G+uPdVnXF6D/FzpfI6kwBtWEcHx5FqDbA79O9n6fQJfrIj6M8jvQ== dependencies: - alphanum-sort "^1.0.2" postcss-selector-parser "^6.0.5" postcss-modules-extract-imports@^3.0.0: @@ -4699,89 +4590,89 @@ postcss-modules-values@^4.0.0: dependencies: icss-utils "^5.0.0" -postcss-normalize-charset@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-5.0.1.tgz#121559d1bebc55ac8d24af37f67bd4da9efd91d0" - integrity sha512-6J40l6LNYnBdPSk+BHZ8SF+HAkS4q2twe5jnocgd+xWpz/mx/5Sa32m3W1AA8uE8XaXN+eg8trIlfu8V9x61eg== +postcss-normalize-charset@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-5.0.3.tgz#719fb9f9ca9835fcbd4fed8d6e0d72a79e7b5472" + integrity sha512-iKEplDBco9EfH7sx4ut7R2r/dwTnUqyfACf62Unc9UiyFuI7uUqZZtY+u+qp7g8Qszl/U28HIfcsI3pEABWFfA== -postcss-normalize-display-values@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-5.0.2.tgz#8b5273c6c7d0a445e6ef226b8a5bb3204a55fb99" - integrity sha512-RxXoJPUR0shSjkMMzgEZDjGPrgXUVYyWA/YwQRicb48H15OClPuaDR7tYokLAlGZ2tCSENEN5WxjgxSD5m4cUw== +postcss-normalize-display-values@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-5.0.3.tgz#94cc82e20c51cc4ffba6b36e9618adc1e50db8c1" + integrity sha512-FIV5FY/qs4Ja32jiDb5mVj5iWBlS3N8tFcw2yg98+8MkRgyhtnBgSC0lxU+16AMHbjX5fbSJgw5AXLMolonuRQ== dependencies: postcss-value-parser "^4.2.0" -postcss-normalize-positions@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-5.0.2.tgz#799fa494b352a5da183be8f050024af6d92fa29c" - integrity sha512-tqghWFVDp2btqFg1gYob1etPNxXLNh3uVeWgZE2AQGh6b2F8AK2Gj36v5Vhyh+APwIzNjmt6jwZ9pTBP+/OM8g== +postcss-normalize-positions@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-5.0.4.tgz#4001f38c99675437b83277836fb4291887fcc6cc" + integrity sha512-qynirjBX0Lc73ROomZE3lzzmXXTu48/QiEzKgMeqh28+MfuHLsuqC9po4kj84igZqqFGovz8F8hf44hA3dPYmQ== dependencies: postcss-value-parser "^4.2.0" -postcss-normalize-repeat-style@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.0.2.tgz#fd9bddba3e6fd5f5d95c18dfb42a09ecd563adea" - integrity sha512-/rIZn8X9bBzC7KvY4iKUhXUGW3MmbXwfPF23jC9wT9xTi7kAvgj8sEgwxjixBmoL6MVa4WOgxNz2hAR6wTK8tw== +postcss-normalize-repeat-style@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.0.4.tgz#d005adf9ee45fae78b673031a376c0c871315145" + integrity sha512-Innt+wctD7YpfeDR7r5Ik6krdyppyAg2HBRpX88fo5AYzC1Ut/l3xaxACG0KsbX49cO2n5EB13clPwuYVt8cMA== dependencies: postcss-value-parser "^4.2.0" -postcss-normalize-string@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-5.0.2.tgz#1b2bbf91526f61266f28abf7f773e4136b2c4bd2" - integrity sha512-zaI1yzwL+a/FkIzUWMQoH25YwCYxi917J4pYm1nRXtdgiCdnlTkx5eRzqWEC64HtRa06WCJ9TIutpb6GmW4gFw== +postcss-normalize-string@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-5.0.4.tgz#b5e00a07597e7aa8a871817bfeac2bfaa59c3333" + integrity sha512-Dfk42l0+A1CDnVpgE606ENvdmksttLynEqTQf5FL3XGQOyqxjbo25+pglCUvziicTxjtI2NLUR6KkxyUWEVubQ== dependencies: postcss-value-parser "^4.2.0" -postcss-normalize-timing-functions@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.0.2.tgz#db4f4f49721f47667afd1fdc5edb032f8d9cdb2e" - integrity sha512-Ao0PP6MoYsRU1LxeVUW740ioknvdIUmfr6uAA3xWlQJ9s69/Tupy8qwhuKG3xWfl+KvLMAP9p2WXF9cwuk/7Bg== +postcss-normalize-timing-functions@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.0.3.tgz#47210227bfcba5e52650d7a18654337090de7072" + integrity sha512-QRfjvFh11moN4PYnJ7hia4uJXeFotyK3t2jjg8lM9mswleGsNw2Lm3I5wO+l4k1FzK96EFwEVn8X8Ojrp2gP4g== dependencies: postcss-value-parser "^4.2.0" -postcss-normalize-unicode@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-5.0.2.tgz#c4db89a0116066716b9e9fcb6444ce63178f5ced" - integrity sha512-3y/V+vjZ19HNcTizeqwrbZSUsE69ZMRHfiiyLAJb7C7hJtYmM4Gsbajy7gKagu97E8q5rlS9k8FhojA8cpGhWw== +postcss-normalize-unicode@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-5.0.4.tgz#02866096937005cdb2c17116c690f29505a1623d" + integrity sha512-W79Regn+a+eXTzB+oV/8XJ33s3pDyFTND2yDuUCo0Xa3QSy1HtNIfRVPXNubHxjhlqmMFADr3FSCHT84ITW3ig== dependencies: browserslist "^4.16.6" postcss-value-parser "^4.2.0" -postcss-normalize-url@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-5.0.4.tgz#3b0322c425e31dd275174d0d5db0e466f50810fb" - integrity sha512-cNj3RzK2pgQQyNp7dzq0dqpUpQ/wYtdDZM3DepPmFjCmYIfceuD9VIAcOdvrNetjIU65g1B4uwdP/Krf6AFdXg== +postcss-normalize-url@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-5.0.5.tgz#c39efc12ff119f6f45f0b4f516902b12c8080e3a" + integrity sha512-Ws3tX+PcekYlXh+ycAt0wyzqGthkvVtZ9SZLutMVvHARxcpu4o7vvXcNoiNKyjKuWecnjS6HDI3fjBuDr5MQxQ== dependencies: normalize-url "^6.0.1" postcss-value-parser "^4.2.0" -postcss-normalize-whitespace@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.0.2.tgz#92c5eaffe5255b5c43fca0baf19227e607c534db" - integrity sha512-CXBx+9fVlzSgbk0IXA/dcZn9lXixnQRndnsPC5ht3HxlQ1bVh77KQDL1GffJx1LTzzfae8ftMulsjYmO2yegxA== +postcss-normalize-whitespace@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.0.4.tgz#1d477e7da23fecef91fc4e37d462272c7b55c5ca" + integrity sha512-wsnuHolYZjMwWZJoTC9jeI2AcjA67v4UuidDrPN9RnX8KIZfE+r2Nd6XZRwHVwUiHmRvKQtxiqo64K+h8/imaw== dependencies: postcss-value-parser "^4.2.0" -postcss-ordered-values@^5.0.3: +postcss-ordered-values@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/postcss-ordered-values/-/postcss-ordered-values-5.0.5.tgz#e878af822a130c3f3709737e24cb815ca7c6d040" + integrity sha512-mfY7lXpq+8bDEHfP+muqibDPhZ5eP9zgBEF9XRvoQgXcQe2Db3G1wcvjbnfjXG6wYsl+0UIjikqq4ym1V2jGMQ== + dependencies: + cssnano-utils "^3.0.2" + postcss-value-parser "^4.2.0" + +postcss-reduce-initial@^5.0.3: version "5.0.3" - resolved "https://registry.yarnpkg.com/postcss-ordered-values/-/postcss-ordered-values-5.0.3.tgz#d80a8565f2e21efe8a06abacd60629a783bbcf54" - integrity sha512-T9pDS+P9bWeFvqivXd5ACzQmrCmHjv3ZP+djn8E1UZY7iK79pFSm7i3WbKw2VSmFmdbMm8sQ12OPcNpzBo3Z2w== - dependencies: - cssnano-utils "^3.0.0" - postcss-value-parser "^4.2.0" - -postcss-reduce-initial@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.0.2.tgz#fa424ce8aa88a89bc0b6d0f94871b24abe94c048" - integrity sha512-v/kbAAQ+S1V5v9TJvbGkV98V2ERPdU6XvMcKMjqAlYiJ2NtsHGlKYLPjWWcXlaTKNxooId7BGxeraK8qXvzKtw== + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.0.3.tgz#68891594defd648253703bbd8f1093162f19568d" + integrity sha512-c88TkSnQ/Dnwgb4OZbKPOBbCaauwEjbECP5uAuFPOzQ+XdjNjRH7SG0dteXrpp1LlIFEKK76iUGgmw2V0xeieA== dependencies: browserslist "^4.16.6" caniuse-api "^3.0.0" -postcss-reduce-transforms@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-5.0.2.tgz#9242758629f9ad4d90312eadbc921259d15bee4d" - integrity sha512-25HeDeFsgiPSUx69jJXZn8I06tMxLQJJNF5h7i9gsUg8iP4KOOJ8EX8fj3seeoLt3SLU2YDD6UPnDYVGUO7DEA== +postcss-reduce-transforms@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-5.0.4.tgz#717e72d30befe857f7d2784dba10eb1157863712" + integrity sha512-VIJB9SFSaL8B/B7AXb7KHL6/GNNbbCHslgdzS9UDfBZYIA2nx8NLY7iD/BXFSO/1sRUILzBTfHCoW5inP37C5g== dependencies: postcss-value-parser "^4.2.0" @@ -4803,20 +4694,19 @@ postcss-selector-parser@^6.0.5: cssesc "^3.0.0" util-deprecate "^1.0.2" -postcss-svgo@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-5.0.3.tgz#d945185756e5dfaae07f9edb0d3cae7ff79f9b30" - integrity sha512-41XZUA1wNDAZrQ3XgWREL/M2zSw8LJPvb5ZWivljBsUQAGoEKMYm6okHsTjJxKYI4M75RQEH4KYlEM52VwdXVA== +postcss-svgo@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-5.0.4.tgz#cfa8682f47b88f7cd75108ec499e133b43102abf" + integrity sha512-yDKHvULbnZtIrRqhZoA+rxreWpee28JSRH/gy9727u0UCgtpv1M/9WEWY3xySlFa0zQJcqf6oCBJPR5NwkmYpg== dependencies: - postcss-value-parser "^4.1.0" + postcss-value-parser "^4.2.0" svgo "^2.7.0" -postcss-unique-selectors@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-5.0.2.tgz#5d6893daf534ae52626708e0d62250890108c0c1" - integrity sha512-w3zBVlrtZm7loQWRPVC0yjUwwpty7OM6DnEHkxcSQXO1bMS3RJ+JUS5LFMSDZHJcvGsRwhZinCWVqn8Kej4EDA== +postcss-unique-selectors@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-5.0.4.tgz#08e188126b634ddfa615fb1d6c262bafdd64826e" + integrity sha512-5ampwoSDJCxDPoANBIlMgoBcYUHnhaiuLYJR5pj1DLnYQvMRVyFuTA5C3Bvt+aHtiqWpJkD/lXT50Vo1D0ZsAQ== dependencies: - alphanum-sort "^1.0.2" postcss-selector-parser "^6.0.5" postcss-value-parser@^4.0.2, postcss-value-parser@^4.1.0: @@ -4829,14 +4719,14 @@ postcss-value-parser@^4.2.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@8.4.5: - version "8.4.5" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.5.tgz#bae665764dfd4c6fcc24dc0fdf7e7aa00cc77f95" - integrity sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg== +postcss@8.4.6, postcss@^8.4.5: + version "8.4.6" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.6.tgz#c5ff3c3c457a23864f32cb45ac9b741498a09ae1" + integrity sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA== dependencies: - nanoid "^3.1.30" + nanoid "^3.2.0" picocolors "^1.0.0" - source-map-js "^1.0.1" + source-map-js "^1.0.2" postcss@^8.1.10: version "8.2.8" @@ -4847,15 +4737,6 @@ postcss@^8.1.10: nanoid "^3.1.20" source-map "^0.6.1" -postcss@^8.2.15: - version "8.3.0" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.0.tgz#b1a713f6172ca427e3f05ef1303de8b65683325f" - integrity sha512-+ogXpdAjWGa+fdYY5BQ96V/6tAo+TdSSIMP5huJBIygdWwKtVoB5JWZ7yUd4xZ8r+8Kvvx4nyg/PQ071H4UtcQ== - dependencies: - colorette "^1.2.2" - nanoid "^3.1.23" - source-map-js "^0.6.2" - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -4866,15 +4747,10 @@ pretty-bytes@^5.6.0: resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" integrity sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg== -printj@~1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/printj/-/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222" - integrity sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ== - -prismjs@1.26.0: - version "1.26.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.26.0.tgz#16881b594828bb6b45296083a8cbab46b0accd47" - integrity sha512-HUoH9C5Z3jKkl3UunCyiD5jwk0+Hz0fIgQ2nbwU2Oo/ceuTAQAg+pPVnfdt2TJWRVLcxKh9iuoYDUSc8clb5UQ== +prismjs@1.27.0: + version "1.27.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.27.0.tgz#bb6ee3138a0b438a3653dd4d6ce0cc6510a45057" + integrity sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA== private-ip@2.3.3: version "2.3.3" @@ -5026,11 +4902,6 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= - punycode@2.1.1, punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -5056,11 +4927,6 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - querystring@0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" @@ -5131,11 +4997,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-from-string@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -5254,18 +5115,18 @@ safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sass-loader@12.4.0: - version "12.4.0" - resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-12.4.0.tgz#260b0d51a8a373bb8e88efc11f6ba5583fea0bcf" - integrity sha512-7xN+8khDIzym1oL9XyS6zP6Ges+Bo2B2xbPrjdMHEYyV3AQYhd/wXeru++3ODHF0zMjYmVadblSKrPrjEkL8mg== +sass-loader@12.6.0: + version "12.6.0" + resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-12.6.0.tgz#5148362c8e2cdd4b950f3c63ac5d16dbfed37bcb" + integrity sha512-oLTaH0YCtX4cfnJZxKSLAyglED0naiYfNG1iXfU5w1LNZ+ukoA5DtyDIN5zmKVZwYNJP4KRc5Y3hkWga+7tYfA== dependencies: klona "^2.0.4" neo-async "^2.6.2" -sass@1.49.0: - version "1.49.0" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.0.tgz#65ec1b1d9a6bc1bae8d2c9d4b392c13f5d32c078" - integrity sha512-TVwVdNDj6p6b4QymJtNtRS2YtLJ/CqZriGg0eIAbAKMlN8Xy6kbv33FsEZSF7FufFFM705SQviHjjThfaQ4VNw== +sass@1.49.8: + version "1.49.8" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.8.tgz#9bbbc5d43d14862db07f1c04b786c9da9b641828" + integrity sha512-NoGOjvDDOU9og9oAxhRnap71QaTjjlzrvLnKecUJ3GxhaQBrV6e7gPuSPF28u1OcVAArVojPAe4ZhOXwwC4tGw== dependencies: chokidar ">=3.0.0 <4.0.0" immutable "^4.0.0" @@ -5318,20 +5179,20 @@ semver@^7.3.5: dependencies: lru-cache "^6.0.0" -serialize-javascript@5.0.1, serialize-javascript@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" - integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== - dependencies: - randombytes "^2.1.0" - -serialize-javascript@^6.0.0: +serialize-javascript@6.0.0, serialize-javascript@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== dependencies: randombytes "^2.1.0" +serialize-javascript@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== + dependencies: + randombytes "^2.1.0" + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -5403,15 +5264,15 @@ source-list-map@^2.0.1: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== -"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.1: +"source-map-js@>=0.6.2 <2.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf" integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA== -source-map-js@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e" - integrity sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug== +source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== source-map-support@~0.5.19: version "0.5.19" @@ -5498,14 +5359,6 @@ strict-event-emitter-types@2.0.0: resolved "https://registry.yarnpkg.com/strict-event-emitter-types/-/strict-event-emitter-types-2.0.0.tgz#05e15549cb4da1694478a53543e4e2f4abcf277f" integrity sha512-Nk/brWYpD85WlOgzw5h173aci0Teyv8YdIAEtV+N88nDB0dLlazZyJMIsN6eo1/AR61l+p6CJTG1JIyFaoNEEA== -"string-width@^1.0.2 || 2": - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" @@ -5572,13 +5425,6 @@ stringz@2.1.0: dependencies: char-regex "^1.0.2" -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - strip-ansi@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" @@ -5613,12 +5459,12 @@ style-loader@3.3.1: resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-3.3.1.tgz#057dfa6b3d4d7c7064462830f9113ed417d38575" integrity sha512-GPcQ+LDJbrcxHORTRes6Jy2sfvK2kS6hpSfI/fXhPt+spVzxF6LJ1dHLN9zIGmVaaP044YKaIatFaufENRiDoQ== -stylehacks@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-5.0.1.tgz#323ec554198520986806388c7fdaebc38d2c06fb" - integrity sha512-Es0rVnHIqbWzveU1b24kbw92HsebBepxfcqe5iix7t9j0PQqhs0IxXVXv0pY2Bxa08CgMkzD6OWql7kbGOuEdA== +stylehacks@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-5.0.3.tgz#2ef3de567bfa2be716d29a93bf3d208c133e8d04" + integrity sha512-ENcUdpf4yO0E1rubu8rkxI+JGQk4CgjchynZ4bDBJDfqdy+uhTRSWb8/F3Jtu+Bw5MW45Po3/aQGeIyyxgQtxg== dependencies: - browserslist "^4.16.0" + browserslist "^4.16.6" postcss-selector-parser "^6.0.4" supports-color@8.1.1, supports-color@^8.0.0, supports-color@^8.1.1: @@ -5766,7 +5612,7 @@ tinycolor2@1.4.2: resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.2.tgz#3f6a4d1071ad07676d7fa472e1fac40a719d8803" integrity sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA== -tmp@0.2.1, tmp@~0.2.1: +tmp@~0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== @@ -5798,11 +5644,6 @@ tough-cookie@~2.5.0: psl "^1.1.28" punycode "^2.1.1" -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= - ts-loader@9.2.6: version "9.2.6" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.2.6.tgz#9937c4dd0a1e3dbbb5e433f8102a6601c6615d74" @@ -5813,10 +5654,10 @@ ts-loader@9.2.6: micromatch "^4.0.0" semver "^7.3.4" -ts-node@10.4.0: - version "10.4.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" - integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== +ts-node@10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.5.0.tgz#618bef5854c1fbbedf5e31465cbb224a1d524ef9" + integrity sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw== dependencies: "@cspotcode/source-map-support" "0.7.0" "@tsconfig/node10" "^1.0.7" @@ -5829,6 +5670,7 @@ ts-node@10.4.0: create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" + v8-compile-cache-lib "^3.0.0" yn "3.1.1" tsc-alias@1.5.0: @@ -5976,14 +5818,6 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -url@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= - dependencies: - punycode "1.3.2" - querystring "0.2.0" - urlsafe-base64@^1.0.0, urlsafe-base64@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/urlsafe-base64/-/urlsafe-base64-1.0.0.tgz#23f89069a6c62f46cf3a1d3b00169cefb90be0c6" @@ -6026,6 +5860,11 @@ v-debounce@0.1.2: resolved "https://registry.yarnpkg.com/v-debounce/-/v-debounce-0.1.2.tgz#cab75df7def2783215bf449ef85c69c2decf0a55" integrity sha1-yrdd997yeDIVv0Se+Fxpwt7PClU= +v8-compile-cache-lib@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" + integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== + v8-compile-cache@^2.0.3: version "2.2.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" @@ -6077,10 +5916,12 @@ vue-prism-editor@2.0.0-alpha.2: resolved "https://registry.yarnpkg.com/vue-prism-editor/-/vue-prism-editor-2.0.0-alpha.2.tgz#aa53a88efaaed628027cbb282c2b1d37fc7c5c69" integrity sha512-Gu42ba9nosrE+gJpnAEuEkDMqG9zSUysIR8SdXUw8MQKDjBnnNR9lHC18uOr/ICz7yrA/5c7jHJr9lpElODC7w== -vue-router@4.0.5: - version "4.0.5" - resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.0.5.tgz#dd0a4134bc950c37aef64b973e9ee1008428d8fa" - integrity sha512-AQq+pllb6FCc7rS6vh4PPcce3XA1jgK3hKNkQ4hXHwoVN7jOeAOMKCnX7XAX3etV9rmN7iNW8iIwgPk95ckBjw== +vue-router@4.0.12: + version "4.0.12" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.0.12.tgz#8dc792cddf5bb1abcc3908f9064136de7e13c460" + integrity sha512-CPXvfqe+mZLB1kBWssssTiWg4EQERyqJZes7USiqfW9B5N2x+nHlnsM1D3b5CaJ6qgCvMmYJnz+G0iWjNCvXrg== + dependencies: + "@vue/devtools-api" "^6.0.0-beta.18" vue-style-loader@4.1.3: version "4.1.3" @@ -6099,16 +5940,16 @@ vue-svg-loader@0.17.0-beta.2: semver "^7.3.2" svgo "^1.3.2" -vue@3.2.29: - version "3.2.29" - resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.29.tgz#3571b65dbd796d3a6347e2fd45a8e6e11c13d56a" - integrity sha512-cFIwr7LkbtCRanjNvh6r7wp2yUxfxeM2yPpDQpAfaaLIGZSrUmLbNiSze9nhBJt5MrZ68Iqt0O5scwAMEVxF+Q== +vue@3.2.31: + version "3.2.31" + resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.31.tgz#e0c49924335e9f188352816788a4cca10f817ce6" + integrity sha512-odT3W2tcffTiQCy57nOT93INw1auq5lYLLYtWpPYQQYQOOdHiqFct9Xhna6GJ+pJQaF67yZABraH47oywkJgFw== dependencies: - "@vue/compiler-dom" "3.2.29" - "@vue/compiler-sfc" "3.2.29" - "@vue/runtime-dom" "3.2.29" - "@vue/server-renderer" "3.2.29" - "@vue/shared" "3.2.29" + "@vue/compiler-dom" "3.2.31" + "@vue/compiler-sfc" "3.2.31" + "@vue/runtime-dom" "3.2.31" + "@vue/server-renderer" "3.2.31" + "@vue/shared" "3.2.31" vuedraggable@4.0.1: version "4.0.1" @@ -6156,20 +5997,15 @@ web-push@3.4.5: minimist "^1.2.5" urlsafe-base64 "^1.0.0" -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= - -webpack-cli@4.9.1: - version "4.9.1" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.9.1.tgz#b64be825e2d1b130f285c314caa3b1ba9a4632b3" - integrity sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ== +webpack-cli@4.9.2: + version "4.9.2" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.9.2.tgz#77c1adaea020c3f9e2db8aad8ea78d235c83659d" + integrity sha512-m3/AACnBBzK/kMTcxWHcZFPrw/eQuY4Df1TxvIWfWM2x7mRqBQCqKEd96oCUa9jkapLBaFfRce33eGDb4Pr7YQ== dependencies: "@discoveryjs/json-ext" "^0.5.0" - "@webpack-cli/configtest" "^1.1.0" - "@webpack-cli/info" "^1.4.0" - "@webpack-cli/serve" "^1.6.0" + "@webpack-cli/configtest" "^1.1.1" + "@webpack-cli/info" "^1.4.1" + "@webpack-cli/serve" "^1.6.1" colorette "^2.0.14" commander "^7.0.0" execa "^5.0.0" @@ -6195,18 +6031,18 @@ webpack-sources@^2.1.1: source-list-map "^2.0.1" source-map "^0.6.1" -webpack-sources@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.2.tgz#d88e3741833efec57c4c789b6010db9977545260" - integrity sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw== +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@5.66.0: - version "5.66.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.66.0.tgz#789bf36287f407fc92b3e2d6f978ddff1bfc2dbb" - integrity sha512-NJNtGT7IKpGzdW7Iwpn/09OXz9inIkeIQ/ibY6B+MdV1x6+uReqz/5z1L89ezWnpPDWpXF0TY5PCYKQdWVn8Vg== +webpack@5.69.1: + version "5.69.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.69.1.tgz#8cfd92c192c6a52c99ab00529b5a0d33aa848dc5" + integrity sha512-+VyvOSJXZMT2V5vLzOnDuMz5GxEqLk7hKWQ56YxPW/PQRUuKimPqmEIJOx8jHYeyo65pKbapbW464mvsKbaj4A== dependencies: - "@types/eslint-scope" "^3.7.0" - "@types/estree" "^0.0.50" + "@types/eslint-scope" "^3.7.3" + "@types/estree" "^0.0.51" "@webassemblyjs/ast" "1.11.1" "@webassemblyjs/wasm-edit" "1.11.1" "@webassemblyjs/wasm-parser" "1.11.1" @@ -6228,7 +6064,7 @@ webpack@5.66.0: tapable "^2.1.1" terser-webpack-plugin "^5.1.3" watchpack "^2.3.1" - webpack-sources "^3.2.2" + webpack-sources "^3.2.3" webpack@^5: version "5.33.2" @@ -6271,14 +6107,6 @@ websocket@1.0.34: utf-8-validate "^5.0.2" yaeti "^0.0.6" -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" @@ -6309,13 +6137,6 @@ which@^1.2.14: dependencies: isexe "^2.0.0" -wide-align@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== - dependencies: - string-width "^1.0.2 || 2" - wildcard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" @@ -6336,10 +6157,10 @@ word-wrap@^1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== -workerpool@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.0.tgz#a8e038b4c94569596852de7a8ea4228eefdeb37b" - integrity sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg== +workerpool@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.0.tgz#827d93c9ba23ee2019c3ffaff5c27fccea289e8b" + integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== wrap-ansi@^6.2.0: version "6.2.0" @@ -6364,10 +6185,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@8.4.2: - version "8.4.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.4.2.tgz#18e749868d8439f2268368829042894b6907aa0b" - integrity sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA== +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== xml-js@^1.6.11: version "1.6.11" @@ -6396,11 +6217,6 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml-ast-parser@0.0.43: - version "0.0.43" - resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" - integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== - yaml@^1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" diff --git a/yarn.lock b/yarn.lock index 739f06e831..8ba1d4c145 100644 --- a/yarn.lock +++ b/yarn.lock @@ -67,32 +67,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@redocly/ajv@^8.6.4": - version "8.6.4" - resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.6.4.tgz#94053e7a9d4146d1a4feacd3813892873f229a85" - integrity sha512-y9qNj0//tZtWB2jfXNK3BX18BSBp9zNR7KE7lMysVHwbZtY392OJCjm6Rb/h4UHH2r1AqjNEHFD6bRn+DqU9Mw== - dependencies: - fast-deep-equal "^3.1.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - uri-js "^4.2.2" - -"@redocly/openapi-core@1.0.0-beta.79": - version "1.0.0-beta.79" - resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.0.0-beta.79.tgz#7512b3507ab99dc78226f9069669c5302abb0969" - integrity sha512-do79vGt3iiHsaVG9LKY8dH+d1E7TLHr+3T+CQ1lqagtWVjYOxqGaoxAT8tRD7R1W0z8BmS4e2poNON6c1sxP5g== - dependencies: - "@redocly/ajv" "^8.6.4" - "@types/node" "^14.11.8" - colorette "^1.2.0" - js-levenshtein "^1.1.6" - js-yaml "^4.1.0" - lodash.isequal "^4.5.0" - minimatch "^3.0.4" - node-fetch "^2.6.1" - pluralize "^8.0.0" - yaml-ast-parser "0.0.43" - "@sideway/address@^4.1.0": version "4.1.2" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1" @@ -125,13 +99,6 @@ resolved "https://registry.yarnpkg.com/@types/expect/-/expect-1.20.4.tgz#8288e51737bf7e3ab5d7c77bfa695883745264e5" integrity sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg== -"@types/fluent-ffmpeg@2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.20.tgz#3b5f42fc8263761d58284fa46ee6759a64ce54ac" - integrity sha512-B+OvhCdJ3LgEq2PhvWNOiB/EfwnXLElfMCgc4Z1K5zXgSfo9I6uGKwR/lqmNPFQuebNnes7re3gqkV77SyypLg== - dependencies: - "@types/node" "*" - "@types/glob-stream@*": version "6.1.0" resolved "https://registry.yarnpkg.com/@types/glob-stream/-/glob-stream-6.1.0.tgz#7ede8a33e59140534f8d8adfb8ac9edfb31897bc" @@ -176,7 +143,7 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50" integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA== -"@types/node@^14.11.8", "@types/node@^14.14.31", "@types/node@^14.14.41": +"@types/node@^14.14.31", "@types/node@^14.14.41": version "14.17.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.9.tgz#b97c057e6138adb7b720df2bd0264b03c9f504fd" integrity sha512-CMjgRNsks27IDwI785YMY0KLt3co/c0cQ5foxHYv/shC2w8oOnVwz5Ubq1QG5KzrcW+AXk6gzdnxIkDnTvzu3g== @@ -227,48 +194,48 @@ dependencies: "@types/node" "*" -"@typescript-eslint/parser@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.0.tgz#8f59e036f5f1cffc178cacbd5ccdd02aeb96c91c" - integrity sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw== +"@typescript-eslint/parser@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.0.tgz#0ca669861813df99ce54916f66f524c625ed2434" + integrity sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog== dependencies: - "@typescript-eslint/scope-manager" "5.10.0" - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/typescript-estree" "5.10.0" + "@typescript-eslint/scope-manager" "5.12.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/typescript-estree" "5.12.0" debug "^4.3.2" -"@typescript-eslint/scope-manager@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz#bb5d872e8b9e36203908595507fbc4d3105329cb" - integrity sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg== +"@typescript-eslint/scope-manager@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e" + integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ== dependencies: - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/visitor-keys" "5.10.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/visitor-keys" "5.12.0" -"@typescript-eslint/types@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.0.tgz#beb3cb345076f5b088afe996d57bcd1dfddaa75c" - integrity sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ== +"@typescript-eslint/types@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8" + integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ== -"@typescript-eslint/typescript-estree@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz#4be24a3dea0f930bb1397c46187d0efdd955a224" - integrity sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA== +"@typescript-eslint/typescript-estree@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2" + integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ== dependencies: - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/visitor-keys" "5.10.0" + "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/visitor-keys" "5.12.0" debug "^4.3.2" globby "^11.0.4" is-glob "^4.0.3" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/visitor-keys@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz#770215497ad67cd15a572b52089991d5dfe06281" - integrity sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ== +"@typescript-eslint/visitor-keys@5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16" + integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg== dependencies: - "@typescript-eslint/types" "5.10.0" + "@typescript-eslint/types" "5.12.0" eslint-visitor-keys "^3.0.0" aggregate-error@^3.0.0: @@ -959,7 +926,7 @@ color@^0.11.0: color-convert "^1.3.0" color-string "^0.3.0" -colorette@^1.2.0, colorette@^1.2.2: +colorette@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== @@ -1117,10 +1084,10 @@ csso@~2.3.1: clap "^1.0.9" source-map "^0.5.3" -cypress@9.4.1: - version "9.4.1" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.4.1.tgz#1a4ba706435829c24b7edf350c2b059e05da9084" - integrity sha512-+JgMG9uT+QFx97JU9kOHE3jO3+0UdkQ9H1oCBiC7A74qme7Jkdy2sYDBCPjjGczutnWnGUTMRlwiNMP/Uq6LrQ== +cypress@9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.5.0.tgz#704a79f0d3d4e775f433334eb8f5ae065e3bea31" + integrity sha512-rC5QPolKsVjJ8QJZ7IeZ6HlKM4gswBGZc0XvoAJNL8urQCSL8zTX0A/ai/h35WfF47NQ0iSZnwIXBlHX3MOUIQ== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -1539,11 +1506,6 @@ fancy-log@^1.3.2: parse-node-version "^1.0.0" time-stamp "^1.0.0" -fast-deep-equal@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" - integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== - fast-glob@^3.1.1: version "3.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" @@ -2416,12 +2378,7 @@ js-base64@^2.1.9: resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== -js-levenshtein@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" - integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== - -js-yaml@4.1.0, js-yaml@^4.1.0: +js-yaml@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -2441,11 +2398,6 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - json-schema@0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" @@ -2581,11 +2533,6 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -lodash.isequal@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= - lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -2798,11 +2745,6 @@ next-tick@~1.0.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -node-fetch@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== - normalize-package-data@^2.3.2: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -3111,11 +3053,6 @@ plugin-error@^1.0.1: arr-union "^3.1.0" extend-shallow "^3.0.2" -pluralize@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" - integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -3422,7 +3359,7 @@ pumpify@^1.3.5: inherits "^2.0.3" pump "^2.0.0" -punycode@^2.1.0, punycode@^2.1.1: +punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== @@ -3603,11 +3540,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-from-string@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" @@ -4331,13 +4263,6 @@ upath@^1.1.1: resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== - dependencies: - punycode "^2.1.0" - urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" @@ -4528,11 +4453,6 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml-ast-parser@0.0.43: - version "0.0.43" - resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" - integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== - yargs-parser@>=5.0.0-security.0: version "20.2.7" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" From 510de87607283d4d49239b1d14026a577299c99e Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 19 Feb 2022 14:05:32 +0900 Subject: [PATCH 09/95] refactor: use ajv instead of cafy (#8324) * wip * wip * Update abuse-user-reports.ts * Update files.ts * Update list-remote.ts * Update list.ts * Update show-users.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update update.ts * Update search.ts * Update reactions.ts * Update search.ts * wip * wip * wip * wip * Update update.ts * Update relation.ts * Update available.ts * wip * wip * wip * Update packages/backend/src/server/api/define.ts Co-authored-by: Johann150 * Update define.ts * Update define.ts * typo * wip * wip * wip * wip * wip * wip * wip * wip * Update update.ts * wip * Update signup.ts * Update call.ts * minimum for limit * type * remove needless annotation * wip * Update signup.ts * wip * wip * fix * Update create.ts Co-authored-by: Johann150 --- packages/backend/package.json | 1 + packages/backend/src/misc/schema.ts | 80 +- .../src/models/repositories/drive-folder.ts | 7 - .../models/repositories/messaging-message.ts | 4 - .../backend/src/models/repositories/note.ts | 4 - .../backend/src/models/repositories/user.ts | 29 +- .../backend/src/server/api/api-handler.ts | 2 +- packages/backend/src/server/api/call.ts | 16 +- .../backend/src/server/api/common/signup.ts | 4 +- packages/backend/src/server/api/define.ts | 69 +- packages/backend/src/server/api/endpoints.ts | 18 +- .../api/endpoints/admin/abuse-user-reports.ts | 63 +- .../api/endpoints/admin/accounts/create.ts | 21 +- .../api/endpoints/admin/accounts/delete.ts | 14 +- .../server/api/endpoints/admin/ad/create.ts | 37 +- .../server/api/endpoints/admin/ad/delete.ts | 18 +- .../src/server/api/endpoints/admin/ad/list.ts | 27 +- .../server/api/endpoints/admin/ad/update.ts | 46 +- .../endpoints/admin/announcements/create.ts | 25 +- .../endpoints/admin/announcements/delete.ts | 18 +- .../api/endpoints/admin/announcements/list.ts | 31 +- .../endpoints/admin/announcements/update.ts | 30 +- .../admin/delete-all-files-of-a-user.ts | 14 +- .../admin/drive/clean-remote-files.ts | 8 +- .../api/endpoints/admin/drive/cleanup.ts | 8 +- .../server/api/endpoints/admin/drive/files.ts | 52 +- .../api/endpoints/admin/drive/show-file.ts | 23 +- .../endpoints/admin/emoji/add-aliases-bulk.ts | 23 +- .../server/api/endpoints/admin/emoji/add.ts | 18 +- .../server/api/endpoints/admin/emoji/copy.ts | 18 +- .../api/endpoints/admin/emoji/delete-bulk.ts | 16 +- .../api/endpoints/admin/emoji/delete.ts | 18 +- .../api/endpoints/admin/emoji/import-zip.ts | 15 +- .../api/endpoints/admin/emoji/list-remote.ts | 43 +- .../server/api/endpoints/admin/emoji/list.ts | 41 +- .../admin/emoji/remove-aliases-bulk.ts | 23 +- .../endpoints/admin/emoji/set-aliases-bulk.ts | 23 +- .../admin/emoji/set-category-bulk.ts | 21 +- .../api/endpoints/admin/emoji/update.ts | 35 +- .../admin/federation/delete-all-files.ts | 13 +- .../refresh-remote-instance-metadata.ts | 13 +- .../admin/federation/remove-all-following.ts | 13 +- .../admin/federation/update-instance.ts | 18 +- .../api/endpoints/admin/get-index-stats.ts | 9 +- .../api/endpoints/admin/get-table-stats.ts | 11 +- .../src/server/api/endpoints/admin/invite.ts | 10 +- .../api/endpoints/admin/moderators/add.ts | 14 +- .../api/endpoints/admin/moderators/remove.ts | 14 +- .../api/endpoints/admin/promo/create.ts | 23 +- .../server/api/endpoints/admin/queue/clear.ts | 8 +- .../endpoints/admin/queue/deliver-delayed.ts | 11 +- .../endpoints/admin/queue/inbox-delayed.ts | 11 +- .../server/api/endpoints/admin/queue/stats.ts | 10 +- .../server/api/endpoints/admin/relays/add.ts | 17 +- .../server/api/endpoints/admin/relays/list.ts | 11 +- .../api/endpoints/admin/relays/remove.ts | 13 +- .../api/endpoints/admin/reset-password.ts | 18 +- .../admin/resolve-abuse-user-report.ts | 21 +- .../server/api/endpoints/admin/send-email.ts | 21 +- .../server/api/endpoints/admin/server-info.ts | 11 +- .../endpoints/admin/show-moderation-logs.ts | 31 +- .../server/api/endpoints/admin/show-user.ts | 18 +- .../server/api/endpoints/admin/show-users.ts | 74 +- .../api/endpoints/admin/silence-user.ts | 14 +- .../api/endpoints/admin/suspend-user.ts | 14 +- .../api/endpoints/admin/unsilence-user.ts | 14 +- .../api/endpoints/admin/unsuspend-user.ts | 14 +- .../server/api/endpoints/admin/update-meta.ts | 381 ++----- .../src/server/api/endpoints/admin/vacuum.ts | 17 +- .../src/server/api/endpoints/announcements.ts | 37 +- .../server/api/endpoints/antennas/create.ts | 78 +- .../server/api/endpoints/antennas/delete.ts | 18 +- .../src/server/api/endpoints/antennas/list.ts | 8 +- .../server/api/endpoints/antennas/notes.ts | 46 +- .../src/server/api/endpoints/antennas/show.ts | 18 +- .../server/api/endpoints/antennas/update.ts | 83 +- .../src/server/api/endpoints/ap/get.ts | 17 +- .../src/server/api/endpoints/ap/show.ts | 17 +- .../src/server/api/endpoints/app/create.ts | 36 +- .../src/server/api/endpoints/app/show.ts | 18 +- .../src/server/api/endpoints/auth/accept.ts | 17 +- .../api/endpoints/auth/session/generate.ts | 17 +- .../server/api/endpoints/auth/session/show.ts | 17 +- .../api/endpoints/auth/session/userkey.ts | 22 +- .../server/api/endpoints/blocking/create.ts | 18 +- .../server/api/endpoints/blocking/delete.ts | 18 +- .../src/server/api/endpoints/blocking/list.ts | 31 +- .../server/api/endpoints/channels/create.ts | 28 +- .../server/api/endpoints/channels/featured.ts | 8 +- .../server/api/endpoints/channels/follow.ts | 18 +- .../server/api/endpoints/channels/followed.ts | 31 +- .../server/api/endpoints/channels/owned.ts | 31 +- .../src/server/api/endpoints/channels/show.ts | 18 +- .../server/api/endpoints/channels/timeline.ts | 46 +- .../server/api/endpoints/channels/unfollow.ts | 18 +- .../server/api/endpoints/channels/update.ts | 33 +- .../api/endpoints/charts/active-users.ts | 31 +- .../server/api/endpoints/charts/ap-request.ts | 31 +- .../src/server/api/endpoints/charts/drive.ts | 31 +- .../server/api/endpoints/charts/federation.ts | 31 +- .../server/api/endpoints/charts/hashtag.ts | 36 +- .../server/api/endpoints/charts/instance.ts | 36 +- .../src/server/api/endpoints/charts/notes.ts | 31 +- .../server/api/endpoints/charts/user/drive.ts | 37 +- .../api/endpoints/charts/user/following.ts | 37 +- .../server/api/endpoints/charts/user/notes.ts | 37 +- .../api/endpoints/charts/user/reactions.ts | 37 +- .../src/server/api/endpoints/charts/users.ts | 31 +- .../server/api/endpoints/clips/add-note.ts | 23 +- .../src/server/api/endpoints/clips/create.ts | 27 +- .../src/server/api/endpoints/clips/delete.ts | 18 +- .../src/server/api/endpoints/clips/list.ts | 8 +- .../src/server/api/endpoints/clips/notes.ts | 36 +- .../src/server/api/endpoints/clips/show.ts | 18 +- .../src/server/api/endpoints/clips/update.ts | 33 +- .../backend/src/server/api/endpoints/drive.ts | 8 +- .../src/server/api/endpoints/drive/files.ts | 42 +- .../endpoints/drive/files/attached-notes.ts | 18 +- .../endpoints/drive/files/check-existence.ts | 17 +- .../api/endpoints/drive/files/create.ts | 43 +- .../api/endpoints/drive/files/delete.ts | 18 +- .../api/endpoints/drive/files/find-by-hash.ts | 17 +- .../server/api/endpoints/drive/files/find.ts | 24 +- .../server/api/endpoints/drive/files/show.ts | 23 +- .../api/endpoints/drive/files/update.ts | 51 +- .../endpoints/drive/files/upload-from-url.ts | 45 +- .../src/server/api/endpoints/drive/folders.ts | 37 +- .../api/endpoints/drive/folders/create.ts | 24 +- .../api/endpoints/drive/folders/delete.ts | 18 +- .../api/endpoints/drive/folders/find.ts | 24 +- .../api/endpoints/drive/folders/show.ts | 18 +- .../api/endpoints/drive/folders/update.ts | 28 +- .../src/server/api/endpoints/drive/stream.ts | 36 +- .../api/endpoints/email-address/available.ts | 17 +- .../src/server/api/endpoints/endpoint.ts | 13 +- .../src/server/api/endpoints/endpoints.ts | 11 +- .../api/endpoints/export-custom-emojis.ts | 9 +- .../api/endpoints/federation/followers.ts | 36 +- .../api/endpoints/federation/following.ts | 36 +- .../api/endpoints/federation/instances.ts | 68 +- .../api/endpoints/federation/show-instance.ts | 28 +- .../federation/update-remote-user.ts | 14 +- .../server/api/endpoints/federation/users.ts | 36 +- .../server/api/endpoints/following/create.ts | 18 +- .../server/api/endpoints/following/delete.ts | 18 +- .../api/endpoints/following/invalidate.ts | 18 +- .../endpoints/following/requests/accept.ts | 18 +- .../endpoints/following/requests/cancel.ts | 18 +- .../api/endpoints/following/requests/list.ts | 8 +- .../endpoints/following/requests/reject.ts | 18 +- .../server/api/endpoints/gallery/featured.ts | 8 +- .../server/api/endpoints/gallery/popular.ts | 8 +- .../src/server/api/endpoints/gallery/posts.ts | 31 +- .../api/endpoints/gallery/posts/create.ts | 36 +- .../api/endpoints/gallery/posts/delete.ts | 18 +- .../api/endpoints/gallery/posts/like.ts | 18 +- .../api/endpoints/gallery/posts/show.ts | 18 +- .../api/endpoints/gallery/posts/unlike.ts | 18 +- .../api/endpoints/gallery/posts/update.ts | 41 +- .../api/endpoints/get-online-users-count.ts | 9 +- .../src/server/api/endpoints/hashtags/list.ts | 56 +- .../server/api/endpoints/hashtags/search.ts | 31 +- .../src/server/api/endpoints/hashtags/show.ts | 17 +- .../server/api/endpoints/hashtags/trend.ts | 8 +- .../server/api/endpoints/hashtags/users.ts | 56 +- .../backend/src/server/api/endpoints/i.ts | 10 +- .../src/server/api/endpoints/i/2fa/done.ts | 13 +- .../server/api/endpoints/i/2fa/key-done.ts | 34 +- .../api/endpoints/i/2fa/password-less.ts | 13 +- .../api/endpoints/i/2fa/register-key.ts | 13 +- .../server/api/endpoints/i/2fa/register.ts | 13 +- .../server/api/endpoints/i/2fa/remove-key.ts | 17 +- .../server/api/endpoints/i/2fa/unregister.ts | 13 +- .../src/server/api/endpoints/i/apps.ts | 18 +- .../server/api/endpoints/i/authorized-apps.ts | 28 +- .../server/api/endpoints/i/change-password.ts | 18 +- .../server/api/endpoints/i/delete-account.ts | 13 +- .../server/api/endpoints/i/export-blocking.ts | 8 +- .../api/endpoints/i/export-following.ts | 20 +- .../src/server/api/endpoints/i/export-mute.ts | 8 +- .../server/api/endpoints/i/export-notes.ts | 8 +- .../api/endpoints/i/export-user-lists.ts | 8 +- .../src/server/api/endpoints/i/favorites.ts | 31 +- .../server/api/endpoints/i/gallery/likes.ts | 31 +- .../server/api/endpoints/i/gallery/posts.ts | 31 +- .../endpoints/i/get-word-muted-notes-count.ts | 11 +- .../server/api/endpoints/i/import-blocking.ts | 18 +- .../api/endpoints/i/import-following.ts | 18 +- .../server/api/endpoints/i/import-muting.ts | 18 +- .../api/endpoints/i/import-user-lists.ts | 18 +- .../server/api/endpoints/i/notifications.ts | 63 +- .../src/server/api/endpoints/i/page-likes.ts | 31 +- .../src/server/api/endpoints/i/pages.ts | 31 +- .../backend/src/server/api/endpoints/i/pin.ts | 18 +- .../i/read-all-messaging-messages.ts | 9 +- .../api/endpoints/i/read-all-unread-notes.ts | 9 +- .../api/endpoints/i/read-announcement.ts | 18 +- .../api/endpoints/i/regenerate-token.ts | 13 +- .../api/endpoints/i/registry/get-all.ts | 16 +- .../api/endpoints/i/registry/get-detail.ts | 25 +- .../server/api/endpoints/i/registry/get.ts | 25 +- .../endpoints/i/registry/keys-with-type.ts | 16 +- .../server/api/endpoints/i/registry/keys.ts | 16 +- .../server/api/endpoints/i/registry/remove.ts | 25 +- .../server/api/endpoints/i/registry/scopes.ts | 9 +- .../server/api/endpoints/i/registry/set.ts | 26 +- .../server/api/endpoints/i/revoke-token.ts | 14 +- .../server/api/endpoints/i/signin-history.ts | 27 +- .../src/server/api/endpoints/i/unpin.ts | 18 +- .../server/api/endpoints/i/update-email.ts | 22 +- .../src/server/api/endpoints/i/update.ts | 166 +-- .../api/endpoints/i/user-group-invites.ts | 31 +- .../server/api/endpoints/messaging/history.ts | 26 +- .../api/endpoints/messaging/messages.ts | 49 +- .../endpoints/messaging/messages/create.ts | 33 +- .../endpoints/messaging/messages/delete.ts | 18 +- .../api/endpoints/messaging/messages/read.ts | 18 +- .../backend/src/server/api/endpoints/meta.ts | 18 +- .../server/api/endpoints/miauth/gen-token.ts | 39 +- .../src/server/api/endpoints/mute/create.ts | 18 +- .../src/server/api/endpoints/mute/delete.ts | 18 +- .../src/server/api/endpoints/mute/list.ts | 31 +- .../src/server/api/endpoints/my/apps.ts | 26 +- .../backend/src/server/api/endpoints/notes.ts | 56 +- .../server/api/endpoints/notes/children.ts | 36 +- .../src/server/api/endpoints/notes/clips.ts | 18 +- .../api/endpoints/notes/conversation.ts | 32 +- .../src/server/api/endpoints/notes/create.ts | 123 +-- .../src/server/api/endpoints/notes/delete.ts | 18 +- .../api/endpoints/notes/favorites/create.ts | 18 +- .../api/endpoints/notes/favorites/delete.ts | 18 +- .../server/api/endpoints/notes/featured.ts | 24 +- .../api/endpoints/notes/global-timeline.ts | 46 +- .../api/endpoints/notes/hybrid-timeline.ts | 64 +- .../api/endpoints/notes/local-timeline.ts | 59 +- .../server/api/endpoints/notes/mentions.ts | 42 +- .../endpoints/notes/polls/recommendation.ts | 26 +- .../server/api/endpoints/notes/polls/vote.ts | 23 +- .../server/api/endpoints/notes/reactions.ts | 47 +- .../api/endpoints/notes/reactions/create.ts | 23 +- .../api/endpoints/notes/reactions/delete.ts | 18 +- .../src/server/api/endpoints/notes/renotes.ts | 36 +- .../src/server/api/endpoints/notes/replies.ts | 36 +- .../api/endpoints/notes/search-by-tag.ts | 68 +- .../src/server/api/endpoints/notes/search.ts | 57 +- .../src/server/api/endpoints/notes/show.ts | 18 +- .../src/server/api/endpoints/notes/state.ts | 18 +- .../endpoints/notes/thread-muting/create.ts | 18 +- .../endpoints/notes/thread-muting/delete.ts | 18 +- .../server/api/endpoints/notes/timeline.ts | 64 +- .../server/api/endpoints/notes/translate.ts | 22 +- .../server/api/endpoints/notes/unrenote.ts | 18 +- .../api/endpoints/notes/user-list-timeline.ts | 69 +- .../api/endpoints/notes/watching/create.ts | 18 +- .../api/endpoints/notes/watching/delete.ts | 18 +- .../api/endpoints/notifications/create.ts | 27 +- .../notifications/mark-all-as-read.ts | 8 +- .../api/endpoints/notifications/read.ts | 18 +- .../src/server/api/endpoints/page-push.ts | 28 +- .../src/server/api/endpoints/pages/create.ts | 70 +- .../src/server/api/endpoints/pages/delete.ts | 18 +- .../server/api/endpoints/pages/featured.ts | 8 +- .../src/server/api/endpoints/pages/like.ts | 18 +- .../src/server/api/endpoints/pages/show.ts | 28 +- .../src/server/api/endpoints/pages/unlike.ts | 18 +- .../src/server/api/endpoints/pages/update.ts | 72 +- .../backend/src/server/api/endpoints/ping.ts | 11 +- .../src/server/api/endpoints/pinned-users.ts | 11 +- .../src/server/api/endpoints/promo/read.ts | 18 +- .../api/endpoints/request-reset-password.ts | 22 +- .../src/server/api/endpoints/reset-db.ts | 12 +- .../server/api/endpoints/reset-password.ts | 22 +- .../src/server/api/endpoints/server-info.ts | 12 +- .../backend/src/server/api/endpoints/stats.ts | 11 +- .../src/server/api/endpoints/sw/register.ts | 27 +- .../src/server/api/endpoints/sw/unregister.ts | 13 +- .../backend/src/server/api/endpoints/test.ts | 22 + .../api/endpoints/username/available.ts | 17 +- .../backend/src/server/api/endpoints/users.ts | 60 +- .../src/server/api/endpoints/users/clips.ts | 32 +- .../server/api/endpoints/users/followers.ts | 46 +- .../server/api/endpoints/users/following.ts | 46 +- .../api/endpoints/users/gallery/posts.ts | 32 +- .../users/get-frequently-replied-users.ts | 26 +- .../api/endpoints/users/groups/create.ts | 17 +- .../api/endpoints/users/groups/delete.ts | 18 +- .../users/groups/invitations/accept.ts | 18 +- .../users/groups/invitations/reject.ts | 18 +- .../api/endpoints/users/groups/invite.ts | 23 +- .../api/endpoints/users/groups/joined.ts | 8 +- .../api/endpoints/users/groups/leave.ts | 18 +- .../api/endpoints/users/groups/owned.ts | 8 +- .../server/api/endpoints/users/groups/pull.ts | 23 +- .../server/api/endpoints/users/groups/show.ts | 18 +- .../api/endpoints/users/groups/transfer.ts | 23 +- .../api/endpoints/users/groups/update.ts | 23 +- .../api/endpoints/users/lists/create.ts | 17 +- .../api/endpoints/users/lists/delete.ts | 18 +- .../server/api/endpoints/users/lists/list.ts | 8 +- .../server/api/endpoints/users/lists/pull.ts | 23 +- .../server/api/endpoints/users/lists/push.ts | 23 +- .../server/api/endpoints/users/lists/show.ts | 18 +- .../api/endpoints/users/lists/update.ts | 23 +- .../src/server/api/endpoints/users/notes.ts | 77 +- .../src/server/api/endpoints/users/pages.ts | 32 +- .../server/api/endpoints/users/reactions.ts | 46 +- .../api/endpoints/users/recommendation.ts | 26 +- .../server/api/endpoints/users/relation.ts | 26 +- .../api/endpoints/users/report-abuse.ts | 23 +- .../users/search-by-username-and-host.ts | 44 +- .../src/server/api/endpoints/users/search.ts | 49 +- .../src/server/api/endpoints/users/show.ts | 35 +- .../src/server/api/endpoints/users/stats.ts | 18 +- .../src/server/api/openapi/gen-spec.ts | 61 +- .../backend/src/server/api/openapi/schemas.ts | 4 +- .../backend/src/server/api/private/signup.ts | 4 +- packages/backend/src/services/chart/core.ts | 32 + packages/backend/test/api.ts | 975 +----------------- packages/backend/test/endpoints.ts | 858 +++++++++++++++ packages/backend/yarn.lock | 10 + 320 files changed, 4395 insertions(+), 5939 deletions(-) create mode 100644 packages/backend/src/server/api/endpoints/test.ts create mode 100644 packages/backend/test/endpoints.ts diff --git a/packages/backend/package.json b/packages/backend/package.json index d143846f6f..b9433f7f35 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -70,6 +70,7 @@ "@typescript-eslint/eslint-plugin": "5.12.0", "@typescript-eslint/parser": "5.12.0", "abort-controller": "3.0.0", + "ajv": "8.10.0", "archiver": "5.3.0", "autobind-decorator": "2.4.0", "autwh": "0.1.0", diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index 2dae954af9..fbe5a1e421 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -65,16 +65,18 @@ export const refs = { // Packed = SchemaTypeDef; とすると展開されてマウスホバー時に型表示が使い物にならなくなる // ObjTypeを指定すると(なぜか)展開されずにPacked<'Hoge'>と表示される -type PackedDef; allOf?: ReadonlyArray }> = - r['allOf'] extends ReadonlyArray ? UnionToIntersection> : - r['oneOf'] extends ReadonlyArray ? UnionSchemaType : - r['properties'] extends Obj ? ObjType : +type PackedDef; allOf?: ReadonlyArray }> = + r['allOf'] extends ReadonlyArray ? UnionToIntersection> : + r['oneOf'] extends ReadonlyArray ? UnionSchemaType : + r['properties'] extends Obj ? ObjType : never; export type Packed = PackedDef; -type TypeStringef = 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any'; +type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any'; type StringDefToType = + T extends 'null' ? null : T extends 'boolean' ? boolean : + T extends 'integer' ? number : T extends 'number' ? number : T extends 'string' ? string | Date : T extends 'array' ? ReadonlyArray : @@ -83,17 +85,18 @@ type StringDefToType = // https://swagger.io/specification/?sbsearch=optional#schema-object type OfSchema = { - readonly anyOf?: ReadonlyArray; - readonly oneOf?: ReadonlyArray; - readonly allOf?: ReadonlyArray; + readonly anyOf?: ReadonlyArray; + readonly oneOf?: ReadonlyArray; + readonly allOf?: ReadonlyArray; } -export interface MinimumSchema extends OfSchema { +export interface Schema extends OfSchema { readonly type?: TypeStringef; readonly nullable?: boolean; readonly optional?: boolean; - readonly items?: MinimumSchema; + readonly items?: Schema; readonly properties?: Obj; + readonly required?: ReadonlyArray>; readonly description?: string; readonly example?: any; readonly format?: string; @@ -104,26 +107,33 @@ export interface MinimumSchema extends OfSchema { readonly minLength?: number; } -export interface Schema extends MinimumSchema { - readonly nullable: boolean; - readonly optional: boolean; -} - -type NonUndefinedPropertyNames = { - [K in keyof T]: T[K]['optional'] extends true ? never : K +type OptionalPropertyNames = { + [K in keyof T]: T[K]['optional'] extends true ? K : never }[keyof T]; -type UndefinedPropertyNames = { - [K in keyof T]: T[K]['optional'] extends true ? K : never +type NonOptionalPropertyNames = { + [K in keyof T]: T[K]['optional'] extends false ? K : never +}[keyof T]; + +type DefaultPropertyNames = { + [K in keyof T]: T[K]['default'] extends null ? K : + T[K]['default'] extends string ? K : + T[K]['default'] extends number ? K : + T[K]['default'] extends boolean ? K : + T[K]['default'] extends Record ? K : + never }[keyof T]; export interface Obj { [key: string]: Schema; } -export type ObjType = - { -readonly [P in UndefinedPropertyNames]?: SchemaType } & - { -readonly [P in NonUndefinedPropertyNames]: SchemaType }; +export type ObjType> = + { -readonly [P in keyof s]?: SchemaType } & + { -readonly [P in RequiredProps[number]]: SchemaType } & + { -readonly [P in OptionalPropertyNames]?: SchemaType } & + { -readonly [P in NonOptionalPropertyNames]: SchemaType } & + { -readonly [P in DefaultPropertyNames]: SchemaType }; -type NullOrUndefined

= +type NullOrUndefined

= p['nullable'] extends true ? p['optional'] extends true ? (T | null | undefined) @@ -137,10 +147,12 @@ type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( // https://github.com/misskey-dev/misskey/pull/8144#discussion_r785287552 // 単純にSchemaTypeDefで判定するだけではダメ -type UnionSchemaType = X extends any ? SchemaType : never; +type UnionSchemaType = X extends any ? SchemaType : never; type ArrayUnion = T extends any ? Array : never; -export type SchemaTypeDef

= +export type SchemaTypeDef

= + p['type'] extends 'null' ? null : + p['type'] extends 'integer' ? number : p['type'] extends 'number' ? number : p['type'] extends 'string' ? ( p['enum'] extends readonly string[] ? @@ -151,22 +163,22 @@ export type SchemaTypeDef

= p['type'] extends 'boolean' ? boolean : p['type'] extends 'object' ? ( p['ref'] extends keyof typeof refs ? Packed : - p['properties'] extends NonNullable ? ObjType : - p['anyOf'] extends ReadonlyArray ? UnionSchemaType & Partial>> : - p['allOf'] extends ReadonlyArray ? UnionToIntersection> : + p['properties'] extends NonNullable ? ObjType> : + p['anyOf'] extends ReadonlyArray ? UnionSchemaType & Partial>> : + p['allOf'] extends ReadonlyArray ? UnionToIntersection> : any ) : p['type'] extends 'array' ? ( p['items'] extends OfSchema ? ( - p['items']['anyOf'] extends ReadonlyArray ? UnionSchemaType>[] : - p['items']['oneOf'] extends ReadonlyArray ? ArrayUnion>> : - p['items']['allOf'] extends ReadonlyArray ? UnionToIntersection>>[] : + p['items']['anyOf'] extends ReadonlyArray ? UnionSchemaType>[] : + p['items']['oneOf'] extends ReadonlyArray ? ArrayUnion>> : + p['items']['allOf'] extends ReadonlyArray ? UnionToIntersection>>[] : never ) : - p['items'] extends NonNullable ? SchemaTypeDef[] : + p['items'] extends NonNullable ? SchemaTypeDef[] : any[] ) : - p['oneOf'] extends ReadonlyArray ? UnionSchemaType : + p['oneOf'] extends ReadonlyArray ? UnionSchemaType : any; -export type SchemaType

= NullOrUndefined>; +export type SchemaType

= NullOrUndefined>; diff --git a/packages/backend/src/models/repositories/drive-folder.ts b/packages/backend/src/models/repositories/drive-folder.ts index b2e6cee9b8..cc7e4ca55b 100644 --- a/packages/backend/src/models/repositories/drive-folder.ts +++ b/packages/backend/src/models/repositories/drive-folder.ts @@ -6,13 +6,6 @@ import { Packed } from '@/misc/schema'; @EntityRepository(DriveFolder) export class DriveFolderRepository extends Repository { - public validateFolderName(name: string): boolean { - return ( - (name.trim().length > 0) && - (name.length <= 200) - ); - } - public async pack( src: DriveFolder['id'] | DriveFolder, options?: { diff --git a/packages/backend/src/models/repositories/messaging-message.ts b/packages/backend/src/models/repositories/messaging-message.ts index 0a342430b9..d01d82c368 100644 --- a/packages/backend/src/models/repositories/messaging-message.ts +++ b/packages/backend/src/models/repositories/messaging-message.ts @@ -6,10 +6,6 @@ import { User } from '@/models/entities/user'; @EntityRepository(MessagingMessage) export class MessagingMessageRepository extends Repository { - public validateText(text: string): boolean { - return text.trim().length <= 1000 && text.trim() != ''; - } - public async pack( src: MessagingMessage['id'] | MessagingMessage, me?: { id: User['id'] } | null | undefined, diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 9a7fef4977..a7e44d9496 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -12,10 +12,6 @@ import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/popu @EntityRepository(Note) export class NoteRepository extends Repository { - public validateCw(x: string) { - return x.trim().length <= 100; - } - public async isVisibleForMe(note: Note, meId: User['id'] | null): Promise { // visibility が specified かつ自分が指定されていなかったら非表示 if (note.visibility === 'specified') { diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 33b2b32fee..aea94b3797 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -1,5 +1,5 @@ -import $ from 'cafy'; import { EntityRepository, Repository, In, Not } from 'typeorm'; +import * as Ajv from 'ajv'; import { User, ILocalUser, IRemoteUser } from '@/models/entities/user'; import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances } from '../index'; import config from '@/config/index'; @@ -17,8 +17,26 @@ type IsMeAndIsUserDetailed : Packed<'UserLite'>; +const ajv = new Ajv(); + @EntityRepository(User) export class UserRepository extends Repository { + public localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const; + public passwordSchema = { type: 'string', minLength: 1 } as const; + public nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; + public descriptionSchema = { type: 'string', minLength: 1, maxLength: 500 } as const; + public locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; + public birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const; + + //#region Validators + public validateLocalUsername = ajv.compile(this.localUsernameSchema); + public validatePassword = ajv.compile(this.passwordSchema); + public validateName = ajv.compile(this.nameSchema); + public validateDescription = ajv.compile(this.descriptionSchema); + public validateLocation = ajv.compile(this.locationSchema); + public validateBirthday = ajv.compile(this.birthdaySchema); + //#endregion + public async getRelation(me: User['id'], target: User['id']) { const [following1, following2, followReq1, followReq2, toBlocking, fromBlocked, mute] = await Promise.all([ Followings.findOne({ @@ -351,13 +369,4 @@ export class UserRepository extends Repository { public isRemoteUser(user: User | { host: User['host'] }): boolean { return !this.isLocalUser(user); } - - //#region Validators - public validateLocalUsername = $.str.match(/^\w{1,20}$/); - public validatePassword = $.str.min(1); - public validateName = $.str.min(1).max(50); - public validateDescription = $.str.min(1).max(500); - public validateLocation = $.str.min(1).max(50); - public validateBirthday = $.str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/); - //#endregion } diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 362bbb0f57..cd7b9615bc 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -5,7 +5,7 @@ import authenticate, { AuthenticationError } from './authenticate'; import call from './call'; import { ApiError } from './error'; -export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { +export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { const body = ctx.request.body; const reply = (x?: any, y?: ApiError) => { diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index 18143340ae..ea457d9556 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -2,7 +2,7 @@ import * as Koa from 'koa'; import { performance } from 'perf_hooks'; import { limiter } from './limiter'; import { User } from '@/models/entities/user'; -import endpoints from './endpoints'; +import endpoints, { IEndpoint } from './endpoints'; import { ApiError } from './error'; import { apiLogger } from './logger'; import { AccessToken } from '@/models/entities/access-token'; @@ -67,7 +67,7 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac if (ep.meta.requireCredential && ep.meta.limit && !user!.isAdmin && !user!.isModerator) { // Rate limit - await limiter(ep, user!).catch(e => { + await limiter(ep as IEndpoint & { meta: { limit: NonNullable } }, user!).catch(e => { throw new ApiError({ message: 'Rate limit exceeded. Please try again later.', code: 'RATE_LIMIT_EXCEEDED', @@ -78,10 +78,10 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac } // Cast non JSON input - if (ep.meta.requireFile && ep.meta.params) { - for (const k of Object.keys(ep.meta.params)) { - const param = ep.meta.params[k]; - if (['Boolean', 'Number'].includes(param.validator.name) && typeof data[k] === 'string') { + if (ep.meta.requireFile) { + for (const k of Object.keys(ep.params)) { + const param = ep.params.properties![k]; + if (['boolean', 'number', 'integer'].includes(param.type ?? '') && typeof data[k] === 'string') { try { data[k] = JSON.parse(data[k]); } catch (e) { @@ -91,8 +91,8 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac id: '0b5f1631-7c1a-41a6-b399-cce335f34d85', }, { param: k, - reason: `cannot cast to ${param.validator.name}`, - }) + reason: `cannot cast to ${param.type}`, + }); } } } diff --git a/packages/backend/src/server/api/common/signup.ts b/packages/backend/src/server/api/common/signup.ts index f8db7e374e..786c94cf59 100644 --- a/packages/backend/src/server/api/common/signup.ts +++ b/packages/backend/src/server/api/common/signup.ts @@ -21,13 +21,13 @@ export async function signup(opts: { let hash = passwordHash; // Validate username - if (!Users.validateLocalUsername.ok(username)) { + if (!Users.validateLocalUsername(username)) { throw new Error('INVALID_USERNAME'); } if (password != null && passwordHash == null) { // Validate password - if (!Users.validatePassword.ok(password)) { + if (!Users.validatePassword(password)) { throw new Error('INVALID_PASSWORD'); } diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index b6bb2da8ac..061ade17bf 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -1,12 +1,11 @@ import * as fs from 'fs'; +import * as Ajv from 'ajv'; import { ILocalUser } from '@/models/entities/user'; import { IEndpointMeta } from './endpoints'; import { ApiError } from './error'; -import { SchemaType } from '@/misc/schema'; +import { Schema, SchemaType } from '@/misc/schema'; import { AccessToken } from '@/models/entities/access-token'; -type NonOptional = T extends undefined ? never : T; - type SimpleUserInfo = { id: ILocalUser['id']; createdAt: ILocalUser['createdAt']; @@ -21,22 +20,24 @@ type SimpleUserInfo = { showTimelineReplies: ILocalUser['showTimelineReplies']; }; -type Params = { - [P in keyof T['params']]: NonNullable[P]['transform'] extends () => any - ? ReturnType[P]['transform']> - : NonNullable[P]['default'] extends null | number | string - ? NonOptional[P]['validator']['get']>[0]> - : ReturnType[P]['validator']['get']>[0]; -}; - export type Response = Record | void; -type executor = - (params: Params, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any, cleanup?: () => any) => +// TODO: paramsの型をT['params']のスキーマ定義から推論する +type executor = + (params: SchemaType, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any, cleanup?: () => any) => Promise>>; -export default function (meta: T, cb: executor) +const ajv = new Ajv({ + useDefaults: true, +}); + +ajv.addFormat('misskey:id', /^[a-z0-9]+$/); + +export default function (meta: T, paramDef: Ps, cb: executor) : (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => Promise { + + const validate = ajv.compile(paramDef); + return (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => { function cleanup() { fs.unlink(file.path, () => {}); @@ -48,42 +49,22 @@ export default function (meta: T, cb: executor) id: '4267801e-70d1-416a-b011-4ee502885d8b', })); - const [ps, pserr] = getParams(meta, params); - if (pserr) { + const valid = validate(params); + if (!valid) { if (file) cleanup(); - return Promise.reject(pserr); - } - return cb(ps, user, token, file, cleanup); - }; -} - -function getParams(defs: T, params: any): [Params, ApiError | null] { - if (defs.params == null) return [params, null]; - - const x: any = {}; - let err: ApiError | null = null; - Object.entries(defs.params).some(([k, def]) => { - const [v, e] = def.validator.get(params[k]); - if (e) { - err = new ApiError({ + const errors = validate.errors!; + const err = new ApiError({ message: 'Invalid param.', code: 'INVALID_PARAM', id: '3d81ceae-475f-4600-b2a8-2bc116157532', }, { - param: k, - reason: e.message, + param: errors[0].schemaPath, + reason: errors[0].message, }); - return true; - } else { - if (v === undefined && Object.prototype.hasOwnProperty.call(def, 'default')) { - x[k] = def.default; - } else { - x[k] = v; - } - if (def.transform) x[k] = def.transform(x[k]); - return false; + return Promise.reject(err); } - }); - return [x, err]; + + return cb(params, user, token, file, cleanup); + }; } diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index bb4e972b8e..32dbdeb315 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -1,6 +1,4 @@ -import { fileURLToPath } from 'url'; import { dirname } from 'path'; -import { Context } from 'cafy'; import * as path from 'path'; import * as glob from 'glob'; import { Schema } from '@/misc/schema'; @@ -9,23 +7,11 @@ import { Schema } from '@/misc/schema'; const _filename = __filename; const _dirname = dirname(_filename); -export type Param = { - validator: Context; - transform?: any; - default?: any; - deprecated?: boolean; - ref?: string; -}; - export interface IEndpointMeta { readonly stability?: 'deprecated' | 'experimental' | 'stable'; readonly tags?: ReadonlyArray; - readonly params?: { - readonly [key: string]: Param; - }; - readonly errors?: { readonly [key: string]: { readonly message: string; @@ -99,12 +85,15 @@ export interface IEndpointMeta { * パーミッションの実現に利用されます。 */ readonly kind?: string; + + readonly description?: string; } export interface IEndpoint { name: string; exec: any; meta: IEndpointMeta; + params: Schema; } const files = glob.sync('**/*.js', { @@ -118,6 +107,7 @@ const endpoints: IEndpoint[] = files.map(f => { name: f.replace('.js', ''), exec: ep.default, meta: ep.meta || {}, + params: ep.paramDef, }; }); diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index ed7b146d03..97b7bc7dba 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { AbuseUserReports } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -10,49 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - state: { - validator: $.optional.nullable.str, - default: null, - }, - - reporterOrigin: { - validator: $.optional.str.or([ - 'combined', - 'local', - 'remote', - ]), - default: 'combined', - }, - - targetUserOrigin: { - validator: $.optional.str.or([ - 'combined', - 'local', - 'remote', - ]), - default: 'combined', - }, - - forwarded: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -115,8 +70,22 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + state: { type: 'string', nullable: true, default: null }, + reporterOrigin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "combined" }, + targetUserOrigin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "combined" }, + forwarded: { type: 'boolean', default: false }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(AbuseUserReports.createQueryBuilder('report'), ps.sinceId, ps.untilId); switch (ps.state) { @@ -134,7 +103,7 @@ export default define(meta, async (ps) => { case 'remote': query.andWhere('report.targetUserHost IS NOT NULL'); break; } - const reports = await query.take(ps.limit!).getMany(); + const reports = await query.take(ps.limit).getMany(); return await AbuseUserReports.packMany(reports); }); diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index 20f1232959..50b2eb0427 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -5,16 +5,6 @@ import { signup } from '../../../common/signup'; export const meta = { tags: ['admin'], - params: { - username: { - validator: Users.validateLocalUsername, - }, - - password: { - validator: Users.validatePassword, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -28,8 +18,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + username: Users.localUsernameSchema, + password: Users.passwordSchema, + }, + required: ['username', 'password'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, _me) => { +export default define(meta, paramDef, async (ps, _me) => { const me = _me ? await Users.findOneOrFail(_me.id) : null; const noUsers = (await Users.count({ host: null, diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index 1701c1e3a7..99d61b2f32 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -1,26 +1,26 @@ -import $ from 'cafy'; import define from '../../../define'; import { Users } from '@/models/index'; import { doPostSuspend } from '@/services/suspend-user'; import { publishUserEvent } from '@/services/stream'; import { createDeleteAccountJob } from '@/queue'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['admin'], requireCredential: true, requireModerator: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index 00ad2012fe..9883efefe7 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { Ads } from '@/models/index'; import { genId } from '@/misc/gen-id'; @@ -8,34 +7,24 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - url: { - validator: $.str.min(1), - }, - memo: { - validator: $.str, - }, - place: { - validator: $.str, - }, - priority: { - validator: $.str, - }, - ratio: { - validator: $.num.int().min(0), - }, - expiresAt: { - validator: $.num.int(), - }, - imageUrl: { - validator: $.str.min(1), - }, +const paramDef = { + type: 'object', + properties: { + url: { type: 'string', minLength: 1 }, + memo: { type: 'string' }, + place: { type: 'string' }, + priority: { type: 'string' }, + ratio: { type: 'integer' }, + expiresAt: { type: 'integer' }, + imageUrl: { type: 'string', minLength: 1 }, }, + required: ['url', 'memo', 'place', 'priority', 'ratio', 'expiresAt', 'imageUrl'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { await Ads.insert({ id: genId(), createdAt: new Date(), diff --git a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts index c0124e2484..dfd873f016 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Ads } from '@/models/index'; import { ApiError } from '../../../error'; @@ -10,12 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - id: { - validator: $.type(ID), - }, - }, - errors: { noSuchAd: { message: 'No such ad.', @@ -25,8 +17,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + }, + required: ['id'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const ad = await Ads.findOne(ps.id); if (ad == null) throw new ApiError(meta.errors.noSuchAd); diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 7a83637f3b..83fdedef77 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { Ads } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; @@ -9,29 +7,24 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(Ads.createQueryBuilder('ad'), ps.sinceId, ps.untilId) .andWhere('ad.expiresAt > :now', { now: new Date() }); - const ads = await query.take(ps.limit!).getMany(); + const ads = await query.take(ps.limit).getMany(); return ads; }); diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index c2b09ab9cf..bf4bce5150 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Ads } from '@/models/index'; import { ApiError } from '../../../error'; @@ -10,33 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - id: { - validator: $.type(ID), - }, - memo: { - validator: $.str, - }, - url: { - validator: $.str.min(1), - }, - imageUrl: { - validator: $.str.min(1), - }, - place: { - validator: $.str, - }, - priority: { - validator: $.str, - }, - ratio: { - validator: $.num.int().min(0), - }, - expiresAt: { - validator: $.num.int(), - }, - }, - errors: { noSuchAd: { message: 'No such ad.', @@ -46,8 +17,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + memo: { type: 'string' }, + url: { type: 'string', minLength: 1 }, + imageUrl: { type: 'string', minLength: 1 }, + place: { type: 'string' }, + priority: { type: 'string' }, + ratio: { type: 'integer' }, + expiresAt: { type: 'integer' }, + }, + required: ['id', 'memo', 'url', 'imageUrl', 'place', 'priority', 'ratio', 'expiresAt'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const ad = await Ads.findOne(ps.id); if (ad == null) throw new ApiError(meta.errors.noSuchAd); diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 24c4caa37d..8d2bda9781 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { Announcements } from '@/models/index'; import { genId } from '@/misc/gen-id'; @@ -9,18 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - title: { - validator: $.str.min(1), - }, - text: { - validator: $.str.min(1), - }, - imageUrl: { - validator: $.nullable.str.min(1), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -57,8 +44,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + title: { type: 'string', minLength: 1 }, + text: { type: 'string', minLength: 1 }, + imageUrl: { type: 'string', nullable: true, minLength: 1 }, + }, + required: ['title', 'text', 'imageUrl'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const announcement = await Announcements.insert({ id: genId(), createdAt: new Date(), diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index 5548f99006..f0141ca595 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Announcements } from '@/models/index'; import { ApiError } from '../../../error'; @@ -10,12 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - id: { - validator: $.type(ID), - }, - }, - errors: { noSuchAnnouncement: { message: 'No such announcement.', @@ -25,8 +17,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + }, + required: ['id'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const announcement = await Announcements.findOne(ps.id); if (announcement == null) throw new ApiError(meta.errors.noSuchAnnouncement); diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index e5cc53ccdd..993f9877d2 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { Announcements, AnnouncementReads } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; @@ -10,21 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -69,11 +52,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(Announcements.createQueryBuilder('announcement'), ps.sinceId, ps.untilId); - const announcements = await query.take(ps.limit!).getMany(); + const announcements = await query.take(ps.limit).getMany(); for (const announcement of announcements) { (announcement as any).reads = await AnnouncementReads.count({ diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index f66293bb18..f905616b3e 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Announcements } from '@/models/index'; import { ApiError } from '../../../error'; @@ -10,21 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - id: { - validator: $.type(ID), - }, - title: { - validator: $.str.min(1), - }, - text: { - validator: $.str.min(1), - }, - imageUrl: { - validator: $.nullable.str.min(1), - }, - }, - errors: { noSuchAnnouncement: { message: 'No such announcement.', @@ -34,8 +17,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + title: { type: 'string', minLength: 1 }, + text: { type: 'string', minLength: 1 }, + imageUrl: { type: 'string', nullable: true, minLength: 1 }, + }, + required: ['id', 'title', 'text', 'imageUrl'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const announcement = await Announcements.findOne(ps.id); if (announcement == null) throw new ApiError(meta.errors.noSuchAnnouncement); diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 249e63a0f8..41e2c23488 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -1,24 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; import { deleteFile } from '@/services/drive/delete-file'; import { DriveFiles } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['admin'], requireCredential: true, requireModerator: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const files = await DriveFiles.find({ userId: ps.userId, }); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts index acabbfef5c..9b127eb5d3 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -8,7 +8,13 @@ export const meta = { requireModerator: true, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { createCleanRemoteFilesJob(); }); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts index 452e7069a8..1c63af6a17 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts @@ -10,8 +10,14 @@ export const meta = { requireModerator: true, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const files = await DriveFiles.find({ userId: IsNull(), }); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index 264f549867..56a8c1c642 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -1,8 +1,6 @@ -import $ from 'cafy'; import define from '../../../define'; import { DriveFiles } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['admin'], @@ -10,39 +8,6 @@ export const meta = { requireCredential: false, requireModerator: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - type: { - validator: $.optional.nullable.str.match(/^[a-zA-Z0-9\/\-*]+$/), - }, - - origin: { - validator: $.optional.str.or([ - 'combined', - 'local', - 'remote', - ]), - default: 'local', - }, - - hostname: { - validator: $.optional.nullable.str, - default: null, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -54,8 +19,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + type: { type: 'string', nullable: true, pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) }, + origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "local" }, + hostname: { type: 'string', nullable: true, default: null }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(DriveFiles.createQueryBuilder('file'), ps.sinceId, ps.untilId); if (ps.origin === 'local') { @@ -76,7 +54,7 @@ export default define(meta, async (ps, me) => { } } - const files = await query.take(ps.limit!).getMany(); + const files = await query.take(ps.limit).getMany(); return await DriveFiles.packMany(files, { detail: true, withUser: true, self: true }); }); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts index 5d9a1f2703..bb1ed1072a 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFiles } from '@/models/index'; @@ -10,16 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - fileId: { - validator: $.optional.type(ID), - }, - - url: { - validator: $.optional.str, - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -161,8 +149,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + url: { type: 'string' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const file = ps.fileId ? await DriveFiles.findOne(ps.fileId) : await DriveFiles.findOne({ where: [{ url: ps.url, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts index f0fd73c276..9aeb04d247 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection, In } from 'typeorm'; import { ApiError } from '../../../error'; @@ -10,20 +8,23 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - ids: { - validator: $.arr($.type(ID)), - }, - - aliases: { - validator: $.arr($.str), - }, +const paramDef = { + type: 'object', + properties: { + ids: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, + aliases: { type: 'array', items: { + type: 'string', + } }, }, + required: ['ids', 'aliases'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const emojis = await Emojis.find({ id: In(ps.ids), }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts index 1dfeae262f..718ecae4b1 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts @@ -1,11 +1,9 @@ -import $ from 'cafy'; import define from '../../../define'; import { Emojis, DriveFiles } from '@/models/index'; import { genId } from '@/misc/gen-id'; import { getConnection } from 'typeorm'; import { insertModerationLog } from '@/services/insert-moderation-log'; import { ApiError } from '../../../error'; -import { ID } from '@/misc/cafy-id'; import rndstr from 'rndstr'; import { publishBroadcastStream } from '@/services/stream'; @@ -15,12 +13,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - fileId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -30,8 +22,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) throw new ApiError(meta.errors.noSuchFile); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index 17cbf208aa..fc20ff0a84 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -1,11 +1,9 @@ -import $ from 'cafy'; import define from '../../../define'; import { Emojis } from '@/models/index'; import { genId } from '@/misc/gen-id'; import { getConnection } from 'typeorm'; import { ApiError } from '../../../error'; import { DriveFile } from '@/models/entities/drive-file'; -import { ID } from '@/misc/cafy-id'; import { uploadFromUrl } from '@/services/drive/upload-from-url'; import { publishBroadcastStream } from '@/services/stream'; @@ -15,12 +13,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - emojiId: { - validator: $.type(ID), - }, - }, - errors: { noSuchEmoji: { message: 'No such emoji.', @@ -42,8 +34,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + emojiId: { type: 'string', format: 'misskey:id' }, + }, + required: ['emojiId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const emoji = await Emojis.findOne(ps.emojiId); if (emoji == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts index 797a5de672..792e72ff97 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection, In } from 'typeorm'; import { insertModerationLog } from '@/services/insert-moderation-log'; @@ -11,16 +9,20 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - ids: { - validator: $.arr($.type(ID)), - }, +const paramDef = { + type: 'object', + properties: { + ids: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, }, + required: ['ids'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const emojis = await Emojis.find({ id: In(ps.ids), }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts index 1580439024..15d44b3a0e 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection } from 'typeorm'; import { insertModerationLog } from '@/services/insert-moderation-log'; @@ -12,12 +10,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - id: { - validator: $.type(ID), - }, - }, - errors: { noSuchEmoji: { message: 'No such emoji.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + }, + required: ['id'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const emoji = await Emojis.findOne(ps.id); if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts index 8856a38f24..5ee6dd4c8d 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts @@ -1,21 +1,22 @@ -import $ from 'cafy'; import define from '../../../define'; import { createImportCustomEmojisJob } from '@/queue/index'; import ms from 'ms'; -import { ID } from '@/misc/cafy-id'; export const meta = { secure: true, requireCredential: true, requireModerator: true, - params: { - fileId: { - validator: $.type(ID), - }, +} as const; + +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, }, + required: ['fileId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createImportCustomEmojisJob(user, ps.fileId); }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index 6e502547f5..865715968a 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -1,9 +1,7 @@ -import $ from 'cafy'; import define from '../../../define'; import { Emojis } from '@/models/index'; import { toPuny } from '@/misc/convert-host'; import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['admin'], @@ -11,31 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - query: { - validator: $.optional.nullable.str, - default: null, - }, - - host: { - validator: $.optional.nullable.str, - default: null, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -77,8 +50,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + query: { type: 'string', nullable: true, default: null }, + host: { type: 'string', nullable: true, default: null }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const q = makePaginationQuery(Emojis.createQueryBuilder('emoji'), ps.sinceId, ps.untilId); if (ps.host == null) { @@ -93,7 +78,7 @@ export default define(meta, async (ps) => { const emojis = await q .orderBy('emoji.id', 'DESC') - .take(ps.limit!) + .take(ps.limit) .getMany(); return Emojis.packMany(emojis); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 76ef190f94..0e23132d99 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -1,8 +1,6 @@ -import $ from 'cafy'; import define from '../../../define'; import { Emojis } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; import { Emoji } from '@/models/entities/emoji'; export const meta = { @@ -11,26 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - query: { - validator: $.optional.nullable.str, - default: null, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -72,8 +50,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + query: { type: 'string', nullable: true, default: null }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const q = makePaginationQuery(Emojis.createQueryBuilder('emoji'), ps.sinceId, ps.untilId) .andWhere(`emoji.host IS NULL`); @@ -81,7 +70,7 @@ export default define(meta, async (ps) => { if (ps.query) { //q.andWhere('emoji.name ILIKE :q', { q: `%${ps.query}%` }); - //const emojis = await q.take(ps.limit!).getMany(); + //const emojis = await q.take(ps.limit).getMany(); emojis = await q.getMany(); @@ -90,9 +79,9 @@ export default define(meta, async (ps) => { emoji.aliases.some(a => a.includes(ps.query!)) || emoji.category?.includes(ps.query!)); - emojis.splice(ps.limit! + 1); + emojis.splice(ps.limit + 1); } else { - emojis = await q.take(ps.limit!).getMany(); + emojis = await q.take(ps.limit).getMany(); } return Emojis.packMany(emojis); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts index c49f84b7fb..e6ccbf684d 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection, In } from 'typeorm'; import { ApiError } from '../../../error'; @@ -10,20 +8,23 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - ids: { - validator: $.arr($.type(ID)), - }, - - aliases: { - validator: $.arr($.str), - }, +const paramDef = { + type: 'object', + properties: { + ids: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, + aliases: { type: 'array', items: { + type: 'string', + } }, }, + required: ['ids', 'aliases'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const emojis = await Emojis.find({ id: In(ps.ids), }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts index 06197820f0..30a1c28af6 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection, In } from 'typeorm'; import { ApiError } from '../../../error'; @@ -10,20 +8,23 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - ids: { - validator: $.arr($.type(ID)), - }, - - aliases: { - validator: $.arr($.str), - }, +const paramDef = { + type: 'object', + properties: { + ids: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, + aliases: { type: 'array', items: { + type: 'string', + } }, }, + required: ['ids', 'aliases'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { await Emojis.update({ id: In(ps.ids), }, { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts index f0645f111b..9679e4a369 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection, In } from 'typeorm'; import { ApiError } from '../../../error'; @@ -10,20 +8,21 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - ids: { - validator: $.arr($.type(ID)), - }, - - category: { - validator: $.optional.nullable.str, - }, +const paramDef = { + type: 'object', + properties: { + ids: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, + category: { type: 'string', nullable: true }, }, + required: ['ids'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { await Emojis.update({ id: In(ps.ids), }, { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts index 54a2cf9517..da5a5f005e 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; import { Emojis } from '@/models/index'; import { getConnection } from 'typeorm'; import { ApiError } from '../../../error'; @@ -11,24 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - id: { - validator: $.type(ID), - }, - - name: { - validator: $.str, - }, - - category: { - validator: $.optional.nullable.str, - }, - - aliases: { - validator: $.arr($.str), - }, - }, - errors: { noSuchEmoji: { message: 'No such emoji.', @@ -38,8 +18,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + name: { type: 'string' }, + category: { type: 'string', nullable: true }, + aliases: { type: 'array', items: { + type: 'string', + } }, + }, + required: ['id', 'name', 'aliases'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const emoji = await Emojis.findOne(ps.id); if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji); diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index db023c6f0b..e98de40ff8 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { deleteFile } from '@/services/drive/delete-file'; import { DriveFiles } from '@/models/index'; @@ -8,16 +7,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - host: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, }, + required: ['host'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const files = await DriveFiles.find({ userHost: ps.host, }); diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index b68252ef2e..d6e3a15c61 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { Instances } from '@/models/index'; import { toPuny } from '@/misc/convert-host'; @@ -9,16 +8,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - host: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, }, + required: ['host'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const instance = await Instances.findOne({ host: toPuny(ps.host) }); if (instance == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 4de8ad1336..7c2d6dc391 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import deleteFollowing from '@/services/following/delete'; import { Followings, Users } from '@/models/index'; @@ -8,16 +7,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - host: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, }, + required: ['host'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const followings = await Followings.find({ followerHost: ps.host, }); diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts index 6ac2f1f467..04cad3b9f7 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { Instances } from '@/models/index'; import { toPuny } from '@/misc/convert-host'; @@ -8,20 +7,19 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - host: { - validator: $.str, - }, - - isSuspended: { - validator: $.bool, - }, +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, + isSuspended: { type: 'boolean' }, }, + required: ['host', 'isSuspended'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const instance = await Instances.findOne({ host: toPuny(ps.host) }); if (instance == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts index 9a2bccec77..9379379aef 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts @@ -6,13 +6,16 @@ export const meta = { requireModerator: true, tags: ['admin'], +} as const; - params: { - }, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const stats = await getConnection().query(`SELECT * FROM pg_indexes;`) .then(recs => { diff --git a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts index 1c5f250676..28856cd41c 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts @@ -7,9 +7,6 @@ export const meta = { tags: ['admin'], - params: { - }, - res: { type: 'object', optional: false, nullable: false, @@ -22,8 +19,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const sizes = await getConnection().query(` SELECT relname AS "table", reltuples as "count", pg_total_relation_size(C.oid) AS "size" diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index 3428709c04..a21777937c 100644 --- a/packages/backend/src/server/api/endpoints/admin/invite.ts +++ b/packages/backend/src/server/api/endpoints/admin/invite.ts @@ -9,8 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: {}, - res: { type: 'object', optional: false, nullable: false, @@ -26,8 +24,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const code = rndstr({ length: 8, chars: '2-9A-HJ-NP-Z', // [0-9A-Z] w/o [01IO] (32 patterns) diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts index 0308cf2761..6b7e549c35 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { Users } from '@/models/index'; @@ -8,16 +6,18 @@ export const meta = { requireCredential: true, requireAdmin: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts index bdb976e9ec..585d6fbfa7 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { Users } from '@/models/index'; @@ -8,16 +6,18 @@ export const meta = { requireCredential: true, requireAdmin: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/promo/create.ts b/packages/backend/src/server/api/endpoints/admin/promo/create.ts index f2735ac9f8..2ba35306db 100644 --- a/packages/backend/src/server/api/endpoints/admin/promo/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/promo/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getNote } from '../../../common/getters'; @@ -11,16 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - noteId: { - validator: $.type(ID), - }, - - expiresAt: { - validator: $.num.int(), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -36,8 +24,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + expiresAt: { type: 'integer' }, + }, + required: ['noteId', 'expiresAt'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts index 3c8e7a27a2..27bb9cc858 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts @@ -7,12 +7,16 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: {}, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { destroy(); insertModerationLog(me, 'clearQueue'); diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index 4760e2c310..38eac5a135 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -8,9 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - }, - res: { type: 'array', optional: false, nullable: false, @@ -35,8 +32,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const jobs = await deliverQueue.getJobs(['delayed']); const res = [] as [string, number][]; diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index a95aabc506..9669cfd3b8 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -8,9 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - }, - res: { type: 'array', optional: false, nullable: false, @@ -35,8 +32,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const jobs = await inboxQueue.getJobs(['delayed']); const res = [] as [string, number][]; diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index dab0be5dbc..3f7e6be5fb 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -7,8 +7,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: {}, - res: { type: 'object', optional: false, nullable: false, @@ -33,8 +31,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const deliverJobCounts = await deliverQueue.getJobCounts(); const inboxJobCounts = await inboxQueue.getJobCounts(); const dbJobCounts = await dbQueue.getJobCounts(); diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index 65890a00f7..ecf77b87df 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -1,5 +1,4 @@ import { URL } from 'url'; -import $ from 'cafy'; import define from '../../../define'; import { addRelay } from '@/services/relay'; import { ApiError } from '../../../error'; @@ -10,12 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - inbox: { - validator: $.str, - }, - }, - errors: { invalidUrl: { message: 'Invalid URL', @@ -52,8 +45,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + inbox: { type: 'string' }, + }, + required: ['inbox'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { try { if (new URL(ps.inbox).protocol !== 'https:') throw 'https only'; } catch { diff --git a/packages/backend/src/server/api/endpoints/admin/relays/list.ts b/packages/backend/src/server/api/endpoints/admin/relays/list.ts index bdddf13374..6cdaa418a7 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/list.ts @@ -7,9 +7,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - }, - res: { type: 'array', optional: false, nullable: false, @@ -42,7 +39,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { return await listRelay(); }); diff --git a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts index 4b04e620c1..d452c2e6a5 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { removeRelay } from '@/services/relay'; @@ -7,15 +6,17 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - inbox: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + inbox: { type: 'string' }, }, + required: ['inbox'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { return await removeRelay(ps.inbox); }); diff --git a/packages/backend/src/server/api/endpoints/admin/reset-password.ts b/packages/backend/src/server/api/endpoints/admin/reset-password.ts index b6cf1ee2d0..87424782c5 100644 --- a/packages/backend/src/server/api/endpoints/admin/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/admin/reset-password.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import * as bcrypt from 'bcryptjs'; import rndstr from 'rndstr'; @@ -11,12 +9,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - userId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -31,8 +23,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index a47b69ec1a..4139f77614 100644 --- a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { AbuseUserReports, Users } from '@/models/index'; import { getInstanceActor } from '@/services/instance-actor'; @@ -12,22 +10,19 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - reportId: { - validator: $.type(ID), - }, - - forward: { - validator: $.optional.boolean, - required: false, - default: false, - }, +const paramDef = { + type: 'object', + properties: { + reportId: { type: 'string', format: 'misskey:id' }, + forward: { type: 'boolean', default: false }, }, + required: ['reportId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const report = await AbuseUserReports.findOne(ps.reportId); if (report == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/send-email.ts b/packages/backend/src/server/api/endpoints/admin/send-email.ts index c2972c35fa..2ebe7e0bc9 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-email.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-email.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { sendEmail } from '@/services/send-email'; @@ -7,21 +6,19 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - to: { - validator: $.str, - }, - subject: { - validator: $.str, - }, - text: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + to: { type: 'string' }, + subject: { type: 'string' }, + text: { type: 'string' }, }, + required: ['to', 'subject', 'text'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { await sendEmail(ps.to, ps.subject, ps.text, ps.text); }); diff --git a/packages/backend/src/server/api/endpoints/admin/server-info.ts b/packages/backend/src/server/api/endpoints/admin/server-info.ts index cd282e364c..44e069d603 100644 --- a/packages/backend/src/server/api/endpoints/admin/server-info.ts +++ b/packages/backend/src/server/api/endpoints/admin/server-info.ts @@ -10,9 +10,6 @@ export const meta = { tags: ['admin', 'meta'], - params: { - }, - res: { type: 'object', optional: false, nullable: false, @@ -90,8 +87,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const memStats = await si.mem(); const fsStats = await si.fsSize(); const netInterface = await si.networkInterfaceDefault(); diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index 84e2b84bb5..c08acaeca9 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ModerationLogs } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -10,21 +8,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -65,11 +48,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(ModerationLogs.createQueryBuilder('report'), ps.sinceId, ps.untilId); - const reports = await query.take(ps.limit!).getMany(); + const reports = await query.take(ps.limit).getMany(); return await ModerationLogs.packMany(reports); }); diff --git a/packages/backend/src/server/api/endpoints/admin/show-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts index 0d0cc9087a..b883aff494 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Users } from '@/models/index'; @@ -9,20 +7,22 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - userId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', nullable: false, optional: false, }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index d3dde99b72..c373021d0e 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Users } from '@/models/index'; @@ -8,61 +7,6 @@ export const meta = { requireCredential: true, requireModerator: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - - sort: { - validator: $.optional.str.or([ - '+follower', - '-follower', - '+createdAt', - '-createdAt', - '+updatedAt', - '-updatedAt', - ]), - }, - - state: { - validator: $.optional.str.or([ - 'all', - 'available', - 'admin', - 'moderator', - 'adminOrModerator', - 'silenced', - 'suspended', - ]), - default: 'all', - }, - - origin: { - validator: $.optional.str.or([ - 'combined', - 'local', - 'remote', - ]), - default: 'local', - }, - - username: { - validator: $.optional.str, - default: null, - }, - - hostname: { - validator: $.optional.str, - default: null, - }, - }, - res: { type: 'array', nullable: false, optional: false, @@ -74,8 +18,22 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] }, + state: { type: 'string', enum: ['all', 'available', 'admin', 'moderator', 'adminOrModerator', 'silenced', 'suspended'], default: "all" }, + origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "local" }, + username: { type: 'string', default: null }, + hostname: { type: 'string', default: null }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Users.createQueryBuilder('user'); switch (ps.state) { @@ -111,7 +69,7 @@ export default define(meta, async (ps, me) => { default: query.orderBy('user.id', 'ASC'); break; } - query.take(ps.limit!); + query.take(ps.limit); query.skip(ps.offset); const users = await query.getMany(); diff --git a/packages/backend/src/server/api/endpoints/admin/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index 872bd2a6ac..df547184ad 100644 --- a/packages/backend/src/server/api/endpoints/admin/silence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/silence-user.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Users } from '@/models/index'; import { insertModerationLog } from '@/services/insert-moderation-log'; @@ -9,16 +7,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 2bb1875fc0..31867a4055 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import deleteFollowing from '@/services/following/delete'; import { Users, Followings, Notifications } from '@/models/index'; @@ -13,16 +11,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts index a4c6ff2ade..42c7e776a8 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Users } from '@/models/index'; import { insertModerationLog } from '@/services/insert-moderation-log'; @@ -9,16 +7,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts index 5ab56d51c7..011f485277 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Users } from '@/models/index'; import { insertModerationLog } from '@/services/insert-moderation-log'; @@ -10,16 +8,18 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId as string); if (user == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 1764d230a3..b845eb4d5b 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -1,310 +1,107 @@ -import $ from 'cafy'; import define from '../../define'; import { getConnection } from 'typeorm'; import { Meta } from '@/models/entities/meta'; import { insertModerationLog } from '@/services/insert-moderation-log'; import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['admin'], requireCredential: true, requireAdmin: true, - - params: { - disableRegistration: { - validator: $.optional.nullable.bool, - }, - - disableLocalTimeline: { - validator: $.optional.nullable.bool, - }, - - disableGlobalTimeline: { - validator: $.optional.nullable.bool, - }, - - useStarForReactionFallback: { - validator: $.optional.nullable.bool, - }, - - pinnedUsers: { - validator: $.optional.nullable.arr($.str), - }, - - hiddenTags: { - validator: $.optional.nullable.arr($.str), - }, - - blockedHosts: { - validator: $.optional.nullable.arr($.str), - }, - - themeColor: { - validator: $.optional.nullable.str, - }, - - mascotImageUrl: { - validator: $.optional.nullable.str, - }, - - bannerUrl: { - validator: $.optional.nullable.str, - }, - - errorImageUrl: { - validator: $.optional.nullable.str, - }, - - iconUrl: { - validator: $.optional.nullable.str, - }, - - backgroundImageUrl: { - validator: $.optional.nullable.str, - }, - - logoImageUrl: { - validator: $.optional.nullable.str, - }, - - name: { - validator: $.optional.nullable.str, - }, - - description: { - validator: $.optional.nullable.str, - }, - - maxNoteTextLength: { - validator: $.optional.num.min(0).max(DB_MAX_NOTE_TEXT_LENGTH), - }, - - localDriveCapacityMb: { - validator: $.optional.num.min(0), - }, - - remoteDriveCapacityMb: { - validator: $.optional.num.min(0), - }, - - cacheRemoteFiles: { - validator: $.optional.bool, - }, - - proxyRemoteFiles: { - validator: $.optional.bool, - }, - - emailRequiredForSignup: { - validator: $.optional.bool, - }, - - enableHcaptcha: { - validator: $.optional.bool, - }, - - hcaptchaSiteKey: { - validator: $.optional.nullable.str, - }, - - hcaptchaSecretKey: { - validator: $.optional.nullable.str, - }, - - enableRecaptcha: { - validator: $.optional.bool, - }, - - recaptchaSiteKey: { - validator: $.optional.nullable.str, - }, - - recaptchaSecretKey: { - validator: $.optional.nullable.str, - }, - - proxyAccountId: { - validator: $.optional.nullable.type(ID), - }, - - maintainerName: { - validator: $.optional.nullable.str, - }, - - maintainerEmail: { - validator: $.optional.nullable.str, - }, - - pinnedPages: { - validator: $.optional.arr($.str), - }, - - pinnedClipId: { - validator: $.optional.nullable.type(ID), - }, - - langs: { - validator: $.optional.arr($.str), - }, - - summalyProxy: { - validator: $.optional.nullable.str, - }, - - deeplAuthKey: { - validator: $.optional.nullable.str, - }, - - deeplIsPro: { - validator: $.optional.bool, - }, - - enableTwitterIntegration: { - validator: $.optional.bool, - }, - - twitterConsumerKey: { - validator: $.optional.nullable.str, - }, - - twitterConsumerSecret: { - validator: $.optional.nullable.str, - }, - - enableGithubIntegration: { - validator: $.optional.bool, - }, - - githubClientId: { - validator: $.optional.nullable.str, - }, - - githubClientSecret: { - validator: $.optional.nullable.str, - }, - - enableDiscordIntegration: { - validator: $.optional.bool, - }, - - discordClientId: { - validator: $.optional.nullable.str, - }, - - discordClientSecret: { - validator: $.optional.nullable.str, - }, - - enableEmail: { - validator: $.optional.bool, - }, - - email: { - validator: $.optional.nullable.str, - }, - - smtpSecure: { - validator: $.optional.bool, - }, - - smtpHost: { - validator: $.optional.nullable.str, - }, - - smtpPort: { - validator: $.optional.nullable.num, - }, - - smtpUser: { - validator: $.optional.nullable.str, - }, - - smtpPass: { - validator: $.optional.nullable.str, - }, - - enableServiceWorker: { - validator: $.optional.bool, - }, - - swPublicKey: { - validator: $.optional.nullable.str, - }, - - swPrivateKey: { - validator: $.optional.nullable.str, - }, - - tosUrl: { - validator: $.optional.nullable.str, - }, - - repositoryUrl: { - validator: $.optional.str, - }, - - feedbackUrl: { - validator: $.optional.str, - }, - - useObjectStorage: { - validator: $.optional.bool, - }, - - objectStorageBaseUrl: { - validator: $.optional.nullable.str, - }, - - objectStorageBucket: { - validator: $.optional.nullable.str, - }, - - objectStoragePrefix: { - validator: $.optional.nullable.str, - }, - - objectStorageEndpoint: { - validator: $.optional.nullable.str, - }, - - objectStorageRegion: { - validator: $.optional.nullable.str, - }, - - objectStoragePort: { - validator: $.optional.nullable.num, - }, - - objectStorageAccessKey: { - validator: $.optional.nullable.str, - }, - - objectStorageSecretKey: { - validator: $.optional.nullable.str, - }, - - objectStorageUseSSL: { - validator: $.optional.bool, - }, - - objectStorageUseProxy: { - validator: $.optional.bool, - }, - - objectStorageSetPublicRead: { - validator: $.optional.bool, - }, - - objectStorageS3ForcePathStyle: { - validator: $.optional.bool, - }, +} as const; + +const paramDef = { + type: 'object', + properties: { + disableRegistration: { type: 'boolean', nullable: true }, + disableLocalTimeline: { type: 'boolean', nullable: true }, + disableGlobalTimeline: { type: 'boolean', nullable: true }, + useStarForReactionFallback: { type: 'boolean', nullable: true }, + pinnedUsers: { type: 'array', nullable: true, items: { + type: 'string', + } }, + hiddenTags: { type: 'array', nullable: true, items: { + type: 'string', + } }, + blockedHosts: { type: 'array', nullable: true, items: { + type: 'string', + } }, + themeColor: { type: 'string', nullable: true }, + mascotImageUrl: { type: 'string', nullable: true }, + bannerUrl: { type: 'string', nullable: true }, + errorImageUrl: { type: 'string', nullable: true }, + iconUrl: { type: 'string', nullable: true }, + backgroundImageUrl: { type: 'string', nullable: true }, + logoImageUrl: { type: 'string', nullable: true }, + name: { type: 'string', nullable: true }, + description: { type: 'string', nullable: true }, + maxNoteTextLength: { type: 'integer', maximum: 8192 }, + localDriveCapacityMb: { type: 'integer' }, + remoteDriveCapacityMb: { type: 'integer' }, + cacheRemoteFiles: { type: 'boolean' }, + proxyRemoteFiles: { type: 'boolean' }, + emailRequiredForSignup: { type: 'boolean' }, + enableHcaptcha: { type: 'boolean' }, + hcaptchaSiteKey: { type: 'string', nullable: true }, + hcaptchaSecretKey: { type: 'string', nullable: true }, + enableRecaptcha: { type: 'boolean' }, + recaptchaSiteKey: { type: 'string', nullable: true }, + recaptchaSecretKey: { type: 'string', nullable: true }, + proxyAccountId: { type: 'string', format: 'misskey:id', nullable: true }, + maintainerName: { type: 'string', nullable: true }, + maintainerEmail: { type: 'string', nullable: true }, + pinnedPages: { type: 'array', items: { + type: 'string', + } }, + pinnedClipId: { type: 'string', format: 'misskey:id', nullable: true }, + langs: { type: 'array', items: { + type: 'string', + } }, + summalyProxy: { type: 'string', nullable: true }, + deeplAuthKey: { type: 'string', nullable: true }, + deeplIsPro: { type: 'boolean' }, + enableTwitterIntegration: { type: 'boolean' }, + twitterConsumerKey: { type: 'string', nullable: true }, + twitterConsumerSecret: { type: 'string', nullable: true }, + enableGithubIntegration: { type: 'boolean' }, + githubClientId: { type: 'string', nullable: true }, + githubClientSecret: { type: 'string', nullable: true }, + enableDiscordIntegration: { type: 'boolean' }, + discordClientId: { type: 'string', nullable: true }, + discordClientSecret: { type: 'string', nullable: true }, + enableEmail: { type: 'boolean' }, + email: { type: 'string', nullable: true }, + smtpSecure: { type: 'boolean' }, + smtpHost: { type: 'string', nullable: true }, + smtpPort: { type: 'integer', nullable: true }, + smtpUser: { type: 'string', nullable: true }, + smtpPass: { type: 'string', nullable: true }, + enableServiceWorker: { type: 'boolean' }, + swPublicKey: { type: 'string', nullable: true }, + swPrivateKey: { type: 'string', nullable: true }, + tosUrl: { type: 'string', nullable: true }, + repositoryUrl: { type: 'string' }, + feedbackUrl: { type: 'string' }, + useObjectStorage: { type: 'boolean' }, + objectStorageBaseUrl: { type: 'string', nullable: true }, + objectStorageBucket: { type: 'string', nullable: true }, + objectStoragePrefix: { type: 'string', nullable: true }, + objectStorageEndpoint: { type: 'string', nullable: true }, + objectStorageRegion: { type: 'string', nullable: true }, + objectStoragePort: { type: 'integer', nullable: true }, + objectStorageAccessKey: { type: 'string', nullable: true }, + objectStorageSecretKey: { type: 'string', nullable: true }, + objectStorageUseSSL: { type: 'boolean' }, + objectStorageUseProxy: { type: 'boolean' }, + objectStorageSetPublicRead: { type: 'boolean' }, + objectStorageS3ForcePathStyle: { type: 'boolean' }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const set = {} as Partial; if (typeof ps.disableRegistration === 'boolean') { diff --git a/packages/backend/src/server/api/endpoints/admin/vacuum.ts b/packages/backend/src/server/api/endpoints/admin/vacuum.ts index 4229ef0d29..07a4517bd4 100644 --- a/packages/backend/src/server/api/endpoints/admin/vacuum.ts +++ b/packages/backend/src/server/api/endpoints/admin/vacuum.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { getConnection } from 'typeorm'; import { insertModerationLog } from '@/services/insert-moderation-log'; @@ -8,19 +7,19 @@ export const meta = { requireCredential: true, requireModerator: true, +} as const; - params: { - full: { - validator: $.bool, - }, - analyze: { - validator: $.bool, - }, +const paramDef = { + type: 'object', + properties: { + full: { type: 'boolean' }, + analyze: { type: 'boolean' }, }, + required: ['full', 'analyze'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const params: string[] = []; if (ps.full) { diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index 22c13743a8..bea3a287fc 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../define'; import { Announcements, AnnouncementReads } from '@/models/index'; import { makePaginationQuery } from '../common/make-pagination-query'; @@ -9,26 +7,6 @@ export const meta = { requireCredential: false, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - withUnreads: { - validator: $.optional.boolean, - default: false, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -73,11 +51,22 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + withUnreads: { type: 'boolean', default: false }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Announcements.createQueryBuilder('announcement'), ps.sinceId, ps.untilId); - const announcements = await query.take(ps.limit!).getMany(); + const announcements = await query.take(ps.limit).getMany(); if (user) { const reads = (await AnnouncementReads.find({ diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 2092d177ba..16ba065b9d 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -1,8 +1,6 @@ -import $ from 'cafy'; import define from '../../define'; import { genId } from '@/misc/gen-id'; import { Antennas, UserLists, UserGroupJoinings } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; import { ApiError } from '../../error'; import { publishInternalEvent } from '@/services/stream'; @@ -13,52 +11,6 @@ export const meta = { kind: 'write:account', - params: { - name: { - validator: $.str.range(1, 100), - }, - - src: { - validator: $.str.or(['home', 'all', 'users', 'list', 'group']), - }, - - userListId: { - validator: $.nullable.optional.type(ID), - }, - - userGroupId: { - validator: $.nullable.optional.type(ID), - }, - - keywords: { - validator: $.arr($.arr($.str)), - }, - - excludeKeywords: { - validator: $.arr($.arr($.str)), - }, - - users: { - validator: $.arr($.str), - }, - - caseSensitive: { - validator: $.bool, - }, - - withReplies: { - validator: $.bool, - }, - - withFile: { - validator: $.bool, - }, - - notify: { - validator: $.bool, - }, - }, - errors: { noSuchUserList: { message: 'No such user list.', @@ -80,8 +32,36 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string', minLength: 1, maxLength: 100 }, + src: { type: 'string', enum: ['home', 'all', 'users', 'list', 'group'] }, + userListId: { type: 'string', format: 'misskey:id', nullable: true }, + userGroupId: { type: 'string', format: 'misskey:id', nullable: true }, + keywords: { type: 'array', items: { + type: 'array', items: { + type: 'string', + }, + } }, + excludeKeywords: { type: 'array', items: { + type: 'array', items: { + type: 'string', + }, + } }, + users: { type: 'array', items: { + type: 'string', + } }, + caseSensitive: { type: 'boolean' }, + withReplies: { type: 'boolean' }, + withFile: { type: 'boolean' }, + notify: { type: 'boolean' }, + }, + required: ['name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile', 'notify'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let userList; let userGroupJoining; diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index b2793fc70d..c140084778 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Antennas } from '@/models/index'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - antennaId: { - validator: $.type(ID), - }, - }, - errors: { noSuchAntenna: { message: 'No such antenna.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + antennaId: { type: 'string', format: 'misskey:id' }, + }, + required: ['antennaId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const antenna = await Antennas.findOne({ id: ps.antennaId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/antennas/list.ts b/packages/backend/src/server/api/endpoints/antennas/list.ts index bb58912612..6910c07291 100644 --- a/packages/backend/src/server/api/endpoints/antennas/list.ts +++ b/packages/backend/src/server/api/endpoints/antennas/list.ts @@ -19,8 +19,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const antennas = await Antennas.find({ userId: me.id, }); diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index eb7de901c5..283c01c2c7 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import readNote from '@/services/note/read'; import { Antennas, Notes, AntennaNotes } from '@/models/index'; @@ -16,33 +14,6 @@ export const meta = { kind: 'read:account', - params: { - antennaId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - }, - errors: { noSuchAntenna: { message: 'No such antenna.', @@ -62,8 +33,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + antennaId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + }, + required: ['antennaId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const antenna = await Antennas.findOne({ id: ps.antennaId, userId: user.id, @@ -92,7 +76,7 @@ export default define(meta, async (ps, user) => { generateBlockedUserQuery(query, user); const notes = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); if (notes.length > 0) { diff --git a/packages/backend/src/server/api/endpoints/antennas/show.ts b/packages/backend/src/server/api/endpoints/antennas/show.ts index a37d37d31c..d8c08f2777 100644 --- a/packages/backend/src/server/api/endpoints/antennas/show.ts +++ b/packages/backend/src/server/api/endpoints/antennas/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Antennas } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'read:account', - params: { - antennaId: { - validator: $.type(ID), - }, - }, - errors: { noSuchAntenna: { message: 'No such antenna.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + antennaId: { type: 'string', format: 'misskey:id' }, + }, + required: ['antennaId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the antenna const antenna = await Antennas.findOne({ id: ps.antennaId, diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index 900f725505..9f8564c2c0 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Antennas, UserLists, UserGroupJoinings } from '@/models/index'; @@ -12,56 +10,6 @@ export const meta = { kind: 'write:account', - params: { - antennaId: { - validator: $.type(ID), - }, - - name: { - validator: $.str.range(1, 100), - }, - - src: { - validator: $.str.or(['home', 'all', 'users', 'list', 'group']), - }, - - userListId: { - validator: $.nullable.optional.type(ID), - }, - - userGroupId: { - validator: $.nullable.optional.type(ID), - }, - - keywords: { - validator: $.arr($.arr($.str)), - }, - - excludeKeywords: { - validator: $.arr($.arr($.str)), - }, - - users: { - validator: $.arr($.str), - }, - - caseSensitive: { - validator: $.bool, - }, - - withReplies: { - validator: $.bool, - }, - - withFile: { - validator: $.bool, - }, - - notify: { - validator: $.bool, - }, - }, - errors: { noSuchAntenna: { message: 'No such antenna.', @@ -89,8 +37,37 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + antennaId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', minLength: 1, maxLength: 100 }, + src: { type: 'string', enum: ['home', 'all', 'users', 'list', 'group'] }, + userListId: { type: 'string', format: 'misskey:id', nullable: true }, + userGroupId: { type: 'string', format: 'misskey:id', nullable: true }, + keywords: { type: 'array', items: { + type: 'array', items: { + type: 'string', + }, + } }, + excludeKeywords: { type: 'array', items: { + type: 'array', items: { + type: 'string', + }, + } }, + users: { type: 'array', items: { + type: 'string', + } }, + caseSensitive: { type: 'boolean' }, + withReplies: { type: 'boolean' }, + withFile: { type: 'boolean' }, + notify: { type: 'boolean' }, + }, + required: ['antennaId', 'name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile', 'notify'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch the antenna const antenna = await Antennas.findOne({ id: ps.antennaId, diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index ff8c677b91..c62ca6088b 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import Resolver from '@/remote/activitypub/resolver'; import { ApiError } from '../../error'; @@ -14,12 +13,6 @@ export const meta = { max: 30, }, - params: { - uri: { - validator: $.str, - }, - }, - errors: { }, @@ -29,8 +22,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + uri: { type: 'string' }, + }, + required: ['uri'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const resolver = new Resolver(); const object = await resolver.resolve(ps.uri); return object; diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 7d17d8edce..e0b53403bb 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import config from '@/config/index'; import { createPerson } from '@/remote/activitypub/models/person'; @@ -24,12 +23,6 @@ export const meta = { max: 30, }, - params: { - uri: { - validator: $.str, - }, - }, - errors: { noSuchObject: { message: 'No such object.', @@ -75,8 +68,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + uri: { type: 'string' }, + }, + required: ['uri'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const object = await fetchAny(ps.uri); if (object) { return object; diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index fbe6690f1d..0f9610d2a9 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Apps } from '@/models/index'; import { genId } from '@/misc/gen-id'; @@ -10,26 +9,6 @@ export const meta = { requireCredential: false, - params: { - name: { - validator: $.str, - }, - - description: { - validator: $.str, - }, - - permission: { - validator: $.arr($.str).unique(), - }, - - // TODO: Check it is valid url - callbackUrl: { - validator: $.optional.nullable.str, - default: null, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -37,8 +16,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string' }, + description: { type: 'string' }, + permission: { type: 'array', uniqueItems: true, items: { + type: 'string', + } }, + callbackUrl: { type: 'string', nullable: true }, + }, + required: ['name', 'description', 'permission'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Generate secret const secret = secureRndstr(32, true); diff --git a/packages/backend/src/server/api/endpoints/app/show.ts b/packages/backend/src/server/api/endpoints/app/show.ts index 9f4777b383..0ca7fcc2a8 100644 --- a/packages/backend/src/server/api/endpoints/app/show.ts +++ b/packages/backend/src/server/api/endpoints/app/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Apps } from '@/models/index'; @@ -7,12 +5,6 @@ import { Apps } from '@/models/index'; export const meta = { tags: ['app'], - params: { - appId: { - validator: $.type(ID), - }, - }, - errors: { noSuchApp: { message: 'No such app.', @@ -28,8 +20,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + appId: { type: 'string', format: 'misskey:id' }, + }, + required: ['appId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user, token) => { +export default define(meta, paramDef, async (ps, user, token) => { const isSecure = user != null && token == null; // Lookup app diff --git a/packages/backend/src/server/api/endpoints/auth/accept.ts b/packages/backend/src/server/api/endpoints/auth/accept.ts index f028135ca5..4429119b1f 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -1,5 +1,4 @@ import * as crypto from 'crypto'; -import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { AuthSessions, AccessTokens, Apps } from '@/models/index'; @@ -13,12 +12,6 @@ export const meta = { secure: true, - params: { - token: { - validator: $.str, - }, - }, - errors: { noSuchSession: { message: 'No such session.', @@ -28,8 +21,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + token: { type: 'string' }, + }, + required: ['token'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch token const session = await AuthSessions .findOne({ token: ps.token }); diff --git a/packages/backend/src/server/api/endpoints/auth/session/generate.ts b/packages/backend/src/server/api/endpoints/auth/session/generate.ts index 98987eba5b..8d5c14e2f7 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/generate.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/generate.ts @@ -1,5 +1,4 @@ import { v4 as uuid } from 'uuid'; -import $ from 'cafy'; import config from '@/config/index'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -11,12 +10,6 @@ export const meta = { requireCredential: false, - params: { - appSecret: { - validator: $.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -42,8 +35,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + appSecret: { type: 'string' }, + }, + required: ['appSecret'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { // Lookup app const app = await Apps.findOne({ secret: ps.appSecret, diff --git a/packages/backend/src/server/api/endpoints/auth/session/show.ts b/packages/backend/src/server/api/endpoints/auth/session/show.ts index ae0d016cea..dfc1c06ee6 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/show.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/show.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { ApiError } from '../../../error'; import { AuthSessions } from '@/models/index'; @@ -8,12 +7,6 @@ export const meta = { requireCredential: false, - params: { - token: { - validator: $.str, - }, - }, - errors: { noSuchSession: { message: 'No such session.', @@ -44,8 +37,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + token: { type: 'string' }, + }, + required: ['token'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Lookup session const session = await AuthSessions.findOne({ token: ps.token, diff --git a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index fe0211ebe3..397d1e687b 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { ApiError } from '../../../error'; import { Apps, AuthSessions, AccessTokens, Users } from '@/models/index'; @@ -8,16 +7,6 @@ export const meta = { requireCredential: false, - params: { - appSecret: { - validator: $.str, - }, - - token: { - validator: $.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -56,8 +45,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + appSecret: { type: 'string' }, + token: { type: 'string' }, + }, + required: ['appSecret', 'token'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { // Lookup app const app = await Apps.findOne({ secret: ps.appSecret, diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index 6d555ff569..8fd8f33338 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import ms from 'ms'; import create from '@/services/blocking/create'; import define from '../../define'; @@ -19,12 +17,6 @@ export const meta = { kind: 'write:blocks', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -52,8 +44,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const blocker = await Users.findOneOrFail(user.id); // 自分自身 diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index 942cddaedf..ad00fd1e0b 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import ms from 'ms'; import deleteBlocking from '@/services/blocking/delete'; import define from '../../define'; @@ -19,12 +17,6 @@ export const meta = { kind: 'write:blocks', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -52,8 +44,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const blocker = await Users.findOneOrFail(user.id); // Check if the blockee is yourself diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index 9a4f662140..a315ccde9e 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Blockings } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:blocks', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 30, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,13 +20,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Blockings.createQueryBuilder('blocking'), ps.sinceId, ps.untilId) .andWhere(`blocking.blockerId = :meId`, { meId: me.id }); const blockings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Blockings.packMany(blockings, me); diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index 68cdf1143e..dc7afadfa2 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -1,10 +1,8 @@ -import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { Channels, DriveFiles } from '@/models/index'; import { Channel } from '@/models/entities/channel'; import { genId } from '@/misc/gen-id'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['channels'], @@ -13,20 +11,6 @@ export const meta = { kind: 'write:channels', - params: { - name: { - validator: $.str.range(1, 128), - }, - - description: { - validator: $.nullable.optional.str.range(1, 2048), - }, - - bannerId: { - validator: $.nullable.optional.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -42,8 +26,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string', minLength: 1, maxLength: 128 }, + description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 }, + bannerId: { type: 'string', format: 'misskey:id', nullable: true }, + }, + required: ['name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let banner = null; if (ps.bannerId != null) { banner = await DriveFiles.findOne({ diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index ceadde907c..4d07e720a9 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -17,8 +17,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Channels.createQueryBuilder('channel') .where('channel.lastNotedAt IS NOT NULL') .orderBy('channel.lastNotedAt', 'DESC'); diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index bf580eea60..01156d1c2c 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Channels, ChannelFollowings } from '@/models/index'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:channels', - params: { - channelId: { - validator: $.type(ID), - }, - }, - errors: { noSuchChannel: { message: 'No such channel.', @@ -28,8 +20,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + channelId: { type: 'string', format: 'misskey:id' }, + }, + required: ['channelId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const channel = await Channels.findOne({ id: ps.channelId, }); diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index 9e4c942af2..0e75f06f47 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Channels, ChannelFollowings } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:channels', - params: { - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 5, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,13 +20,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 5 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(ChannelFollowings.createQueryBuilder(), ps.sinceId, ps.untilId) .andWhere({ followerId: me.id }); const followings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Promise.all(followings.map(x => Channels.pack(x.followeeId, me))); diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index 5473636a85..f8acae836b 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Channels } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:channels', - params: { - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 5, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,13 +20,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 5 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Channels.createQueryBuilder(), ps.sinceId, ps.untilId) .andWhere({ userId: me.id }); const channels = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Promise.all(channels.map(x => Channels.pack(x, me))); diff --git a/packages/backend/src/server/api/endpoints/channels/show.ts b/packages/backend/src/server/api/endpoints/channels/show.ts index 598a87ec4e..fb2c7b5adf 100644 --- a/packages/backend/src/server/api/endpoints/channels/show.ts +++ b/packages/backend/src/server/api/endpoints/channels/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Channels } from '@/models/index'; @@ -9,12 +7,6 @@ export const meta = { requireCredential: false, - params: { - channelId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -30,8 +22,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + channelId: { type: 'string', format: 'misskey:id' }, + }, + required: ['channelId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const channel = await Channels.findOne({ id: ps.channelId, }); diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index 2639095f8a..a870ecccbb 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Notes, Channels } from '@/models/index'; @@ -11,33 +9,6 @@ export const meta = { requireCredential: false, - params: { - channelId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -57,8 +28,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + channelId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + }, + required: ['channelId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const channel = await Channels.findOne({ id: ps.channelId, }); @@ -78,7 +62,7 @@ export default define(meta, async (ps, user) => { .leftJoinAndSelect('note.channel', 'channel'); //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); if (user) activeUsersChart.read(user); diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index ada0cb29fd..42a0eb0a5a 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Channels, ChannelFollowings } from '@/models/index'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:channels', - params: { - channelId: { - validator: $.type(ID), - }, - }, - errors: { noSuchChannel: { message: 'No such channel.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + channelId: { type: 'string', format: 'misskey:id' }, + }, + required: ['channelId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const channel = await Channels.findOne({ id: ps.channelId, }); diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index 1f7108a1cb..5a593c62e0 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Channels, DriveFiles } from '@/models/index'; @@ -11,24 +9,6 @@ export const meta = { kind: 'write:channels', - params: { - channelId: { - validator: $.type(ID), - }, - - name: { - validator: $.optional.str.range(1, 128), - }, - - description: { - validator: $.nullable.optional.str.range(1, 2048), - }, - - bannerId: { - validator: $.nullable.optional.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -56,8 +36,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + channelId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', minLength: 1, maxLength: 128 }, + description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 }, + bannerId: { type: 'string', format: 'misskey:id', nullable: true }, + }, + required: ['channelId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const channel = await Channels.findOne({ id: ps.channelId, }); diff --git a/packages/backend/src/server/api/endpoints/charts/active-users.ts b/packages/backend/src/server/api/endpoints/charts/active-users.ts index a51cd00351..a99269da0c 100644 --- a/packages/backend/src/server/api/endpoints/charts/active-users.ts +++ b/packages/backend/src/server/api/endpoints/charts/active-users.ts @@ -1,31 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { activeUsersChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'users'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(activeUsersChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, }, - - // TODO: response definition + required: ['span'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await activeUsersChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null); +export default define(meta, paramDef, async (ps) => { + return await activeUsersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null); }); diff --git a/packages/backend/src/server/api/endpoints/charts/ap-request.ts b/packages/backend/src/server/api/endpoints/charts/ap-request.ts index 38bbddb27a..403a933807 100644 --- a/packages/backend/src/server/api/endpoints/charts/ap-request.ts +++ b/packages/backend/src/server/api/endpoints/charts/ap-request.ts @@ -1,31 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { apRequestChart } from '@/services/chart/index'; export const meta = { tags: ['charts'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(apRequestChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, }, - - // TODO: response definition + required: ['span'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await apRequestChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null); +export default define(meta, paramDef, async (ps) => { + return await apRequestChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null); }); diff --git a/packages/backend/src/server/api/endpoints/charts/drive.ts b/packages/backend/src/server/api/endpoints/charts/drive.ts index 4bbb9861f8..2c815367f6 100644 --- a/packages/backend/src/server/api/endpoints/charts/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/drive.ts @@ -1,31 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { driveChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'drive'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(driveChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, }, - - // TODO: response definition + required: ['span'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await driveChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null); +export default define(meta, paramDef, async (ps) => { + return await driveChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null); }); diff --git a/packages/backend/src/server/api/endpoints/charts/federation.ts b/packages/backend/src/server/api/endpoints/charts/federation.ts index 237678ffed..c48613ffac 100644 --- a/packages/backend/src/server/api/endpoints/charts/federation.ts +++ b/packages/backend/src/server/api/endpoints/charts/federation.ts @@ -1,31 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { federationChart } from '@/services/chart/index'; export const meta = { tags: ['charts'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(federationChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, }, - - // TODO: response definition + required: ['span'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await federationChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null); +export default define(meta, paramDef, async (ps) => { + return await federationChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null); }); diff --git a/packages/backend/src/server/api/endpoints/charts/hashtag.ts b/packages/backend/src/server/api/endpoints/charts/hashtag.ts index 6c12cb063e..3cb0784ba4 100644 --- a/packages/backend/src/server/api/endpoints/charts/hashtag.ts +++ b/packages/backend/src/server/api/endpoints/charts/hashtag.ts @@ -1,35 +1,25 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { hashtagChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'hashtags'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(hashtagChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, - - tag: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, + tag: { type: 'string' }, }, - - // TODO: response definition + required: ['span', 'tag'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await hashtagChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.tag); +export default define(meta, paramDef, async (ps) => { + return await hashtagChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.tag); }); diff --git a/packages/backend/src/server/api/endpoints/charts/instance.ts b/packages/backend/src/server/api/endpoints/charts/instance.ts index 32a10d5a28..2da3cd3c3a 100644 --- a/packages/backend/src/server/api/endpoints/charts/instance.ts +++ b/packages/backend/src/server/api/endpoints/charts/instance.ts @@ -1,35 +1,25 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { instanceChart } from '@/services/chart/index'; export const meta = { tags: ['charts'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(instanceChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, - - host: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, + host: { type: 'string' }, }, - - // TODO: response definition + required: ['span', 'host'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await instanceChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.host); +export default define(meta, paramDef, async (ps) => { + return await instanceChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.host); }); diff --git a/packages/backend/src/server/api/endpoints/charts/notes.ts b/packages/backend/src/server/api/endpoints/charts/notes.ts index 09255f1d2d..c48bc67e1c 100644 --- a/packages/backend/src/server/api/endpoints/charts/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/notes.ts @@ -1,31 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { notesChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'notes'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(notesChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, }, - - // TODO: response definition + required: ['span'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await notesChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null); +export default define(meta, paramDef, async (ps) => { + return await notesChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null); }); diff --git a/packages/backend/src/server/api/endpoints/charts/user/drive.ts b/packages/backend/src/server/api/endpoints/charts/user/drive.ts index 89379858d1..62f7afa435 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/drive.ts @@ -1,36 +1,25 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { perUserDriveChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'drive', 'users'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(perUserDriveChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, - - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, + userId: { type: 'string', format: 'misskey:id' }, }, - - // TODO: response definition + required: ['span', 'userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await perUserDriveChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId); +export default define(meta, paramDef, async (ps) => { + return await perUserDriveChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId); }); diff --git a/packages/backend/src/server/api/endpoints/charts/user/following.ts b/packages/backend/src/server/api/endpoints/charts/user/following.ts index 26c3f5c126..d6d2d5e3ee 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/following.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/following.ts @@ -1,36 +1,25 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { perUserFollowingChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'users', 'following'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(perUserFollowingChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, - - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, + userId: { type: 'string', format: 'misskey:id' }, }, - - // TODO: response definition + required: ['span', 'userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await perUserFollowingChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId); +export default define(meta, paramDef, async (ps) => { + return await perUserFollowingChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId); }); diff --git a/packages/backend/src/server/api/endpoints/charts/user/notes.ts b/packages/backend/src/server/api/endpoints/charts/user/notes.ts index ecf85becfa..becde8b1df 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/notes.ts @@ -1,36 +1,25 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { perUserNotesChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'users', 'notes'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(perUserNotesChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, - - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, + userId: { type: 'string', format: 'misskey:id' }, }, - - // TODO: response definition + required: ['span', 'userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await perUserNotesChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId); +export default define(meta, paramDef, async (ps) => { + return await perUserNotesChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId); }); diff --git a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts index 6e08d07511..8f4d9a812a 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts @@ -1,36 +1,25 @@ -import $ from 'cafy'; import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { perUserReactionsChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'users', 'reactions'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(perUserReactionsChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, - - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, + userId: { type: 'string', format: 'misskey:id' }, }, - - // TODO: response definition + required: ['span', 'userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await perUserReactionsChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId); +export default define(meta, paramDef, async (ps) => { + return await perUserReactionsChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId); }); diff --git a/packages/backend/src/server/api/endpoints/charts/users.ts b/packages/backend/src/server/api/endpoints/charts/users.ts index 15a9ec038e..855fc6cd07 100644 --- a/packages/backend/src/server/api/endpoints/charts/users.ts +++ b/packages/backend/src/server/api/endpoints/charts/users.ts @@ -1,31 +1,24 @@ -import $ from 'cafy'; import define from '../../define'; -import { convertLog } from '@/services/chart/core'; +import { getJsonSchema } from '@/services/chart/core'; import { usersChart } from '@/services/chart/index'; export const meta = { tags: ['charts', 'users'], - params: { - span: { - validator: $.str.or(['day', 'hour']), - }, + res: getJsonSchema(usersChart.schema), +} as const; - limit: { - validator: $.optional.num.range(1, 500), - default: 30, - }, - - offset: { - validator: $.optional.nullable.num, - default: null, - }, +const paramDef = { + type: 'object', + properties: { + span: { type: 'string', enum: ['day', 'hour'] }, + limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 }, + offset: { type: 'integer', nullable: true, default: null }, }, - - // TODO: response definition + required: ['span'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { - return await usersChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null); +export default define(meta, paramDef, async (ps) => { + return await usersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null); }); diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index 4a740b6cfe..e7dc25fe40 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ClipNotes, Clips } from '@/models/index'; import { ApiError } from '../../error'; @@ -13,16 +11,6 @@ export const meta = { kind: 'write:account', - params: { - clipId: { - validator: $.type(ID), - }, - - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchClip: { message: 'No such clip.', @@ -44,8 +32,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + clipId: { type: 'string', format: 'misskey:id' }, + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['clipId', 'noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const clip = await Clips.findOne({ id: ps.clipId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index 852e66c9e4..b6ebf866b8 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { genId } from '@/misc/gen-id'; import { Clips } from '@/models/index'; @@ -10,20 +9,6 @@ export const meta = { kind: 'write:account', - params: { - name: { - validator: $.str.range(1, 100), - }, - - isPublic: { - validator: $.optional.bool, - }, - - description: { - validator: $.optional.nullable.str.range(1, 2048), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -31,8 +16,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string', minLength: 1, maxLength: 100 }, + isPublic: { type: 'boolean' }, + description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 }, + }, + required: ['name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const clip = await Clips.insert({ id: genId(), createdAt: new Date(), diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index 85c64a115d..a263e10521 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Clips } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:account', - params: { - clipId: { - validator: $.type(ID), - }, - }, - errors: { noSuchClip: { message: 'No such clip.', @@ -26,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + clipId: { type: 'string', format: 'misskey:id' }, + }, + required: ['clipId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const clip = await Clips.findOne({ id: ps.clipId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/clips/list.ts b/packages/backend/src/server/api/endpoints/clips/list.ts index d88897d164..959b60e6f9 100644 --- a/packages/backend/src/server/api/endpoints/clips/list.ts +++ b/packages/backend/src/server/api/endpoints/clips/list.ts @@ -19,8 +19,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const clips = await Clips.find({ userId: me.id, }); diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index eeb20631c1..dd76e396bf 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ClipNotes, Clips, Notes } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -15,25 +13,6 @@ export const meta = { kind: 'read:account', - params: { - clipId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - errors: { noSuchClip: { message: 'No such clip.', @@ -53,8 +32,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + clipId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: ['clipId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const clip = await Clips.findOne({ id: ps.clipId, }); @@ -87,7 +77,7 @@ export default define(meta, async (ps, user) => { } const notes = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Notes.packMany(notes, user); diff --git a/packages/backend/src/server/api/endpoints/clips/show.ts b/packages/backend/src/server/api/endpoints/clips/show.ts index 0a45672019..7fe827a967 100644 --- a/packages/backend/src/server/api/endpoints/clips/show.ts +++ b/packages/backend/src/server/api/endpoints/clips/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Clips } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'read:account', - params: { - clipId: { - validator: $.type(ID), - }, - }, - errors: { noSuchClip: { message: 'No such clip.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + clipId: { type: 'string', format: 'misskey:id' }, + }, + required: ['clipId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the clip const clip = await Clips.findOne({ id: ps.clipId, diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index 795483d5b2..b864497349 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Clips } from '@/models/index'; @@ -11,24 +9,6 @@ export const meta = { kind: 'write:account', - params: { - clipId: { - validator: $.type(ID), - }, - - name: { - validator: $.str.range(1, 100), - }, - - isPublic: { - validator: $.optional.bool, - }, - - description: { - validator: $.optional.nullable.str.range(1, 2048), - }, - }, - errors: { noSuchClip: { message: 'No such clip.', @@ -44,8 +24,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + clipId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', minLength: 1, maxLength: 100 }, + isPublic: { type: 'boolean' }, + description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 }, + }, + required: ['clipId', 'name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch the clip const clip = await Clips.findOne({ id: ps.clipId, diff --git a/packages/backend/src/server/api/endpoints/drive.ts b/packages/backend/src/server/api/endpoints/drive.ts index d9ab9883ca..5fc1f64cf0 100644 --- a/packages/backend/src/server/api/endpoints/drive.ts +++ b/packages/backend/src/server/api/endpoints/drive.ts @@ -25,8 +25,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const instance = await fetchMeta(true); // Calculate drive usage diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index a5c0a626a1..8ca9daed4d 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { DriveFiles } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,30 +9,6 @@ export const meta = { kind: 'read:drive', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - folderId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - - type: { - validator: $.optional.nullable.str.match(/^[a-zA-Z\/\-*]+$/), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -46,8 +20,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + type: { type: 'string', nullable: true, pattern: /^[a-zA-Z\/\-*]+$/.toString().slice(1, -1) }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(DriveFiles.createQueryBuilder('file'), ps.sinceId, ps.untilId) .andWhere('file.userId = :userId', { userId: user.id }); @@ -65,7 +51,7 @@ export default define(meta, async (ps, user) => { } } - const files = await query.take(ps.limit!).getMany(); + const files = await query.take(ps.limit).getMany(); return await DriveFiles.packMany(files, { detail: false, self: true }); }); diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index 835dde8058..20238c1b96 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFiles, Notes } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'read:drive', - params: { - fileId: { - validator: $.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -36,8 +28,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch file const file = await DriveFiles.findOne({ id: ps.fileId, diff --git a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts index a45d357ee8..8b7af3e54a 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { DriveFiles } from '@/models/index'; @@ -9,20 +8,22 @@ export const meta = { kind: 'read:drive', - params: { - md5: { - validator: $.str, - }, - }, - res: { type: 'boolean', optional: false, nullable: false, }, } as const; +const paramDef = { + type: 'object', + properties: { + md5: { type: 'string' }, + }, + required: ['md5'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne({ md5: ps.md5, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index ac7863ec7e..f5791f6ec7 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -1,6 +1,4 @@ import ms from 'ms'; -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { addFile } from '@/services/drive/add-file'; import define from '../../../define'; import { apiLogger } from '../../../logger'; @@ -22,33 +20,6 @@ export const meta = { kind: 'write:drive', - params: { - folderId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - - name: { - validator: $.optional.nullable.str, - default: null, - }, - - comment: { - validator: $.optional.nullable.str.max(DB_MAX_IMAGE_COMMENT_LENGTH), - default: null, - }, - - isSensitive: { - validator: $.optional.bool, - default: false, - }, - - force: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -64,8 +35,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + name: { type: 'string', nullable: true, default: null }, + comment: { type: 'string', nullable: true, maxLength: DB_MAX_IMAGE_COMMENT_LENGTH, default: null }, + isSensitive: { type: 'boolean', default: false }, + force: { type: 'boolean', default: false }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user, _, file, cleanup) => { +export default define(meta, paramDef, async (ps, user, _, file, cleanup) => { // Get 'name' parameter let name = ps.name || file.originalname; if (name !== undefined && name !== null) { diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 308beb58a4..664637a68f 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { deleteFile } from '@/services/drive/delete-file'; import { publishDriveStream } from '@/services/stream'; import define from '../../../define'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:drive', - params: { - fileId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -34,8 +26,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) { diff --git a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts index dc74dcb7e6..98de790c0d 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { DriveFiles } from '@/models/index'; @@ -9,12 +8,6 @@ export const meta = { kind: 'read:drive', - params: { - md5: { - validator: $.str, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -26,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + md5: { type: 'string' }, + }, + required: ['md5'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const files = await DriveFiles.find({ md5: ps.md5, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/drive/files/find.ts b/packages/backend/src/server/api/endpoints/drive/files/find.ts index 2244df13cd..8d30c29da6 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { DriveFiles } from '@/models/index'; @@ -10,17 +8,6 @@ export const meta = { kind: 'read:drive', - params: { - name: { - validator: $.str, - }, - - folderId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -32,8 +19,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string' }, + folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + }, + required: ['name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const files = await DriveFiles.find({ name: ps.name, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/drive/files/show.ts b/packages/backend/src/server/api/endpoints/drive/files/show.ts index 18b17c4653..8edb8785bc 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFile } from '@/models/entities/drive-file'; @@ -12,16 +10,6 @@ export const meta = { kind: 'read:drive', - params: { - fileId: { - validator: $.optional.type(ID), - }, - - url: { - validator: $.optional.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -49,8 +37,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + url: { type: 'string' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let file: DriveFile | undefined; if (ps.fileId) { diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index b7ca80e83c..d77deea7db 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { publishDriveStream } from '@/services/stream'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -13,33 +11,13 @@ export const meta = { kind: 'write:drive', - params: { - fileId: { - validator: $.type(ID), - }, - - folderId: { - validator: $.optional.nullable.type(ID), - default: undefined as any, - }, - - name: { - validator: $.optional.str.pipe(DriveFiles.validateFileName), - default: undefined as any, - }, - - isSensitive: { - validator: $.optional.bool, - default: undefined as any, - }, - - comment: { - validator: $.optional.nullable.str.max(DB_MAX_IMAGE_COMMENT_LENGTH), - default: undefined as any, - }, - }, - errors: { + invalidFileName: { + message: 'Invalid file name.', + code: 'INVALID_FILE_NAME', + id: '395e7156-f9f0-475e-af89-53c3c23080c2', + }, + noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', @@ -66,8 +44,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + folderId: { type: 'string', format: 'misskey:id', nullable: true }, + name: { type: 'string' }, + isSensitive: { type: 'boolean' }, + comment: { type: 'string', nullable: true, maxLength: 512 }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) { @@ -79,6 +69,9 @@ export default define(meta, async (ps, user) => { } if (ps.name) file.name = ps.name; + if (!DriveFiles.validateFileName(file.name)) { + throw new ApiError(meta.errors.invalidFileName); + } if (ps.comment !== undefined) file.comment = ps.comment; diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index 40da1a4fb4..a4619ebf36 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import ms from 'ms'; import { uploadFromUrl } from '@/services/drive/upload-from-url'; import define from '../../../define'; @@ -18,42 +16,23 @@ export const meta = { requireCredential: true, kind: 'write:drive', +} as const; - params: { - url: { - // TODO: Validate this url - validator: $.str, - }, - - folderId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - - isSensitive: { - validator: $.optional.bool, - default: false, - }, - - comment: { - validator: $.optional.nullable.str.max(DB_MAX_IMAGE_COMMENT_LENGTH), - default: null, - }, - - marker: { - validator: $.optional.nullable.str, - default: null, - }, - - force: { - validator: $.optional.bool, - default: false, - }, +const paramDef = { + type: 'object', + properties: { + url: { type: 'string' }, + folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + isSensitive: { type: 'boolean', default: false }, + comment: { type: 'string', nullable: true, maxLength: 512, default: null }, + marker: { type: 'string', nullable: true, default: null }, + force: { type: 'boolean', default: false }, }, + required: ['url'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { uploadFromUrl({ url: ps.url, user, folderId: ps.folderId, sensitive: ps.isSensitive, force: ps.force, comment: ps.comment }).then(file => { DriveFiles.pack(file, { self: true }).then(packedFile => { publishMainStream(user.id, 'urlUploadFinished', { diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index 8f8d1d2c0a..a543ae27df 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { DriveFolders } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,26 +9,6 @@ export const meta = { kind: 'read:drive', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - folderId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -42,8 +20,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(DriveFolders.createQueryBuilder('folder'), ps.sinceId, ps.untilId) .andWhere('folder.userId = :userId', { userId: user.id }); @@ -53,7 +42,7 @@ export default define(meta, async (ps, user) => { query.andWhere('folder.parentId IS NULL'); } - const folders = await query.take(ps.limit!).getMany(); + const folders = await query.take(ps.limit).getMany(); return await Promise.all(folders.map(folder => DriveFolders.pack(folder))); }); diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index 38ed17e0e5..ab48d5599e 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { publishDriveStream } from '@/services/stream'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -13,17 +11,6 @@ export const meta = { kind: 'write:drive', - params: { - name: { - validator: $.optional.str.pipe(DriveFolders.validateFolderName), - default: 'Untitled', - }, - - parentId: { - validator: $.optional.nullable.type(ID), - }, - }, - errors: { noSuchFolder: { message: 'No such folder.', @@ -39,8 +26,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string', default: "Untitled", maxLength: 200 }, + parentId: { type: 'string', format: 'misskey:id', nullable: true }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // If the parent folder is specified let parent = null; if (ps.parentId) { diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index 13716fccea..51c0340529 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { publishDriveStream } from '@/services/stream'; import { ApiError } from '../../../error'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:drive', - params: { - folderId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFolder: { message: 'No such folder.', @@ -33,8 +25,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + folderId: { type: 'string', format: 'misskey:id' }, + }, + required: ['folderId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Get folder const folder = await DriveFolders.findOne({ id: ps.folderId, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index 911f51d78b..057f40b1cc 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/find.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { DriveFolders } from '@/models/index'; @@ -10,17 +8,6 @@ export const meta = { kind: 'read:drive', - params: { - name: { - validator: $.str, - }, - - parentId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -32,8 +19,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string' }, + parentId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + }, + required: ['name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const folders = await DriveFolders.find({ name: ps.name, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/show.ts b/packages/backend/src/server/api/endpoints/drive/folders/show.ts index 58a6dd3c06..d31d7a4276 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { DriveFolders } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'read:drive', - params: { - folderId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + folderId: { type: 'string', format: 'misskey:id' }, + }, + required: ['folderId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Get folder const folder = await DriveFolders.findOne({ id: ps.folderId, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index 5b0cccd1c6..c70b5a0d54 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { publishDriveStream } from '@/services/stream'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -12,20 +10,6 @@ export const meta = { kind: 'write:drive', - params: { - folderId: { - validator: $.type(ID), - }, - - name: { - validator: $.optional.str.pipe(DriveFolders.validateFolderName), - }, - - parentId: { - validator: $.optional.nullable.type(ID), - }, - }, - errors: { noSuchFolder: { message: 'No such folder.', @@ -53,8 +37,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + folderId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', maxLength: 200 }, + parentId: { type: 'string', format: 'misskey:id', nullable: true }, + }, + required: ['folderId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch folder const folder = await DriveFolders.findOne({ id: ps.folderId, diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 9ba7804946..921ae4c221 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { DriveFiles } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,25 +9,6 @@ export const meta = { kind: 'read:drive', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - type: { - validator: $.optional.str.match(/^[a-zA-Z\/\-*]+$/), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -41,8 +20,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + type: { type: 'string', pattern: /^[a-zA-Z\/\-*]+$/.toString().slice(1, -1) }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(DriveFiles.createQueryBuilder('file'), ps.sinceId, ps.untilId) .andWhere('file.userId = :userId', { userId: user.id }); @@ -54,7 +44,7 @@ export default define(meta, async (ps, user) => { } } - const files = await query.take(ps.limit!).getMany(); + const files = await query.take(ps.limit).getMany(); return await DriveFiles.packMany(files, { detail: false, self: true }); }); diff --git a/packages/backend/src/server/api/endpoints/email-address/available.ts b/packages/backend/src/server/api/endpoints/email-address/available.ts index 19f9b7ccdc..cb740ffae7 100644 --- a/packages/backend/src/server/api/endpoints/email-address/available.ts +++ b/packages/backend/src/server/api/endpoints/email-address/available.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { validateEmailForAccount } from '@/services/validate-email-for-account'; @@ -7,12 +6,6 @@ export const meta = { requireCredential: false, - params: { - emailAddress: { - validator: $.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -29,7 +22,15 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + emailAddress: { type: 'string' }, + }, + required: ['emailAddress'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { return await validateEmailForAccount(ps.emailAddress); }); diff --git a/packages/backend/src/server/api/endpoints/endpoint.ts b/packages/backend/src/server/api/endpoints/endpoint.ts index 42fd468838..b8fe030e8c 100644 --- a/packages/backend/src/server/api/endpoints/endpoint.ts +++ b/packages/backend/src/server/api/endpoints/endpoint.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../define'; import endpoints from '../endpoints'; @@ -6,16 +5,18 @@ export const meta = { requireCredential: false, tags: ['meta'], +} as const; - params: { - endpoint: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + endpoint: { type: 'string' }, }, + required: ['endpoint'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const ep = endpoints.find(x => x.name === ps.endpoint); if (ep == null) return null; return { diff --git a/packages/backend/src/server/api/endpoints/endpoints.ts b/packages/backend/src/server/api/endpoints/endpoints.ts index ebb78de337..b090e0dced 100644 --- a/packages/backend/src/server/api/endpoints/endpoints.ts +++ b/packages/backend/src/server/api/endpoints/endpoints.ts @@ -6,9 +6,6 @@ export const meta = { tags: ['meta'], - params: { - }, - res: { type: 'array', optional: false, nullable: false, @@ -25,7 +22,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { return endpoints.map(x => x.name); }); diff --git a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts index 24c9f56aa6..f0ab63f74b 100644 --- a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../define'; import { createExportCustomEmojisJob } from '@/queue/index'; import ms from 'ms'; @@ -12,7 +11,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createExportCustomEmojisJob(user); }); diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index c0a85f166c..5960e482c0 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Followings } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -9,25 +7,6 @@ export const meta = { requireCredential: false, - params: { - host: { - validator: $.str, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -39,13 +18,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: ['host'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId) .andWhere(`following.followeeHost = :host`, { host: ps.host }); const followings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Followings.packMany(followings, me, { populateFollowee: true }); diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 147f0aedb2..4f139b0c45 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Followings } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -9,25 +7,6 @@ export const meta = { requireCredential: false, - params: { - host: { - validator: $.str, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -39,13 +18,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: ['host'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId) .andWhere(`following.followerHost = :host`, { host: ps.host }); const followings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Followings.packMany(followings, me, { populateFollowee: true }); diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 11df7ed6b6..494b5120ab 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import config from '@/config/index'; import define from '../../define'; import { Instances } from '@/models/index'; @@ -9,50 +8,6 @@ export const meta = { requireCredential: false, - params: { - host: { - validator: $.optional.nullable.str, - }, - - blocked: { - validator: $.optional.nullable.bool, - }, - - notResponding: { - validator: $.optional.nullable.bool, - }, - - suspended: { - validator: $.optional.nullable.bool, - }, - - federating: { - validator: $.optional.nullable.bool, - }, - - subscribing: { - validator: $.optional.nullable.bool, - }, - - publishing: { - validator: $.optional.nullable.bool, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 30, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - - sort: { - validator: $.optional.str, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -64,8 +19,25 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + host: { type: 'string', nullable: true }, + blocked: { type: 'boolean', nullable: true }, + notResponding: { type: 'boolean', nullable: true }, + suspended: { type: 'boolean', nullable: true }, + federating: { type: 'boolean', nullable: true }, + subscribing: { type: 'boolean', nullable: true }, + publishing: { type: 'boolean', nullable: true }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, + offset: { type: 'integer', default: 0 }, + sort: { type: 'string' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Instances.createQueryBuilder('instance'); switch (ps.sort) { @@ -144,7 +116,7 @@ export default define(meta, async (ps, me) => { query.andWhere('instance.host like :host', { host: '%' + ps.host.toLowerCase() + '%' }); } - const instances = await query.take(ps.limit!).skip(ps.offset).getMany(); + const instances = await query.take(ps.limit).skip(ps.offset).getMany(); - return instances; + return await Instances.packMany(instances); }); diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index 6f13b28cae..cead515d81 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Instances } from '@/models/index'; import { toPuny } from '@/misc/convert-host'; @@ -8,23 +7,28 @@ export const meta = { requireCredential: false, - params: { - host: { - validator: $.str, - }, - }, - res: { - type: 'object', - optional: true, nullable: false, - ref: 'FederationInstance', + oneOf: [{ + type: 'object', + ref: 'FederationInstance', + }, { + type: 'null', + }], }, } as const; +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, + }, + required: ['host'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const instance = await Instances .findOne({ host: toPuny(ps.host) }); - return instance; + return instance ? await Instances.pack(instance) : null; }); diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index 092f805bc2..ebdc54d0a6 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { getRemoteUser } from '../../common/getters'; import { updatePerson } from '@/remote/activitypub/models/person'; @@ -8,16 +6,18 @@ export const meta = { tags: ['federation'], requireCredential: true, +} as const; - params: { - userId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const user = await getRemoteUser(ps.userId); await updatePerson(user.uri!); }); diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index 9a8f749936..294894cd92 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Users } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -9,25 +7,6 @@ export const meta = { requireCredential: false, - params: { - host: { - validator: $.str, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -39,13 +18,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + host: { type: 'string' }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: ['host'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Users.createQueryBuilder('user'), ps.sinceId, ps.untilId) .andWhere(`user.host = :host`, { host: ps.host }); const users = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Users.packMany(users, me, { detail: true }); diff --git a/packages/backend/src/server/api/endpoints/following/create.ts b/packages/backend/src/server/api/endpoints/following/create.ts index b840ab7696..1edb3517a0 100644 --- a/packages/backend/src/server/api/endpoints/following/create.ts +++ b/packages/backend/src/server/api/endpoints/following/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import ms from 'ms'; import create from '@/services/following/create'; import define from '../../define'; @@ -20,12 +18,6 @@ export const meta = { kind: 'write:following', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -65,8 +57,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const follower = user; // 自分自身 diff --git a/packages/backend/src/server/api/endpoints/following/delete.ts b/packages/backend/src/server/api/endpoints/following/delete.ts index 4cd0c49452..2eb8636816 100644 --- a/packages/backend/src/server/api/endpoints/following/delete.ts +++ b/packages/backend/src/server/api/endpoints/following/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import ms from 'ms'; import deleteFollowing from '@/services/following/delete'; import define from '../../define'; @@ -19,12 +17,6 @@ export const meta = { kind: 'write:following', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -52,8 +44,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const follower = user; // Check if the followee is yourself diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index 92e887e00b..8a1da3d299 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import * as ms from 'ms'; import deleteFollowing from '@/services/following/delete'; import define from '../../define'; @@ -19,12 +17,6 @@ export const meta = { kind: 'write:following', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -52,8 +44,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const followee = user; // Check if the follower is yourself diff --git a/packages/backend/src/server/api/endpoints/following/requests/accept.ts b/packages/backend/src/server/api/endpoints/following/requests/accept.ts index 7e7c056f55..7040efcc80 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/accept.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/accept.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import acceptFollowRequest from '@/services/following/requests/accept'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:following', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch follower const follower = await getUser(ps.userId).catch(e => { if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index c9abbf36de..4204f8526a 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import cancelFollowRequest from '@/services/following/requests/cancel'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -14,12 +12,6 @@ export const meta = { kind: 'write:following', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -41,8 +33,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch followee const followee = await getUser(ps.userId).catch(e => { if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index ec0c76502c..17d576d1c0 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -35,8 +35,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const reqs = await FollowRequests.find({ followeeId: user.id, }); diff --git a/packages/backend/src/server/api/endpoints/following/requests/reject.ts b/packages/backend/src/server/api/endpoints/following/requests/reject.ts index a5ce1e7c77..9e345aa15f 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/reject.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/reject.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { rejectFollowRequest } from '@/services/following/reject'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:following', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch follower const follower = await getUser(ps.userId).catch(e => { if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index ff7c16889f..6b347f9dea 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -17,8 +17,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = GalleryPosts.createQueryBuilder('post') .andWhere('post.createdAt > :date', { date: new Date(Date.now() - (1000 * 60 * 60 * 24 * 3)) }) .andWhere('post.likedCount > 0') diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 2c3368a19d..57ead79826 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -17,8 +17,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = GalleryPosts.createQueryBuilder('post') .andWhere('post.likedCount > 0') .orderBy('post.likedCount', 'DESC'); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index 9d2601c7e9..c36e80b83c 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { GalleryPosts } from '@/models/index'; @@ -7,21 +5,6 @@ import { GalleryPosts } from '@/models/index'; export const meta = { tags: ['gallery'], - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -33,12 +16,22 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(GalleryPosts.createQueryBuilder('post'), ps.sinceId, ps.untilId) .innerJoinAndSelect('post.user', 'user'); - const posts = await query.take(ps.limit!).getMany(); + const posts = await query.take(ps.limit).getMany(); return await GalleryPosts.packMany(posts, me); }); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index e9d5df1ab6..d64937d0bc 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -1,7 +1,5 @@ -import $ from 'cafy'; import ms from 'ms'; import define from '../../../define'; -import { ID } from '../../../../../misc/cafy-id'; import { DriveFiles, GalleryPosts } from '@/models/index'; import { genId } from '../../../../../misc/gen-id'; import { GalleryPost } from '@/models/entities/gallery-post'; @@ -20,25 +18,6 @@ export const meta = { max: 300, }, - params: { - title: { - validator: $.str.min(1), - }, - - description: { - validator: $.optional.nullable.str, - }, - - fileIds: { - validator: $.arr($.type(ID)).unique().range(1, 32), - }, - - isSensitive: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -50,8 +29,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + title: { type: 'string', minLength: 1 }, + description: { type: 'string', nullable: true }, + fileIds: { type: 'array', uniqueItems: true, minItems: 1, maxItems: 32, items: { + type: 'string', format: 'misskey:id', + } }, + isSensitive: { type: 'boolean', default: false }, + }, + required: ['title', 'fileIds'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const files = (await Promise.all(ps.fileIds.map(fileId => DriveFiles.findOne({ id: fileId, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index 2a13b9ed58..82ffd62d60 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -1,8 +1,6 @@ -import $ from 'cafy'; import define from '../../../define'; import { ApiError } from '../../../error'; import { GalleryPosts } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['gallery'], @@ -11,12 +9,6 @@ export const meta = { kind: 'write:gallery', - params: { - postId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPost: { message: 'No such post.', @@ -26,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + postId: { type: 'string', format: 'misskey:id' }, + }, + required: ['postId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const post = await GalleryPosts.findOne({ id: ps.postId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index 0fb408fa5f..73d5a0ea99 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { GalleryPosts, GalleryLikes } from '@/models/index'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:gallery-likes', - params: { - postId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPost: { message: 'No such post.', @@ -39,8 +31,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + postId: { type: 'string', format: 'misskey:id' }, + }, + required: ['postId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const post = await GalleryPosts.findOne(ps.postId); if (post == null) { throw new ApiError(meta.errors.noSuchPost); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts index 4325d2ad37..819d360b14 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { GalleryPosts } from '@/models/index'; @@ -9,12 +7,6 @@ export const meta = { requireCredential: false, - params: { - postId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPost: { message: 'No such post.', @@ -30,8 +22,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + postId: { type: 'string', format: 'misskey:id' }, + }, + required: ['postId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const post = await GalleryPosts.findOne({ id: ps.postId, }); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index 9cca09bddc..fc38174810 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { GalleryPosts, GalleryLikes } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:gallery-likes', - params: { - postId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPost: { message: 'No such post.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + postId: { type: 'string', format: 'misskey:id' }, + }, + required: ['postId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const post = await GalleryPosts.findOne(ps.postId); if (post == null) { throw new ApiError(meta.errors.noSuchPost); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index c35e1bbf58..1a86b56bc6 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -1,7 +1,5 @@ -import $ from 'cafy'; import ms from 'ms'; import define from '../../../define'; -import { ID } from '../../../../../misc/cafy-id'; import { DriveFiles, GalleryPosts } from '@/models/index'; import { GalleryPost } from '@/models/entities/gallery-post'; import { ApiError } from '../../../error'; @@ -19,29 +17,6 @@ export const meta = { max: 300, }, - params: { - postId: { - validator: $.type(ID), - }, - - title: { - validator: $.str.min(1), - }, - - description: { - validator: $.optional.nullable.str, - }, - - fileIds: { - validator: $.arr($.type(ID)).unique().range(1, 32), - }, - - isSensitive: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -53,8 +28,22 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + postId: { type: 'string', format: 'misskey:id' }, + title: { type: 'string', minLength: 1 }, + description: { type: 'string', nullable: true }, + fileIds: { type: 'array', uniqueItems: true, minItems: 1, maxItems: 32, items: { + type: 'string', format: 'misskey:id', + } }, + isSensitive: { type: 'boolean', default: false }, + }, + required: ['postId', 'title', 'fileIds'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const files = (await Promise.all(ps.fileIds.map(fileId => DriveFiles.findOne({ id: fileId, diff --git a/packages/backend/src/server/api/endpoints/get-online-users-count.ts b/packages/backend/src/server/api/endpoints/get-online-users-count.ts index 5b13d5a3b8..855b9fc342 100644 --- a/packages/backend/src/server/api/endpoints/get-online-users-count.ts +++ b/packages/backend/src/server/api/endpoints/get-online-users-count.ts @@ -7,13 +7,16 @@ export const meta = { tags: ['meta'], requireCredential: false, +} as const; - params: { - }, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const count = await Users.count({ lastActiveDate: MoreThan(new Date(Date.now() - USER_ONLINE_THRESHOLD)), }); diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 9fa9b3edc6..68f2b2bf57 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Hashtags } from '@/models/index'; @@ -7,45 +6,6 @@ export const meta = { requireCredential: false, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - attachedToUserOnly: { - validator: $.optional.bool, - default: false, - }, - - attachedToLocalUserOnly: { - validator: $.optional.bool, - default: false, - }, - - attachedToRemoteUserOnly: { - validator: $.optional.bool, - default: false, - }, - - sort: { - validator: $.str.or([ - '+mentionedUsers', - '-mentionedUsers', - '+mentionedLocalUsers', - '-mentionedLocalUsers', - '+mentionedRemoteUsers', - '-mentionedRemoteUsers', - '+attachedUsers', - '-attachedUsers', - '+attachedLocalUsers', - '-attachedLocalUsers', - '+attachedRemoteUsers', - '-attachedRemoteUsers', - ]), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -57,8 +17,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + attachedToUserOnly: { type: 'boolean', default: false }, + attachedToLocalUserOnly: { type: 'boolean', default: false }, + attachedToRemoteUserOnly: { type: 'boolean', default: false }, + sort: { type: 'string', enum: ['+mentionedUsers', '-mentionedUsers', '+mentionedLocalUsers', '-mentionedLocalUsers', '+mentionedRemoteUsers', '-mentionedRemoteUsers', '+attachedUsers', '-attachedUsers', '+attachedLocalUsers', '-attachedLocalUsers', '+attachedRemoteUsers', '-attachedRemoteUsers'] }, + }, + required: ['sort'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Hashtags.createQueryBuilder('tag'); if (ps.attachedToUserOnly) query.andWhere('tag.attachedUsersCount != 0'); @@ -90,7 +62,7 @@ export default define(meta, async (ps, me) => { 'tag.attachedRemoteUsersCount', ]); - const tags = await query.take(ps.limit!).getMany(); + const tags = await query.take(ps.limit).getMany(); return Hashtags.packMany(tags); }); diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 0d646c64f5..9aa08ed28e 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Hashtags } from '@/models/index'; @@ -7,22 +6,6 @@ export const meta = { requireCredential: false, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - query: { - validator: $.str, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -33,13 +16,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + query: { type: 'string' }, + offset: { type: 'integer', default: 0 }, + }, + required: ['query'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const hashtags = await Hashtags.createQueryBuilder('tag') .where('tag.name like :q', { q: ps.query.toLowerCase() + '%' }) .orderBy('tag.count', 'DESC') .groupBy('tag.id') - .take(ps.limit!) + .take(ps.limit) .skip(ps.offset) .getMany(); diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index 242cef99d4..79b9613086 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { Hashtags } from '@/models/index'; @@ -9,12 +8,6 @@ export const meta = { requireCredential: false, - params: { - tag: { - validator: $.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -30,8 +23,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + tag: { type: 'string' }, + }, + required: ['tag'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const hashtag = await Hashtags.findOne({ name: normalizeForSearch(ps.tag) }); if (hashtag == null) { throw new ApiError(meta.errors.noSuchHashtag); diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index be964ad639..de3e453c3e 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -53,8 +53,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const instance = await fetchMeta(true); const hiddenTags = instance.hiddenTags.map(t => normalizeForSearch(t)); diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index 2158dc4349..1760732c1a 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Users } from '@/models/index'; import { normalizeForSearch } from '@/misc/normalize-for-search'; @@ -8,45 +7,6 @@ export const meta = { tags: ['hashtags', 'users'], - params: { - tag: { - validator: $.str, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sort: { - validator: $.str.or([ - '+follower', - '-follower', - '+createdAt', - '-createdAt', - '+updatedAt', - '-updatedAt', - ]), - }, - - state: { - validator: $.optional.str.or([ - 'all', - 'alive', - ]), - default: 'all', - }, - - origin: { - validator: $.optional.str.or([ - 'combined', - 'local', - 'remote', - ]), - default: 'local', - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -58,8 +18,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + tag: { type: 'string' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] }, + state: { type: 'string', enum: ['all', 'alive'], default: "all" }, + origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "local" }, + }, + required: ['tag', 'sort'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Users.createQueryBuilder('user') .where(':tag = ANY(user.tags)', { tag: normalizeForSearch(ps.tag) }); @@ -84,7 +56,7 @@ export default define(meta, async (ps, me) => { case '-updatedAt': query.orderBy('user.updatedAt', 'ASC'); break; } - const users = await query.take(ps.limit!).getMany(); + const users = await query.take(ps.limit).getMany(); return await Users.packMany(users, me, { detail: true }); }); diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index d69c118cfc..091276ea27 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -6,8 +6,6 @@ export const meta = { requireCredential: true, - params: {}, - res: { type: 'object', optional: false, nullable: false, @@ -15,8 +13,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user, token) => { +export default define(meta, paramDef, async (ps, user, token) => { const isSecure = token == null; // ここで渡ってきている user はキャッシュされていて古い可能性もあるので id だけ渡す diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index 4853908693..8d82ab3886 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as speakeasy from 'speakeasy'; import define from '../../../define'; import { UserProfiles } from '@/models/index'; @@ -7,16 +6,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - token: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + token: { type: 'string' }, }, + required: ['token'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const token = ps.token.replace(/\s/g, ''); const profile = await UserProfiles.findOneOrFail(user.id); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts index 26e9a60886..5052afda97 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import { promisify } from 'util'; import * as cbor from 'cbor'; @@ -14,35 +13,28 @@ import { procedures, hash } from '../../../2fa'; import { publishMainStream } from '@/services/stream'; const cborDecodeFirst = promisify(cbor.decodeFirst) as any; +const rpIdHashReal = hash(Buffer.from(config.hostname, 'utf-8')); export const meta = { requireCredential: true, secure: true, - - params: { - clientDataJSON: { - validator: $.str, - }, - attestationObject: { - validator: $.str, - }, - password: { - validator: $.str, - }, - challengeId: { - validator: $.str, - }, - name: { - validator: $.str, - }, - }, } as const; -const rpIdHashReal = hash(Buffer.from(config.hostname, 'utf-8')); +const paramDef = { + type: 'object', + properties: { + clientDataJSON: { type: 'string' }, + attestationObject: { type: 'string' }, + password: { type: 'string' }, + challengeId: { type: 'string' }, + name: { type: 'string' }, + }, + required: ['clientDataJSON', 'attestationObject', 'password', 'challengeId', 'name'], +} as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts index 854848a434..2830f8994a 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { UserProfiles } from '@/models/index'; @@ -6,16 +5,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - value: { - validator: $.boolean, - }, +const paramDef = { + type: 'object', + properties: { + value: { type: 'boolean' }, }, + required: ['value'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { await UserProfiles.update(user.id, { usePasswordLessLogin: ps.value, }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts index 057e54c69b..da3ff421a7 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import define from '../../../define'; import { UserProfiles, AttestationChallenges } from '@/models/index'; @@ -13,16 +12,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - password: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, }, + required: ['password'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index c5cfb9dfad..32acc838b7 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; import * as QRCode from 'qrcode'; @@ -10,16 +9,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - password: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, }, + required: ['password'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts index 03e1d0434d..3004ce36a1 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import define from '../../../define'; import { UserProfiles, UserSecurityKeys, Users } from '@/models/index'; @@ -8,19 +7,19 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - password: { - validator: $.str, - }, - credentialId: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, + credentialId: { type: 'string' }, }, + required: ['password', 'credentialId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts index a19ad6810d..b8e89bac72 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import define from '../../../define'; import { UserProfiles } from '@/models/index'; @@ -7,16 +6,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - password: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, }, + required: ['password'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/apps.ts b/packages/backend/src/server/api/endpoints/i/apps.ts index 63999b0981..f45b6745b8 100644 --- a/packages/backend/src/server/api/endpoints/i/apps.ts +++ b/packages/backend/src/server/api/endpoints/i/apps.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { AccessTokens } from '@/models/index'; @@ -6,21 +5,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - sort: { - validator: $.optional.str.or([ - '+createdAt', - '-createdAt', - '+lastUsedAt', - '-lastUsedAt', - ]), - }, +const paramDef = { + type: 'object', + properties: { + sort: { type: 'string', enum: ['+createdAt', '-createdAt', '+lastUsedAt', '-lastUsedAt'] }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = AccessTokens.createQueryBuilder('token') .where('token.userId = :userId', { userId: user.id }); diff --git a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts index 52122b851b..e417f3e81a 100644 --- a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts +++ b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { AccessTokens, Apps } from '@/models/index'; @@ -6,33 +5,26 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - - sort: { - validator: $.optional.str.or('desc|asc'), - default: 'desc', - }, +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + sort: { type: 'string', enum: ['desc', 'asc'], default: "desc" }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Get tokens const tokens = await AccessTokens.find({ where: { userId: user.id, }, - take: ps.limit!, + take: ps.limit, skip: ps.offset, order: { id: ps.sort == 'asc' ? 1 : -1, diff --git a/packages/backend/src/server/api/endpoints/i/change-password.ts b/packages/backend/src/server/api/endpoints/i/change-password.ts index 7b6c137737..eac60ee183 100644 --- a/packages/backend/src/server/api/endpoints/i/change-password.ts +++ b/packages/backend/src/server/api/endpoints/i/change-password.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import define from '../../define'; import { UserProfiles } from '@/models/index'; @@ -7,20 +6,19 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - currentPassword: { - validator: $.str, - }, - - newPassword: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + currentPassword: { type: 'string' }, + newPassword: { type: 'string', minLength: 1 }, }, + required: ['currentPassword', 'newPassword'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index e1eee949fc..6f689c0b4e 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import define from '../../define'; import { UserProfiles, Users } from '@/models/index'; @@ -10,16 +9,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - password: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, }, + required: ['password'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); const userDetailed = await Users.findOneOrFail(user.id); if (userDetailed.isDeleted) { diff --git a/packages/backend/src/server/api/endpoints/i/export-blocking.ts b/packages/backend/src/server/api/endpoints/i/export-blocking.ts index 44d8a1cb38..afa6f2fc8e 100644 --- a/packages/backend/src/server/api/endpoints/i/export-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/export-blocking.ts @@ -11,7 +11,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createExportBlockingJob(user); }); diff --git a/packages/backend/src/server/api/endpoints/i/export-following.ts b/packages/backend/src/server/api/endpoints/i/export-following.ts index 5d1617d57b..4dd8cda398 100644 --- a/packages/backend/src/server/api/endpoints/i/export-following.ts +++ b/packages/backend/src/server/api/endpoints/i/export-following.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { createExportFollowingJob } from '@/queue/index'; import ms from 'ms'; @@ -10,19 +9,18 @@ export const meta = { duration: ms('1hour'), max: 1, }, - params: { - excludeMuting: { - validator: $.optional.bool, - default: false, - }, - excludeInactive: { - validator: $.optional.bool, - default: false, - }, +} as const; + +const paramDef = { + type: 'object', + properties: { + excludeMuting: { type: 'boolean', default: false }, + excludeInactive: { type: 'boolean', default: false }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createExportFollowingJob(user, ps.excludeMuting, ps.excludeInactive); }); diff --git a/packages/backend/src/server/api/endpoints/i/export-mute.ts b/packages/backend/src/server/api/endpoints/i/export-mute.ts index 27ce8f0b29..ca8a7b997c 100644 --- a/packages/backend/src/server/api/endpoints/i/export-mute.ts +++ b/packages/backend/src/server/api/endpoints/i/export-mute.ts @@ -11,7 +11,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createExportMuteJob(user); }); diff --git a/packages/backend/src/server/api/endpoints/i/export-notes.ts b/packages/backend/src/server/api/endpoints/i/export-notes.ts index 25b1849e80..fc155d9d0f 100644 --- a/packages/backend/src/server/api/endpoints/i/export-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/export-notes.ts @@ -11,7 +11,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createExportNotesJob(user); }); diff --git a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts index d28b699c5a..22cbf973f8 100644 --- a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts @@ -11,7 +11,13 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { createExportUserListsJob(user); }); diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index 92c767876b..45f5d99cce 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { NoteFavorites } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:favorites', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,14 +20,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(NoteFavorites.createQueryBuilder('favorite'), ps.sinceId, ps.untilId) .andWhere(`favorite.userId = :meId`, { meId: user.id }) .leftJoinAndSelect('favorite.note', 'note'); const favorites = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await NoteFavorites.packMany(favorites, user); diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index f1c5763593..dc862a6b05 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { GalleryLikes } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:gallery-likes', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -44,14 +27,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(GalleryLikes.createQueryBuilder('like'), ps.sinceId, ps.untilId) .andWhere(`like.userId = :meId`, { meId: user.id }) .leftJoinAndSelect('like.post', 'post'); const likes = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await GalleryLikes.packMany(likes, user); diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index d46d42f633..fbab8795ca 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { GalleryPosts } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:gallery', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,13 +20,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(GalleryPosts.createQueryBuilder('post'), ps.sinceId, ps.untilId) .andWhere(`post.userId = :meId`, { meId: user.id }); const posts = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await GalleryPosts.packMany(posts, user); diff --git a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts index 4e1a4d3db9..2b31b89ff1 100644 --- a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -8,9 +8,6 @@ export const meta = { kind: 'read:account', - params: { - }, - res: { type: 'object', optional: false, nullable: false, @@ -23,8 +20,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { return { count: await MutedNotes.count({ userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index acc5797420..b90bfb1402 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { createImportBlockingJob } from '@/queue/index'; import ms from 'ms'; @@ -15,12 +13,6 @@ export const meta = { max: 1, }, - params: { - fileId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -48,8 +40,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) throw new ApiError(meta.errors.noSuchFile); diff --git a/packages/backend/src/server/api/endpoints/i/import-following.ts b/packages/backend/src/server/api/endpoints/i/import-following.ts index 35006746fb..75388502a5 100644 --- a/packages/backend/src/server/api/endpoints/i/import-following.ts +++ b/packages/backend/src/server/api/endpoints/i/import-following.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { createImportFollowingJob } from '@/queue/index'; import ms from 'ms'; @@ -14,12 +12,6 @@ export const meta = { max: 1, }, - params: { - fileId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -47,8 +39,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) throw new ApiError(meta.errors.noSuchFile); diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index 7bbb2e008e..e1c3df33e1 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { createImportMutingJob } from '@/queue/index'; import ms from 'ms'; @@ -15,12 +13,6 @@ export const meta = { max: 1, }, - params: { - fileId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -48,8 +40,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) throw new ApiError(meta.errors.noSuchFile); diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index 759d41b6cd..eb1302a98c 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { createImportUserListsJob } from '@/queue/index'; import ms from 'ms'; @@ -14,12 +12,6 @@ export const meta = { max: 1, }, - params: { - fileId: { - validator: $.type(ID), - }, - }, - errors: { noSuchFile: { message: 'No such file.', @@ -47,8 +39,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: ['fileId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOne(ps.fileId); if (file == null) throw new ApiError(meta.errors.noSuchFile); diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index 59efd32bb2..bb1d6a49b3 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { readNotification } from '../../common/read-notification'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -16,44 +14,6 @@ export const meta = { kind: 'read:notifications', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - following: { - validator: $.optional.bool, - default: false, - }, - - unreadOnly: { - validator: $.optional.bool, - default: false, - }, - - markAsRead: { - validator: $.optional.bool, - default: true, - }, - - includeTypes: { - validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])), - }, - - excludeTypes: { - validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -65,8 +25,27 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + following: { type: 'boolean', default: false }, + unreadOnly: { type: 'boolean', default: false }, + markAsRead: { type: 'boolean', default: true }, + includeTypes: { type: 'array', items: { + type: 'string', enum: notificationTypes, + } }, + excludeTypes: { type: 'array', items: { + type: 'string', enum: notificationTypes, + } }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // includeTypes が空の場合はクエリしない if (ps.includeTypes && ps.includeTypes.length === 0) { return []; @@ -125,7 +104,7 @@ export default define(meta, async (ps, user) => { query.andWhere(`notification.isRead = false`); } - const notifications = await query.take(ps.limit!).getMany(); + const notifications = await query.take(ps.limit).getMany(); // Mark all as read if (notifications.length > 0 && ps.markAsRead) { diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 59239c7446..e66bc616c2 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { PageLikes } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:page-likes', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -44,14 +27,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(PageLikes.createQueryBuilder('like'), ps.sinceId, ps.untilId) .andWhere(`like.userId = :meId`, { meId: user.id }) .leftJoinAndSelect('like.page', 'page'); const likes = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await PageLikes.packMany(likes, user); diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index bef775d063..dbc58021b9 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Pages } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:pages', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,13 +20,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId) .andWhere(`page.userId = :meId`, { meId: user.id }); const pages = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Pages.packMany(pages); diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index a940d1b99b..a09618ebe8 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { addPinned } from '@/services/i/pin'; import define from '../../define'; import { ApiError } from '../../error'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -45,8 +37,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { await addPinned(user, ps.noteId).catch(e => { if (e.id === '70c4e51f-5bea-449c-a030-53bee3cce202') throw new ApiError(meta.errors.noSuchNote); if (e.id === '15a018eb-58e5-4da1-93be-330fcc5e4e1a') throw new ApiError(meta.errors.pinLimitExceeded); diff --git a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts index 4e4fb3840f..b0185a3e37 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -8,13 +8,16 @@ export const meta = { requireCredential: true, kind: 'write:account', +} as const; - params: { - }, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Update documents await MessagingMessages.update({ recipientId: user.id, diff --git a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts index 99f17ddfc9..45638c2579 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -8,13 +8,16 @@ export const meta = { requireCredential: true, kind: 'write:account', +} as const; - params: { - }, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Remove documents await NoteUnreads.delete({ userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/i/read-announcement.ts b/packages/backend/src/server/api/endpoints/i/read-announcement.ts index e9bb66264b..f3cedddb35 100644 --- a/packages/backend/src/server/api/endpoints/i/read-announcement.ts +++ b/packages/backend/src/server/api/endpoints/i/read-announcement.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { genId } from '@/misc/gen-id'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:account', - params: { - announcementId: { - validator: $.type(ID), - }, - }, - errors: { noSuchAnnouncement: { message: 'No such announcement.', @@ -28,8 +20,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + announcementId: { type: 'string', format: 'misskey:id' }, + }, + required: ['announcementId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Check if announcement exists const announcement = await Announcements.findOne(ps.announcementId); diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts index a20719363b..71a3ea08af 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import { publishMainStream, publishUserEvent } from '@/services/stream'; import generateUserToken from '../../common/generate-native-user-token'; @@ -9,16 +8,18 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - password: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, }, + required: ['password'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts index 2941b441e2..0429cd283a 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; @@ -6,17 +5,20 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, +const paramDef = { + type: 'object', + properties: { + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .where('item.domain IS NULL') .andWhere('item.userId = :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts index 51371353c9..194a922718 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; import { ApiError } from '../../../error'; @@ -8,17 +7,6 @@ export const meta = { secure: true, - params: { - key: { - validator: $.str, - }, - - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, - }, - errors: { noSuchKey: { message: 'No such key.', @@ -28,8 +16,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + key: { type: 'string' }, + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, + }, + required: ['key'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .where('item.domain IS NULL') .andWhere('item.userId = :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/registry/get.ts b/packages/backend/src/server/api/endpoints/i/registry/get.ts index ac617defb0..7d413e3528 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; import { ApiError } from '../../../error'; @@ -8,17 +7,6 @@ export const meta = { secure: true, - params: { - key: { - validator: $.str, - }, - - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, - }, - errors: { noSuchKey: { message: 'No such key.', @@ -28,8 +16,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + key: { type: 'string' }, + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, + }, + required: ['key'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .where('item.domain IS NULL') .andWhere('item.userId = :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index 0445922188..52e0d6fac5 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; @@ -6,17 +5,20 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, +const paramDef = { + type: 'object', + properties: { + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .where('item.domain IS NULL') .andWhere('item.userId = :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys.ts b/packages/backend/src/server/api/endpoints/i/registry/keys.ts index a3c9d0e5ee..c494ed8f5c 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; @@ -6,17 +5,20 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, +const paramDef = { + type: 'object', + properties: { + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .select('item.key') .where('item.domain IS NULL') diff --git a/packages/backend/src/server/api/endpoints/i/registry/remove.ts b/packages/backend/src/server/api/endpoints/i/registry/remove.ts index 08185f224b..5bc55bd297 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/remove.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/remove.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; import { ApiError } from '../../../error'; @@ -8,17 +7,6 @@ export const meta = { secure: true, - params: { - key: { - validator: $.str, - }, - - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, - }, - errors: { noSuchKey: { message: 'No such key.', @@ -28,8 +16,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + key: { type: 'string' }, + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, + }, + required: ['key'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .where('item.domain IS NULL') .andWhere('item.userId = :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index 9de68ac6e8..e04d123a1f 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts @@ -5,13 +5,16 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - }, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .select('item.scope') .where('item.domain IS NULL') diff --git a/packages/backend/src/server/api/endpoints/i/registry/set.ts b/packages/backend/src/server/api/endpoints/i/registry/set.ts index 27884046b4..c78f4383be 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/set.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/set.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import { publishMainStream } from '@/services/stream'; import define from '../../../define'; import { RegistryItems } from '@/models/index'; @@ -8,25 +7,22 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - key: { - validator: $.str.min(1), - }, - - value: { - validator: $.nullable.any, - }, - - scope: { - validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), - default: [], - }, +const paramDef = { + type: 'object', + properties: { + key: { type: 'string', minLength: 1 }, + value: {}, + scope: { type: 'array', default: [], items: { + type: 'string', pattern: /^[a-zA-Z0-9_]+$/.toString().slice(1, -1), + } }, }, + required: ['key', 'value'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = RegistryItems.createQueryBuilder('item') .where('item.domain IS NULL') .andWhere('item.userId = :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/revoke-token.ts b/packages/backend/src/server/api/endpoints/i/revoke-token.ts index 51721c5b58..14800346c1 100644 --- a/packages/backend/src/server/api/endpoints/i/revoke-token.ts +++ b/packages/backend/src/server/api/endpoints/i/revoke-token.ts @@ -1,23 +1,23 @@ -import $ from 'cafy'; import define from '../../define'; import { AccessTokens } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; import { publishUserEvent } from '@/services/stream'; export const meta = { requireCredential: true, secure: true, +} as const; - params: { - tokenId: { - validator: $.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + tokenId: { type: 'string', format: 'misskey:id' }, }, + required: ['tokenId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const token = await AccessTokens.findOne(ps.tokenId); if (token) { diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index 796e2ec309..468972c239 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Signins } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -8,29 +6,24 @@ export const meta = { requireCredential: true, secure: true, +} as const; - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, }, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Signins.createQueryBuilder('signin'), ps.sinceId, ps.untilId) .andWhere(`signin.userId = :meId`, { meId: user.id }); - const history = await query.take(ps.limit!).getMany(); + const history = await query.take(ps.limit).getMany(); return await Promise.all(history.map(record => Signins.pack(record))); }); diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index 9c82b74960..895bfd0c28 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { removePinned } from '@/services/i/pin'; import define from '../../define'; import { ApiError } from '../../error'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -33,8 +25,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { await removePinned(user, ps.noteId).catch(e => { if (e.id === 'b302d4cf-c050-400a-bbb3-be208681f40c') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index b4479aa50d..1450eabc2a 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import { publishMainStream } from '@/services/stream'; import define from '../../define'; import rndstr from 'rndstr'; @@ -20,16 +19,6 @@ export const meta = { max: 3, }, - params: { - password: { - validator: $.str, - }, - - email: { - validator: $.optional.nullable.str, - }, - }, - errors: { incorrectPassword: { message: 'Incorrect password.', @@ -45,8 +34,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + password: { type: 'string' }, + email: { type: 'string', nullable: true }, + }, + required: ['password'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const profile = await UserProfiles.findOneOrFail(user.id); // Compare password diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index aec7bbd2e1..0a5188609b 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -1,7 +1,5 @@ const RE2 = require('re2'); -import $ from 'cafy'; import * as mfm from 'mfm-js'; -import { ID } from '@/misc/cafy-id'; import { publishMainStream, publishUserEvent } from '@/services/stream'; import acceptAllFollowRequests from '@/services/following/requests/accept-all'; import { publishToFollowers } from '@/services/i/update'; @@ -24,116 +22,6 @@ export const meta = { kind: 'write:account', - params: { - name: { - validator: $.optional.nullable.use(Users.validateName), - }, - - description: { - validator: $.optional.nullable.use(Users.validateDescription), - }, - - lang: { - validator: $.optional.nullable.str.or(Object.keys(langmap)), - }, - - location: { - validator: $.optional.nullable.use(Users.validateLocation), - }, - - birthday: { - validator: $.optional.nullable.use(Users.validateBirthday), - }, - - avatarId: { - validator: $.optional.nullable.type(ID), - }, - - bannerId: { - validator: $.optional.nullable.type(ID), - }, - - fields: { - validator: $.optional.arr($.object()).range(1, 4), - }, - - isLocked: { - validator: $.optional.bool, - }, - - isExplorable: { - validator: $.optional.bool, - }, - - hideOnlineStatus: { - validator: $.optional.bool, - }, - - publicReactions: { - validator: $.optional.bool, - }, - - ffVisibility: { - validator: $.optional.str, - }, - - carefulBot: { - validator: $.optional.bool, - }, - - autoAcceptFollowed: { - validator: $.optional.bool, - }, - - noCrawle: { - validator: $.optional.bool, - }, - - isBot: { - validator: $.optional.bool, - }, - - isCat: { - validator: $.optional.bool, - }, - - showTimelineReplies: { - validator: $.optional.bool, - }, - - injectFeaturedNote: { - validator: $.optional.bool, - }, - - receiveAnnouncementEmail: { - validator: $.optional.bool, - }, - - alwaysMarkNsfw: { - validator: $.optional.bool, - }, - - pinnedPageId: { - validator: $.optional.nullable.type(ID), - }, - - mutedWords: { - validator: $.optional.arr($.either($.arr($.str.min(1)).min(1), $.str)), - }, - - mutedInstances: { - validator: $.optional.arr($.str), - }, - - mutingNotificationTypes: { - validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])), - }, - - emailNotificationTypes: { - validator: $.optional.arr($.str), - }, - }, - errors: { noSuchAvatar: { message: 'No such avatar file.', @@ -179,8 +67,60 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { ...Users.nameSchema, nullable: true }, + description: { ...Users.descriptionSchema, nullable: true }, + location: { ...Users.locationSchema, nullable: true }, + birthday: { ...Users.birthdaySchema, nullable: true }, + lang: { type: 'string', enum: Object.keys(langmap), nullable: true }, + avatarId: { type: 'string', format: 'misskey:id', nullable: true }, + bannerId: { type: 'string', format: 'misskey:id', nullable: true }, + fields: { type: 'array', + minItems: 0, + maxItems: 8, + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' }, + }, + required: ['name', 'value'], + }, + }, + isLocked: { type: 'boolean' }, + isExplorable: { type: 'boolean' }, + hideOnlineStatus: { type: 'boolean' }, + publicReactions: { type: 'boolean' }, + carefulBot: { type: 'boolean' }, + autoAcceptFollowed: { type: 'boolean' }, + noCrawle: { type: 'boolean' }, + isBot: { type: 'boolean' }, + isCat: { type: 'boolean' }, + showTimelineReplies: { type: 'boolean' }, + injectFeaturedNote: { type: 'boolean' }, + receiveAnnouncementEmail: { type: 'boolean' }, + alwaysMarkNsfw: { type: 'boolean' }, + ffVisibility: { type: 'string', enum: ['public', 'followers', 'private'] }, + pinnedPageId: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, + mutedWords: { type: 'array' }, + mutedInstances: { type: 'array', items: { + type: 'string', + } }, + mutingNotificationTypes: { type: 'array', items: { + type: 'string', enum: notificationTypes, + } }, + emailNotificationTypes: { type: 'array', items: { + type: 'string', + } }, + }, +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, _user, token) => { +export default define(meta, paramDef, async (ps, _user, token) => { const user = await Users.findOneOrFail(_user.id); const isSecure = token == null; diff --git a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts index 76a3131e6d..6c38240913 100644 --- a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts +++ b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { UserGroupInvitations } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:user-groups', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -48,14 +31,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(UserGroupInvitations.createQueryBuilder('invitation'), ps.sinceId, ps.untilId) .andWhere(`invitation.userId = :meId`, { meId: user.id }) .leftJoinAndSelect('invitation.userGroup', 'user_group'); const invitations = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await UserGroupInvitations.packMany(invitations); diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index 5ac49cf96b..5c1c040cc3 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { MessagingMessage } from '@/models/entities/messaging-message'; import { MessagingMessages, Mutings, UserGroupJoinings } from '@/models/index'; @@ -11,18 +10,6 @@ export const meta = { kind: 'read:messaging', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - group: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -34,8 +21,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + group: { type: 'boolean', default: false }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const mute = await Mutings.find({ muterId: user.id, }); @@ -50,7 +46,7 @@ export default define(meta, async (ps, user) => { const history: MessagingMessage[] = []; - for (let i = 0; i < ps.limit!; i++) { + for (let i = 0; i < ps.limit; i++) { const found = ps.group ? history.map(m => m.groupId!) : history.map(m => (m.userId === user.id) ? m.recipientId! : m.userId!); diff --git a/packages/backend/src/server/api/endpoints/messaging/messages.ts b/packages/backend/src/server/api/endpoints/messaging/messages.ts index 7dbddd80e2..ce477feac4 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { getUser } from '../../common/getters'; @@ -15,34 +13,6 @@ export const meta = { kind: 'read:messaging', - params: { - userId: { - validator: $.optional.type(ID), - }, - - groupId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - markAsRead: { - validator: $.optional.bool, - default: true, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -74,8 +44,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + groupId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + markAsRead: { type: 'boolean', default: true }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { if (ps.userId != null) { // Fetch recipient (user) const recipient = await getUser(ps.userId).catch(e => { @@ -97,7 +80,7 @@ export default define(meta, async (ps, user) => { .setParameter('meId', user.id) .setParameter('recipientId', recipient.id); - const messages = await query.take(ps.limit!).getMany(); + const messages = await query.take(ps.limit).getMany(); // Mark all as read if (ps.markAsRead) { @@ -133,7 +116,7 @@ export default define(meta, async (ps, user) => { const query = makePaginationQuery(MessagingMessages.createQueryBuilder('message'), ps.sinceId, ps.untilId) .andWhere(`message.groupId = :groupId`, { groupId: recipientGroup.id }); - const messages = await query.take(ps.limit!).getMany(); + const messages = await query.take(ps.limit).getMany(); // Mark all as read if (ps.markAsRead) { diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index 5ec16f5e5a..60b1e2cdce 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getUser } from '../../../common/getters'; @@ -15,24 +13,6 @@ export const meta = { kind: 'write:messaging', - params: { - userId: { - validator: $.optional.type(ID), - }, - - groupId: { - validator: $.optional.type(ID), - }, - - text: { - validator: $.optional.str.pipe(MessagingMessages.validateText), - }, - - fileId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -84,8 +64,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + groupId: { type: 'string', format: 'misskey:id' }, + text: { type: 'string', nullable: true, maxLength: 3000 }, + fileId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let recipientUser: User | undefined; let recipientGroup: UserGroup | undefined; diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts index 2975419cef..67ecd4a1e6 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import ms from 'ms'; import { ApiError } from '../../../error'; @@ -19,12 +17,6 @@ export const meta = { minInterval: ms('1sec'), }, - params: { - messageId: { - validator: $.type(ID), - }, - }, - errors: { noSuchMessage: { message: 'No such message.', @@ -34,8 +26,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + messageId: { type: 'string', format: 'misskey:id' }, + }, + required: ['messageId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const message = await MessagingMessages.findOne({ id: ps.messageId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts index 42c3f49f6f..1d0ddaf98f 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { MessagingMessages } from '@/models/index'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:messaging', - params: { - messageId: { - validator: $.type(ID), - }, - }, - errors: { noSuchMessage: { message: 'No such message.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + messageId: { type: 'string', format: 'misskey:id' }, + }, + required: ['messageId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const message = await MessagingMessages.findOne(ps.messageId); if (message == null) { diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 16ea99af69..fdd1586ca5 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import config from '@/config/index'; import define from '../define'; import { fetchMeta } from '@/misc/fetch-meta'; @@ -11,13 +10,6 @@ export const meta = { requireCredential: false, - params: { - detail: { - validator: $.optional.bool, - default: true, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -448,8 +440,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + detail: { type: 'boolean', default: true }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const instance = await fetchMeta(true); const emojis = await Emojis.find({ diff --git a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts index 158c8877e9..e61c78754f 100644 --- a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts +++ b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { AccessTokens } from '@/models/index'; import { genId } from '@/misc/gen-id'; @@ -11,28 +10,6 @@ export const meta = { secure: true, - params: { - session: { - validator: $.nullable.str, - }, - - name: { - validator: $.nullable.optional.str, - }, - - description: { - validator: $.nullable.optional.str, - }, - - iconUrl: { - validator: $.nullable.optional.str, - }, - - permission: { - validator: $.arr($.str).unique(), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -45,8 +22,22 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + session: { type: 'string', nullable: true }, + name: { type: 'string', nullable: true }, + description: { type: 'string', nullable: true }, + iconUrl: { type: 'string', nullable: true }, + permission: { type: 'array', uniqueItems: true, items: { + type: 'string', + } }, + }, + required: ['session', 'permission'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Generate access token const accessToken = secureRndstr(32, true); diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index 6ba5a453c3..3ef97a1491 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { getUser } from '../../common/getters'; @@ -15,12 +13,6 @@ export const meta = { kind: 'write:mutes', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -42,8 +34,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const muter = user; // 自分自身 diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 21948dc3d1..8a88e13039 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { getUser } from '../../common/getters'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:mutes', - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -40,8 +32,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const muter = user; // Check if the mutee is yourself diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index 4c6a81b63c..fd8443e2b7 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Mutings } from '@/models/index'; @@ -11,21 +9,6 @@ export const meta = { kind: 'read:mutes', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 30, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -37,13 +20,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Mutings.createQueryBuilder('muting'), ps.sinceId, ps.untilId) .andWhere(`muting.muterId = :meId`, { meId: me.id }); const mutings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Mutings.packMany(mutings, me); diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index 42bd5c5f75..60e5014110 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Apps } from '@/models/index'; @@ -7,18 +6,6 @@ export const meta = { requireCredential: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -69,15 +56,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = { userId: user.id, }; const apps = await Apps.find({ where: query, - take: ps.limit!, + take: ps.limit, skip: ps.offset, }); diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index 9edc6cb11c..0106bac516 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../define'; import { makePaginationQuery } from '../common/make-pagination-query'; import { Notes } from '@/models/index'; @@ -7,41 +5,6 @@ import { Notes } from '@/models/index'; export const meta = { tags: ['notes'], - params: { - local: { - validator: $.optional.bool, - }, - - reply: { - validator: $.optional.bool, - }, - - renote: { - validator: $.optional.bool, - }, - - withFiles: { - validator: $.optional.bool, - }, - - poll: { - validator: $.optional.bool, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -53,8 +16,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + local: { type: 'boolean' }, + reply: { type: 'boolean' }, + renote: { type: 'boolean' }, + withFiles: { type: 'boolean' }, + poll: { type: 'boolean' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId) .andWhere(`note.visibility = 'public'`) .andWhere(`note.localOnly = FALSE`) @@ -89,7 +67,7 @@ export default define(meta, async (ps) => { // query.isBot = bot; //} - const notes = await query.take(ps.limit!).getMany(); + const notes = await query.take(ps.limit).getMany(); return await Notes.packMany(notes); }); diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index 088ef65e96..ea2c166b75 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; @@ -14,25 +12,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -44,8 +23,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId) .andWhere(new Brackets(qb => { qb .where(`note.replyId = :noteId`, { noteId: ps.noteId }) @@ -69,7 +59,7 @@ export default define(meta, async (ps, user) => { if (user) generateBlockedUserQuery(query, user); if (user) generateMutedInstanceQuery(query, user); - const notes = await query.take(ps.limit!).getMany(); + const notes = await query.take(ps.limit).getMany(); return await Notes.packMany(notes, user); }); diff --git a/packages/backend/src/server/api/endpoints/notes/clips.ts b/packages/backend/src/server/api/endpoints/notes/clips.ts index b89c6db4a8..2caa3a499f 100644 --- a/packages/backend/src/server/api/endpoints/notes/clips.ts +++ b/packages/backend/src/server/api/endpoints/notes/clips.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ClipNotes, Clips } from '@/models/index'; import { getNote } from '../../common/getters'; @@ -11,12 +9,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -36,8 +28,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index 4bd89c32e7..c199a3f831 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { getNote } from '../../common/getters'; @@ -11,22 +9,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -46,8 +28,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; @@ -65,7 +57,7 @@ export default define(meta, async (ps, user) => { conversation.push(p); } - if (conversation.length == ps.limit!) { + if (conversation.length == ps.limit) { return; } diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 4efa76b248..7d81abc3a7 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -1,11 +1,9 @@ -import $ from 'cafy'; import ms from 'ms'; import { length } from 'stringz'; import create from '@/services/note/create'; import define from '../../define'; import { fetchMeta } from '@/misc/fetch-meta'; import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; import { User } from '@/models/entities/user'; import { Users, DriveFiles, Notes, Channels, Blockings } from '@/models/index'; import { DriveFile } from '@/models/entities/drive-file'; @@ -34,84 +32,6 @@ export const meta = { kind: 'write:notes', - params: { - visibility: { - validator: $.optional.str.or(noteVisibilities as unknown as string[]), - default: 'public', - }, - - visibleUserIds: { - validator: $.optional.arr($.type(ID)).unique().min(0), - }, - - text: { - validator: $.optional.nullable.str.pipe(text => - text.trim() != '' - && length(text.trim()) <= maxNoteTextLength - && Array.from(text.trim()).length <= DB_MAX_NOTE_TEXT_LENGTH, // DB limit - ), - default: null, - }, - - cw: { - validator: $.optional.nullable.str.pipe(Notes.validateCw), - }, - - localOnly: { - validator: $.optional.bool, - default: false, - }, - - noExtractMentions: { - validator: $.optional.bool, - default: false, - }, - - noExtractHashtags: { - validator: $.optional.bool, - default: false, - }, - - noExtractEmojis: { - validator: $.optional.bool, - default: false, - }, - - fileIds: { - validator: $.optional.arr($.type(ID)).unique().range(1, 16), - }, - - mediaIds: { - validator: $.optional.arr($.type(ID)).unique().range(1, 16), - deprecated: true, - }, - - replyId: { - validator: $.optional.nullable.type(ID), - }, - - renoteId: { - validator: $.optional.nullable.type(ID), - }, - - channelId: { - validator: $.optional.nullable.type(ID), - }, - - poll: { - validator: $.optional.nullable.obj({ - choices: $.arr($.str) - .unique() - .range(2, 10) - .each(c => c.length > 0 && c.length < 50), - multiple: $.optional.bool, - expiresAt: $.optional.nullable.num.int(), - expiredAfter: $.optional.nullable.num.int().min(1), - }).strict(), - ref: 'poll', - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -175,8 +95,49 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + visibility: { type: 'string', enum: ['public', 'home', 'followers', 'specified'], default: "public" }, + visibleUserIds: { type: 'array', uniqueItems: true, items: { + type: 'string', format: 'misskey:id', + } }, + text: { type: 'string', nullable: true, maxLength: 3000, default: null }, + cw: { type: 'string', nullable: true, maxLength: 100 }, + localOnly: { type: 'boolean', default: false }, + noExtractMentions: { type: 'boolean', default: false }, + noExtractHashtags: { type: 'boolean', default: false }, + noExtractEmojis: { type: 'boolean', default: false }, + fileIds: { type: 'array', uniqueItems: true, minItems: 1, maxItems: 16, items: { + type: 'string', format: 'misskey:id', + } }, + mediaIds: { type: 'array', uniqueItems: true, minItems: 1, maxItems: 16, items: { + type: 'string', format: 'misskey:id', + } }, + replyId: { type: 'string', format: 'misskey:id', nullable: true }, + renoteId: { type: 'string', format: 'misskey:id', nullable: true }, + channelId: { type: 'string', format: 'misskey:id', nullable: true }, + poll: { + type: 'object', nullable: true, + properties: { + choices: { + type: 'array', uniqueItems: true, minItems: 2, maxItems: 10, + items: { + type: 'string', minLength: 1, maxLength: 50, + }, + }, + multiple: { type: 'boolean', default: false }, + expiresAt: { type: 'integer', nullable: true }, + expiredAfter: { type: 'integer', nullable: true, minimum: 1 }, + }, + required: ['choices'], + }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let visibleUsers: User[] = []; if (ps.visibleUserIds) { visibleUsers = (await Promise.all(ps.visibleUserIds.map(id => Users.findOne(id)))) diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 9e080d9e99..62a2a98469 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import deleteNote from '@/services/note/delete'; import define from '../../define'; import ms from 'ms'; @@ -20,12 +18,6 @@ export const meta = { minInterval: ms('1sec'), }, - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -41,8 +33,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 78da6a3b00..570e2354ba 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getNote } from '../../../common/getters'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:favorites', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -34,8 +26,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Get favoritee const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index 3f3d50f0d5..b33a5f148b 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getNote } from '../../../common/getters'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:favorites', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -33,8 +25,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Get favoritee const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index 5a47fb9e08..8a4297de62 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; import { Notes } from '@/models/index'; @@ -9,18 +8,6 @@ export const meta = { requireCredential: false, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -32,8 +19,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const max = 30; const day = 1000 * 60 * 60 * 24 * 3; // 3日前まで diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index cdd110994e..23ca8752c9 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { fetchMeta } from '@/misc/fetch-meta'; import { ApiError } from '../../error'; @@ -15,33 +13,6 @@ import { generateBlockedUserQuery } from '../../common/generate-block-query'; export const meta = { tags: ['notes'], - params: { - withFiles: { - validator: $.optional.bool, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -61,8 +32,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + withFiles: { type: 'boolean' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const m = await fetchMeta(); if (m.disableGlobalTimeline) { if (user == null || (!user.isAdmin && !user.isModerator)) { @@ -92,7 +76,7 @@ export default define(meta, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); process.nextTick(() => { if (user) { diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index b438491026..ba6f3b5927 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { fetchMeta } from '@/misc/fetch-meta'; import { ApiError } from '../../error'; @@ -20,48 +18,6 @@ export const meta = { requireCredential: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - - includeMyRenotes: { - validator: $.optional.bool, - default: true, - }, - - includeRenotedMyNotes: { - validator: $.optional.bool, - default: true, - }, - - includeLocalRenotes: { - validator: $.optional.bool, - default: true, - }, - - withFiles: { - validator: $.optional.bool, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -81,8 +37,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + includeMyRenotes: { type: 'boolean', default: true }, + includeRenotedMyNotes: { type: 'boolean', default: true }, + includeLocalRenotes: { type: 'boolean', default: true }, + withFiles: { type: 'boolean' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const m = await fetchMeta(); if (m.disableLocalTimeline && !user.isAdmin && !user.isModerator) { throw new ApiError(meta.errors.stlDisabled); @@ -149,7 +121,7 @@ export default define(meta, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); process.nextTick(() => { if (user) { diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index ce0bcbeb7b..7c118317d6 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { fetchMeta } from '@/misc/fetch-meta'; import { ApiError } from '../../error'; @@ -17,42 +15,6 @@ import { generateBlockedUserQuery } from '../../common/generate-block-query'; export const meta = { tags: ['notes'], - params: { - withFiles: { - validator: $.optional.bool, - }, - - fileType: { - validator: $.optional.arr($.str), - }, - - excludeNsfw: { - validator: $.optional.bool, - default: false, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -72,8 +34,25 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + withFiles: { type: 'boolean' }, + fileType: { type: 'array', items: { + type: 'string', + } }, + excludeNsfw: { type: 'boolean', default: false }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const m = await fetchMeta(); if (m.disableLocalTimeline) { if (user == null || (!user.isAdmin && !user.isModerator)) { @@ -118,7 +97,7 @@ export default define(meta, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); process.nextTick(() => { if (user) { diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 81b3844365..265882fa70 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import read from '@/services/note/read'; import { Notes, Followings } from '@/models/index'; @@ -15,30 +13,6 @@ export const meta = { requireCredential: true, - params: { - following: { - validator: $.optional.bool, - default: false, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - visibility: { - validator: $.optional.str, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -50,8 +24,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + following: { type: 'boolean', default: false }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + visibility: { type: 'string' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const followingQuery = Followings.createQueryBuilder('following') .select('following.followeeId') .where('following.followerId = :followerId', { followerId: user.id }); @@ -81,7 +67,7 @@ export default define(meta, async (ps, user) => { query.setParameters(followingQuery.getParameters()); } - const mentions = await query.take(ps.limit!).getMany(); + const mentions = await query.take(ps.limit).getMany(); read(user.id, mentions); diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index 79b558e65e..4030694b58 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { Polls, Mutings, Notes, PollVotes } from '@/models/index'; import { Brackets, In } from 'typeorm'; @@ -8,18 +7,6 @@ export const meta = { requireCredential: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -31,8 +18,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = Polls.createQueryBuilder('poll') .where('poll.userHost IS NULL') .andWhere(`poll.userId != :meId`, { meId: user.id }) @@ -64,7 +60,7 @@ export default define(meta, async (ps, user) => { query.setParameters(mutingQuery.getParameters()); //#endregion - const polls = await query.take(ps.limit!).skip(ps.offset).getMany(); + const polls = await query.take(ps.limit).skip(ps.offset).getMany(); if (polls.length === 0) return []; diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 77387cacb2..739df8a03c 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { publishNoteStream } from '@/services/stream'; import { createNotification } from '@/services/create-notification'; import define from '../../../define'; @@ -21,16 +19,6 @@ export const meta = { kind: 'write:votes', - params: { - noteId: { - validator: $.type(ID), - }, - - choice: { - validator: $.num, - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -70,8 +58,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + choice: { type: 'integer' }, + }, + required: ['noteId', 'choice'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const createdAt = new Date(); // Get votee diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index 5205a78171..fdcaed64e1 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; @@ -12,34 +10,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - - type: { - validator: $.optional.nullable.str, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num, - default: 0, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -59,8 +29,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + type: { type: 'string', nullable: true }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; @@ -80,7 +63,7 @@ export default define(meta, async (ps, user) => { const reactions = await NoteReactions.find({ where: query, - take: ps.limit!, + take: ps.limit, skip: ps.offset, order: { id: -1, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index 1b42781ceb..a898b3249a 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import createReaction from '@/services/note/reaction/create'; import define from '../../../define'; import { getNote } from '../../../common/getters'; @@ -12,16 +10,6 @@ export const meta = { kind: 'write:reactions', - params: { - noteId: { - validator: $.type(ID), - }, - - reaction: { - validator: $.str, - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -43,8 +31,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + reaction: { type: 'string' }, + }, + required: ['noteId', 'reaction'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index 1d686b5971..53cadac7c9 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import ms from 'ms'; import deleteReaction from '@/services/note/reaction/delete'; @@ -19,12 +17,6 @@ export const meta = { minInterval: ms('3sec'), }, - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -40,8 +32,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index f71d23146a..aa5c2c0a45 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; @@ -14,25 +12,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -52,8 +31,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; @@ -71,7 +61,7 @@ export default define(meta, async (ps, user) => { if (user) generateMutedUserQuery(query, user); if (user) generateBlockedUserQuery(query, user); - const renotes = await query.take(ps.limit!).getMany(); + const renotes = await query.take(ps.limit).getMany(); return await Notes.packMany(renotes, user); }); diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index 62c56534e1..b88e3d7168 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Notes } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -12,25 +10,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -42,8 +21,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId) .andWhere('note.replyId = :replyId', { replyId: ps.noteId }) .innerJoinAndSelect('note.user', 'user') @@ -56,7 +46,7 @@ export default define(meta, async (ps, user) => { if (user) generateMutedUserQuery(query, user); if (user) generateBlockedUserQuery(query, user); - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); return await Notes.packMany(timeline, user); }); diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 87eaffe2f1..bf18a20b97 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notes } from '@/models/index'; @@ -13,48 +11,6 @@ import { generateBlockedUserQuery } from '../../common/generate-block-query'; export const meta = { tags: ['notes', 'hashtags'], - params: { - tag: { - validator: $.optional.str, - }, - - query: { - validator: $.optional.arr($.arr($.str)), - }, - - reply: { - validator: $.optional.nullable.bool, - default: null, - }, - - renote: { - validator: $.optional.nullable.bool, - default: null, - }, - - withFiles: { - validator: $.optional.bool, - }, - - poll: { - validator: $.optional.nullable.bool, - default: null, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -66,8 +22,28 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + tag: { type: 'string' }, + query: { type: 'array', items: { + type: 'array', items: { + type: 'string', + }, + } }, + reply: { type: 'boolean', nullable: true, default: null }, + renote: { type: 'boolean', nullable: true, default: null }, + withFiles: { type: 'boolean' }, + poll: { type: 'boolean', nullable: true, default: null }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId) .innerJoinAndSelect('note.user', 'user') .leftJoinAndSelect('note.reply', 'reply') @@ -129,7 +105,7 @@ export default define(meta, async (ps, me) => { } // Search notes - const notes = await query.take(ps.limit!).getMany(); + const notes = await query.take(ps.limit).getMany(); return await Notes.packMany(notes, me); }); diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index e75212b14b..bcb9c2b8a1 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -1,9 +1,7 @@ -import $ from 'cafy'; import es from '../../../../db/elasticsearch'; import define from '../../define'; import { Notes } from '@/models/index'; import { In } from 'typeorm'; -import { ID } from '@/misc/cafy-id'; import config from '@/config/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; @@ -15,40 +13,6 @@ export const meta = { requireCredential: false, - params: { - query: { - validator: $.str, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - host: { - validator: $.optional.nullable.str, - default: undefined, - }, - - userId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - - channelId: { - validator: $.optional.nullable.type(ID), - default: null, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -63,8 +27,23 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + query: { type: 'string' }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + host: { type: 'string', nullable: true }, + userId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + channelId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, + }, + required: ['query'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { if (es == null) { const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId); @@ -86,7 +65,7 @@ export default define(meta, async (ps, me) => { if (me) generateMutedUserQuery(query, me); if (me) generateBlockedUserQuery(query, me); - const notes = await query.take(ps.limit!).getMany(); + const notes = await query.take(ps.limit).getMany(); return await Notes.packMany(notes, me); } else { @@ -115,7 +94,7 @@ export default define(meta, async (ps, me) => { const result = await es.search({ index: config.elasticsearch.index || 'misskey_note', body: { - size: ps.limit!, + size: ps.limit, from: ps.offset, query: { bool: { diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index feb94be1a1..8f75eeb5e8 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; @@ -10,12 +8,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -31,8 +23,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/state.ts b/packages/backend/src/server/api/endpoints/notes/state.ts index c3e9090bbf..cf5f08ea9a 100644 --- a/packages/backend/src/server/api/endpoints/notes/state.ts +++ b/packages/backend/src/server/api/endpoints/notes/state.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { NoteFavorites, Notes, NoteThreadMutings, NoteWatchings } from '@/models/index'; @@ -8,12 +6,6 @@ export const meta = { requireCredential: true, - params: { - noteId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -34,8 +26,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await Notes.findOneOrFail(ps.noteId); const [favorite, watching, threadMuting] = await Promise.all([ diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index a8b50d90f6..4068a8a571 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { getNote } from '../../../common/getters'; import { ApiError } from '../../../error'; @@ -14,12 +12,6 @@ export const meta = { kind: 'write:account', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -29,8 +21,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index f76b526ce1..09b64f7277 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { getNote } from '../../../common/getters'; import { ApiError } from '../../../error'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index f8cd083249..c06a98feaa 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notes, Followings } from '@/models/index'; @@ -18,48 +16,6 @@ export const meta = { requireCredential: true, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - - includeMyRenotes: { - validator: $.optional.bool, - default: true, - }, - - includeRenotedMyNotes: { - validator: $.optional.bool, - default: true, - }, - - includeLocalRenotes: { - validator: $.optional.bool, - default: true, - }, - - withFiles: { - validator: $.optional.bool, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -71,8 +27,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + includeMyRenotes: { type: 'boolean', default: true }, + includeRenotedMyNotes: { type: 'boolean', default: true }, + includeLocalRenotes: { type: 'boolean', default: true }, + withFiles: { type: 'boolean' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const hasFollowing = (await Followings.count({ where: { followerId: user.id, @@ -141,7 +113,7 @@ export default define(meta, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); process.nextTick(() => { if (user) { diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index ed069cb75a..d85c8b96f9 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { getNote } from '../../common/getters'; import { ApiError } from '../../error'; @@ -15,15 +13,6 @@ export const meta = { requireCredential: false, - params: { - noteId: { - validator: $.type(ID), - }, - targetLang: { - validator: $.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -38,8 +27,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + targetLang: { type: 'string' }, + }, + required: ['noteId', 'targetLang'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index 8db543d328..c10d277de1 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import deleteNote from '@/services/note/delete'; import define from '../../define'; import ms from 'ms'; @@ -20,12 +18,6 @@ export const meta = { minInterval: ms('1sec'), }, - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -35,8 +27,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 3512fb3638..018e3e06a8 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { UserLists, UserListJoinings, Notes } from '@/models/index'; @@ -13,52 +11,6 @@ export const meta = { requireCredential: true, - params: { - listId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - - includeMyRenotes: { - validator: $.optional.bool, - default: true, - }, - - includeRenotedMyNotes: { - validator: $.optional.bool, - default: true, - }, - - includeLocalRenotes: { - validator: $.optional.bool, - default: true, - }, - - withFiles: { - validator: $.optional.bool, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -78,8 +30,25 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + listId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + includeMyRenotes: { type: 'boolean', default: true }, + includeRenotedMyNotes: { type: 'boolean', default: true }, + includeLocalRenotes: { type: 'boolean', default: true }, + withFiles: { type: 'boolean' }, + }, + required: ['listId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const list = await UserLists.findOne({ id: ps.listId, userId: user.id, @@ -140,7 +109,7 @@ export default define(meta, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); activeUsersChart.read(user); diff --git a/packages/backend/src/server/api/endpoints/notes/watching/create.ts b/packages/backend/src/server/api/endpoints/notes/watching/create.ts index 6433c6bc2a..b19d370027 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/create.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import watch from '@/services/note/watch'; import { getNote } from '../../../common/getters'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts index 3e9faa2b23..f9ceb49278 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import unwatch from '@/services/note/unwatch'; import { getNote } from '../../../common/getters'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -27,8 +19,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index bd8a7ba1b7..b5bfb34f4b 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { createNotification } from '@/services/create-notification'; @@ -9,26 +8,22 @@ export const meta = { kind: 'write:notifications', - params: { - body: { - validator: $.str, - }, - - header: { - validator: $.optional.nullable.str, - }, - - icon: { - validator: $.optional.nullable.str, - }, - }, - errors: { }, } as const; +const paramDef = { + type: 'object', + properties: { + body: { type: 'string' }, + header: { type: 'string', nullable: true }, + icon: { type: 'string', nullable: true }, + }, + required: ['body'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user, token) => { +export default define(meta, paramDef, async (ps, user, token) => { createNotification(user.id, 'app', { appAccessTokenId: token ? token.id : null, customBody: ps.body, diff --git a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts index 4cec38a95d..12dc43de16 100644 --- a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -10,8 +10,14 @@ export const meta = { kind: 'write:notifications', } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Update documents await Notifications.update({ notifieeId: user.id, diff --git a/packages/backend/src/server/api/endpoints/notifications/read.ts b/packages/backend/src/server/api/endpoints/notifications/read.ts index 7e23bc234d..6e5b5616dd 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { publishMainStream } from '@/services/stream'; import define from '../../define'; import { Notifications } from '@/models/index'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:notifications', - params: { - notificationId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNotification: { message: 'No such notification.', @@ -28,8 +20,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + notificationId: { type: 'string', format: 'misskey:id' }, + }, + required: ['notificationId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const notification = await Notifications.findOne({ notifieeId: user.id, id: ps.notificationId, diff --git a/packages/backend/src/server/api/endpoints/page-push.ts b/packages/backend/src/server/api/endpoints/page-push.ts index 61c0160f83..20334f33fc 100644 --- a/packages/backend/src/server/api/endpoints/page-push.ts +++ b/packages/backend/src/server/api/endpoints/page-push.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../define'; -import { ID } from '@/misc/cafy-id'; import { publishMainStream } from '@/services/stream'; import { Users, Pages } from '@/models/index'; import { ApiError } from '../error'; @@ -9,20 +7,6 @@ export const meta = { requireCredential: true, secure: true, - params: { - pageId: { - validator: $.type(ID), - }, - - event: { - validator: $.str, - }, - - var: { - validator: $.optional.nullable.any, - }, - }, - errors: { noSuchPage: { message: 'No such page.', @@ -32,8 +16,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + pageId: { type: 'string', format: 'misskey:id' }, + event: { type: 'string' }, + var: {}, + }, + required: ['pageId', 'event'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const page = await Pages.findOne(ps.pageId); if (page == null) { throw new ApiError(meta.errors.noSuchPage); diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index 7ee50fbdfa..6c00a2f779 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -1,7 +1,5 @@ -import $ from 'cafy'; import ms from 'ms'; import define from '../../define'; -import { ID } from '@/misc/cafy-id'; import { Pages, DriveFiles } from '@/models/index'; import { genId } from '@/misc/gen-id'; import { Page } from '@/models/entities/page'; @@ -19,51 +17,6 @@ export const meta = { max: 300, }, - params: { - title: { - validator: $.str, - }, - - name: { - validator: $.str.min(1), - }, - - summary: { - validator: $.optional.nullable.str, - }, - - content: { - validator: $.arr($.obj()), - }, - - variables: { - validator: $.arr($.obj()), - }, - - script: { - validator: $.str, - }, - - eyeCatchingImageId: { - validator: $.optional.nullable.type(ID), - }, - - font: { - validator: $.optional.str.or(['serif', 'sans-serif']), - default: 'sans-serif', - }, - - alignCenter: { - validator: $.optional.bool, - default: false, - }, - - hideTitleWhenPinned: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -84,8 +37,29 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + title: { type: 'string' }, + name: { type: 'string', minLength: 1 }, + summary: { type: 'string', nullable: true }, + content: { type: 'array', items: { + type: 'object', additionalProperties: true, + } }, + variables: { type: 'array', items: { + type: 'object', additionalProperties: true, + } }, + script: { type: 'string' }, + eyeCatchingImageId: { type: 'string', format: 'misskey:id', nullable: true }, + font: { type: 'string', enum: ['serif', 'sans-serif'], default: "sans-serif" }, + alignCenter: { type: 'boolean', default: false }, + hideTitleWhenPinned: { type: 'boolean', default: false }, + }, + required: ['title', 'name', 'content', 'variables', 'script'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let eyeCatchingImage = null; if (ps.eyeCatchingImageId != null) { eyeCatchingImage = await DriveFiles.findOne({ diff --git a/packages/backend/src/server/api/endpoints/pages/delete.ts b/packages/backend/src/server/api/endpoints/pages/delete.ts index aeda823e52..c41373bb7c 100644 --- a/packages/backend/src/server/api/endpoints/pages/delete.ts +++ b/packages/backend/src/server/api/endpoints/pages/delete.ts @@ -1,8 +1,6 @@ -import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { Pages } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; export const meta = { tags: ['pages'], @@ -11,12 +9,6 @@ export const meta = { kind: 'write:pages', - params: { - pageId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPage: { message: 'No such page.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + pageId: { type: 'string', format: 'misskey:id' }, + }, + required: ['pageId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const page = await Pages.findOne(ps.pageId); if (page == null) { throw new ApiError(meta.errors.noSuchPage); diff --git a/packages/backend/src/server/api/endpoints/pages/featured.ts b/packages/backend/src/server/api/endpoints/pages/featured.ts index 7f0d58b350..38aa4dfacc 100644 --- a/packages/backend/src/server/api/endpoints/pages/featured.ts +++ b/packages/backend/src/server/api/endpoints/pages/featured.ts @@ -17,8 +17,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Pages.createQueryBuilder('page') .where('page.visibility = \'public\'') .andWhere('page.likedCount > 0') diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index c479f637a9..d286fd2bfd 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Pages, PageLikes } from '@/models/index'; @@ -12,12 +10,6 @@ export const meta = { kind: 'write:page-likes', - params: { - pageId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPage: { message: 'No such page.', @@ -39,8 +31,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + pageId: { type: 'string', format: 'misskey:id' }, + }, + required: ['pageId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const page = await Pages.findOne(ps.pageId); if (page == null) { throw new ApiError(meta.errors.noSuchPage); diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index 5cda5386d5..95243e411f 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -1,8 +1,6 @@ -import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; import { Pages, Users } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; import { Page } from '@/models/entities/page'; export const meta = { @@ -10,20 +8,6 @@ export const meta = { requireCredential: false, - params: { - pageId: { - validator: $.optional.type(ID), - }, - - name: { - validator: $.optional.str, - }, - - username: { - validator: $.optional.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -39,8 +23,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + pageId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string' }, + username: { type: 'string' }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { let page: Page | undefined; if (ps.pageId) { diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index cca5e5b5a9..582c924d91 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Pages, PageLikes } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:page-likes', - params: { - pageId: { - validator: $.type(ID), - }, - }, - errors: { noSuchPage: { message: 'No such page.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + pageId: { type: 'string', format: 'misskey:id' }, + }, + required: ['pageId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const page = await Pages.findOne(ps.pageId); if (page == null) { throw new ApiError(meta.errors.noSuchPage); diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 991085ee09..686271cf46 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -1,9 +1,7 @@ -import $ from 'cafy'; import ms from 'ms'; import define from '../../define'; import { ApiError } from '../../error'; import { Pages, DriveFiles } from '@/models/index'; -import { ID } from '@/misc/cafy-id'; import { Not } from 'typeorm'; export const meta = { @@ -18,52 +16,6 @@ export const meta = { max: 300, }, - params: { - pageId: { - validator: $.type(ID), - }, - - title: { - validator: $.str, - }, - - name: { - validator: $.str.min(1), - }, - - summary: { - validator: $.optional.nullable.str, - }, - - content: { - validator: $.arr($.obj()), - }, - - variables: { - validator: $.arr($.obj()), - }, - - script: { - validator: $.str, - }, - - eyeCatchingImageId: { - validator: $.optional.nullable.type(ID), - }, - - font: { - validator: $.optional.str.or(['serif', 'sans-serif']), - }, - - alignCenter: { - validator: $.optional.bool, - }, - - hideTitleWhenPinned: { - validator: $.optional.bool, - }, - }, - errors: { noSuchPage: { message: 'No such page.', @@ -90,8 +42,30 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + pageId: { type: 'string', format: 'misskey:id' }, + title: { type: 'string' }, + name: { type: 'string', minLength: 1 }, + summary: { type: 'string', nullable: true }, + content: { type: 'array', items: { + type: 'object', additionalProperties: true, + } }, + variables: { type: 'array', items: { + type: 'object', additionalProperties: true, + } }, + script: { type: 'string' }, + eyeCatchingImageId: { type: 'string', format: 'misskey:id', nullable: true }, + font: { type: 'string', enum: ['serif', 'sans-serif'] }, + alignCenter: { type: 'boolean' }, + hideTitleWhenPinned: { type: 'boolean' }, + }, + required: ['pageId', 'title', 'name', 'content', 'variables', 'script'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const page = await Pages.findOne(ps.pageId); if (page == null) { throw new ApiError(meta.errors.noSuchPage); diff --git a/packages/backend/src/server/api/endpoints/ping.ts b/packages/backend/src/server/api/endpoints/ping.ts index 3eab70ae2e..964401e19b 100644 --- a/packages/backend/src/server/api/endpoints/ping.ts +++ b/packages/backend/src/server/api/endpoints/ping.ts @@ -5,9 +5,6 @@ export const meta = { tags: ['meta'], - params: { - }, - res: { type: 'object', optional: false, nullable: false, @@ -20,8 +17,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { return { pong: Date.now(), }; diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index ff0e22555f..83657f8bf9 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -9,9 +9,6 @@ export const meta = { requireCredential: false, - params: { - }, - res: { type: 'array', optional: false, nullable: false, @@ -23,8 +20,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const meta = await fetchMeta(); const users = await Promise.all(meta.pinnedUsers.map(acct => Users.findOne(Acct.parse(acct)))); diff --git a/packages/backend/src/server/api/endpoints/promo/read.ts b/packages/backend/src/server/api/endpoints/promo/read.ts index 8d8c60d755..99be33fb0c 100644 --- a/packages/backend/src/server/api/endpoints/promo/read.ts +++ b/packages/backend/src/server/api/endpoints/promo/read.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { getNote } from '../../common/getters'; @@ -11,12 +9,6 @@ export const meta = { requireCredential: true, - params: { - noteId: { - validator: $.type(ID), - }, - }, - errors: { noSuchNote: { message: 'No such note.', @@ -26,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + noteId: { type: 'string', format: 'misskey:id' }, + }, + required: ['noteId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const note = await getNote(ps.noteId).catch(e => { if (e.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); throw e; diff --git a/packages/backend/src/server/api/endpoints/request-reset-password.ts b/packages/backend/src/server/api/endpoints/request-reset-password.ts index af1aeb4311..193c3ee79d 100644 --- a/packages/backend/src/server/api/endpoints/request-reset-password.ts +++ b/packages/backend/src/server/api/endpoints/request-reset-password.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import { publishMainStream } from '@/services/stream'; import define from '../define'; import rndstr from 'rndstr'; @@ -18,23 +17,22 @@ export const meta = { max: 3, }, - params: { - username: { - validator: $.str, - }, - - email: { - validator: $.str, - }, - }, - errors: { }, } as const; +const paramDef = { + type: 'object', + properties: { + username: { type: 'string' }, + email: { type: 'string' }, + }, + required: ['username', 'email'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { const user = await Users.findOne({ usernameLower: ps.username.toLowerCase(), host: IsNull(), diff --git a/packages/backend/src/server/api/endpoints/reset-db.ts b/packages/backend/src/server/api/endpoints/reset-db.ts index e99dc9db15..1c1cb3f136 100644 --- a/packages/backend/src/server/api/endpoints/reset-db.ts +++ b/packages/backend/src/server/api/endpoints/reset-db.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../define'; import { ApiError } from '../error'; import { resetDb } from '@/db/postgre'; @@ -6,16 +5,19 @@ import { resetDb } from '@/db/postgre'; export const meta = { requireCredential: false, - params: { - }, - errors: { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { if (process.env.NODE_ENV !== 'test') throw 'NODE_ENV is not a test'; await resetDb(); diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index a7366584b1..04048b9ef1 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import { publishMainStream } from '@/services/stream'; import define from '../define'; @@ -8,23 +7,22 @@ import { ApiError } from '../error'; export const meta = { requireCredential: false, - params: { - token: { - validator: $.str, - }, - - password: { - validator: $.str, - }, - }, - errors: { }, } as const; +const paramDef = { + type: 'object', + properties: { + token: { type: 'string' }, + password: { type: 'string' }, + }, + required: ['token', 'password'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const req = await PasswordResetRequests.findOneOrFail({ token: ps.token, }); diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index 1ad2c54ab5..4a5bc6a86c 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -5,17 +5,17 @@ import define from '../define'; export const meta = { requireCredential: false, - desc: { - }, - tags: ['meta'], +} as const; - params: { - }, +const paramDef = { + type: 'object', + properties: {}, + required: [], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const memStats = await si.mem(); const fsStats = await si.fsSize(); diff --git a/packages/backend/src/server/api/endpoints/stats.ts b/packages/backend/src/server/api/endpoints/stats.ts index 82b0bb3291..8abae921ac 100644 --- a/packages/backend/src/server/api/endpoints/stats.ts +++ b/packages/backend/src/server/api/endpoints/stats.ts @@ -7,9 +7,6 @@ export const meta = { tags: ['meta'], - params: { - }, - res: { type: 'object', optional: false, nullable: false, @@ -46,8 +43,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async () => { +export default define(meta, paramDef, async () => { const [ notesCount, originalNotesCount, diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index ae3e9ce77a..9091c9481a 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { fetchMeta } from '@/misc/fetch-meta'; import { genId } from '@/misc/gen-id'; @@ -9,20 +8,6 @@ export const meta = { requireCredential: true, - params: { - endpoint: { - validator: $.str, - }, - - auth: { - validator: $.str, - }, - - publickey: { - validator: $.str, - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -40,8 +25,18 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + endpoint: { type: 'string' }, + auth: { type: 'string' }, + publickey: { type: 'string' }, + }, + required: ['endpoint', 'auth', 'publickey'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // if already subscribed const exist = await SwSubscriptions.findOne({ userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/sw/unregister.ts b/packages/backend/src/server/api/endpoints/sw/unregister.ts index 6f569e9417..ec994c37c2 100644 --- a/packages/backend/src/server/api/endpoints/sw/unregister.ts +++ b/packages/backend/src/server/api/endpoints/sw/unregister.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { SwSubscriptions } from '../../../../models'; @@ -6,16 +5,18 @@ export const meta = { tags: ['account'], requireCredential: true, +} as const; - params: { - endpoint: { - validator: $.str, - }, +const paramDef = { + type: 'object', + properties: { + endpoint: { type: 'string' }, }, + required: ['endpoint'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { await SwSubscriptions.delete({ userId: user.id, endpoint: ps.endpoint, diff --git a/packages/backend/src/server/api/endpoints/test.ts b/packages/backend/src/server/api/endpoints/test.ts new file mode 100644 index 0000000000..820448e677 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/test.ts @@ -0,0 +1,22 @@ +import define from '../define'; + +export const meta = { + requireCredential: false, +} as const; + +const paramDef = { + type: 'object', + properties: { + required: { type: 'boolean' }, + string: { type: 'string' }, + default: { type: 'string', default: 'hello' }, + nullableDefault: { type: 'string', nullable: true, default: 'hello' }, + id: { type: 'string', format: 'misskey:id' }, + }, + required: ['required'], +} as const; + +// eslint-disable-next-line import/no-default-export +export default define(meta, paramDef, async (ps, me) => { + return ps; +}); diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index 74120fc406..6e38d4d310 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Users, UsedUsernames } from '@/models/index'; @@ -7,12 +6,6 @@ export const meta = { requireCredential: false, - params: { - username: { - validator: $.use(Users.validateLocalUsername), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -25,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + username: Users.localUsernameSchema, + }, + required: ['username'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps) => { +export default define(meta, paramDef, async (ps) => { // Get exist const exist = await Users.count({ host: null, diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 6b11ec0f01..0c03ac05c3 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../define'; import { Users } from '@/models/index'; import { generateMutedUserQueryForUsers } from '../common/generate-muted-user-query'; @@ -9,49 +8,6 @@ export const meta = { requireCredential: false, - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - - sort: { - validator: $.optional.str.or([ - '+follower', - '-follower', - '+createdAt', - '-createdAt', - '+updatedAt', - '-updatedAt', - ]), - }, - - state: { - validator: $.optional.str.or([ - 'all', - 'admin', - 'moderator', - 'adminOrModerator', - 'alive', - ]), - default: 'all', - }, - - origin: { - validator: $.optional.str.or([ - 'combined', - 'local', - 'remote', - ]), - default: 'local', - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -63,8 +19,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] }, + state: { type: 'string', enum: ['all', 'admin', 'moderator', 'adminOrModerator', 'alive'], default: "all" }, + origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "local" }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Users.createQueryBuilder('user'); query.where('user.isExplorable = TRUE'); @@ -93,7 +61,7 @@ export default define(meta, async (ps, me) => { if (me) generateMutedUserQueryForUsers(query, me); if (me) generateBlockQueryForUsers(query, me); - query.take(ps.limit!); + query.take(ps.limit); query.skip(ps.offset); const users = await query.getMany(); diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index d4152fbf50..e224bdf603 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -1,40 +1,30 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Clips } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; export const meta = { tags: ['users', 'clips'], +} as const; - params: { - userId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Clips.createQueryBuilder('clip'), ps.sinceId, ps.untilId) .andWhere(`clip.userId = :userId`, { userId: ps.userId }) .andWhere('clip.isPublic = true'); const clips = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Clips.packMany(clips); diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 6214ab40ba..5607b4cc73 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Users, Followings, UserProfiles } from '@/models/index'; @@ -11,33 +9,6 @@ export const meta = { requireCredential: false, - params: { - userId: { - validator: $.optional.type(ID), - }, - - username: { - validator: $.optional.str, - }, - - host: { - validator: $.optional.nullable.str, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -63,8 +34,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + username: { type: 'string' }, + host: { type: 'string', nullable: true }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId != null ? { id: ps.userId } : { usernameLower: ps.username!.toLowerCase(), host: toPunyNullable(ps.host) }); @@ -98,7 +82,7 @@ export default define(meta, async (ps, me) => { .innerJoinAndSelect('following.follower', 'follower'); const followings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Followings.packMany(followings, me, { populateFollower: true }); diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 76112eab25..36943232d1 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Users, Followings, UserProfiles } from '@/models/index'; @@ -11,33 +9,6 @@ export const meta = { requireCredential: false, - params: { - userId: { - validator: $.optional.type(ID), - }, - - username: { - validator: $.optional.str, - }, - - host: { - validator: $.optional.nullable.str, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -63,8 +34,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + username: { type: 'string' }, + host: { type: 'string', nullable: true }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId != null ? { id: ps.userId } : { usernameLower: ps.username!.toLowerCase(), host: toPunyNullable(ps.host) }); @@ -98,7 +82,7 @@ export default define(meta, async (ps, me) => { .innerJoinAndSelect('following.followee', 'followee'); const followings = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Followings.packMany(followings, me, { populateFollowee: true }); diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index c5f08b4c94..e874a54c77 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -1,39 +1,29 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { GalleryPosts } from '@/models/index'; import { makePaginationQuery } from '../../../common/make-pagination-query'; export const meta = { tags: ['users', 'gallery'], +} as const; - params: { - userId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(GalleryPosts.createQueryBuilder('post'), ps.sinceId, ps.untilId) .andWhere(`post.userId = :userId`, { userId: ps.userId }); const posts = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await GalleryPosts.packMany(posts, user); diff --git a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts index d886d3355a..a08587cd16 100644 --- a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { maximum } from '@/prelude/array'; import { ApiError } from '../../error'; @@ -12,17 +10,6 @@ export const meta = { requireCredential: false, - params: { - userId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -52,8 +39,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Lookup user const user = await getUser(ps.userId).catch(e => { if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); @@ -104,7 +100,7 @@ export default define(meta, async (ps, me) => { const repliedUsersSorted = Object.keys(repliedUsers).sort((a, b) => repliedUsers[b] - repliedUsers[a]); // Extract top replied users - const topRepliedUsers = repliedUsersSorted.slice(0, ps.limit!); + const topRepliedUsers = repliedUsersSorted.slice(0, ps.limit); // Make replies object (includes weights) const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({ diff --git a/packages/backend/src/server/api/endpoints/users/groups/create.ts b/packages/backend/src/server/api/endpoints/users/groups/create.ts index 25e29de01c..e7bc95791f 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/create.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { UserGroups, UserGroupJoinings } from '@/models/index'; import { genId } from '@/misc/gen-id'; @@ -12,12 +11,6 @@ export const meta = { kind: 'write:user-groups', - params: { - name: { - validator: $.str.range(1, 100), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -25,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string', minLength: 1, maxLength: 100 }, + }, + required: ['name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const userGroup = await UserGroups.insert({ id: genId(), createdAt: new Date(), diff --git a/packages/backend/src/server/api/endpoints/users/groups/delete.ts b/packages/backend/src/server/api/endpoints/users/groups/delete.ts index f30ab78ca0..cb30b4d813 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserGroups } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - }, - errors: { noSuchGroup: { message: 'No such group.', @@ -26,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + }, + required: ['groupId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const userGroup = await UserGroups.findOne({ id: ps.groupId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts index 7061db538b..7a6a620cb3 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../../define'; import { ApiError } from '../../../../error'; import { UserGroupJoinings, UserGroupInvitations } from '@/models/index'; @@ -13,12 +11,6 @@ export const meta = { kind: 'write:user-groups', - params: { - invitationId: { - validator: $.type(ID), - }, - }, - errors: { noSuchInvitation: { message: 'No such invitation.', @@ -28,8 +20,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + invitationId: { type: 'string', format: 'misskey:id' }, + }, + required: ['invitationId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch the invitation const invitation = await UserGroupInvitations.findOne({ id: ps.invitationId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts index f5ca3dec8b..b5c7f0908a 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../../define'; import { ApiError } from '../../../../error'; import { UserGroupInvitations } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:user-groups', - params: { - invitationId: { - validator: $.type(ID), - }, - }, - errors: { noSuchInvitation: { message: 'No such invitation.', @@ -26,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + invitationId: { type: 'string', format: 'misskey:id' }, + }, + required: ['invitationId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch the invitation const invitation = await UserGroupInvitations.findOne({ id: ps.invitationId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invite.ts b/packages/backend/src/server/api/endpoints/users/groups/invite.ts index 3b7a4edb81..ba78a28a38 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invite.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invite.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getUser } from '../../../common/getters'; @@ -15,16 +13,6 @@ export const meta = { kind: 'write:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchGroup: { message: 'No such group.', @@ -52,8 +40,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['groupId', 'userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/joined.ts b/packages/backend/src/server/api/endpoints/users/groups/joined.ts index ab48b1910d..192a52a66b 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/joined.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/joined.ts @@ -20,8 +20,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const ownedGroups = await UserGroups.find({ userId: me.id, }); diff --git a/packages/backend/src/server/api/endpoints/users/groups/leave.ts b/packages/backend/src/server/api/endpoints/users/groups/leave.ts index d2fcdab301..b7c7b328fd 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/leave.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/leave.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserGroups, UserGroupJoinings } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - }, - errors: { noSuchGroup: { message: 'No such group.', @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + }, + required: ['groupId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/owned.ts b/packages/backend/src/server/api/endpoints/users/groups/owned.ts index 6193a71019..4592fc437f 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/owned.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/owned.ts @@ -19,8 +19,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const userGroups = await UserGroups.find({ userId: me.id, }); diff --git a/packages/backend/src/server/api/endpoints/users/groups/pull.ts b/packages/backend/src/server/api/endpoints/users/groups/pull.ts index 785bea140d..d50f61b159 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/pull.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getUser } from '../../../common/getters'; @@ -12,16 +10,6 @@ export const meta = { kind: 'write:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchGroup: { message: 'No such group.', @@ -43,8 +31,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['groupId', 'userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/show.ts b/packages/backend/src/server/api/endpoints/users/groups/show.ts index eb26eac2a8..230254060d 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/show.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserGroups, UserGroupJoinings } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'read:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + }, + required: ['groupId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts index 4b1c8fbbdb..4b5206fa18 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getUser } from '../../../common/getters'; @@ -12,16 +10,6 @@ export const meta = { kind: 'write:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - - userId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -49,8 +37,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['groupId', 'userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, diff --git a/packages/backend/src/server/api/endpoints/users/groups/update.ts b/packages/backend/src/server/api/endpoints/users/groups/update.ts index 6caf903555..0714fb4bd4 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/update.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserGroups } from '@/models/index'; @@ -11,16 +9,6 @@ export const meta = { kind: 'write:user-groups', - params: { - groupId: { - validator: $.type(ID), - }, - - name: { - validator: $.str.range(1, 100), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -36,8 +24,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + groupId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', minLength: 1, maxLength: 100 }, + }, + required: ['groupId', 'name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index 945b511628..0a74424e0e 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../../define'; import { UserLists } from '@/models/index'; import { genId } from '@/misc/gen-id'; @@ -11,12 +10,6 @@ export const meta = { kind: 'write:account', - params: { - name: { - validator: $.str.range(1, 100), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -24,8 +17,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + name: { type: 'string', minLength: 1, maxLength: 100 }, + }, + required: ['name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const userList = await UserLists.insert({ id: genId(), createdAt: new Date(), diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 3183d2a09c..6795a227dc 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserLists } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'write:account', - params: { - listId: { - validator: $.type(ID), - }, - }, - errors: { noSuchList: { message: 'No such list.', @@ -26,8 +18,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + listId: { type: 'string', format: 'misskey:id' }, + }, + required: ['listId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const userList = await UserLists.findOne({ id: ps.listId, userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/users/lists/list.ts b/packages/backend/src/server/api/endpoints/users/lists/list.ts index ae66b0aacc..d439723403 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/list.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/list.ts @@ -19,8 +19,14 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const userLists = await UserLists.find({ userId: me.id, }); diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index 4c74aefa8a..5eca5a999d 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import { publishUserListStream } from '@/services/stream'; import define from '../../../define'; import { ApiError } from '../../../error'; @@ -13,16 +11,6 @@ export const meta = { kind: 'write:account', - params: { - listId: { - validator: $.type(ID), - }, - - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchList: { message: 'No such list.', @@ -38,8 +26,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + listId: { type: 'string', format: 'misskey:id' }, + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['listId', 'userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the list const userList = await UserLists.findOne({ id: ps.listId, diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 8b50c475b0..68a1f00774 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { getUser } from '../../../common/getters'; @@ -13,16 +11,6 @@ export const meta = { kind: 'write:account', - params: { - listId: { - validator: $.type(ID), - }, - - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchList: { message: 'No such list.', @@ -50,8 +38,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + listId: { type: 'string', format: 'misskey:id' }, + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['listId', 'userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the list const userList = await UserLists.findOne({ id: ps.listId, diff --git a/packages/backend/src/server/api/endpoints/users/lists/show.ts b/packages/backend/src/server/api/endpoints/users/lists/show.ts index 06555c1a88..3e9aa836ba 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/show.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/show.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserLists } from '@/models/index'; @@ -11,12 +9,6 @@ export const meta = { kind: 'read:account', - params: { - listId: { - validator: $.type(ID), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -32,8 +24,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + listId: { type: 'string', format: 'misskey:id' }, + }, + required: ['listId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Fetch the list const userList = await UserLists.findOne({ id: ps.listId, diff --git a/packages/backend/src/server/api/endpoints/users/lists/update.ts b/packages/backend/src/server/api/endpoints/users/lists/update.ts index 02b0d5fe18..ee1489fc6a 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/update.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/update.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; import { UserLists } from '@/models/index'; @@ -11,16 +9,6 @@ export const meta = { kind: 'write:account', - params: { - listId: { - validator: $.type(ID), - }, - - name: { - validator: $.str.range(1, 100), - }, - }, - res: { type: 'object', optional: false, nullable: false, @@ -36,8 +24,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + listId: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', minLength: 1, maxLength: 100 }, + }, + required: ['listId', 'name'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { // Fetch the list const userList = await UserLists.findOne({ id: ps.listId, diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 99158fb0ae..956d90b7ad 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { getUser } from '../../common/getters'; @@ -14,57 +12,6 @@ import { generateMutedInstanceQuery } from '../../common/generate-muted-instance export const meta = { tags: ['users', 'notes'], - params: { - userId: { - validator: $.type(ID), - }, - - includeReplies: { - validator: $.optional.bool, - default: true, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - - includeMyRenotes: { - validator: $.optional.bool, - default: true, - }, - - withFiles: { - validator: $.optional.bool, - default: false, - }, - - fileType: { - validator: $.optional.arr($.str), - }, - - excludeNsfw: { - validator: $.optional.bool, - default: false, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -84,8 +31,28 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + includeReplies: { type: 'boolean', default: true }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + includeMyRenotes: { type: 'boolean', default: true }, + withFiles: { type: 'boolean', default: false }, + fileType: { type: 'array', items: { + type: 'string', + } }, + excludeNsfw: { type: 'boolean', default: false }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Lookup user const user = await getUser(ps.userId).catch(e => { if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); @@ -141,7 +108,7 @@ export default define(meta, async (ps, me) => { //#endregion - const timeline = await query.take(ps.limit!).getMany(); + const timeline = await query.take(ps.limit).getMany(); return await Notes.packMany(timeline, me); }); diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index 6e003dd1af..873b5e80fa 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -1,40 +1,30 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { Pages } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; export const meta = { tags: ['users', 'pages'], +} as const; - params: { - userId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, }, + required: ['userId'], } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, user) => { +export default define(meta, paramDef, async (ps, user) => { const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId) .andWhere(`page.userId = :userId`, { userId: ps.userId }) .andWhere('page.visibility = \'public\''); const pages = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Pages.packMany(pages); diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index 312d4dbf23..8d968210bc 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -1,5 +1,3 @@ -import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { NoteReactions, UserProfiles } from '@/models/index'; import { makePaginationQuery } from '../../common/make-pagination-query'; @@ -11,33 +9,6 @@ export const meta = { requireCredential: false, - params: { - userId: { - validator: $.type(ID), - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - sinceId: { - validator: $.optional.type(ID), - }, - - untilId: { - validator: $.optional.type(ID), - }, - - sinceDate: { - validator: $.optional.num, - }, - - untilDate: { - validator: $.optional.num, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -57,8 +28,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + sinceDate: { type: 'integer' }, + untilDate: { type: 'integer' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const profile = await UserProfiles.findOneOrFail(ps.userId); if (me == null || (me.id !== ps.userId && !profile.publicReactions)) { @@ -73,7 +57,7 @@ export default define(meta, async (ps, me) => { generateVisibilityQuery(query, me); const reactions = await query - .take(ps.limit!) + .take(ps.limit) .getMany(); return await Promise.all(reactions.map(reaction => NoteReactions.pack(reaction, me, { withNote: true }))); diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 9ea39eb2dd..4a2d8d7e4a 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -1,5 +1,4 @@ import ms from 'ms'; -import $ from 'cafy'; import define from '../../define'; import { Users, Followings } from '@/models/index'; import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query'; @@ -12,18 +11,6 @@ export const meta = { kind: 'read:account', - params: { - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -35,8 +22,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + offset: { type: 'integer', default: 0 }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const query = Users.createQueryBuilder('user') .where('user.isLocked = FALSE') .andWhere('user.isExplorable = TRUE') @@ -58,7 +54,7 @@ export default define(meta, async (ps, me) => { query.setParameters(followingQuery.getParameters()); - const users = await query.take(ps.limit!).skip(ps.offset).getMany(); + const users = await query.take(ps.limit).skip(ps.offset).getMany(); return await Users.packMany(users, me, { detail: true }); }); diff --git a/packages/backend/src/server/api/endpoints/users/relation.ts b/packages/backend/src/server/api/endpoints/users/relation.ts index 7e319ca105..fac1a4b92d 100644 --- a/packages/backend/src/server/api/endpoints/users/relation.ts +++ b/packages/backend/src/server/api/endpoints/users/relation.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import define from '../../define'; -import { ID } from '@/misc/cafy-id'; import { Users } from '@/models/index'; export const meta = { @@ -8,12 +6,6 @@ export const meta = { requireCredential: true, - params: { - userId: { - validator: $.either($.type(ID), $.arr($.type(ID)).unique()), - }, - }, - res: { optional: false, nullable: false, oneOf: [ @@ -101,8 +93,24 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { + anyOf: [ + { type: 'string', format: 'misskey:id' }, + { + type: 'array', + items: { type: 'string', format: 'misskey:id' }, + }, + ], + }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const ids = Array.isArray(ps.userId) ? ps.userId : [ps.userId]; const relations = await Promise.all(ids.map(id => Users.getRelation(me.id, id))); diff --git a/packages/backend/src/server/api/endpoints/users/report-abuse.ts b/packages/backend/src/server/api/endpoints/users/report-abuse.ts index ed2aa7bb26..1df5e1573f 100644 --- a/packages/backend/src/server/api/endpoints/users/report-abuse.ts +++ b/packages/backend/src/server/api/endpoints/users/report-abuse.ts @@ -1,6 +1,4 @@ -import $ from 'cafy'; import * as sanitizeHtml from 'sanitize-html'; -import { ID } from '@/misc/cafy-id'; import define from '../../define'; import { publishAdminStream } from '@/services/stream'; import { ApiError } from '../../error'; @@ -15,16 +13,6 @@ export const meta = { requireCredential: true, - params: { - userId: { - validator: $.type(ID), - }, - - comment: { - validator: $.str.range(1, 2048), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -46,8 +34,17 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + comment: { type: 'string', minLength: 1, maxLength: 2048 }, + }, + required: ['userId', 'comment'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { // Lookup user const user = await getUser(ps.userId).catch(e => { if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser); diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 72e79c8824..433779ae2d 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { Followings, Users } from '@/models/index'; import { Brackets } from 'typeorm'; @@ -10,26 +9,6 @@ export const meta = { requireCredential: false, - params: { - username: { - validator: $.optional.nullable.str, - }, - - host: { - validator: $.optional.nullable.str, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - detail: { - validator: $.optional.bool, - default: true, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -41,8 +20,19 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + username: { type: 'string', nullable: true }, + host: { type: 'string', nullable: true }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + detail: { type: 'boolean', default: true }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const activeThreshold = new Date(Date.now() - (1000 * 60 * 60 * 24 * 30)); // 30日 if (ps.host) { @@ -57,7 +47,7 @@ export default define(meta, async (ps, me) => { q.andWhere('user.updatedAt IS NOT NULL'); q.orderBy('user.updatedAt', 'DESC'); - const users = await q.take(ps.limit!).getMany(); + const users = await q.take(ps.limit).getMany(); return await Users.packMany(users, me, { detail: ps.detail }); } else if (ps.username) { @@ -82,10 +72,10 @@ export default define(meta, async (ps, me) => { users = await query .orderBy('user.usernameLower', 'ASC') - .take(ps.limit!) + .take(ps.limit) .getMany(); - if (users.length < ps.limit!) { + if (users.length < ps.limit) { const otherQuery = await Users.createQueryBuilder('user') .where(`user.id NOT IN (${ followingQuery.getQuery() })`) .andWhere(`user.id != :meId`, { meId: me.id }) @@ -97,7 +87,7 @@ export default define(meta, async (ps, me) => { const otherUsers = await otherQuery .orderBy('user.updatedAt', 'DESC') - .take(ps.limit! - users.length) + .take(ps.limit - users.length) .getMany(); users = users.concat(otherUsers); @@ -108,7 +98,7 @@ export default define(meta, async (ps, me) => { .andWhere('user.usernameLower LIKE :username', { username: ps.username.toLowerCase() + '%' }) .andWhere('user.updatedAt IS NOT NULL') .orderBy('user.updatedAt', 'DESC') - .take(ps.limit! - users.length) + .take(ps.limit - users.length) .getMany(); } diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 26f818afcc..8c28e7c3a6 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -1,4 +1,3 @@ -import $ from 'cafy'; import define from '../../define'; import { UserProfiles, Users } from '@/models/index'; import { User } from '@/models/entities/user'; @@ -9,32 +8,6 @@ export const meta = { requireCredential: false, - params: { - query: { - validator: $.str, - }, - - offset: { - validator: $.optional.num.min(0), - default: 0, - }, - - limit: { - validator: $.optional.num.range(1, 100), - default: 10, - }, - - origin: { - validator: $.optional.str.or(['local', 'remote', 'combined']), - default: 'combined', - }, - - detail: { - validator: $.optional.bool, - default: true, - }, - }, - res: { type: 'array', optional: false, nullable: false, @@ -46,8 +19,20 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + query: { type: 'string' }, + offset: { type: 'integer', default: 0 }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + origin: { type: 'string', enum: ['local', 'remote', 'combined'], default: "combined" }, + detail: { type: 'boolean', default: true }, + }, + required: ['query'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const activeThreshold = new Date(Date.now() - (1000 * 60 * 60 * 24 * 30)); // 30日 const isUsername = ps.query.startsWith('@'); @@ -71,7 +56,7 @@ export default define(meta, async (ps, me) => { users = await usernameQuery .orderBy('user.updatedAt', 'DESC', 'NULLS LAST') - .take(ps.limit!) + .take(ps.limit) .skip(ps.offset) .getMany(); } else { @@ -91,11 +76,11 @@ export default define(meta, async (ps, me) => { users = await nameQuery .orderBy('user.updatedAt', 'DESC', 'NULLS LAST') - .take(ps.limit!) + .take(ps.limit) .skip(ps.offset) .getMany(); - if (users.length < ps.limit!) { + if (users.length < ps.limit) { const profQuery = UserProfiles.createQueryBuilder('prof') .select('prof.userId') .where('prof.description ILIKE :query', { query: '%' + ps.query + '%' }); @@ -117,7 +102,7 @@ export default define(meta, async (ps, me) => { users = users.concat(await query .orderBy('user.updatedAt', 'DESC', 'NULLS LAST') - .take(ps.limit!) + .take(ps.limit) .skip(ps.offset) .getMany() ); diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index 92910e9ed8..29c90963ad 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -1,9 +1,7 @@ -import $ from 'cafy'; import { resolveUser } from '@/remote/resolve-user'; import define from '../../define'; import { apiLogger } from '../../logger'; import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; import { Users } from '@/models/index'; import { In } from 'typeorm'; import { User } from '@/models/entities/user'; @@ -13,24 +11,6 @@ export const meta = { requireCredential: false, - params: { - userId: { - validator: $.optional.type(ID), - }, - - userIds: { - validator: $.optional.arr($.type(ID)).unique(), - }, - - username: { - validator: $.optional.str, - }, - - host: { - validator: $.optional.nullable.str, - }, - }, - res: { optional: false, nullable: false, oneOf: [ @@ -64,8 +44,21 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + userIds: { type: 'array', uniqueItems: true, items: { + type: 'string', format: 'misskey:id', + } }, + username: { type: 'string' }, + host: { type: 'string', nullable: true }, + }, + required: [], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { let user; const isAdminOrModerator = me && (me.isAdmin || me.isModerator); diff --git a/packages/backend/src/server/api/endpoints/users/stats.ts b/packages/backend/src/server/api/endpoints/users/stats.ts index 381e433479..29dd8fdf93 100644 --- a/packages/backend/src/server/api/endpoints/users/stats.ts +++ b/packages/backend/src/server/api/endpoints/users/stats.ts @@ -1,7 +1,5 @@ -import $ from 'cafy'; import define from '../../define'; import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, Users } from '@/models/index'; export const meta = { @@ -9,12 +7,6 @@ export const meta = { requireCredential: false, - params: { - userId: { - validator: $.type(ID), - }, - }, - errors: { noSuchUser: { message: 'No such user.', @@ -24,8 +16,16 @@ export const meta = { }, } as const; +const paramDef = { + type: 'object', + properties: { + userId: { type: 'string', format: 'misskey:id' }, + }, + required: ['userId'], +} as const; + // eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { +export default define(meta, paramDef, async (ps, me) => { const user = await Users.findOne(ps.userId); if (user == null) { throw new ApiError(meta.errors.noSuchUser); diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index 1efef8d26d..fe5a4715e8 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -1,5 +1,4 @@ import endpoints from '../endpoints'; -import { Context } from 'cafy'; import config from '@/config/index'; import { errors as basicErrors } from './errors'; import { schemas, convertSchemaToOpenApiSchema } from './schemas'; @@ -38,47 +37,7 @@ export function genOpenapiSpec(lang = 'ja-JP') { }, }; - function genProps(props: { [key: string]: Context; }) { - const properties = {} as any; - - for (const [k, v] of Object.entries(props)) { - properties[k] = genProp(v); - } - - return properties; - } - - function genProp(param: Context): any { - const required = param.name === 'Object' ? (param as any).props ? Object.entries((param as any).props).filter(([k, v]: any) => !v.isOptional).map(([k, v]) => k) : [] : []; - return { - description: (param.data || {}).desc, - default: (param.data || {}).default, - deprecated: (param.data || {}).deprecated, - ...((param.data || {}).default ? { default: (param.data || {}).default } : {}), - type: param.name === 'ID' ? 'string' : param.name.toLowerCase(), - ...(param.name === 'ID' ? { example: 'xxxxxxxxxx', format: 'id' } : {}), - nullable: param.isNullable, - ...(param.name === 'String' ? { - ...((param as any).enum ? { enum: (param as any).enum } : {}), - ...((param as any).minLength ? { minLength: (param as any).minLength } : {}), - ...((param as any).maxLength ? { maxLength: (param as any).maxLength } : {}), - } : {}), - ...(param.name === 'Number' ? { - ...((param as any).minimum ? { minimum: (param as any).minimum } : {}), - ...((param as any).maximum ? { maximum: (param as any).maximum } : {}), - } : {}), - ...(param.name === 'Object' ? { - ...(required.length > 0 ? { required } : {}), - properties: (param as any).props ? genProps((param as any).props) : {}, - } : {}), - ...(param.name === 'Array' ? { - items: (param as any).ctx ? genProp((param as any).ctx) : {}, - } : {}), - }; - } - for (const endpoint of endpoints.filter(ep => !ep.meta.secure)) { - const porops = {} as any; const errors = {} as any; if (endpoint.meta.errors) { @@ -91,21 +50,9 @@ export function genOpenapiSpec(lang = 'ja-JP') { } } - if (endpoint.meta.params) { - for (const [k, v] of Object.entries(endpoint.meta.params)) { - if (v.validator.data == null) v.validator.data = {}; - if (v.desc) v.validator.data.desc = v.desc[lang]; - if (v.deprecated) v.validator.data.deprecated = v.deprecated; - if (v.default) v.validator.data.default = v.default; - porops[k] = v.validator; - } - } - - const required = endpoint.meta.params ? Object.entries(endpoint.meta.params).filter(([k, v]) => !v.validator.isOptional).map(([k, v]) => k) : []; - const resSchema = endpoint.meta.res ? convertSchemaToOpenApiSchema(endpoint.meta.res) : {}; - let desc = (endpoint.meta.desc ? endpoint.meta.desc[lang] : 'No description provided.') + '\n\n'; + let desc = (endpoint.meta.description ? endpoint.meta.description : 'No description provided.') + '\n\n'; desc += `**Credential required**: *${endpoint.meta.requireCredential ? 'Yes' : 'No'}*`; if (endpoint.meta.kind) { const kind = endpoint.meta.kind; @@ -132,11 +79,7 @@ export function genOpenapiSpec(lang = 'ja-JP') { required: true, content: { 'application/json': { - schema: { - type: 'object', - ...(required.length > 0 ? { required } : {}), - properties: endpoint.meta.params ? genProps(porops) : {}, - }, + schema: endpoint.params, }, }, }, diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts index eb42667fd5..5d062168e7 100644 --- a/packages/backend/src/server/api/openapi/schemas.ts +++ b/packages/backend/src/server/api/openapi/schemas.ts @@ -1,6 +1,6 @@ -import { refs, MinimumSchema } from '@/misc/schema'; +import { refs, Schema } from '@/misc/schema'; -export function convertSchemaToOpenApiSchema(schema: MinimumSchema) { +export function convertSchemaToOpenApiSchema(schema: Schema) { const res: any = schema; if (schema.type === 'object' && schema.properties) { diff --git a/packages/backend/src/server/api/private/signup.ts b/packages/backend/src/server/api/private/signup.ts index eaab8e7111..d42c270bb0 100644 --- a/packages/backend/src/server/api/private/signup.ts +++ b/packages/backend/src/server/api/private/signup.ts @@ -38,7 +38,7 @@ export default async (ctx: Koa.Context) => { const emailAddress = body['emailAddress']; if (instance.emailRequiredForSignup) { - if (emailAddress == null || typeof emailAddress != 'string') { + if (emailAddress == null || typeof emailAddress !== 'string') { ctx.status = 400; return; } @@ -51,7 +51,7 @@ export default async (ctx: Koa.Context) => { } if (instance.disableRegistration) { - if (invitationCode == null || typeof invitationCode != 'string') { + if (invitationCode == null || typeof invitationCode !== 'string') { ctx.status = 400; return; } diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index cc10900e9f..c6bea0feea 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -82,6 +82,38 @@ type Unflatten> = UnionToIntersection< }[Extract] >; +type ToJsonSchema = { + type: 'object'; + properties: { + [K in keyof S]: S[K] extends number[] ? { type: 'array'; items: { type: 'number'; }; } : ToJsonSchema; + }, + required: (keyof S)[]; +}; + +export function getJsonSchema(schema: S): ToJsonSchema>> { + const object = {}; + for (const [k, v] of Object.entries(schema)) { + nestedProperty.set(object, k, null); + } + + function f(obj: Record>) { + const jsonSchema = { + type: 'object', + properties: {} as Record, + required: [], + }; + for (const [k, v] of Object.entries(obj)) { + jsonSchema.properties[k] = v === null ? { + type: 'array', + items: { type: 'number' }, + } : f(v as Record>); + } + return jsonSchema; + } + + return f(object) as ToJsonSchema>>; +} + /** * 様々なチャートの管理を司るクラス */ diff --git a/packages/backend/test/api.ts b/packages/backend/test/api.ts index 99fb196dcd..c4802e224e 100644 --- a/packages/backend/test/api.ts +++ b/packages/backend/test/api.ts @@ -1,970 +1,83 @@ -/* process.env.NODE_ENV = 'test'; import * as assert from 'assert'; import * as childProcess from 'child_process'; -import { async, signup, request, post, react, uploadFile } from './utils'; +import { async, signup, request, post, react, uploadFile, startServer, shutdownServer } from './utils'; describe('API', () => { let p: childProcess.ChildProcess; + let alice: any; + let bob: any; + let carol: any; - beforeEach(done => { - p = childProcess.spawn('node', [__dirname + '/../index.js'], { - stdio: ['inherit', 'inherit', 'ipc'], - env: { NODE_ENV: 'test' } - }); - p.on('message', message => { - if (message === 'ok') { - done(); - } - }); + before(async () => { + p = await startServer(); + alice = await signup({ username: 'alice' }); + bob = await signup({ username: 'bob' }); + carol = await signup({ username: 'carol' }); }); - afterEach(() => { - p.kill(); + after(async () => { + await shutdownServer(p); }); - describe('signup', () => { - it('不正なユーザー名でアカウントが作成できない', async(async () => { - const res = await request('/signup', { - username: 'test.', - password: 'test' + describe('General validation', () => { + it('wrong type', async(async () => { + const res = await request('/test', { + required: true, + string: 42, }); assert.strictEqual(res.status, 400); })); - it('空のパスワードでアカウントが作成できない', async(async () => { - const res = await request('/signup', { - username: 'test', - password: '' + it('missing require param', async(async () => { + const res = await request('/test', { + string: 'a', }); assert.strictEqual(res.status, 400); })); - it('正しくアカウントが作成できる', async(async () => { - const me = { - username: 'test', - password: 'test' - }; - - const res = await request('/signup', me); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.username, me.username); - })); - - it('同じユーザー名のアカウントは作成できない', async(async () => { - await signup({ - username: 'test' - }); - - const res = await request('/signup', { - username: 'test', - password: 'test' - }); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('signin', () => { - it('間違ったパスワードでサインインできない', async(async () => { - await signup({ - username: 'test', - password: 'foo' - }); - - const res = await request('/signin', { - username: 'test', - password: 'bar' - }); - - assert.strictEqual(res.status, 403); - })); - - it('クエリをインジェクションできない', async(async () => { - await signup({ - username: 'test' - }); - - const res = await request('/signin', { - username: 'test', - password: { - $gt: '' - } - }); - - assert.strictEqual(res.status, 400); - })); - - it('正しい情報でサインインできる', async(async () => { - await signup({ - username: 'test', - password: 'foo' - }); - - const res = await request('/signin', { - username: 'test', - password: 'foo' - }); - - assert.strictEqual(res.status, 200); - })); - }); - - describe('i/update', () => { - it('アカウント設定を更新できる', async(async () => { - const me = await signup(); - - const myName = '大室櫻子'; - const myLocation = '七森中'; - const myBirthday = '2000-09-07'; - - const res = await request('/i/update', { - name: myName, - location: myLocation, - birthday: myBirthday - }, me); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.name, myName); - assert.strictEqual(res.body.location, myLocation); - assert.strictEqual(res.body.birthday, myBirthday); - })); - - it('名前を空白にできない', async(async () => { - const me = await signup(); - const res = await request('/i/update', { - name: ' ' - }, me); - assert.strictEqual(res.status, 400); - })); - - it('誕生日の設定を削除できる', async(async () => { - const me = await signup(); - await request('/i/update', { - birthday: '2000-09-07' - }, me); - - const res = await request('/i/update', { - birthday: null - }, me); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.birthday, null); - })); - - it('不正な誕生日の形式で怒られる', async(async () => { - const me = await signup(); - const res = await request('/i/update', { - birthday: '2000/09/07' - }, me); - assert.strictEqual(res.status, 400); - })); - }); - - describe('users/show', () => { - it('ユーザーが取得できる', async(async () => { - const me = await signup(); - - const res = await request('/users/show', { - userId: me.id - }, me); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.id, me.id); - })); - - it('ユーザーが存在しなかったら怒る', async(async () => { - const res = await request('/users/show', { - userId: '000000000000000000000000' + it('invalid misskey:id (empty string)', async(async () => { + const res = await request('/test', { + required: true, + id: '', }); assert.strictEqual(res.status, 400); })); - it('間違ったIDで怒られる', async(async () => { - const res = await request('/users/show', { - userId: 'kyoppie' + it('valid misskey:id', async(async () => { + const res = await request('/test', { + required: true, + id: '8wvhjghbxu', }); - assert.strictEqual(res.status, 400); + assert.strictEqual(res.status, 200); })); - }); - describe('notes/show', () => { - it('投稿が取得できる', async(async () => { - const me = await signup(); - const myPost = await post(me, { - text: 'test' + it('default value', async(async () => { + const res = await request('/test', { + required: true, + string: 'a', }); - - const res = await request('/notes/show', { - noteId: myPost.id - }, me); - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.id, myPost.id); - assert.strictEqual(res.body.text, myPost.text); + assert.strictEqual(res.body.default, 'hello'); })); - it('投稿が存在しなかったら怒る', async(async () => { - const res = await request('/notes/show', { - noteId: '000000000000000000000000' + it('can set null even if it has default value', async(async () => { + const res = await request('/test', { + required: true, + nullableDefault: null, }); - assert.strictEqual(res.status, 400); + assert.strictEqual(res.status, 200); + assert.strictEqual(res.body.nullableDefault, null); })); - it('間違ったIDで怒られる', async(async () => { - const res = await request('/notes/show', { - noteId: 'kyoppie' + it('cannot set undefined if it has default value', async(async () => { + const res = await request('/test', { + required: true, + nullableDefault: undefined, }); - assert.strictEqual(res.status, 400); - })); - }); - - describe('notes/reactions/create', () => { - it('リアクションできる', async(async () => { - const bob = await signup({ username: 'bob' }); - const bobPost = await post(bob); - - const alice = await signup({ username: 'alice' }); - const res = await request('/notes/reactions/create', { - noteId: bobPost.id, - reaction: 'like' - }, alice); - - assert.strictEqual(res.status, 204); - })); - - it('自分の投稿にはリアクションできない', async(async () => { - const me = await signup(); - const myPost = await post(me); - - const res = await request('/notes/reactions/create', { - noteId: myPost.id, - reaction: 'like' - }, me); - - assert.strictEqual(res.status, 400); - })); - - it('二重にリアクションできない', async(async () => { - const bob = await signup({ username: 'bob' }); - const bobPost = await post(bob); - - const alice = await signup({ username: 'alice' }); - await react(alice, bobPost, 'like'); - - const res = await request('/notes/reactions/create', { - noteId: bobPost.id, - reaction: 'like' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('存在しない投稿にはリアクションできない', async(async () => { - const me = await signup(); - - const res = await request('/notes/reactions/create', { - noteId: '000000000000000000000000', - reaction: 'like' - }, me); - - assert.strictEqual(res.status, 400); - })); - - it('空のパラメータで怒られる', async(async () => { - const me = await signup(); - - const res = await request('/notes/reactions/create', {}, me); - - assert.strictEqual(res.status, 400); - })); - - it('間違ったIDで怒られる', async(async () => { - const me = await signup(); - - const res = await request('/notes/reactions/create', { - noteId: 'kyoppie', - reaction: 'like' - }, me); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('following/create', () => { - it('フォローできる', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - - const res = await request('/following/create', { - userId: alice.id - }, bob); - assert.strictEqual(res.status, 200); - })); - - it('既にフォローしている場合は怒る', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - await request('/following/create', { - userId: alice.id - }, bob); - - const res = await request('/following/create', { - userId: alice.id - }, bob); - - assert.strictEqual(res.status, 400); - })); - - it('存在しないユーザーはフォローできない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/create', { - userId: '000000000000000000000000' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('自分自身はフォローできない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/create', { - userId: alice.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('空のパラメータで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/create', {}, alice); - - assert.strictEqual(res.status, 400); - })); - - it('間違ったIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/create', { - userId: 'foo' - }, alice); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('following/delete', () => { - it('フォロー解除できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - await request('/following/create', { - userId: alice.id - }, bob); - - const res = await request('/following/delete', { - userId: alice.id - }, bob); - - assert.strictEqual(res.status, 200); - })); - - it('フォローしていない場合は怒る', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - - const res = await request('/following/delete', { - userId: alice.id - }, bob); - - assert.strictEqual(res.status, 400); - })); - - it('存在しないユーザーはフォロー解除できない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/delete', { - userId: '000000000000000000000000' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('自分自身はフォロー解除できない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/delete', { - userId: alice.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('空のパラメータで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/delete', {}, alice); - - assert.strictEqual(res.status, 400); - })); - - it('間違ったIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/following/delete', { - userId: 'kyoppie' - }, alice); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('drive', () => { - it('ドライブ情報を取得できる', async(async () => { - const bob = await signup({ username: 'bob' }); - await uploadFile({ - userId: me.id, - size: 256 - }); - await uploadFile({ - userId: me.id, - size: 512 - }); - await uploadFile({ - userId: me.id, - size: 1024 - }); - const res = await request('/drive', {}, me); - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - expect(res.body).have.property('usage').eql(1792); - })); - }); - - describe('drive/files/create', () => { - it('ファイルを作成できる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await uploadFile(alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.name, 'Lenna.png'); - })); - - it('ファイルに名前を付けられる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await assert.request(server) - .post('/drive/files/create') - .field('i', alice.token) - .field('name', 'Belmond.png') - .attach('file', fs.readFileSync(__dirname + '/resources/Lenna.png'), 'Lenna.png'); - - expect(res).have.status(200); - expect(res.body).be.a('object'); - expect(res.body).have.property('name').eql('Belmond.png'); - })); - - it('ファイル無しで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/drive/files/create', {}, alice); - - assert.strictEqual(res.status, 400); - })); - - it('SVGファイルを作成できる', async(async () => { - const izumi = await signup({ username: 'izumi' }); - - const res = await uploadFile(izumi, __dirname + '/resources/image.svg'); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.name, 'image.svg'); - assert.strictEqual(res.body.type, 'image/svg+xml'); - })); - }); - - describe('drive/files/update', () => { - it('名前を更新できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(alice); - const newName = 'いちごパスタ.png'; - - const res = await request('/drive/files/update', { - fileId: file.id, - name: newName - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.name, newName); - })); - - it('他人のファイルは更新できない', async(async () => { - const bob = await signup({ username: 'bob' }); - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(bob); - - const res = await request('/drive/files/update', { - fileId: file.id, - name: 'いちごパスタ.png' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('親フォルダを更新できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(alice); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - - const res = await request('/drive/files/update', { - fileId: file.id, - folderId: folder.id - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.folderId, folder.id); - })); - - it('親フォルダを無しにできる', async(async () => { - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(alice); - - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - - await request('/drive/files/update', { - fileId: file.id, - folderId: folder.id - }, alice); - - const res = await request('/drive/files/update', { - fileId: file.id, - folderId: null - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.folderId, null); - })); - - it('他人のフォルダには入れられない', async(async () => { - const bob = await signup({ username: 'bob' }); - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(alice); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, bob)).body; - - const res = await request('/drive/files/update', { - fileId: file.id, - folderId: folder.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('存在しないフォルダで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(alice); - - const res = await request('/drive/files/update', { - fileId: file.id, - folderId: '000000000000000000000000' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('不正なフォルダIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - const file = await uploadFile(alice); - - const res = await request('/drive/files/update', { - fileId: file.id, - folderId: 'foo' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('ファイルが存在しなかったら怒る', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/drive/files/update', { - fileId: '000000000000000000000000', - name: 'いちごパスタ.png' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('間違ったIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/drive/files/update', { - fileId: 'kyoppie', - name: 'いちごパスタ.png' - }, alice); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('drive/folders/create', () => { - it('フォルダを作成できる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/drive/folders/create', { - name: 'test' - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.name, 'test'); - })); - }); - - describe('drive/folders/update', () => { - it('名前を更新できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - - const res = await request('/drive/folders/update', { - folderId: folder.id, - name: 'new name' - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.name, 'new name'); - })); - - it('他人のフォルダを更新できない', async(async () => { - const bob = await signup({ username: 'bob' }); - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, bob)).body; - - const res = await request('/drive/folders/update', { - folderId: folder.id, - name: 'new name' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('親フォルダを更新できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - const parentFolder = (await request('/drive/folders/create', { - name: 'parent' - }, alice)).body; - - const res = await request('/drive/folders/update', { - folderId: folder.id, - parentId: parentFolder.id - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.parentId, parentFolder.id); - })); - - it('親フォルダを無しに更新できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - const parentFolder = (await request('/drive/folders/create', { - name: 'parent' - }, alice)).body; - await request('/drive/folders/update', { - folderId: folder.id, - parentId: parentFolder.id - }, alice); - - const res = await request('/drive/folders/update', { - folderId: folder.id, - parentId: null - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.parentId, null); - })); - - it('他人のフォルダを親フォルダに設定できない', async(async () => { - const bob = await signup({ username: 'bob' }); - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - const parentFolder = (await request('/drive/folders/create', { - name: 'parent' - }, bob)).body; - - const res = await request('/drive/folders/update', { - folderId: folder.id, - parentId: parentFolder.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('フォルダが循環するような構造にできない', async(async () => { - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - const parentFolder = (await request('/drive/folders/create', { - name: 'parent' - }, alice)).body; - await request('/drive/folders/update', { - folderId: parentFolder.id, - parentId: folder.id - }, alice); - - const res = await request('/drive/folders/update', { - folderId: folder.id, - parentId: parentFolder.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('フォルダが循環するような構造にできない(再帰的)', async(async () => { - const alice = await signup({ username: 'alice' }); - const folderA = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - const folderB = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - const folderC = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - await request('/drive/folders/update', { - folderId: folderB.id, - parentId: folderA.id - }, alice); - await request('/drive/folders/update', { - folderId: folderC.id, - parentId: folderB.id - }, alice); - - const res = await request('/drive/folders/update', { - folderId: folderA.id, - parentId: folderC.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('フォルダが循環するような構造にできない(自身)', async(async () => { - const arisugawa = await signup({ username: 'arisugawa' }); - const folderA = (await request('/drive/folders/create', { - name: 'test' - }, arisugawa)).body; - - const res = await request('/drive/folders/update', { - folderId: folderA.id, - parentId: folderA.id - }, arisugawa); - - assert.strictEqual(res.status, 400); - })); - - it('存在しない親フォルダを設定できない', async(async () => { - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - - const res = await request('/drive/folders/update', { - folderId: folder.id, - parentId: '000000000000000000000000' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('不正な親フォルダIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - const folder = (await request('/drive/folders/create', { - name: 'test' - }, alice)).body; - - const res = await request('/drive/folders/update', { - folderId: folder.id, - parentId: 'foo' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('存在しないフォルダを更新できない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/drive/folders/update', { - folderId: '000000000000000000000000' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('不正なフォルダIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/drive/folders/update', { - folderId: 'foo' - }, alice); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('messaging/messages/create', () => { - it('メッセージを送信できる', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - - const res = await request('/messaging/messages/create', { - userId: bob.id, - text: 'test' - }, alice); - - assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); - assert.strictEqual(res.body.text, 'test'); - })); - - it('自分自身にはメッセージを送信できない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/messaging/messages/create', { - userId: alice.id, - text: 'Yo' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('存在しないユーザーにはメッセージを送信できない', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/messaging/messages/create', { - userId: '000000000000000000000000', - text: 'test' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('不正なユーザーIDで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - - const res = await request('/messaging/messages/create', { - userId: 'foo', - text: 'test' - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('テキストが無くて怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - - const res = await request('/messaging/messages/create', { - userId: bob.id - }, alice); - - assert.strictEqual(res.status, 400); - })); - - it('文字数オーバーで怒られる', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - - const res = await request('/messaging/messages/create', { - userId: bob.id, - text: '!'.repeat(1001) - }, alice); - - assert.strictEqual(res.status, 400); - })); - }); - - describe('notes/replies', () => { - it('自分に閲覧権限のない投稿は含まれない', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - const carol = await signup({ username: 'carol' }); - - const alicePost = await post(alice, { - text: 'foo' - }); - - await post(bob, { - replyId: alicePost.id, - text: 'bar', - visibility: 'specified', - visibleUserIds: [alice.id] - }); - - const res = await request('/notes/replies', { - noteId: alicePost.id - }, carol); - - assert.strictEqual(res.status, 200); - assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.length, 0); - })); - }); - - describe('notes/timeline', () => { - it('フォロワー限定投稿が含まれる', async(async () => { - const alice = await signup({ username: 'alice' }); - const bob = await signup({ username: 'bob' }); - - await request('/following/create', { - userId: alice.id - }, bob); - - const alicePost = await post(alice, { - text: 'foo', - visibility: 'followers' - }); - - const res = await request('/notes/timeline', {}, bob); - - assert.strictEqual(res.status, 200); - assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.length, 1); - assert.strictEqual(res.body[0].id, alicePost.id); + assert.strictEqual(res.body.nullableDefault, 'hello'); })); }); }); -*/ diff --git a/packages/backend/test/endpoints.ts b/packages/backend/test/endpoints.ts new file mode 100644 index 0000000000..4df080030a --- /dev/null +++ b/packages/backend/test/endpoints.ts @@ -0,0 +1,858 @@ +/* +process.env.NODE_ENV = 'test'; + +import * as assert from 'assert'; +import * as childProcess from 'child_process'; +import { async, signup, request, post, react, uploadFile, startServer, shutdownServer } from './utils'; + +describe('API: Endpoints', () => { + let p: childProcess.ChildProcess; + let alice: any; + let bob: any; + let carol: any; + + before(async () => { + p = await startServer(); + alice = await signup({ username: 'alice' }); + bob = await signup({ username: 'bob' }); + carol = await signup({ username: 'carol' }); + }); + + after(async () => { + await shutdownServer(p); + }); + + describe('signup', () => { + it('不正なユーザー名でアカウントが作成できない', async(async () => { + const res = await request('/signup', { + username: 'test.', + password: 'test' + }); + assert.strictEqual(res.status, 400); + })); + + it('空のパスワードでアカウントが作成できない', async(async () => { + const res = await request('/signup', { + username: 'test', + password: '' + }); + assert.strictEqual(res.status, 400); + })); + + it('正しくアカウントが作成できる', async(async () => { + const me = { + username: 'test1', + password: 'test1' + }; + + const res = await request('/signup', me); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.username, me.username); + })); + + it('同じユーザー名のアカウントは作成できない', async(async () => { + await signup({ + username: 'test2' + }); + + const res = await request('/signup', { + username: 'test2', + password: 'test2' + }); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('signin', () => { + it('間違ったパスワードでサインインできない', async(async () => { + await signup({ + username: 'test3', + password: 'foo' + }); + + const res = await request('/signin', { + username: 'test3', + password: 'bar' + }); + + assert.strictEqual(res.status, 403); + })); + + it('クエリをインジェクションできない', async(async () => { + await signup({ + username: 'test4' + }); + + const res = await request('/signin', { + username: 'test4', + password: { + $gt: '' + } + }); + + assert.strictEqual(res.status, 400); + })); + + it('正しい情報でサインインできる', async(async () => { + await signup({ + username: 'test5', + password: 'foo' + }); + + const res = await request('/signin', { + username: 'test5', + password: 'foo' + }); + + assert.strictEqual(res.status, 200); + })); + }); + + describe('i/update', () => { + it('アカウント設定を更新できる', async(async () => { + const myName = '大室櫻子'; + const myLocation = '七森中'; + const myBirthday = '2000-09-07'; + + const res = await request('/i/update', { + name: myName, + location: myLocation, + birthday: myBirthday + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.name, myName); + assert.strictEqual(res.body.location, myLocation); + assert.strictEqual(res.body.birthday, myBirthday); + })); + + it('名前を空白にできない', async(async () => { + const res = await request('/i/update', { + name: ' ' + }, alice); + assert.strictEqual(res.status, 400); + })); + + it('誕生日の設定を削除できる', async(async () => { + await request('/i/update', { + birthday: '2000-09-07' + }, alice); + + const res = await request('/i/update', { + birthday: null + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.birthday, null); + })); + + it('不正な誕生日の形式で怒られる', async(async () => { + const res = await request('/i/update', { + birthday: '2000/09/07' + }, alice); + assert.strictEqual(res.status, 400); + })); + }); + + describe('users/show', () => { + it('ユーザーが取得できる', async(async () => { + const res = await request('/users/show', { + userId: alice.id + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.id, alice.id); + })); + + it('ユーザーが存在しなかったら怒る', async(async () => { + const res = await request('/users/show', { + userId: '000000000000000000000000' + }); + assert.strictEqual(res.status, 400); + })); + + it('間違ったIDで怒られる', async(async () => { + const res = await request('/users/show', { + userId: 'kyoppie' + }); + assert.strictEqual(res.status, 400); + })); + }); + + describe('notes/show', () => { + it('投稿が取得できる', async(async () => { + const myPost = await post(alice, { + text: 'test' + }); + + const res = await request('/notes/show', { + noteId: myPost.id + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.id, myPost.id); + assert.strictEqual(res.body.text, myPost.text); + })); + + it('投稿が存在しなかったら怒る', async(async () => { + const res = await request('/notes/show', { + noteId: '000000000000000000000000' + }); + assert.strictEqual(res.status, 400); + })); + + it('間違ったIDで怒られる', async(async () => { + const res = await request('/notes/show', { + noteId: 'kyoppie' + }); + assert.strictEqual(res.status, 400); + })); + }); + + describe('notes/reactions/create', () => { + it('リアクションできる', async(async () => { + const bobPost = await post(bob); + + const alice = await signup({ username: 'alice' }); + const res = await request('/notes/reactions/create', { + noteId: bobPost.id, + reaction: '👍', + }, alice); + + assert.strictEqual(res.status, 204); + })); + + it('自分の投稿にもリアクションできる', async(async () => { + const myPost = await post(alice); + + const res = await request('/notes/reactions/create', { + noteId: myPost.id, + reaction: '👍', + }, alice); + + assert.strictEqual(res.status, 204); + })); + + it('二重にリアクションできない', async(async () => { + const bobPost = await post(bob); + + await react(alice, bobPost, 'like'); + + const res = await request('/notes/reactions/create', { + noteId: bobPost.id, + reaction: '👍', + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('存在しない投稿にはリアクションできない', async(async () => { + const res = await request('/notes/reactions/create', { + noteId: '000000000000000000000000', + reaction: '👍', + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('空のパラメータで怒られる', async(async () => { + const res = await request('/notes/reactions/create', {}, alice); + + assert.strictEqual(res.status, 400); + })); + + it('間違ったIDで怒られる', async(async () => { + const res = await request('/notes/reactions/create', { + noteId: 'kyoppie', + reaction: '👍', + }, alice); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('following/create', () => { + it('フォローできる', async(async () => { + const res = await request('/following/create', { + userId: alice.id + }, bob); + + assert.strictEqual(res.status, 200); + })); + + it('既にフォローしている場合は怒る', async(async () => { + const res = await request('/following/create', { + userId: alice.id + }, bob); + + assert.strictEqual(res.status, 400); + })); + + it('存在しないユーザーはフォローできない', async(async () => { + const res = await request('/following/create', { + userId: '000000000000000000000000' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('自分自身はフォローできない', async(async () => { + const res = await request('/following/create', { + userId: alice.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('空のパラメータで怒られる', async(async () => { + const res = await request('/following/create', {}, alice); + + assert.strictEqual(res.status, 400); + })); + + it('間違ったIDで怒られる', async(async () => { + const res = await request('/following/create', { + userId: 'foo' + }, alice); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('following/delete', () => { + it('フォロー解除できる', async(async () => { + await request('/following/create', { + userId: alice.id + }, bob); + + const res = await request('/following/delete', { + userId: alice.id + }, bob); + + assert.strictEqual(res.status, 200); + })); + + it('フォローしていない場合は怒る', async(async () => { + const res = await request('/following/delete', { + userId: alice.id + }, bob); + + assert.strictEqual(res.status, 400); + })); + + it('存在しないユーザーはフォロー解除できない', async(async () => { + const res = await request('/following/delete', { + userId: '000000000000000000000000' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('自分自身はフォロー解除できない', async(async () => { + const res = await request('/following/delete', { + userId: alice.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('空のパラメータで怒られる', async(async () => { + const res = await request('/following/delete', {}, alice); + + assert.strictEqual(res.status, 400); + })); + + it('間違ったIDで怒られる', async(async () => { + const res = await request('/following/delete', { + userId: 'kyoppie' + }, alice); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('drive', () => { + it('ドライブ情報を取得できる', async(async () => { + await uploadFile({ + userId: alice.id, + size: 256 + }); + await uploadFile({ + userId: alice.id, + size: 512 + }); + await uploadFile({ + userId: alice.id, + size: 1024 + }); + const res = await request('/drive', {}, alice); + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + expect(res.body).have.property('usage').eql(1792); + })); + }); + + describe('drive/files/create', () => { + it('ファイルを作成できる', async(async () => { + const res = await uploadFile(alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.name, 'Lenna.png'); + })); + + it('ファイルに名前を付けられる', async(async () => { + const res = await assert.request(server) + .post('/drive/files/create') + .field('i', alice.token) + .field('name', 'Belmond.png') + .attach('file', fs.readFileSync(__dirname + '/resources/Lenna.png'), 'Lenna.png'); + + expect(res).have.status(200); + expect(res.body).be.a('object'); + expect(res.body).have.property('name').eql('Belmond.png'); + })); + + it('ファイル無しで怒られる', async(async () => { + const res = await request('/drive/files/create', {}, alice); + + assert.strictEqual(res.status, 400); + })); + + it('SVGファイルを作成できる', async(async () => { + const res = await uploadFile(alice, __dirname + '/resources/image.svg'); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.name, 'image.svg'); + assert.strictEqual(res.body.type, 'image/svg+xml'); + })); + }); + + describe('drive/files/update', () => { + it('名前を更新できる', async(async () => { + const file = await uploadFile(alice); + const newName = 'いちごパスタ.png'; + + const res = await request('/drive/files/update', { + fileId: file.id, + name: newName + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.name, newName); + })); + + it('他人のファイルは更新できない', async(async () => { + const file = await uploadFile(bob); + + const res = await request('/drive/files/update', { + fileId: file.id, + name: 'いちごパスタ.png' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('親フォルダを更新できる', async(async () => { + const file = await uploadFile(alice); + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + + const res = await request('/drive/files/update', { + fileId: file.id, + folderId: folder.id + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.folderId, folder.id); + })); + + it('親フォルダを無しにできる', async(async () => { + const file = await uploadFile(alice); + + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + + await request('/drive/files/update', { + fileId: file.id, + folderId: folder.id + }, alice); + + const res = await request('/drive/files/update', { + fileId: file.id, + folderId: null + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.folderId, null); + })); + + it('他人のフォルダには入れられない', async(async () => { + const file = await uploadFile(alice); + const folder = (await request('/drive/folders/create', { + name: 'test' + }, bob)).body; + + const res = await request('/drive/files/update', { + fileId: file.id, + folderId: folder.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('存在しないフォルダで怒られる', async(async () => { + const file = await uploadFile(alice); + + const res = await request('/drive/files/update', { + fileId: file.id, + folderId: '000000000000000000000000' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('不正なフォルダIDで怒られる', async(async () => { + const file = await uploadFile(alice); + + const res = await request('/drive/files/update', { + fileId: file.id, + folderId: 'foo' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('ファイルが存在しなかったら怒る', async(async () => { + const res = await request('/drive/files/update', { + fileId: '000000000000000000000000', + name: 'いちごパスタ.png' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('間違ったIDで怒られる', async(async () => { + const res = await request('/drive/files/update', { + fileId: 'kyoppie', + name: 'いちごパスタ.png' + }, alice); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('drive/folders/create', () => { + it('フォルダを作成できる', async(async () => { + const res = await request('/drive/folders/create', { + name: 'test' + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.name, 'test'); + })); + }); + + describe('drive/folders/update', () => { + it('名前を更新できる', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + + const res = await request('/drive/folders/update', { + folderId: folder.id, + name: 'new name' + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.name, 'new name'); + })); + + it('他人のフォルダを更新できない', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, bob)).body; + + const res = await request('/drive/folders/update', { + folderId: folder.id, + name: 'new name' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('親フォルダを更新できる', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + const parentFolder = (await request('/drive/folders/create', { + name: 'parent' + }, alice)).body; + + const res = await request('/drive/folders/update', { + folderId: folder.id, + parentId: parentFolder.id + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.parentId, parentFolder.id); + })); + + it('親フォルダを無しに更新できる', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + const parentFolder = (await request('/drive/folders/create', { + name: 'parent' + }, alice)).body; + await request('/drive/folders/update', { + folderId: folder.id, + parentId: parentFolder.id + }, alice); + + const res = await request('/drive/folders/update', { + folderId: folder.id, + parentId: null + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.parentId, null); + })); + + it('他人のフォルダを親フォルダに設定できない', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + const parentFolder = (await request('/drive/folders/create', { + name: 'parent' + }, bob)).body; + + const res = await request('/drive/folders/update', { + folderId: folder.id, + parentId: parentFolder.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('フォルダが循環するような構造にできない', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + const parentFolder = (await request('/drive/folders/create', { + name: 'parent' + }, alice)).body; + await request('/drive/folders/update', { + folderId: parentFolder.id, + parentId: folder.id + }, alice); + + const res = await request('/drive/folders/update', { + folderId: folder.id, + parentId: parentFolder.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('フォルダが循環するような構造にできない(再帰的)', async(async () => { + const folderA = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + const folderB = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + const folderC = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + await request('/drive/folders/update', { + folderId: folderB.id, + parentId: folderA.id + }, alice); + await request('/drive/folders/update', { + folderId: folderC.id, + parentId: folderB.id + }, alice); + + const res = await request('/drive/folders/update', { + folderId: folderA.id, + parentId: folderC.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('フォルダが循環するような構造にできない(自身)', async(async () => { + const folderA = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + + const res = await request('/drive/folders/update', { + folderId: folderA.id, + parentId: folderA.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('存在しない親フォルダを設定できない', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + + const res = await request('/drive/folders/update', { + folderId: folder.id, + parentId: '000000000000000000000000' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('不正な親フォルダIDで怒られる', async(async () => { + const folder = (await request('/drive/folders/create', { + name: 'test' + }, alice)).body; + + const res = await request('/drive/folders/update', { + folderId: folder.id, + parentId: 'foo' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('存在しないフォルダを更新できない', async(async () => { + const res = await request('/drive/folders/update', { + folderId: '000000000000000000000000' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('不正なフォルダIDで怒られる', async(async () => { + const res = await request('/drive/folders/update', { + folderId: 'foo' + }, alice); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('messaging/messages/create', () => { + it('メッセージを送信できる', async(async () => { + const res = await request('/messaging/messages/create', { + userId: bob.id, + text: 'test' + }, alice); + + assert.strictEqual(res.status, 200); + assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual(res.body.text, 'test'); + })); + + it('自分自身にはメッセージを送信できない', async(async () => { + const res = await request('/messaging/messages/create', { + userId: alice.id, + text: 'Yo' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('存在しないユーザーにはメッセージを送信できない', async(async () => { + const res = await request('/messaging/messages/create', { + userId: '000000000000000000000000', + text: 'test' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('不正なユーザーIDで怒られる', async(async () => { + const res = await request('/messaging/messages/create', { + userId: 'foo', + text: 'test' + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('テキストが無くて怒られる', async(async () => { + const res = await request('/messaging/messages/create', { + userId: bob.id + }, alice); + + assert.strictEqual(res.status, 400); + })); + + it('文字数オーバーで怒られる', async(async () => { + const res = await request('/messaging/messages/create', { + userId: bob.id, + text: '!'.repeat(1001) + }, alice); + + assert.strictEqual(res.status, 400); + })); + }); + + describe('notes/replies', () => { + it('自分に閲覧権限のない投稿は含まれない', async(async () => { + const alicePost = await post(alice, { + text: 'foo' + }); + + await post(bob, { + replyId: alicePost.id, + text: 'bar', + visibility: 'specified', + visibleUserIds: [alice.id] + }); + + const res = await request('/notes/replies', { + noteId: alicePost.id + }, carol); + + assert.strictEqual(res.status, 200); + assert.strictEqual(Array.isArray(res.body), true); + assert.strictEqual(res.body.length, 0); + })); + }); + + describe('notes/timeline', () => { + it('フォロワー限定投稿が含まれる', async(async () => { + await request('/following/create', { + userId: alice.id + }, bob); + + const alicePost = await post(alice, { + text: 'foo', + visibility: 'followers' + }); + + const res = await request('/notes/timeline', {}, bob); + + assert.strictEqual(res.status, 200); + assert.strictEqual(Array.isArray(res.body), true); + assert.strictEqual(res.body.length, 1); + assert.strictEqual(res.body[0].id, alicePost.id); + })); + }); +}); +*/ diff --git a/packages/backend/yarn.lock b/packages/backend/yarn.lock index aa7a66f86b..c1932a9053 100644 --- a/packages/backend/yarn.lock +++ b/packages/backend/yarn.lock @@ -1013,6 +1013,16 @@ ajv-keywords@^3.5.2: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== +ajv@8.10.0: + version "8.10.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.10.0.tgz#e573f719bd3af069017e3b66538ab968d040e54d" + integrity sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5: version "6.12.5" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.5.tgz#19b0e8bae8f476e5ba666300387775fb1a00a4da" From 645cf109e994ad23b427c68b3fe47253771a9f71 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 19 Feb 2022 14:28:08 +0900 Subject: [PATCH 10/95] refactor: fix type --- packages/backend/src/daemons/server-stats.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index 47c46042eb..115e88f150 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -36,8 +36,8 @@ export default function() { tx: round(Math.max(0, netStats.tx_sec)), }, fs: { - r: round(Math.max(0, fsStats.rIO_sec)), - w: round(Math.max(0, fsStats.wIO_sec)), + r: round(Math.max(0, fsStats.rIO_sec ?? 0)), + w: round(Math.max(0, fsStats.wIO_sec ?? 0)), }, }; ev.emit('serverStats', stats); @@ -51,9 +51,9 @@ export default function() { } // CPU STAT -function cpuUsage() { +function cpuUsage(): Promise { return new Promise((res, rej) => { - osUtils.cpuUsage((cpuUsage: number) => { + osUtils.cpuUsage((cpuUsage) => { res(cpuUsage); }); }); From 1dc06f7ad372649a9c33c5e2e13f2c90a0413479 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 19 Feb 2022 14:30:42 +0900 Subject: [PATCH 11/95] refactor: fix type --- packages/backend/src/server/api/stream/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/stream/index.ts b/packages/backend/src/server/api/stream/index.ts index 84689bca1a..e0bb8033a2 100644 --- a/packages/backend/src/server/api/stream/index.ts +++ b/packages/backend/src/server/api/stream/index.ts @@ -109,7 +109,8 @@ export default class Connection { * クライアントからメッセージ受信時 */ @autobind - private async onWsConnectionMessage(data: websocket.IMessage) { + private async onWsConnectionMessage(data: websocket.Message) { + if (data.type !== 'utf8') return; if (data.utf8Data == null) return; let obj: Record; From b6db709e0210ca741db2aae63b16947d3f28545d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 19 Feb 2022 14:53:33 +0900 Subject: [PATCH 12/95] refacator: fix typw --- packages/backend/src/queue/processors/db/delete-account.ts | 4 ++-- .../backend/src/queue/processors/db/export-custom-emojis.ts | 2 +- packages/backend/src/queue/processors/db/export-following.ts | 2 +- packages/backend/src/queue/processors/db/export-notes.ts | 2 +- packages/backend/src/remote/activitypub/models/person.ts | 2 +- .../backend/src/server/api/endpoints/admin/promo/create.ts | 1 - packages/backend/src/services/messages/create.ts | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/queue/processors/db/delete-account.ts b/packages/backend/src/queue/processors/db/delete-account.ts index 4b620842a4..3af181d1d4 100644 --- a/packages/backend/src/queue/processors/db/delete-account.ts +++ b/packages/backend/src/queue/processors/db/delete-account.ts @@ -31,7 +31,7 @@ export async function deleteAccount(job: Bull.Job): Promise order: { id: 1, }, - }); + }) as Note[]; if (notes.length === 0) { break; @@ -58,7 +58,7 @@ export async function deleteAccount(job: Bull.Job): Promise order: { id: 1, }, - }); + }) as DriveFile[]; if (files.length === 0) { break; diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts index 2f7505f158..28d54661c5 100644 --- a/packages/backend/src/queue/processors/db/export-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -75,7 +75,7 @@ export async function exportCustomEmojis(job: Bull.Job, done: () => void): Promi await downloadUrl(emoji.originalUrl, emojiPath); downloaded = true; } catch (e) { // TODO: 何度か再試行 - logger.error(e); + logger.error(e instanceof Error ? e : new Error(e as string)); } if (!downloaded) { diff --git a/packages/backend/src/queue/processors/db/export-following.ts b/packages/backend/src/queue/processors/db/export-following.ts index 2ac558381b..d63904aa41 100644 --- a/packages/backend/src/queue/processors/db/export-following.ts +++ b/packages/backend/src/queue/processors/db/export-following.ts @@ -51,7 +51,7 @@ export async function exportFollowing(job: Bull.Job, done: () => order: { id: 1, }, - }); + }) as Following[]; if (followings.length === 0) { break; diff --git a/packages/backend/src/queue/processors/db/export-notes.ts b/packages/backend/src/queue/processors/db/export-notes.ts index 0e65cb8849..6719cf0bb7 100644 --- a/packages/backend/src/queue/processors/db/export-notes.ts +++ b/packages/backend/src/queue/processors/db/export-notes.ts @@ -62,7 +62,7 @@ export async function exportNotes(job: Bull.Job, done: any): Prom order: { id: 1, }, - }); + }) as Note[]; if (notes.length === 0) { job.progress(100); diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index aaccf51fa9..12660a5441 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -199,7 +199,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise { await PromoNotes.insert({ noteId: note.id, - createdAt: new Date(), expiresAt: new Date(ps.expiresAt), userId: note.userId, }); diff --git a/packages/backend/src/services/messages/create.ts b/packages/backend/src/services/messages/create.ts index e1bef09a79..dc89bc785d 100644 --- a/packages/backend/src/services/messages/create.ts +++ b/packages/backend/src/services/messages/create.ts @@ -13,7 +13,7 @@ import renderCreate from '@/remote/activitypub/renderer/create'; import { renderActivity } from '@/remote/activitypub/renderer/index'; import { deliver } from '@/queue/index'; -export async function createMessage(user: { id: User['id']; host: User['host']; }, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | undefined, file: DriveFile | null, uri?: string) { +export async function createMessage(user: { id: User['id']; host: User['host']; }, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | null | undefined, file: DriveFile | null, uri?: string) { const message = { id: genId(), createdAt: new Date(), From fd8f8162e186981ca2acf9d3b1caef523c748691 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 19 Feb 2022 23:21:28 +0900 Subject: [PATCH 13/95] =?UTF-8?q?SchemaType=E3=81=AE=E5=9E=8B=E8=A8=88?= =?UTF-8?q?=E7=AE=97=E9=87=8F=E3=82=92=E5=89=8A=E6=B8=9B=20(#8332)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * schema typeの型計算量を削減 * reduce some type error * wip * fix * clean up * more shrink --- packages/backend/src/misc/schema.ts | 47 ++++++------------- .../backend/src/models/repositories/app.ts | 2 +- .../endpoints/admin/announcements/create.ts | 2 +- .../server/api/endpoints/i/gallery/likes.ts | 28 ++++++----- .../src/server/api/endpoints/i/page-likes.ts | 29 +++++++----- .../src/server/api/endpoints/my/apps.ts | 41 +--------------- .../src/server/api/endpoints/sw/register.ts | 8 ++-- .../backend/src/server/api/stream/types.ts | 1 + .../src/services/create-system-user.ts | 4 +- 9 files changed, 57 insertions(+), 105 deletions(-) diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index fbe5a1e421..5909969bbf 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -63,14 +63,7 @@ export const refs = { Emoji: packedEmojiSchema, }; -// Packed = SchemaTypeDef; とすると展開されてマウスホバー時に型表示が使い物にならなくなる -// ObjTypeを指定すると(なぜか)展開されずにPacked<'Hoge'>と表示される -type PackedDef; allOf?: ReadonlyArray }> = - r['allOf'] extends ReadonlyArray ? UnionToIntersection> : - r['oneOf'] extends ReadonlyArray ? UnionSchemaType : - r['properties'] extends Obj ? ObjType : - never; -export type Packed = PackedDef; +export type Packed = SchemaType; type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any'; type StringDefToType = @@ -107,31 +100,20 @@ export interface Schema extends OfSchema { readonly minLength?: number; } -type OptionalPropertyNames = { - [K in keyof T]: T[K]['optional'] extends true ? K : never -}[keyof T]; - -type NonOptionalPropertyNames = { - [K in keyof T]: T[K]['optional'] extends false ? K : never -}[keyof T]; - -type DefaultPropertyNames = { - [K in keyof T]: T[K]['default'] extends null ? K : - T[K]['default'] extends string ? K : - T[K]['default'] extends number ? K : - T[K]['default'] extends boolean ? K : - T[K]['default'] extends Record ? K : - never -}[keyof T]; +type RequiredPropertyNames = { + [K in keyof s]: + // K is not optional + s[K]['optional'] extends false ? K : + // K has default value + s[K]['default'] extends null | string | number | boolean | Record ? K : never +}[keyof s]; export interface Obj { [key: string]: Schema; } -export type ObjType> = +export type ObjType = { -readonly [P in keyof s]?: SchemaType } & - { -readonly [P in RequiredProps[number]]: SchemaType } & - { -readonly [P in OptionalPropertyNames]?: SchemaType } & - { -readonly [P in NonOptionalPropertyNames]: SchemaType } & - { -readonly [P in DefaultPropertyNames]: SchemaType }; + { -readonly [P in RequiredProps]: SchemaType } & + { -readonly [P in RequiredPropertyNames]: SchemaType }; type NullOrUndefined

= p['nullable'] extends true @@ -142,11 +124,12 @@ type NullOrUndefined

= ? (T | undefined) : T; -// 共用体型を交差型にする型 https://stackoverflow.com/questions/54938141/typescript-convert-union-to-intersection +// https://stackoverflow.com/questions/54938141/typescript-convert-union-to-intersection +// Get intersection from union type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; // https://github.com/misskey-dev/misskey/pull/8144#discussion_r785287552 -// 単純にSchemaTypeDefで判定するだけではダメ +// To get union, we use `Foo extends any ? Hoge : never` type UnionSchemaType = X extends any ? SchemaType : never; type ArrayUnion = T extends any ? Array : never; @@ -163,7 +146,7 @@ export type SchemaTypeDef

= p['type'] extends 'boolean' ? boolean : p['type'] extends 'object' ? ( p['ref'] extends keyof typeof refs ? Packed : - p['properties'] extends NonNullable ? ObjType> : + p['properties'] extends NonNullable ? ObjType[number]> : p['anyOf'] extends ReadonlyArray ? UnionSchemaType & Partial>> : p['allOf'] extends ReadonlyArray ? UnionToIntersection> : any diff --git a/packages/backend/src/models/repositories/app.ts b/packages/backend/src/models/repositories/app.ts index 6bac4d9598..5576c67236 100644 --- a/packages/backend/src/models/repositories/app.ts +++ b/packages/backend/src/models/repositories/app.ts @@ -32,7 +32,7 @@ export class AppRepository extends Repository { ...(me ? { isAuthorized: await AccessTokens.count({ appId: app.id, - userId: me, + userId: me.id, }).then(count => count > 0), } : {}), }; diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 8d2bda9781..295d99513d 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -65,5 +65,5 @@ export default define(meta, paramDef, async (ps) => { imageUrl: ps.imageUrl, }).then(x => Announcements.findOneOrFail(x.identifiers[0])); - return announcement; + return Object.assign({}, announcement, { createdAt: announcement.createdAt.toISOString(), updatedAt: null }); }); diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index dc862a6b05..7578ed3216 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -10,20 +10,24 @@ export const meta = { kind: 'read:gallery-likes', res: { - type: 'object', + type: 'array', optional: false, nullable: false, - properties: { - id: { - type: 'string', - optional: false, nullable: false, - format: 'id', + items: { + type: 'object', + optional: false, nullable: false, + properties: { + id: { + type: 'string', + optional: false, nullable: false, + format: 'id', + }, + post: { + type: 'object', + optional: false, nullable: false, + ref: 'GalleryPost', + }, }, - page: { - type: 'object', - optional: false, nullable: false, - ref: 'GalleryPost', - }, - }, + } }, } as const; diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index e66bc616c2..60ac3ccde1 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -10,20 +10,23 @@ export const meta = { kind: 'read:page-likes', res: { - type: 'object', + type: 'array', optional: false, nullable: false, - properties: { - id: { - type: 'string', - optional: false, nullable: false, - format: 'id', + items: { + type: 'object', + properties: { + id: { + type: 'string', + optional: false, nullable: false, + format: 'id', + }, + page: { + type: 'object', + optional: false, nullable: false, + ref: 'Page', + }, }, - page: { - type: 'object', - optional: false, nullable: false, - ref: 'Page', - }, - }, + } }, } as const; @@ -47,5 +50,5 @@ export default define(meta, paramDef, async (ps, user) => { .take(ps.limit) .getMany(); - return await PageLikes.packMany(likes, user); + return PageLikes.packMany(likes, user); }); diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index 60e5014110..8dee11fb93 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -12,46 +12,7 @@ export const meta = { items: { type: 'object', optional: false, nullable: false, - properties: { - id: { - type: 'string', - optional: false, nullable: false, - }, - name: { - type: 'string', - optional: false, nullable: false, - }, - callbackUrl: { - type: 'string', - optional: false, nullable: false, - }, - permission: { - type: 'array', - optional: false, nullable: false, - items: { - type: 'string', - optional: false, nullable: false, - }, - }, - secret: { - type: 'string', - optional: true, nullable: false, - }, - isAuthorized: { - type: 'object', - optional: true, nullable: false, - properties: { - appId: { - type: 'string', - optional: false, nullable: false, - }, - userId: { - type: 'string', - optional: false, nullable: false, - }, - }, - }, - }, + ref: 'App', }, }, } as const; diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index 9091c9481a..459b0dd969 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -14,12 +14,12 @@ export const meta = { properties: { state: { type: 'string', - optional: false, nullable: false, + optional: true, nullable: false, enum: ['already-subscribed', 'subscribed'], }, key: { type: 'string', - optional: false, nullable: false, + optional: false, nullable: true, }, }, }, @@ -49,7 +49,7 @@ export default define(meta, paramDef, async (ps, user) => { if (exist != null) { return { - state: 'already-subscribed', + state: 'already-subscribed' as const, key: instance.swPublicKey, }; } @@ -64,7 +64,7 @@ export default define(meta, paramDef, async (ps, user) => { }); return { - state: 'subscribed', + state: 'subscribed' as const, key: instance.swPublicKey, }; }); diff --git a/packages/backend/src/server/api/stream/types.ts b/packages/backend/src/server/api/stream/types.ts index e2f1c6fc9c..921856b38d 100644 --- a/packages/backend/src/server/api/stream/types.ts +++ b/packages/backend/src/server/api/stream/types.ts @@ -84,6 +84,7 @@ export interface MainStreamTypes { }; driveFileCreated: Packed<'DriveFile'>; readAntenna: Antenna; + receiveFollowRequest: Packed<'User'>; } export interface DriveStreamTypes { diff --git a/packages/backend/src/services/create-system-user.ts b/packages/backend/src/services/create-system-user.ts index 82130dd593..2e9ec178fd 100644 --- a/packages/backend/src/services/create-system-user.ts +++ b/packages/backend/src/services/create-system-user.ts @@ -4,7 +4,7 @@ import generateNativeUserToken from '../server/api/common/generate-native-user-t import { genRsaKeyPair } from '@/misc/gen-key-pair'; import { User } from '@/models/entities/user'; import { UserProfile } from '@/models/entities/user-profile'; -import { getConnection } from 'typeorm'; +import { getConnection, ObjectLiteral } from 'typeorm'; import { genId } from '@/misc/gen-id'; import { UserKeypair } from '@/models/entities/user-keypair'; import { UsedUsername } from '@/models/entities/used-username'; @@ -21,7 +21,7 @@ export async function createSystemUser(username: string) { const keyPair = await genRsaKeyPair(4096); - let account!: User; + let account!: User | ObjectLiteral; // Start transaction await getConnection().transaction(async transactionalEntityManager => { From 0cab102f3a09d9bee2ee7e6754c25ebd9e0d0b29 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 20 Feb 2022 01:12:30 +0900 Subject: [PATCH 14/95] wip --- packages/backend/src/server/api/call.ts | 4 ++-- .../backend/src/server/api/endpoints/drive/files/create.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index ea457d9556..e767b15417 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -78,8 +78,8 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac } // Cast non JSON input - if (ep.meta.requireFile) { - for (const k of Object.keys(ep.params)) { + if (ep.meta.requireFile && ep.params.properties) { + for (const k of Object.keys(ep.params.properties)) { const param = ep.params.properties![k]; if (['boolean', 'number', 'integer'].includes(param.type ?? '') && typeof data[k] === 'string') { try { diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index f5791f6ec7..aafb650dd7 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -35,7 +35,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, From 78ad95d3adabe54ce094c4266b77da078f2cb7d1 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 20 Feb 2022 01:32:35 +0900 Subject: [PATCH 15/95] :v: --- packages/backend/src/server/api/define.ts | 15 ++++++++++++--- .../api/endpoints/admin/abuse-user-reports.ts | 2 +- .../server/api/endpoints/admin/accounts/create.ts | 2 +- .../server/api/endpoints/admin/accounts/delete.ts | 2 +- .../src/server/api/endpoints/admin/ad/create.ts | 2 +- .../src/server/api/endpoints/admin/ad/delete.ts | 2 +- .../src/server/api/endpoints/admin/ad/list.ts | 2 +- .../src/server/api/endpoints/admin/ad/update.ts | 2 +- .../api/endpoints/admin/announcements/create.ts | 2 +- .../api/endpoints/admin/announcements/delete.ts | 2 +- .../api/endpoints/admin/announcements/list.ts | 2 +- .../api/endpoints/admin/announcements/update.ts | 2 +- .../endpoints/admin/delete-all-files-of-a-user.ts | 2 +- .../endpoints/admin/drive/clean-remote-files.ts | 2 +- .../server/api/endpoints/admin/drive/cleanup.ts | 2 +- .../src/server/api/endpoints/admin/drive/files.ts | 2 +- .../server/api/endpoints/admin/drive/show-file.ts | 2 +- .../api/endpoints/admin/emoji/add-aliases-bulk.ts | 2 +- .../src/server/api/endpoints/admin/emoji/add.ts | 2 +- .../src/server/api/endpoints/admin/emoji/copy.ts | 2 +- .../api/endpoints/admin/emoji/delete-bulk.ts | 2 +- .../server/api/endpoints/admin/emoji/delete.ts | 2 +- .../api/endpoints/admin/emoji/import-zip.ts | 2 +- .../api/endpoints/admin/emoji/list-remote.ts | 2 +- .../src/server/api/endpoints/admin/emoji/list.ts | 2 +- .../endpoints/admin/emoji/remove-aliases-bulk.ts | 2 +- .../api/endpoints/admin/emoji/set-aliases-bulk.ts | 2 +- .../endpoints/admin/emoji/set-category-bulk.ts | 2 +- .../server/api/endpoints/admin/emoji/update.ts | 2 +- .../admin/federation/delete-all-files.ts | 2 +- .../refresh-remote-instance-metadata.ts | 2 +- .../admin/federation/remove-all-following.ts | 2 +- .../endpoints/admin/federation/update-instance.ts | 2 +- .../server/api/endpoints/admin/get-index-stats.ts | 2 +- .../server/api/endpoints/admin/get-table-stats.ts | 2 +- .../src/server/api/endpoints/admin/invite.ts | 2 +- .../server/api/endpoints/admin/moderators/add.ts | 2 +- .../api/endpoints/admin/moderators/remove.ts | 2 +- .../server/api/endpoints/admin/promo/create.ts | 2 +- .../src/server/api/endpoints/admin/queue/clear.ts | 2 +- .../api/endpoints/admin/queue/deliver-delayed.ts | 2 +- .../api/endpoints/admin/queue/inbox-delayed.ts | 2 +- .../src/server/api/endpoints/admin/queue/stats.ts | 2 +- .../src/server/api/endpoints/admin/relays/add.ts | 2 +- .../src/server/api/endpoints/admin/relays/list.ts | 2 +- .../server/api/endpoints/admin/relays/remove.ts | 2 +- .../server/api/endpoints/admin/reset-password.ts | 2 +- .../endpoints/admin/resolve-abuse-user-report.ts | 2 +- .../src/server/api/endpoints/admin/send-email.ts | 2 +- .../src/server/api/endpoints/admin/server-info.ts | 2 +- .../api/endpoints/admin/show-moderation-logs.ts | 2 +- .../src/server/api/endpoints/admin/show-user.ts | 2 +- .../src/server/api/endpoints/admin/show-users.ts | 2 +- .../server/api/endpoints/admin/silence-user.ts | 2 +- .../server/api/endpoints/admin/suspend-user.ts | 2 +- .../server/api/endpoints/admin/unsilence-user.ts | 2 +- .../server/api/endpoints/admin/unsuspend-user.ts | 2 +- .../src/server/api/endpoints/admin/update-meta.ts | 2 +- .../src/server/api/endpoints/admin/vacuum.ts | 2 +- .../src/server/api/endpoints/announcements.ts | 2 +- .../src/server/api/endpoints/antennas/create.ts | 2 +- .../src/server/api/endpoints/antennas/delete.ts | 2 +- .../src/server/api/endpoints/antennas/list.ts | 2 +- .../src/server/api/endpoints/antennas/notes.ts | 2 +- .../src/server/api/endpoints/antennas/show.ts | 2 +- .../src/server/api/endpoints/antennas/update.ts | 2 +- .../backend/src/server/api/endpoints/ap/get.ts | 2 +- .../backend/src/server/api/endpoints/ap/show.ts | 2 +- .../src/server/api/endpoints/app/create.ts | 2 +- .../backend/src/server/api/endpoints/app/show.ts | 2 +- .../src/server/api/endpoints/auth/accept.ts | 2 +- .../server/api/endpoints/auth/session/generate.ts | 2 +- .../src/server/api/endpoints/auth/session/show.ts | 2 +- .../server/api/endpoints/auth/session/userkey.ts | 2 +- .../src/server/api/endpoints/blocking/create.ts | 2 +- .../src/server/api/endpoints/blocking/delete.ts | 2 +- .../src/server/api/endpoints/blocking/list.ts | 2 +- .../src/server/api/endpoints/channels/create.ts | 2 +- .../src/server/api/endpoints/channels/featured.ts | 2 +- .../src/server/api/endpoints/channels/follow.ts | 2 +- .../src/server/api/endpoints/channels/followed.ts | 2 +- .../src/server/api/endpoints/channels/owned.ts | 2 +- .../src/server/api/endpoints/channels/show.ts | 2 +- .../src/server/api/endpoints/channels/timeline.ts | 2 +- .../src/server/api/endpoints/channels/unfollow.ts | 2 +- .../src/server/api/endpoints/channels/update.ts | 2 +- .../server/api/endpoints/charts/active-users.ts | 2 +- .../src/server/api/endpoints/charts/ap-request.ts | 2 +- .../src/server/api/endpoints/charts/drive.ts | 2 +- .../src/server/api/endpoints/charts/federation.ts | 2 +- .../src/server/api/endpoints/charts/hashtag.ts | 2 +- .../src/server/api/endpoints/charts/instance.ts | 2 +- .../src/server/api/endpoints/charts/notes.ts | 2 +- .../src/server/api/endpoints/charts/user/drive.ts | 2 +- .../server/api/endpoints/charts/user/following.ts | 2 +- .../src/server/api/endpoints/charts/user/notes.ts | 2 +- .../server/api/endpoints/charts/user/reactions.ts | 2 +- .../src/server/api/endpoints/charts/users.ts | 2 +- .../src/server/api/endpoints/clips/add-note.ts | 2 +- .../src/server/api/endpoints/clips/create.ts | 2 +- .../src/server/api/endpoints/clips/delete.ts | 2 +- .../src/server/api/endpoints/clips/list.ts | 2 +- .../src/server/api/endpoints/clips/notes.ts | 2 +- .../src/server/api/endpoints/clips/show.ts | 2 +- .../src/server/api/endpoints/clips/update.ts | 2 +- .../backend/src/server/api/endpoints/drive.ts | 2 +- .../src/server/api/endpoints/drive/files.ts | 2 +- .../api/endpoints/drive/files/attached-notes.ts | 2 +- .../api/endpoints/drive/files/check-existence.ts | 2 +- .../server/api/endpoints/drive/files/create.ts | 1 + .../server/api/endpoints/drive/files/delete.ts | 2 +- .../api/endpoints/drive/files/find-by-hash.ts | 2 +- .../src/server/api/endpoints/drive/files/find.ts | 2 +- .../src/server/api/endpoints/drive/files/show.ts | 2 +- .../server/api/endpoints/drive/files/update.ts | 2 +- .../api/endpoints/drive/files/upload-from-url.ts | 2 +- .../src/server/api/endpoints/drive/folders.ts | 2 +- .../server/api/endpoints/drive/folders/create.ts | 2 +- .../server/api/endpoints/drive/folders/delete.ts | 2 +- .../server/api/endpoints/drive/folders/find.ts | 2 +- .../server/api/endpoints/drive/folders/show.ts | 2 +- .../server/api/endpoints/drive/folders/update.ts | 2 +- .../src/server/api/endpoints/drive/stream.ts | 2 +- .../api/endpoints/email-address/available.ts | 2 +- .../backend/src/server/api/endpoints/endpoint.ts | 2 +- .../backend/src/server/api/endpoints/endpoints.ts | 2 +- .../server/api/endpoints/export-custom-emojis.ts | 2 +- .../server/api/endpoints/federation/followers.ts | 2 +- .../server/api/endpoints/federation/following.ts | 2 +- .../server/api/endpoints/federation/instances.ts | 2 +- .../api/endpoints/federation/show-instance.ts | 2 +- .../endpoints/federation/update-remote-user.ts | 2 +- .../src/server/api/endpoints/federation/users.ts | 2 +- .../src/server/api/endpoints/following/create.ts | 2 +- .../src/server/api/endpoints/following/delete.ts | 2 +- .../server/api/endpoints/following/invalidate.ts | 2 +- .../api/endpoints/following/requests/accept.ts | 2 +- .../api/endpoints/following/requests/cancel.ts | 2 +- .../api/endpoints/following/requests/list.ts | 2 +- .../api/endpoints/following/requests/reject.ts | 2 +- .../src/server/api/endpoints/gallery/featured.ts | 2 +- .../src/server/api/endpoints/gallery/popular.ts | 2 +- .../src/server/api/endpoints/gallery/posts.ts | 2 +- .../server/api/endpoints/gallery/posts/create.ts | 2 +- .../server/api/endpoints/gallery/posts/delete.ts | 2 +- .../server/api/endpoints/gallery/posts/like.ts | 2 +- .../server/api/endpoints/gallery/posts/show.ts | 2 +- .../server/api/endpoints/gallery/posts/unlike.ts | 2 +- .../server/api/endpoints/gallery/posts/update.ts | 2 +- .../api/endpoints/get-online-users-count.ts | 2 +- .../src/server/api/endpoints/hashtags/list.ts | 2 +- .../src/server/api/endpoints/hashtags/search.ts | 2 +- .../src/server/api/endpoints/hashtags/show.ts | 2 +- .../src/server/api/endpoints/hashtags/trend.ts | 2 +- .../src/server/api/endpoints/hashtags/users.ts | 2 +- packages/backend/src/server/api/endpoints/i.ts | 2 +- .../src/server/api/endpoints/i/2fa/done.ts | 2 +- .../src/server/api/endpoints/i/2fa/key-done.ts | 2 +- .../server/api/endpoints/i/2fa/password-less.ts | 2 +- .../server/api/endpoints/i/2fa/register-key.ts | 2 +- .../src/server/api/endpoints/i/2fa/register.ts | 2 +- .../src/server/api/endpoints/i/2fa/remove-key.ts | 2 +- .../src/server/api/endpoints/i/2fa/unregister.ts | 2 +- .../backend/src/server/api/endpoints/i/apps.ts | 2 +- .../src/server/api/endpoints/i/authorized-apps.ts | 2 +- .../src/server/api/endpoints/i/change-password.ts | 2 +- .../src/server/api/endpoints/i/delete-account.ts | 2 +- .../src/server/api/endpoints/i/export-blocking.ts | 2 +- .../server/api/endpoints/i/export-following.ts | 2 +- .../src/server/api/endpoints/i/export-mute.ts | 2 +- .../src/server/api/endpoints/i/export-notes.ts | 2 +- .../server/api/endpoints/i/export-user-lists.ts | 2 +- .../src/server/api/endpoints/i/favorites.ts | 2 +- .../src/server/api/endpoints/i/gallery/likes.ts | 2 +- .../src/server/api/endpoints/i/gallery/posts.ts | 2 +- .../api/endpoints/i/get-word-muted-notes-count.ts | 2 +- .../src/server/api/endpoints/i/import-blocking.ts | 2 +- .../server/api/endpoints/i/import-following.ts | 2 +- .../src/server/api/endpoints/i/import-muting.ts | 2 +- .../server/api/endpoints/i/import-user-lists.ts | 2 +- .../src/server/api/endpoints/i/notifications.ts | 2 +- .../src/server/api/endpoints/i/page-likes.ts | 2 +- .../backend/src/server/api/endpoints/i/pages.ts | 2 +- .../backend/src/server/api/endpoints/i/pin.ts | 2 +- .../endpoints/i/read-all-messaging-messages.ts | 2 +- .../api/endpoints/i/read-all-unread-notes.ts | 2 +- .../server/api/endpoints/i/read-announcement.ts | 2 +- .../server/api/endpoints/i/regenerate-token.ts | 2 +- .../server/api/endpoints/i/registry/get-all.ts | 2 +- .../server/api/endpoints/i/registry/get-detail.ts | 2 +- .../src/server/api/endpoints/i/registry/get.ts | 2 +- .../api/endpoints/i/registry/keys-with-type.ts | 2 +- .../src/server/api/endpoints/i/registry/keys.ts | 2 +- .../src/server/api/endpoints/i/registry/remove.ts | 2 +- .../src/server/api/endpoints/i/registry/scopes.ts | 2 +- .../src/server/api/endpoints/i/registry/set.ts | 2 +- .../src/server/api/endpoints/i/revoke-token.ts | 2 +- .../src/server/api/endpoints/i/signin-history.ts | 2 +- .../backend/src/server/api/endpoints/i/unpin.ts | 2 +- .../src/server/api/endpoints/i/update-email.ts | 2 +- .../backend/src/server/api/endpoints/i/update.ts | 2 +- .../server/api/endpoints/i/user-group-invites.ts | 2 +- .../src/server/api/endpoints/messaging/history.ts | 2 +- .../server/api/endpoints/messaging/messages.ts | 2 +- .../api/endpoints/messaging/messages/create.ts | 2 +- .../api/endpoints/messaging/messages/delete.ts | 2 +- .../api/endpoints/messaging/messages/read.ts | 2 +- packages/backend/src/server/api/endpoints/meta.ts | 2 +- .../src/server/api/endpoints/miauth/gen-token.ts | 2 +- .../src/server/api/endpoints/mute/create.ts | 2 +- .../src/server/api/endpoints/mute/delete.ts | 2 +- .../backend/src/server/api/endpoints/mute/list.ts | 2 +- .../backend/src/server/api/endpoints/my/apps.ts | 2 +- .../backend/src/server/api/endpoints/notes.ts | 2 +- .../src/server/api/endpoints/notes/children.ts | 2 +- .../src/server/api/endpoints/notes/clips.ts | 2 +- .../server/api/endpoints/notes/conversation.ts | 2 +- .../src/server/api/endpoints/notes/create.ts | 2 +- .../src/server/api/endpoints/notes/delete.ts | 2 +- .../api/endpoints/notes/favorites/create.ts | 2 +- .../api/endpoints/notes/favorites/delete.ts | 2 +- .../src/server/api/endpoints/notes/featured.ts | 2 +- .../server/api/endpoints/notes/global-timeline.ts | 2 +- .../server/api/endpoints/notes/hybrid-timeline.ts | 2 +- .../server/api/endpoints/notes/local-timeline.ts | 2 +- .../src/server/api/endpoints/notes/mentions.ts | 2 +- .../api/endpoints/notes/polls/recommendation.ts | 2 +- .../src/server/api/endpoints/notes/polls/vote.ts | 2 +- .../src/server/api/endpoints/notes/reactions.ts | 2 +- .../api/endpoints/notes/reactions/create.ts | 2 +- .../api/endpoints/notes/reactions/delete.ts | 2 +- .../src/server/api/endpoints/notes/renotes.ts | 2 +- .../src/server/api/endpoints/notes/replies.ts | 2 +- .../server/api/endpoints/notes/search-by-tag.ts | 2 +- .../src/server/api/endpoints/notes/search.ts | 2 +- .../src/server/api/endpoints/notes/show.ts | 2 +- .../src/server/api/endpoints/notes/state.ts | 2 +- .../api/endpoints/notes/thread-muting/create.ts | 2 +- .../api/endpoints/notes/thread-muting/delete.ts | 2 +- .../src/server/api/endpoints/notes/timeline.ts | 2 +- .../src/server/api/endpoints/notes/translate.ts | 2 +- .../src/server/api/endpoints/notes/unrenote.ts | 2 +- .../api/endpoints/notes/user-list-timeline.ts | 2 +- .../server/api/endpoints/notes/watching/create.ts | 2 +- .../server/api/endpoints/notes/watching/delete.ts | 2 +- .../server/api/endpoints/notifications/create.ts | 2 +- .../endpoints/notifications/mark-all-as-read.ts | 2 +- .../server/api/endpoints/notifications/read.ts | 2 +- .../backend/src/server/api/endpoints/page-push.ts | 2 +- .../src/server/api/endpoints/pages/create.ts | 2 +- .../src/server/api/endpoints/pages/delete.ts | 2 +- .../src/server/api/endpoints/pages/featured.ts | 2 +- .../src/server/api/endpoints/pages/like.ts | 2 +- .../src/server/api/endpoints/pages/show.ts | 2 +- .../src/server/api/endpoints/pages/unlike.ts | 2 +- .../src/server/api/endpoints/pages/update.ts | 2 +- packages/backend/src/server/api/endpoints/ping.ts | 2 +- .../src/server/api/endpoints/pinned-users.ts | 2 +- .../src/server/api/endpoints/promo/read.ts | 2 +- .../api/endpoints/request-reset-password.ts | 2 +- .../backend/src/server/api/endpoints/reset-db.ts | 2 +- .../src/server/api/endpoints/reset-password.ts | 2 +- .../src/server/api/endpoints/server-info.ts | 2 +- .../backend/src/server/api/endpoints/stats.ts | 2 +- .../src/server/api/endpoints/sw/register.ts | 2 +- .../src/server/api/endpoints/sw/unregister.ts | 2 +- packages/backend/src/server/api/endpoints/test.ts | 2 +- .../server/api/endpoints/username/available.ts | 2 +- .../backend/src/server/api/endpoints/users.ts | 2 +- .../src/server/api/endpoints/users/clips.ts | 2 +- .../src/server/api/endpoints/users/followers.ts | 2 +- .../src/server/api/endpoints/users/following.ts | 2 +- .../server/api/endpoints/users/gallery/posts.ts | 2 +- .../users/get-frequently-replied-users.ts | 2 +- .../server/api/endpoints/users/groups/create.ts | 2 +- .../server/api/endpoints/users/groups/delete.ts | 2 +- .../endpoints/users/groups/invitations/accept.ts | 2 +- .../endpoints/users/groups/invitations/reject.ts | 2 +- .../server/api/endpoints/users/groups/invite.ts | 2 +- .../server/api/endpoints/users/groups/joined.ts | 2 +- .../server/api/endpoints/users/groups/leave.ts | 2 +- .../server/api/endpoints/users/groups/owned.ts | 2 +- .../src/server/api/endpoints/users/groups/pull.ts | 2 +- .../src/server/api/endpoints/users/groups/show.ts | 2 +- .../server/api/endpoints/users/groups/transfer.ts | 2 +- .../server/api/endpoints/users/groups/update.ts | 2 +- .../server/api/endpoints/users/lists/create.ts | 2 +- .../server/api/endpoints/users/lists/delete.ts | 2 +- .../src/server/api/endpoints/users/lists/list.ts | 2 +- .../src/server/api/endpoints/users/lists/pull.ts | 2 +- .../src/server/api/endpoints/users/lists/push.ts | 2 +- .../src/server/api/endpoints/users/lists/show.ts | 2 +- .../server/api/endpoints/users/lists/update.ts | 2 +- .../src/server/api/endpoints/users/notes.ts | 2 +- .../src/server/api/endpoints/users/pages.ts | 2 +- .../src/server/api/endpoints/users/reactions.ts | 2 +- .../server/api/endpoints/users/recommendation.ts | 2 +- .../src/server/api/endpoints/users/relation.ts | 2 +- .../server/api/endpoints/users/report-abuse.ts | 2 +- .../users/search-by-username-and-host.ts | 2 +- .../src/server/api/endpoints/users/search.ts | 2 +- .../src/server/api/endpoints/users/show.ts | 2 +- .../src/server/api/endpoints/users/stats.ts | 2 +- 303 files changed, 314 insertions(+), 304 deletions(-) diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 061ade17bf..e2a34f47a5 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -1,10 +1,13 @@ import * as fs from 'fs'; -import * as Ajv from 'ajv'; +import Ajv from 'ajv'; import { ILocalUser } from '@/models/entities/user'; import { IEndpointMeta } from './endpoints'; import { ApiError } from './error'; import { Schema, SchemaType } from '@/misc/schema'; import { AccessToken } from '@/models/entities/access-token'; +import { ValidateFunction } from 'ajv'; +import { JTDDataType } from 'ajv/dist/types/jtd-schema'; +import { apiLogger } from './logger'; type SimpleUserInfo = { id: ILocalUser['id']; @@ -36,7 +39,13 @@ ajv.addFormat('misskey:id', /^[a-z0-9]+$/); export default function (meta: T, paramDef: Ps, cb: executor) : (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => Promise { - const validate = ajv.compile(paramDef); + let validate: ValidateFunction>; + + try { + validate = ajv.compile(paramDef); + } catch (error) { + apiLogger.error('FAILED TO COMPILE SCHEMA ' + JSON.stringify({ param: paramDef, error })); + } return (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => { function cleanup() { @@ -65,6 +74,6 @@ export default function (meta: T, pa return Promise.reject(err); } - return cb(params, user, token, file, cleanup); + return cb(params as SchemaType, user, token, file, cleanup); }; } diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index 97b7bc7dba..6ab9c87e3c 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -70,7 +70,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index 50b2eb0427..421726d60f 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: Users.localUsernameSchema, diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index 99d61b2f32..cf48a906f0 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -11,7 +11,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index 9883efefe7..c1efaf6314 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { url: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts index dfd873f016..1b9607b5aa 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 83fdedef77..5b72f72937 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index bf4bce5150..93902e79c1 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 295d99513d..884dd5e280 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { title: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index f0141ca595..c09307193f 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index 993f9877d2..af48925ec1 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -52,7 +52,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index f905616b3e..fb4d5e95ba 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 41e2c23488..dde84ae45e 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 9b127eb5d3..c42b5caac2 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts index 1c63af6a17..a7ce154cf2 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index 56a8c1c642..0b5544ce28 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts index bb1ed1072a..efd4a8e4aa 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts @@ -149,7 +149,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts index 9aeb04d247..4ddea09b1c 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts index 718ecae4b1..2ca3aade99 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index fc20ff0a84..f2dc11f664 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { emojiId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts index 792e72ff97..d35ef660e4 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts @@ -11,7 +11,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts index 15d44b3a0e..2dabd60a0f 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts index 5ee6dd4c8d..98d8d4fef9 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index 865715968a..e519f64ff0 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -50,7 +50,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string', nullable: true, default: null }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 0e23132d99..8e26da3d64 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -50,7 +50,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string', nullable: true, default: null }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts index e6ccbf684d..e619053e58 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts index 30a1c28af6..dff90193e7 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts index 9679e4a369..462e7a742c 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts index da5a5f005e..870d568311 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index e98de40ff8..71c1c41cf6 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index d6e3a15c61..df73453f78 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 7c2d6dc391..0ae58de534 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts index 04cad3b9f7..9a3c35d055 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts index 9379379aef..17ce1bfce9 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts @@ -8,7 +8,7 @@ export const meta = { tags: ['admin'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts index 28856cd41c..e980ca96ef 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index a21777937c..45392f85c7 100644 --- a/packages/backend/src/server/api/endpoints/admin/invite.ts +++ b/packages/backend/src/server/api/endpoints/admin/invite.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts index 6b7e549c35..3bf66f3c86 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts @@ -8,7 +8,7 @@ export const meta = { requireAdmin: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts index 585d6fbfa7..e2e96de3c1 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts @@ -8,7 +8,7 @@ export const meta = { requireAdmin: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/promo/create.ts b/packages/backend/src/server/api/endpoints/admin/promo/create.ts index 16f522729b..4f714c579c 100644 --- a/packages/backend/src/server/api/endpoints/admin/promo/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/promo/create.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts index 27bb9cc858..fd1dba8e50 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index 38eac5a135..080a7da04f 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 9669cfd3b8..c452b620ec 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index 3f7e6be5fb..6b883aebee 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index ecf77b87df..e8eb249f93 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -45,7 +45,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { inbox: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/relays/list.ts b/packages/backend/src/server/api/endpoints/admin/relays/list.ts index 6cdaa418a7..da2c32ce4f 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/list.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts index d452c2e6a5..26a16284db 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { inbox: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/reset-password.ts b/packages/backend/src/server/api/endpoints/admin/reset-password.ts index 87424782c5..5036d76d1f 100644 --- a/packages/backend/src/server/api/endpoints/admin/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/admin/reset-password.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index 4139f77614..ec8b56083c 100644 --- a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -12,7 +12,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { reportId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/send-email.ts b/packages/backend/src/server/api/endpoints/admin/send-email.ts index 2ebe7e0bc9..819ff8fd03 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-email.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-email.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { to: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/server-info.ts b/packages/backend/src/server/api/endpoints/admin/server-info.ts index 44e069d603..ece9bff53e 100644 --- a/packages/backend/src/server/api/endpoints/admin/server-info.ts +++ b/packages/backend/src/server/api/endpoints/admin/server-info.ts @@ -87,7 +87,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index c08acaeca9..1688a1fc53 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -48,7 +48,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/show-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts index b883aff494..46b6609869 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts @@ -13,7 +13,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index c373021d0e..bc4b319e17 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index df547184ad..54ef60f7fe 100644 --- a/packages/backend/src/server/api/endpoints/admin/silence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/silence-user.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 31867a4055..c2f3d72438 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -13,7 +13,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts index 42c7e776a8..ddda5f48ab 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts index 011f485277..25a8f1a00a 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index b845eb4d5b..ecede8a049 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -11,7 +11,7 @@ export const meta = { requireAdmin: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { disableRegistration: { type: 'boolean', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/admin/vacuum.ts b/packages/backend/src/server/api/endpoints/admin/vacuum.ts index 07a4517bd4..8ce352bffd 100644 --- a/packages/backend/src/server/api/endpoints/admin/vacuum.ts +++ b/packages/backend/src/server/api/endpoints/admin/vacuum.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { full: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index bea3a287fc..78a924fe5e 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -51,7 +51,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 16ba065b9d..272ebddd4b 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index c140084778..247d4af16c 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/antennas/list.ts b/packages/backend/src/server/api/endpoints/antennas/list.ts index 6910c07291..59d75d80f5 100644 --- a/packages/backend/src/server/api/endpoints/antennas/list.ts +++ b/packages/backend/src/server/api/endpoints/antennas/list.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 283c01c2c7..74f0d8d88f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -33,7 +33,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/antennas/show.ts b/packages/backend/src/server/api/endpoints/antennas/show.ts index d8c08f2777..8428844c15 100644 --- a/packages/backend/src/server/api/endpoints/antennas/show.ts +++ b/packages/backend/src/server/api/endpoints/antennas/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index 9f8564c2c0..0b8e864b4d 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index c62ca6088b..a60ff00ecd 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { uri: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index e0b53403bb..8f71e84a15 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -68,7 +68,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { uri: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index 0f9610d2a9..6e8d2b2abd 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/app/show.ts b/packages/backend/src/server/api/endpoints/app/show.ts index 0ca7fcc2a8..6d75294e84 100644 --- a/packages/backend/src/server/api/endpoints/app/show.ts +++ b/packages/backend/src/server/api/endpoints/app/show.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { appId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/auth/accept.ts b/packages/backend/src/server/api/endpoints/auth/accept.ts index 4429119b1f..775c26818b 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/auth/session/generate.ts b/packages/backend/src/server/api/endpoints/auth/session/generate.ts index 8d5c14e2f7..ba0356431f 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/generate.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/generate.ts @@ -35,7 +35,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { appSecret: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/auth/session/show.ts b/packages/backend/src/server/api/endpoints/auth/session/show.ts index dfc1c06ee6..701cc9237d 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/show.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/show.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index 397d1e687b..fa04610ce0 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts @@ -45,7 +45,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { appSecret: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index 8fd8f33338..cf09ca00ba 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index ad00fd1e0b..6e9fead113 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index a315ccde9e..bbae0fe661 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index dc7afadfa2..0491f7638f 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 128 }, diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index 4d07e720a9..c1e4ba2dec 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index 01156d1c2c..c831db4b8c 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index 0e75f06f47..79b12514ff 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { sinceId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index f8acae836b..c4c250fab1 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { sinceId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/show.ts b/packages/backend/src/server/api/endpoints/channels/show.ts index fb2c7b5adf..48d9fe29c1 100644 --- a/packages/backend/src/server/api/endpoints/channels/show.ts +++ b/packages/backend/src/server/api/endpoints/channels/show.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index a870ecccbb..6f35fd966c 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index 42a0eb0a5a..e6524bf555 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index 5a593c62e0..3ee36d97ec 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -36,7 +36,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/charts/active-users.ts b/packages/backend/src/server/api/endpoints/charts/active-users.ts index a99269da0c..dcb155b937 100644 --- a/packages/backend/src/server/api/endpoints/charts/active-users.ts +++ b/packages/backend/src/server/api/endpoints/charts/active-users.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(activeUsersChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/ap-request.ts b/packages/backend/src/server/api/endpoints/charts/ap-request.ts index 403a933807..cb8046236a 100644 --- a/packages/backend/src/server/api/endpoints/charts/ap-request.ts +++ b/packages/backend/src/server/api/endpoints/charts/ap-request.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(apRequestChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/drive.ts b/packages/backend/src/server/api/endpoints/charts/drive.ts index 2c815367f6..35ec62e671 100644 --- a/packages/backend/src/server/api/endpoints/charts/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/drive.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(driveChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/federation.ts b/packages/backend/src/server/api/endpoints/charts/federation.ts index c48613ffac..07492cf6c2 100644 --- a/packages/backend/src/server/api/endpoints/charts/federation.ts +++ b/packages/backend/src/server/api/endpoints/charts/federation.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(federationChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/hashtag.ts b/packages/backend/src/server/api/endpoints/charts/hashtag.ts index 3cb0784ba4..537bb45bf1 100644 --- a/packages/backend/src/server/api/endpoints/charts/hashtag.ts +++ b/packages/backend/src/server/api/endpoints/charts/hashtag.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(hashtagChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/instance.ts b/packages/backend/src/server/api/endpoints/charts/instance.ts index 2da3cd3c3a..cd5c044ad9 100644 --- a/packages/backend/src/server/api/endpoints/charts/instance.ts +++ b/packages/backend/src/server/api/endpoints/charts/instance.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(instanceChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/notes.ts b/packages/backend/src/server/api/endpoints/charts/notes.ts index c48bc67e1c..b30f0894c2 100644 --- a/packages/backend/src/server/api/endpoints/charts/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/notes.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(notesChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/drive.ts b/packages/backend/src/server/api/endpoints/charts/user/drive.ts index 62f7afa435..cc1aac5fea 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/drive.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserDriveChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/following.ts b/packages/backend/src/server/api/endpoints/charts/user/following.ts index d6d2d5e3ee..1b68bdca1c 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/following.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/following.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserFollowingChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/notes.ts b/packages/backend/src/server/api/endpoints/charts/user/notes.ts index becde8b1df..55e6368187 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/notes.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserNotesChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts index 8f4d9a812a..f72424d2cf 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserReactionsChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/users.ts b/packages/backend/src/server/api/endpoints/charts/users.ts index 855fc6cd07..2dfdfefd78 100644 --- a/packages/backend/src/server/api/endpoints/charts/users.ts +++ b/packages/backend/src/server/api/endpoints/charts/users.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(usersChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index e7dc25fe40..7700382bd3 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index b6ebf866b8..86164e69af 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index a263e10521..7f712450ae 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/list.ts b/packages/backend/src/server/api/endpoints/clips/list.ts index 959b60e6f9..b8ee72af7c 100644 --- a/packages/backend/src/server/api/endpoints/clips/list.ts +++ b/packages/backend/src/server/api/endpoints/clips/list.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index dd76e396bf..698b9d428d 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/show.ts b/packages/backend/src/server/api/endpoints/clips/show.ts index 7fe827a967..e1add3a0a6 100644 --- a/packages/backend/src/server/api/endpoints/clips/show.ts +++ b/packages/backend/src/server/api/endpoints/clips/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index b864497349..97134ac79a 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive.ts b/packages/backend/src/server/api/endpoints/drive.ts index 5fc1f64cf0..5ff383f0f4 100644 --- a/packages/backend/src/server/api/endpoints/drive.ts +++ b/packages/backend/src/server/api/endpoints/drive.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index 8ca9daed4d..998d964bc3 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index 20238c1b96..440dc856fd 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts index 8b7af3e54a..853723016e 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts @@ -14,7 +14,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { md5: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index aafb650dd7..89c6c99f36 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -48,6 +48,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export +// @ts-ignore export default define(meta, paramDef, async (ps, user, _, file, cleanup) => { // Get 'name' parameter let name = ps.name || file.originalname; diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 664637a68f..8ae7e7effe 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts index 98de790c0d..feb738be0d 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { md5: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/find.ts b/packages/backend/src/server/api/endpoints/drive/files/find.ts index 8d30c29da6..5419ba9196 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/show.ts b/packages/backend/src/server/api/endpoints/drive/files/show.ts index 8edb8785bc..932e692c4c 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/show.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index d77deea7db..3972e56084 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index a4619ebf36..5c688e883a 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -18,7 +18,7 @@ export const meta = { kind: 'write:drive', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { url: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index a543ae27df..4d8bc32dd7 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index ab48d5599e..994c537f9f 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', default: "Untitled", maxLength: 200 }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index 51c0340529..58b9919595 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index 057f40b1cc..333502f706 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/find.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/show.ts b/packages/backend/src/server/api/endpoints/drive/folders/show.ts index d31d7a4276..4bbd2dcf11 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index c70b5a0d54..a4393d99b0 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 921ae4c221..9d5cb02c70 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/email-address/available.ts b/packages/backend/src/server/api/endpoints/email-address/available.ts index cb740ffae7..8fee4ce509 100644 --- a/packages/backend/src/server/api/endpoints/email-address/available.ts +++ b/packages/backend/src/server/api/endpoints/email-address/available.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { emailAddress: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/endpoint.ts b/packages/backend/src/server/api/endpoints/endpoint.ts index b8fe030e8c..7c528114f2 100644 --- a/packages/backend/src/server/api/endpoints/endpoint.ts +++ b/packages/backend/src/server/api/endpoints/endpoint.ts @@ -7,7 +7,7 @@ export const meta = { tags: ['meta'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { endpoint: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/endpoints.ts b/packages/backend/src/server/api/endpoints/endpoints.ts index b090e0dced..ef6efc6fb3 100644 --- a/packages/backend/src/server/api/endpoints/endpoints.ts +++ b/packages/backend/src/server/api/endpoints/endpoints.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts index f0ab63f74b..3bffbc82bd 100644 --- a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index 5960e482c0..b716552322 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 4f139b0c45..373c432be5 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 494b5120ab..fb25199c73 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index cead515d81..590f8a7e86 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index ebdc54d0a6..59661ea7c0 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -8,7 +8,7 @@ export const meta = { requireCredential: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index 294894cd92..f35471f062 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/following/create.ts b/packages/backend/src/server/api/endpoints/following/create.ts index 1edb3517a0..a18c44a1d8 100644 --- a/packages/backend/src/server/api/endpoints/following/create.ts +++ b/packages/backend/src/server/api/endpoints/following/create.ts @@ -57,7 +57,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/delete.ts b/packages/backend/src/server/api/endpoints/following/delete.ts index 2eb8636816..ec32c2c888 100644 --- a/packages/backend/src/server/api/endpoints/following/delete.ts +++ b/packages/backend/src/server/api/endpoints/following/delete.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index 8a1da3d299..137d366fce 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/requests/accept.ts b/packages/backend/src/server/api/endpoints/following/requests/accept.ts index 7040efcc80..adbbb3404a 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/accept.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/accept.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index 4204f8526a..5e949af9de 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts @@ -33,7 +33,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index 17d576d1c0..563223fcae 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -35,7 +35,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/following/requests/reject.ts b/packages/backend/src/server/api/endpoints/following/requests/reject.ts index 9e345aa15f..f1502eba13 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/reject.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/reject.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index 6b347f9dea..ad994c386a 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 57ead79826..9e5019ddef 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index c36e80b83c..40c9efaf51 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index d64937d0bc..c963dc86d1 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -29,7 +29,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { title: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index 82ffd62d60..7fafc9288a 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index 73d5a0ea99..ca6c06cf9e 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts index 819d360b14..0f8f3a6068 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index fc38174810..30ccaf167e 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index 1a86b56bc6..2b2e26aa5d 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/get-online-users-count.ts b/packages/backend/src/server/api/endpoints/get-online-users-count.ts index 855b9fc342..374d819ce7 100644 --- a/packages/backend/src/server/api/endpoints/get-online-users-count.ts +++ b/packages/backend/src/server/api/endpoints/get-online-users-count.ts @@ -9,7 +9,7 @@ export const meta = { requireCredential: false, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 68f2b2bf57..3bd5305bd4 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 9aa08ed28e..2af6b6d77c 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index 79b9613086..0770882141 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tag: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index de3e453c3e..6da5b90b28 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -53,7 +53,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index 1760732c1a..ff06d925dd 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tag: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index 091276ea27..f9c58c2479 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -13,7 +13,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index 8d82ab3886..1646b7bd89 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts index 5052afda97..52a0afcbfd 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts @@ -21,7 +21,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clientDataJSON: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts index 2830f8994a..d9d2ec66c1 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { value: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts index da3ff421a7..86fc4fdffb 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts @@ -14,7 +14,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index 32acc838b7..e550698abb 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -11,7 +11,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts index 3004ce36a1..0469912340 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts @@ -9,7 +9,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts index b8e89bac72..c1ca445825 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/apps.ts b/packages/backend/src/server/api/endpoints/i/apps.ts index f45b6745b8..0fe3db2d9f 100644 --- a/packages/backend/src/server/api/endpoints/i/apps.ts +++ b/packages/backend/src/server/api/endpoints/i/apps.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { sort: { type: 'string', enum: ['+createdAt', '-createdAt', '+lastUsedAt', '-lastUsedAt'] }, diff --git a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts index e417f3e81a..e2f5ceb7e1 100644 --- a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts +++ b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/change-password.ts b/packages/backend/src/server/api/endpoints/i/change-password.ts index eac60ee183..e68d18b86d 100644 --- a/packages/backend/src/server/api/endpoints/i/change-password.ts +++ b/packages/backend/src/server/api/endpoints/i/change-password.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { currentPassword: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index 6f689c0b4e..188d2257aa 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -11,7 +11,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/export-blocking.ts b/packages/backend/src/server/api/endpoints/i/export-blocking.ts index afa6f2fc8e..808b546bdb 100644 --- a/packages/backend/src/server/api/endpoints/i/export-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/export-blocking.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/export-following.ts b/packages/backend/src/server/api/endpoints/i/export-following.ts index 4dd8cda398..10f8ee9ab2 100644 --- a/packages/backend/src/server/api/endpoints/i/export-following.ts +++ b/packages/backend/src/server/api/endpoints/i/export-following.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { excludeMuting: { type: 'boolean', default: false }, diff --git a/packages/backend/src/server/api/endpoints/i/export-mute.ts b/packages/backend/src/server/api/endpoints/i/export-mute.ts index ca8a7b997c..ab39508534 100644 --- a/packages/backend/src/server/api/endpoints/i/export-mute.ts +++ b/packages/backend/src/server/api/endpoints/i/export-mute.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/export-notes.ts b/packages/backend/src/server/api/endpoints/i/export-notes.ts index fc155d9d0f..770444d68b 100644 --- a/packages/backend/src/server/api/endpoints/i/export-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/export-notes.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts index 22cbf973f8..c0d9d924bd 100644 --- a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index 45f5d99cce..d6c12582d0 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index 7578ed3216..173a502622 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index fbab8795ca..31e9636f84 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts index 2b31b89ff1..c760dd0e23 100644 --- a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index b90bfb1402..e9cf6e562e 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -40,7 +40,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/import-following.ts b/packages/backend/src/server/api/endpoints/i/import-following.ts index 75388502a5..d9c831daf8 100644 --- a/packages/backend/src/server/api/endpoints/i/import-following.ts +++ b/packages/backend/src/server/api/endpoints/i/import-following.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index e1c3df33e1..ac61a6c852 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -40,7 +40,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index eb1302a98c..68f2b377a9 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index bb1d6a49b3..cecaa8ac44 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 60ac3ccde1..d3b68acdc5 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -30,7 +30,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index dbc58021b9..09cff4a0fb 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index a09618ebe8..a4dd64564a 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts index b0185a3e37..e6eb8d7ef0 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -10,7 +10,7 @@ export const meta = { kind: 'write:account', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts index 45638c2579..12038999ae 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -10,7 +10,7 @@ export const meta = { kind: 'write:account', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/read-announcement.ts b/packages/backend/src/server/api/endpoints/i/read-announcement.ts index f3cedddb35..2d8c723e4e 100644 --- a/packages/backend/src/server/api/endpoints/i/read-announcement.ts +++ b/packages/backend/src/server/api/endpoints/i/read-announcement.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { announcementId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts index 71a3ea08af..1462b902c4 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -10,7 +10,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts index 0429cd283a..c371da87d8 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { scope: { type: 'array', default: [], items: { diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts index 194a922718..bd243946b0 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get.ts b/packages/backend/src/server/api/endpoints/i/registry/get.ts index 7d413e3528..2bc6975bb3 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index 52e0d6fac5..78bb9dd348 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { scope: { type: 'array', default: [], items: { diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys.ts b/packages/backend/src/server/api/endpoints/i/registry/keys.ts index c494ed8f5c..5f627125d5 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { scope: { type: 'array', default: [], items: { diff --git a/packages/backend/src/server/api/endpoints/i/registry/remove.ts b/packages/backend/src/server/api/endpoints/i/registry/remove.ts index 5bc55bd297..6a005d10d4 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/remove.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/remove.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index e04d123a1f..09de7125c9 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/registry/set.ts b/packages/backend/src/server/api/endpoints/i/registry/set.ts index c78f4383be..28d9555b1c 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/set.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/set.ts @@ -9,7 +9,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/i/revoke-token.ts b/packages/backend/src/server/api/endpoints/i/revoke-token.ts index 14800346c1..b889e795be 100644 --- a/packages/backend/src/server/api/endpoints/i/revoke-token.ts +++ b/packages/backend/src/server/api/endpoints/i/revoke-token.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tokenId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index 468972c239..f7a98a2332 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index 895bfd0c28..5ab1e95c59 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index 1450eabc2a..21a2081836 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 0a5188609b..d800f23f8e 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -67,7 +67,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { ...Users.nameSchema, nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts index 6c38240913..a026d8d669 100644 --- a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts +++ b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index 5c1c040cc3..cb27f37fbb 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages.ts b/packages/backend/src/server/api/endpoints/messaging/messages.ts index ce477feac4..a21f8d8fc1 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index 60b1e2cdce..c2f9e71b5c 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -64,7 +64,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts index 67ecd4a1e6..8f5d6da665 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { messageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts index 1d0ddaf98f..2a18d9c379 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { messageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index fdd1586ca5..5b5604f6a6 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -440,7 +440,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { detail: { type: 'boolean', default: true }, diff --git a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts index e61c78754f..56fc459d7e 100644 --- a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts +++ b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { session: { type: 'string', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index 3ef97a1491..b8439cd3f6 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 8a88e13039..ff66aa26cf 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index fd8443e2b7..a728affe05 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index 8dee11fb93..5d08f34dac 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index 0106bac516..28c49b0e63 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { local: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index ea2c166b75..43471b8ed5 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/clips.ts b/packages/backend/src/server/api/endpoints/notes/clips.ts index 2caa3a499f..2209894a96 100644 --- a/packages/backend/src/server/api/endpoints/notes/clips.ts +++ b/packages/backend/src/server/api/endpoints/notes/clips.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index c199a3f831..c785496f2e 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 7d81abc3a7..7ac318c501 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -95,7 +95,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { visibility: { type: 'string', enum: ['public', 'home', 'followers', 'specified'], default: "public" }, diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 62a2a98469..6084c93240 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -33,7 +33,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 570e2354ba..eaf2b1ac0f 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index b33a5f148b..1a64fc430e 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index 8a4297de62..11738cbe26 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index 23ca8752c9..54cf51c135 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { withFiles: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index ba6f3b5927..f75cbeb008 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 7c118317d6..9793919487 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { withFiles: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 265882fa70..41f2ad5244 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { following: { type: 'boolean', default: false }, diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index 4030694b58..0f2d4699de 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 739df8a03c..d889ba6f1f 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -58,7 +58,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index fdcaed64e1..746344df3b 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -29,7 +29,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index a898b3249a..9edbabc469 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index 53cadac7c9..d5e2e138a8 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index aa5c2c0a45..a964a0c766 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index b88e3d7168..78559abd5a 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index bf18a20b97..ff55f862aa 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tag: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index bcb9c2b8a1..7034645956 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index 8f75eeb5e8..a300f1aefa 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/state.ts b/packages/backend/src/server/api/endpoints/notes/state.ts index cf5f08ea9a..2e7f1f75c3 100644 --- a/packages/backend/src/server/api/endpoints/notes/state.ts +++ b/packages/backend/src/server/api/endpoints/notes/state.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index 4068a8a571..7b3c88785b 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index 09b64f7277..66d631640a 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index c06a98feaa..14d0d71704 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index d85c8b96f9..a1d8fae10b 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index c10d277de1..5b39239279 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 018e3e06a8..68a15f05fb 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -30,7 +30,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/watching/create.ts b/packages/backend/src/server/api/endpoints/notes/watching/create.ts index b19d370027..ed35638329 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/create.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts index f9ceb49278..1918b887ef 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index b5bfb34f4b..590f1c540f 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -12,7 +12,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { body: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts index 12dc43de16..5ad6605e7f 100644 --- a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -10,7 +10,7 @@ export const meta = { kind: 'write:notifications', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/notifications/read.ts b/packages/backend/src/server/api/endpoints/notifications/read.ts index 6e5b5616dd..93ac75f649 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { notificationId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/page-push.ts b/packages/backend/src/server/api/endpoints/page-push.ts index 20334f33fc..690cd0884d 100644 --- a/packages/backend/src/server/api/endpoints/page-push.ts +++ b/packages/backend/src/server/api/endpoints/page-push.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index 6c00a2f779..c6d50e5cdf 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { title: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/pages/delete.ts b/packages/backend/src/server/api/endpoints/pages/delete.ts index c41373bb7c..2933e04174 100644 --- a/packages/backend/src/server/api/endpoints/pages/delete.ts +++ b/packages/backend/src/server/api/endpoints/pages/delete.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/featured.ts b/packages/backend/src/server/api/endpoints/pages/featured.ts index 38aa4dfacc..dbd8737b08 100644 --- a/packages/backend/src/server/api/endpoints/pages/featured.ts +++ b/packages/backend/src/server/api/endpoints/pages/featured.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index d286fd2bfd..0eb110732f 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index 95243e411f..e330460f23 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index 582c924d91..f8efe8969a 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 686271cf46..8c81ea7463 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -42,7 +42,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/ping.ts b/packages/backend/src/server/api/endpoints/ping.ts index 964401e19b..4f68965598 100644 --- a/packages/backend/src/server/api/endpoints/ping.ts +++ b/packages/backend/src/server/api/endpoints/ping.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index 83657f8bf9..61c67949cf 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/promo/read.ts b/packages/backend/src/server/api/endpoints/promo/read.ts index 99be33fb0c..b811159834 100644 --- a/packages/backend/src/server/api/endpoints/promo/read.ts +++ b/packages/backend/src/server/api/endpoints/promo/read.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/request-reset-password.ts b/packages/backend/src/server/api/endpoints/request-reset-password.ts index 193c3ee79d..af190583c0 100644 --- a/packages/backend/src/server/api/endpoints/request-reset-password.ts +++ b/packages/backend/src/server/api/endpoints/request-reset-password.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/reset-db.ts b/packages/backend/src/server/api/endpoints/reset-db.ts index 1c1cb3f136..5a72c306ba 100644 --- a/packages/backend/src/server/api/endpoints/reset-db.ts +++ b/packages/backend/src/server/api/endpoints/reset-db.ts @@ -10,7 +10,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index 04048b9ef1..880ff682fb 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -12,7 +12,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index 4a5bc6a86c..97245575e8 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -8,7 +8,7 @@ export const meta = { tags: ['meta'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/stats.ts b/packages/backend/src/server/api/endpoints/stats.ts index 8abae921ac..7863d439ca 100644 --- a/packages/backend/src/server/api/endpoints/stats.ts +++ b/packages/backend/src/server/api/endpoints/stats.ts @@ -43,7 +43,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index 459b0dd969..9971bfb7d0 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { endpoint: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/sw/unregister.ts b/packages/backend/src/server/api/endpoints/sw/unregister.ts index ec994c37c2..fc5fb0ce92 100644 --- a/packages/backend/src/server/api/endpoints/sw/unregister.ts +++ b/packages/backend/src/server/api/endpoints/sw/unregister.ts @@ -7,7 +7,7 @@ export const meta = { requireCredential: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { endpoint: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/test.ts b/packages/backend/src/server/api/endpoints/test.ts index 820448e677..ee04009308 100644 --- a/packages/backend/src/server/api/endpoints/test.ts +++ b/packages/backend/src/server/api/endpoints/test.ts @@ -4,7 +4,7 @@ export const meta = { requireCredential: false, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { required: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index 6e38d4d310..4564784a9b 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: Users.localUsernameSchema, diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 0c03ac05c3..2406fcd2fc 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index e224bdf603..7abb94e2cf 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -6,7 +6,7 @@ export const meta = { tags: ['users', 'clips'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 5607b4cc73..75f13a2929 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 36943232d1..b1af55169c 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index e874a54c77..7accc0b627 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -6,7 +6,7 @@ export const meta = { tags: ['users', 'gallery'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts index a08587cd16..5173982840 100644 --- a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/create.ts b/packages/backend/src/server/api/endpoints/users/groups/create.ts index e7bc95791f..358d3828a0 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/create.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/create.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/delete.ts b/packages/backend/src/server/api/endpoints/users/groups/delete.ts index cb30b4d813..ca8d864dcd 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts index 7a6a620cb3..31d3461280 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { invitationId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts index b5c7f0908a..29b7612a8a 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { invitationId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invite.ts b/packages/backend/src/server/api/endpoints/users/groups/invite.ts index ba78a28a38..31eef02b2f 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invite.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invite.ts @@ -40,7 +40,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/joined.ts b/packages/backend/src/server/api/endpoints/users/groups/joined.ts index 192a52a66b..465585376e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/joined.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/joined.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/users/groups/leave.ts b/packages/backend/src/server/api/endpoints/users/groups/leave.ts index b7c7b328fd..56b5330c83 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/leave.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/leave.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/owned.ts b/packages/backend/src/server/api/endpoints/users/groups/owned.ts index 4592fc437f..a3724a0547 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/owned.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/owned.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/users/groups/pull.ts b/packages/backend/src/server/api/endpoints/users/groups/pull.ts index d50f61b159..dd93faa62e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/pull.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/show.ts b/packages/backend/src/server/api/endpoints/users/groups/show.ts index 230254060d..799ec3202e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/show.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts index 4b5206fa18..bb3b7f11c2 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/update.ts b/packages/backend/src/server/api/endpoints/users/groups/update.ts index 0714fb4bd4..6c8851889a 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/update.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/update.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index 0a74424e0e..c0c37f96f1 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 6795a227dc..0f7fdbc908 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/list.ts b/packages/backend/src/server/api/endpoints/users/lists/list.ts index d439723403..5245c57849 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/list.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/list.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index 5eca5a999d..45b0b41564 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 68a1f00774..252f7e6e19 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -38,7 +38,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/show.ts b/packages/backend/src/server/api/endpoints/users/lists/show.ts index 3e9aa836ba..91a2bf55a4 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/show.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/update.ts b/packages/backend/src/server/api/endpoints/users/lists/update.ts index ee1489fc6a..3e3f6ec9fe 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/update.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/update.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 956d90b7ad..4c27fb8ee4 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index 873b5e80fa..f7b39b75fd 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -6,7 +6,7 @@ export const meta = { tags: ['users', 'pages'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index 8d968210bc..c9b5a95639 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 4a2d8d7e4a..78c2f3e1a4 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/users/relation.ts b/packages/backend/src/server/api/endpoints/users/relation.ts index fac1a4b92d..140126cab5 100644 --- a/packages/backend/src/server/api/endpoints/users/relation.ts +++ b/packages/backend/src/server/api/endpoints/users/relation.ts @@ -93,7 +93,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { diff --git a/packages/backend/src/server/api/endpoints/users/report-abuse.ts b/packages/backend/src/server/api/endpoints/users/report-abuse.ts index 1df5e1573f..717724a4cf 100644 --- a/packages/backend/src/server/api/endpoints/users/report-abuse.ts +++ b/packages/backend/src/server/api/endpoints/users/report-abuse.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 433779ae2d..15a93bc4f8 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: { type: 'string', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 8c28e7c3a6..9d772f0968 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index 29c90963ad..cb42cc80a0 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/stats.ts b/packages/backend/src/server/api/endpoints/users/stats.ts index 29dd8fdf93..2f4ca10fc1 100644 --- a/packages/backend/src/server/api/endpoints/users/stats.ts +++ b/packages/backend/src/server/api/endpoints/users/stats.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, From beb451fd192c155763a76271415f8f875fee2cac Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 20 Feb 2022 01:57:15 +0900 Subject: [PATCH 16/95] use ajv/dist/core --- packages/backend/src/server/api/define.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index e2a34f47a5..41978efe81 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -6,7 +6,7 @@ import { ApiError } from './error'; import { Schema, SchemaType } from '@/misc/schema'; import { AccessToken } from '@/models/entities/access-token'; import { ValidateFunction } from 'ajv'; -import { JTDDataType } from 'ajv/dist/types/jtd-schema'; +import { JTDDataType } from 'ajv/dist/core'; import { apiLogger } from './logger'; type SimpleUserInfo = { From 37cb93be101bf4805aad40e534a4fe2c336797f1 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 20 Feb 2022 12:51:20 +0900 Subject: [PATCH 17/95] revert try --- packages/backend/src/server/api/define.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 41978efe81..6ed8cb3d06 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -39,13 +39,7 @@ ajv.addFormat('misskey:id', /^[a-z0-9]+$/); export default function (meta: T, paramDef: Ps, cb: executor) : (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => Promise { - let validate: ValidateFunction>; - - try { - validate = ajv.compile(paramDef); - } catch (error) { - apiLogger.error('FAILED TO COMPILE SCHEMA ' + JSON.stringify({ param: paramDef, error })); - } + const validate = ajv.compile(paramDef); return (params: any, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any) => { function cleanup() { From 5c0f9b14831e3423a593fe25a2f6c6d9acd4dac7 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 20 Feb 2022 13:08:52 +0900 Subject: [PATCH 18/95] clean up --- packages/backend/src/server/api/define.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 6ed8cb3d06..83fc1e8d4f 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -5,9 +5,6 @@ import { IEndpointMeta } from './endpoints'; import { ApiError } from './error'; import { Schema, SchemaType } from '@/misc/schema'; import { AccessToken } from '@/models/entities/access-token'; -import { ValidateFunction } from 'ajv'; -import { JTDDataType } from 'ajv/dist/core'; -import { apiLogger } from './logger'; type SimpleUserInfo = { id: ILocalUser['id']; From fcfb5ef0a3c2a674890e88291bb9db89c95c3a9f Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 20 Feb 2022 13:15:40 +0900 Subject: [PATCH 19/95] Fix ajv (#8333) * wip * :v: * use ajv/dist/core * revert try * clean up --- packages/backend/src/server/api/call.ts | 4 ++-- packages/backend/src/server/api/define.ts | 4 ++-- .../src/server/api/endpoints/admin/abuse-user-reports.ts | 2 +- .../backend/src/server/api/endpoints/admin/accounts/create.ts | 2 +- .../backend/src/server/api/endpoints/admin/accounts/delete.ts | 2 +- packages/backend/src/server/api/endpoints/admin/ad/create.ts | 2 +- packages/backend/src/server/api/endpoints/admin/ad/delete.ts | 2 +- packages/backend/src/server/api/endpoints/admin/ad/list.ts | 2 +- packages/backend/src/server/api/endpoints/admin/ad/update.ts | 2 +- .../src/server/api/endpoints/admin/announcements/create.ts | 2 +- .../src/server/api/endpoints/admin/announcements/delete.ts | 2 +- .../src/server/api/endpoints/admin/announcements/list.ts | 2 +- .../src/server/api/endpoints/admin/announcements/update.ts | 2 +- .../server/api/endpoints/admin/delete-all-files-of-a-user.ts | 2 +- .../server/api/endpoints/admin/drive/clean-remote-files.ts | 2 +- .../backend/src/server/api/endpoints/admin/drive/cleanup.ts | 2 +- .../backend/src/server/api/endpoints/admin/drive/files.ts | 2 +- .../backend/src/server/api/endpoints/admin/drive/show-file.ts | 2 +- .../src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts | 2 +- packages/backend/src/server/api/endpoints/admin/emoji/add.ts | 2 +- packages/backend/src/server/api/endpoints/admin/emoji/copy.ts | 2 +- .../src/server/api/endpoints/admin/emoji/delete-bulk.ts | 2 +- .../backend/src/server/api/endpoints/admin/emoji/delete.ts | 2 +- .../src/server/api/endpoints/admin/emoji/import-zip.ts | 2 +- .../src/server/api/endpoints/admin/emoji/list-remote.ts | 2 +- packages/backend/src/server/api/endpoints/admin/emoji/list.ts | 2 +- .../server/api/endpoints/admin/emoji/remove-aliases-bulk.ts | 2 +- .../src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts | 2 +- .../src/server/api/endpoints/admin/emoji/set-category-bulk.ts | 2 +- .../backend/src/server/api/endpoints/admin/emoji/update.ts | 2 +- .../server/api/endpoints/admin/federation/delete-all-files.ts | 2 +- .../admin/federation/refresh-remote-instance-metadata.ts | 2 +- .../api/endpoints/admin/federation/remove-all-following.ts | 2 +- .../server/api/endpoints/admin/federation/update-instance.ts | 2 +- .../backend/src/server/api/endpoints/admin/get-index-stats.ts | 2 +- .../backend/src/server/api/endpoints/admin/get-table-stats.ts | 2 +- packages/backend/src/server/api/endpoints/admin/invite.ts | 2 +- .../backend/src/server/api/endpoints/admin/moderators/add.ts | 2 +- .../src/server/api/endpoints/admin/moderators/remove.ts | 2 +- .../backend/src/server/api/endpoints/admin/promo/create.ts | 2 +- .../backend/src/server/api/endpoints/admin/queue/clear.ts | 2 +- .../src/server/api/endpoints/admin/queue/deliver-delayed.ts | 2 +- .../src/server/api/endpoints/admin/queue/inbox-delayed.ts | 2 +- .../backend/src/server/api/endpoints/admin/queue/stats.ts | 2 +- packages/backend/src/server/api/endpoints/admin/relays/add.ts | 2 +- .../backend/src/server/api/endpoints/admin/relays/list.ts | 2 +- .../backend/src/server/api/endpoints/admin/relays/remove.ts | 2 +- .../backend/src/server/api/endpoints/admin/reset-password.ts | 2 +- .../server/api/endpoints/admin/resolve-abuse-user-report.ts | 2 +- packages/backend/src/server/api/endpoints/admin/send-email.ts | 2 +- .../backend/src/server/api/endpoints/admin/server-info.ts | 2 +- .../src/server/api/endpoints/admin/show-moderation-logs.ts | 2 +- packages/backend/src/server/api/endpoints/admin/show-user.ts | 2 +- packages/backend/src/server/api/endpoints/admin/show-users.ts | 2 +- .../backend/src/server/api/endpoints/admin/silence-user.ts | 2 +- .../backend/src/server/api/endpoints/admin/suspend-user.ts | 2 +- .../backend/src/server/api/endpoints/admin/unsilence-user.ts | 2 +- .../backend/src/server/api/endpoints/admin/unsuspend-user.ts | 2 +- .../backend/src/server/api/endpoints/admin/update-meta.ts | 2 +- packages/backend/src/server/api/endpoints/admin/vacuum.ts | 2 +- packages/backend/src/server/api/endpoints/announcements.ts | 2 +- packages/backend/src/server/api/endpoints/antennas/create.ts | 2 +- packages/backend/src/server/api/endpoints/antennas/delete.ts | 2 +- packages/backend/src/server/api/endpoints/antennas/list.ts | 2 +- packages/backend/src/server/api/endpoints/antennas/notes.ts | 2 +- packages/backend/src/server/api/endpoints/antennas/show.ts | 2 +- packages/backend/src/server/api/endpoints/antennas/update.ts | 2 +- packages/backend/src/server/api/endpoints/ap/get.ts | 2 +- packages/backend/src/server/api/endpoints/ap/show.ts | 2 +- packages/backend/src/server/api/endpoints/app/create.ts | 2 +- packages/backend/src/server/api/endpoints/app/show.ts | 2 +- packages/backend/src/server/api/endpoints/auth/accept.ts | 2 +- .../backend/src/server/api/endpoints/auth/session/generate.ts | 2 +- .../backend/src/server/api/endpoints/auth/session/show.ts | 2 +- .../backend/src/server/api/endpoints/auth/session/userkey.ts | 2 +- packages/backend/src/server/api/endpoints/blocking/create.ts | 2 +- packages/backend/src/server/api/endpoints/blocking/delete.ts | 2 +- packages/backend/src/server/api/endpoints/blocking/list.ts | 2 +- packages/backend/src/server/api/endpoints/channels/create.ts | 2 +- .../backend/src/server/api/endpoints/channels/featured.ts | 2 +- packages/backend/src/server/api/endpoints/channels/follow.ts | 2 +- .../backend/src/server/api/endpoints/channels/followed.ts | 2 +- packages/backend/src/server/api/endpoints/channels/owned.ts | 2 +- packages/backend/src/server/api/endpoints/channels/show.ts | 2 +- .../backend/src/server/api/endpoints/channels/timeline.ts | 2 +- .../backend/src/server/api/endpoints/channels/unfollow.ts | 2 +- packages/backend/src/server/api/endpoints/channels/update.ts | 2 +- .../backend/src/server/api/endpoints/charts/active-users.ts | 2 +- .../backend/src/server/api/endpoints/charts/ap-request.ts | 2 +- packages/backend/src/server/api/endpoints/charts/drive.ts | 2 +- .../backend/src/server/api/endpoints/charts/federation.ts | 2 +- packages/backend/src/server/api/endpoints/charts/hashtag.ts | 2 +- packages/backend/src/server/api/endpoints/charts/instance.ts | 2 +- packages/backend/src/server/api/endpoints/charts/notes.ts | 2 +- .../backend/src/server/api/endpoints/charts/user/drive.ts | 2 +- .../backend/src/server/api/endpoints/charts/user/following.ts | 2 +- .../backend/src/server/api/endpoints/charts/user/notes.ts | 2 +- .../backend/src/server/api/endpoints/charts/user/reactions.ts | 2 +- packages/backend/src/server/api/endpoints/charts/users.ts | 2 +- packages/backend/src/server/api/endpoints/clips/add-note.ts | 2 +- packages/backend/src/server/api/endpoints/clips/create.ts | 2 +- packages/backend/src/server/api/endpoints/clips/delete.ts | 2 +- packages/backend/src/server/api/endpoints/clips/list.ts | 2 +- packages/backend/src/server/api/endpoints/clips/notes.ts | 2 +- packages/backend/src/server/api/endpoints/clips/show.ts | 2 +- packages/backend/src/server/api/endpoints/clips/update.ts | 2 +- packages/backend/src/server/api/endpoints/drive.ts | 2 +- packages/backend/src/server/api/endpoints/drive/files.ts | 2 +- .../src/server/api/endpoints/drive/files/attached-notes.ts | 2 +- .../src/server/api/endpoints/drive/files/check-existence.ts | 2 +- .../backend/src/server/api/endpoints/drive/files/create.ts | 3 ++- .../backend/src/server/api/endpoints/drive/files/delete.ts | 2 +- .../src/server/api/endpoints/drive/files/find-by-hash.ts | 2 +- packages/backend/src/server/api/endpoints/drive/files/find.ts | 2 +- packages/backend/src/server/api/endpoints/drive/files/show.ts | 2 +- .../backend/src/server/api/endpoints/drive/files/update.ts | 2 +- .../src/server/api/endpoints/drive/files/upload-from-url.ts | 2 +- packages/backend/src/server/api/endpoints/drive/folders.ts | 2 +- .../backend/src/server/api/endpoints/drive/folders/create.ts | 2 +- .../backend/src/server/api/endpoints/drive/folders/delete.ts | 2 +- .../backend/src/server/api/endpoints/drive/folders/find.ts | 2 +- .../backend/src/server/api/endpoints/drive/folders/show.ts | 2 +- .../backend/src/server/api/endpoints/drive/folders/update.ts | 2 +- packages/backend/src/server/api/endpoints/drive/stream.ts | 2 +- .../src/server/api/endpoints/email-address/available.ts | 2 +- packages/backend/src/server/api/endpoints/endpoint.ts | 2 +- packages/backend/src/server/api/endpoints/endpoints.ts | 2 +- .../backend/src/server/api/endpoints/export-custom-emojis.ts | 2 +- .../backend/src/server/api/endpoints/federation/followers.ts | 2 +- .../backend/src/server/api/endpoints/federation/following.ts | 2 +- .../backend/src/server/api/endpoints/federation/instances.ts | 2 +- .../src/server/api/endpoints/federation/show-instance.ts | 2 +- .../src/server/api/endpoints/federation/update-remote-user.ts | 2 +- packages/backend/src/server/api/endpoints/federation/users.ts | 2 +- packages/backend/src/server/api/endpoints/following/create.ts | 2 +- packages/backend/src/server/api/endpoints/following/delete.ts | 2 +- .../backend/src/server/api/endpoints/following/invalidate.ts | 2 +- .../src/server/api/endpoints/following/requests/accept.ts | 2 +- .../src/server/api/endpoints/following/requests/cancel.ts | 2 +- .../src/server/api/endpoints/following/requests/list.ts | 2 +- .../src/server/api/endpoints/following/requests/reject.ts | 2 +- packages/backend/src/server/api/endpoints/gallery/featured.ts | 2 +- packages/backend/src/server/api/endpoints/gallery/popular.ts | 2 +- packages/backend/src/server/api/endpoints/gallery/posts.ts | 2 +- .../backend/src/server/api/endpoints/gallery/posts/create.ts | 2 +- .../backend/src/server/api/endpoints/gallery/posts/delete.ts | 2 +- .../backend/src/server/api/endpoints/gallery/posts/like.ts | 2 +- .../backend/src/server/api/endpoints/gallery/posts/show.ts | 2 +- .../backend/src/server/api/endpoints/gallery/posts/unlike.ts | 2 +- .../backend/src/server/api/endpoints/gallery/posts/update.ts | 2 +- .../src/server/api/endpoints/get-online-users-count.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/list.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/search.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/show.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/trend.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/users.ts | 2 +- packages/backend/src/server/api/endpoints/i.ts | 2 +- packages/backend/src/server/api/endpoints/i/2fa/done.ts | 2 +- packages/backend/src/server/api/endpoints/i/2fa/key-done.ts | 2 +- .../backend/src/server/api/endpoints/i/2fa/password-less.ts | 2 +- .../backend/src/server/api/endpoints/i/2fa/register-key.ts | 2 +- packages/backend/src/server/api/endpoints/i/2fa/register.ts | 2 +- packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts | 2 +- packages/backend/src/server/api/endpoints/i/2fa/unregister.ts | 2 +- packages/backend/src/server/api/endpoints/i/apps.ts | 2 +- .../backend/src/server/api/endpoints/i/authorized-apps.ts | 2 +- .../backend/src/server/api/endpoints/i/change-password.ts | 2 +- packages/backend/src/server/api/endpoints/i/delete-account.ts | 2 +- .../backend/src/server/api/endpoints/i/export-blocking.ts | 2 +- .../backend/src/server/api/endpoints/i/export-following.ts | 2 +- packages/backend/src/server/api/endpoints/i/export-mute.ts | 2 +- packages/backend/src/server/api/endpoints/i/export-notes.ts | 2 +- .../backend/src/server/api/endpoints/i/export-user-lists.ts | 2 +- packages/backend/src/server/api/endpoints/i/favorites.ts | 2 +- packages/backend/src/server/api/endpoints/i/gallery/likes.ts | 2 +- packages/backend/src/server/api/endpoints/i/gallery/posts.ts | 2 +- .../src/server/api/endpoints/i/get-word-muted-notes-count.ts | 2 +- .../backend/src/server/api/endpoints/i/import-blocking.ts | 2 +- .../backend/src/server/api/endpoints/i/import-following.ts | 2 +- packages/backend/src/server/api/endpoints/i/import-muting.ts | 2 +- .../backend/src/server/api/endpoints/i/import-user-lists.ts | 2 +- packages/backend/src/server/api/endpoints/i/notifications.ts | 2 +- packages/backend/src/server/api/endpoints/i/page-likes.ts | 2 +- packages/backend/src/server/api/endpoints/i/pages.ts | 2 +- packages/backend/src/server/api/endpoints/i/pin.ts | 2 +- .../src/server/api/endpoints/i/read-all-messaging-messages.ts | 2 +- .../src/server/api/endpoints/i/read-all-unread-notes.ts | 2 +- .../backend/src/server/api/endpoints/i/read-announcement.ts | 2 +- .../backend/src/server/api/endpoints/i/regenerate-token.ts | 2 +- .../backend/src/server/api/endpoints/i/registry/get-all.ts | 2 +- .../backend/src/server/api/endpoints/i/registry/get-detail.ts | 2 +- packages/backend/src/server/api/endpoints/i/registry/get.ts | 2 +- .../src/server/api/endpoints/i/registry/keys-with-type.ts | 2 +- packages/backend/src/server/api/endpoints/i/registry/keys.ts | 2 +- .../backend/src/server/api/endpoints/i/registry/remove.ts | 2 +- .../backend/src/server/api/endpoints/i/registry/scopes.ts | 2 +- packages/backend/src/server/api/endpoints/i/registry/set.ts | 2 +- packages/backend/src/server/api/endpoints/i/revoke-token.ts | 2 +- packages/backend/src/server/api/endpoints/i/signin-history.ts | 2 +- packages/backend/src/server/api/endpoints/i/unpin.ts | 2 +- packages/backend/src/server/api/endpoints/i/update-email.ts | 2 +- packages/backend/src/server/api/endpoints/i/update.ts | 2 +- .../backend/src/server/api/endpoints/i/user-group-invites.ts | 2 +- .../backend/src/server/api/endpoints/messaging/history.ts | 2 +- .../backend/src/server/api/endpoints/messaging/messages.ts | 2 +- .../src/server/api/endpoints/messaging/messages/create.ts | 2 +- .../src/server/api/endpoints/messaging/messages/delete.ts | 2 +- .../src/server/api/endpoints/messaging/messages/read.ts | 2 +- packages/backend/src/server/api/endpoints/meta.ts | 2 +- packages/backend/src/server/api/endpoints/miauth/gen-token.ts | 2 +- packages/backend/src/server/api/endpoints/mute/create.ts | 2 +- packages/backend/src/server/api/endpoints/mute/delete.ts | 2 +- packages/backend/src/server/api/endpoints/mute/list.ts | 2 +- packages/backend/src/server/api/endpoints/my/apps.ts | 2 +- packages/backend/src/server/api/endpoints/notes.ts | 2 +- packages/backend/src/server/api/endpoints/notes/children.ts | 2 +- packages/backend/src/server/api/endpoints/notes/clips.ts | 2 +- .../backend/src/server/api/endpoints/notes/conversation.ts | 2 +- packages/backend/src/server/api/endpoints/notes/create.ts | 2 +- packages/backend/src/server/api/endpoints/notes/delete.ts | 2 +- .../src/server/api/endpoints/notes/favorites/create.ts | 2 +- .../src/server/api/endpoints/notes/favorites/delete.ts | 2 +- packages/backend/src/server/api/endpoints/notes/featured.ts | 2 +- .../backend/src/server/api/endpoints/notes/global-timeline.ts | 2 +- .../backend/src/server/api/endpoints/notes/hybrid-timeline.ts | 2 +- .../backend/src/server/api/endpoints/notes/local-timeline.ts | 2 +- packages/backend/src/server/api/endpoints/notes/mentions.ts | 2 +- .../src/server/api/endpoints/notes/polls/recommendation.ts | 2 +- packages/backend/src/server/api/endpoints/notes/polls/vote.ts | 2 +- packages/backend/src/server/api/endpoints/notes/reactions.ts | 2 +- .../src/server/api/endpoints/notes/reactions/create.ts | 2 +- .../src/server/api/endpoints/notes/reactions/delete.ts | 2 +- packages/backend/src/server/api/endpoints/notes/renotes.ts | 2 +- packages/backend/src/server/api/endpoints/notes/replies.ts | 2 +- .../backend/src/server/api/endpoints/notes/search-by-tag.ts | 2 +- packages/backend/src/server/api/endpoints/notes/search.ts | 2 +- packages/backend/src/server/api/endpoints/notes/show.ts | 2 +- packages/backend/src/server/api/endpoints/notes/state.ts | 2 +- .../src/server/api/endpoints/notes/thread-muting/create.ts | 2 +- .../src/server/api/endpoints/notes/thread-muting/delete.ts | 2 +- packages/backend/src/server/api/endpoints/notes/timeline.ts | 2 +- packages/backend/src/server/api/endpoints/notes/translate.ts | 2 +- packages/backend/src/server/api/endpoints/notes/unrenote.ts | 2 +- .../src/server/api/endpoints/notes/user-list-timeline.ts | 2 +- .../backend/src/server/api/endpoints/notes/watching/create.ts | 2 +- .../backend/src/server/api/endpoints/notes/watching/delete.ts | 2 +- .../backend/src/server/api/endpoints/notifications/create.ts | 2 +- .../server/api/endpoints/notifications/mark-all-as-read.ts | 2 +- .../backend/src/server/api/endpoints/notifications/read.ts | 2 +- packages/backend/src/server/api/endpoints/page-push.ts | 2 +- packages/backend/src/server/api/endpoints/pages/create.ts | 2 +- packages/backend/src/server/api/endpoints/pages/delete.ts | 2 +- packages/backend/src/server/api/endpoints/pages/featured.ts | 2 +- packages/backend/src/server/api/endpoints/pages/like.ts | 2 +- packages/backend/src/server/api/endpoints/pages/show.ts | 2 +- packages/backend/src/server/api/endpoints/pages/unlike.ts | 2 +- packages/backend/src/server/api/endpoints/pages/update.ts | 2 +- packages/backend/src/server/api/endpoints/ping.ts | 2 +- packages/backend/src/server/api/endpoints/pinned-users.ts | 2 +- packages/backend/src/server/api/endpoints/promo/read.ts | 2 +- .../src/server/api/endpoints/request-reset-password.ts | 2 +- packages/backend/src/server/api/endpoints/reset-db.ts | 2 +- packages/backend/src/server/api/endpoints/reset-password.ts | 2 +- packages/backend/src/server/api/endpoints/server-info.ts | 2 +- packages/backend/src/server/api/endpoints/stats.ts | 2 +- packages/backend/src/server/api/endpoints/sw/register.ts | 2 +- packages/backend/src/server/api/endpoints/sw/unregister.ts | 2 +- packages/backend/src/server/api/endpoints/test.ts | 2 +- .../backend/src/server/api/endpoints/username/available.ts | 2 +- packages/backend/src/server/api/endpoints/users.ts | 2 +- packages/backend/src/server/api/endpoints/users/clips.ts | 2 +- packages/backend/src/server/api/endpoints/users/followers.ts | 2 +- packages/backend/src/server/api/endpoints/users/following.ts | 2 +- .../backend/src/server/api/endpoints/users/gallery/posts.ts | 2 +- .../api/endpoints/users/get-frequently-replied-users.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/create.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/delete.ts | 2 +- .../server/api/endpoints/users/groups/invitations/accept.ts | 2 +- .../server/api/endpoints/users/groups/invitations/reject.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/invite.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/joined.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/leave.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/owned.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/pull.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/show.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/transfer.ts | 2 +- .../backend/src/server/api/endpoints/users/groups/update.ts | 2 +- .../backend/src/server/api/endpoints/users/lists/create.ts | 2 +- .../backend/src/server/api/endpoints/users/lists/delete.ts | 2 +- packages/backend/src/server/api/endpoints/users/lists/list.ts | 2 +- packages/backend/src/server/api/endpoints/users/lists/pull.ts | 2 +- packages/backend/src/server/api/endpoints/users/lists/push.ts | 2 +- packages/backend/src/server/api/endpoints/users/lists/show.ts | 2 +- .../backend/src/server/api/endpoints/users/lists/update.ts | 2 +- packages/backend/src/server/api/endpoints/users/notes.ts | 2 +- packages/backend/src/server/api/endpoints/users/pages.ts | 2 +- packages/backend/src/server/api/endpoints/users/reactions.ts | 2 +- .../backend/src/server/api/endpoints/users/recommendation.ts | 2 +- packages/backend/src/server/api/endpoints/users/relation.ts | 2 +- .../backend/src/server/api/endpoints/users/report-abuse.ts | 2 +- .../server/api/endpoints/users/search-by-username-and-host.ts | 2 +- packages/backend/src/server/api/endpoints/users/search.ts | 2 +- packages/backend/src/server/api/endpoints/users/show.ts | 2 +- packages/backend/src/server/api/endpoints/users/stats.ts | 2 +- 304 files changed, 307 insertions(+), 306 deletions(-) diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index ea457d9556..e767b15417 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -78,8 +78,8 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac } // Cast non JSON input - if (ep.meta.requireFile) { - for (const k of Object.keys(ep.params)) { + if (ep.meta.requireFile && ep.params.properties) { + for (const k of Object.keys(ep.params.properties)) { const param = ep.params.properties![k]; if (['boolean', 'number', 'integer'].includes(param.type ?? '') && typeof data[k] === 'string') { try { diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 061ade17bf..83fc1e8d4f 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as Ajv from 'ajv'; +import Ajv from 'ajv'; import { ILocalUser } from '@/models/entities/user'; import { IEndpointMeta } from './endpoints'; import { ApiError } from './error'; @@ -65,6 +65,6 @@ export default function (meta: T, pa return Promise.reject(err); } - return cb(params, user, token, file, cleanup); + return cb(params as SchemaType, user, token, file, cleanup); }; } diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index 97b7bc7dba..6ab9c87e3c 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -70,7 +70,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index 50b2eb0427..421726d60f 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: Users.localUsernameSchema, diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index 99d61b2f32..cf48a906f0 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -11,7 +11,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index 9883efefe7..c1efaf6314 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { url: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts index dfd873f016..1b9607b5aa 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 83fdedef77..5b72f72937 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index bf4bce5150..93902e79c1 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 295d99513d..884dd5e280 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { title: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index f0141ca595..c09307193f 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index 993f9877d2..af48925ec1 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -52,7 +52,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index f905616b3e..fb4d5e95ba 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 41e2c23488..dde84ae45e 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 9b127eb5d3..c42b5caac2 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts index 1c63af6a17..a7ce154cf2 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index 56a8c1c642..0b5544ce28 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts index bb1ed1072a..efd4a8e4aa 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts @@ -149,7 +149,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts index 9aeb04d247..4ddea09b1c 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts index 718ecae4b1..2ca3aade99 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index fc20ff0a84..f2dc11f664 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { emojiId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts index 792e72ff97..d35ef660e4 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts @@ -11,7 +11,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts index 15d44b3a0e..2dabd60a0f 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts index 5ee6dd4c8d..98d8d4fef9 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index 865715968a..e519f64ff0 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -50,7 +50,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string', nullable: true, default: null }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 0e23132d99..8e26da3d64 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -50,7 +50,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string', nullable: true, default: null }, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts index e6ccbf684d..e619053e58 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts index 30a1c28af6..dff90193e7 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts index 9679e4a369..462e7a742c 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { ids: { type: 'array', items: { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts index da5a5f005e..870d568311 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { id: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index e98de40ff8..71c1c41cf6 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index d6e3a15c61..df73453f78 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 7c2d6dc391..0ae58de534 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts index 04cad3b9f7..9a3c35d055 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts index 9379379aef..17ce1bfce9 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts @@ -8,7 +8,7 @@ export const meta = { tags: ['admin'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts index 28856cd41c..e980ca96ef 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index a21777937c..45392f85c7 100644 --- a/packages/backend/src/server/api/endpoints/admin/invite.ts +++ b/packages/backend/src/server/api/endpoints/admin/invite.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts index 6b7e549c35..3bf66f3c86 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts @@ -8,7 +8,7 @@ export const meta = { requireAdmin: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts index 585d6fbfa7..e2e96de3c1 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts @@ -8,7 +8,7 @@ export const meta = { requireAdmin: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/promo/create.ts b/packages/backend/src/server/api/endpoints/admin/promo/create.ts index 16f522729b..4f714c579c 100644 --- a/packages/backend/src/server/api/endpoints/admin/promo/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/promo/create.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts index 27bb9cc858..fd1dba8e50 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index 38eac5a135..080a7da04f 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 9669cfd3b8..c452b620ec 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index 3f7e6be5fb..6b883aebee 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index ecf77b87df..e8eb249f93 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -45,7 +45,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { inbox: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/relays/list.ts b/packages/backend/src/server/api/endpoints/admin/relays/list.ts index 6cdaa418a7..da2c32ce4f 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/list.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts index d452c2e6a5..26a16284db 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { inbox: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/reset-password.ts b/packages/backend/src/server/api/endpoints/admin/reset-password.ts index 87424782c5..5036d76d1f 100644 --- a/packages/backend/src/server/api/endpoints/admin/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/admin/reset-password.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index 4139f77614..ec8b56083c 100644 --- a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -12,7 +12,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { reportId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/send-email.ts b/packages/backend/src/server/api/endpoints/admin/send-email.ts index 2ebe7e0bc9..819ff8fd03 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-email.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-email.ts @@ -8,7 +8,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { to: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/admin/server-info.ts b/packages/backend/src/server/api/endpoints/admin/server-info.ts index 44e069d603..ece9bff53e 100644 --- a/packages/backend/src/server/api/endpoints/admin/server-info.ts +++ b/packages/backend/src/server/api/endpoints/admin/server-info.ts @@ -87,7 +87,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index c08acaeca9..1688a1fc53 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -48,7 +48,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/show-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts index b883aff494..46b6609869 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts @@ -13,7 +13,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index c373021d0e..bc4b319e17 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/admin/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index df547184ad..54ef60f7fe 100644 --- a/packages/backend/src/server/api/endpoints/admin/silence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/silence-user.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 31867a4055..c2f3d72438 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -13,7 +13,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts index 42c7e776a8..ddda5f48ab 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts index 011f485277..25a8f1a00a 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts @@ -10,7 +10,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index b845eb4d5b..ecede8a049 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -11,7 +11,7 @@ export const meta = { requireAdmin: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { disableRegistration: { type: 'boolean', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/admin/vacuum.ts b/packages/backend/src/server/api/endpoints/admin/vacuum.ts index 07a4517bd4..8ce352bffd 100644 --- a/packages/backend/src/server/api/endpoints/admin/vacuum.ts +++ b/packages/backend/src/server/api/endpoints/admin/vacuum.ts @@ -9,7 +9,7 @@ export const meta = { requireModerator: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { full: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index bea3a287fc..78a924fe5e 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -51,7 +51,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 16ba065b9d..272ebddd4b 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index c140084778..247d4af16c 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/antennas/list.ts b/packages/backend/src/server/api/endpoints/antennas/list.ts index 6910c07291..59d75d80f5 100644 --- a/packages/backend/src/server/api/endpoints/antennas/list.ts +++ b/packages/backend/src/server/api/endpoints/antennas/list.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 283c01c2c7..74f0d8d88f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -33,7 +33,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/antennas/show.ts b/packages/backend/src/server/api/endpoints/antennas/show.ts index d8c08f2777..8428844c15 100644 --- a/packages/backend/src/server/api/endpoints/antennas/show.ts +++ b/packages/backend/src/server/api/endpoints/antennas/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index 9f8564c2c0..0b8e864b4d 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { antennaId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index c62ca6088b..a60ff00ecd 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { uri: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index e0b53403bb..8f71e84a15 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -68,7 +68,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { uri: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index 0f9610d2a9..6e8d2b2abd 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/app/show.ts b/packages/backend/src/server/api/endpoints/app/show.ts index 0ca7fcc2a8..6d75294e84 100644 --- a/packages/backend/src/server/api/endpoints/app/show.ts +++ b/packages/backend/src/server/api/endpoints/app/show.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { appId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/auth/accept.ts b/packages/backend/src/server/api/endpoints/auth/accept.ts index 4429119b1f..775c26818b 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/auth/session/generate.ts b/packages/backend/src/server/api/endpoints/auth/session/generate.ts index 8d5c14e2f7..ba0356431f 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/generate.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/generate.ts @@ -35,7 +35,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { appSecret: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/auth/session/show.ts b/packages/backend/src/server/api/endpoints/auth/session/show.ts index dfc1c06ee6..701cc9237d 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/show.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/show.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index 397d1e687b..fa04610ce0 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts @@ -45,7 +45,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { appSecret: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index 8fd8f33338..cf09ca00ba 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index ad00fd1e0b..6e9fead113 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index a315ccde9e..bbae0fe661 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index dc7afadfa2..0491f7638f 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 128 }, diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index 4d07e720a9..c1e4ba2dec 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index 01156d1c2c..c831db4b8c 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index 0e75f06f47..79b12514ff 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { sinceId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index f8acae836b..c4c250fab1 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { sinceId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/show.ts b/packages/backend/src/server/api/endpoints/channels/show.ts index fb2c7b5adf..48d9fe29c1 100644 --- a/packages/backend/src/server/api/endpoints/channels/show.ts +++ b/packages/backend/src/server/api/endpoints/channels/show.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index a870ecccbb..6f35fd966c 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index 42a0eb0a5a..e6524bf555 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index 5a593c62e0..3ee36d97ec 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -36,7 +36,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { channelId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/charts/active-users.ts b/packages/backend/src/server/api/endpoints/charts/active-users.ts index a99269da0c..dcb155b937 100644 --- a/packages/backend/src/server/api/endpoints/charts/active-users.ts +++ b/packages/backend/src/server/api/endpoints/charts/active-users.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(activeUsersChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/ap-request.ts b/packages/backend/src/server/api/endpoints/charts/ap-request.ts index 403a933807..cb8046236a 100644 --- a/packages/backend/src/server/api/endpoints/charts/ap-request.ts +++ b/packages/backend/src/server/api/endpoints/charts/ap-request.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(apRequestChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/drive.ts b/packages/backend/src/server/api/endpoints/charts/drive.ts index 2c815367f6..35ec62e671 100644 --- a/packages/backend/src/server/api/endpoints/charts/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/drive.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(driveChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/federation.ts b/packages/backend/src/server/api/endpoints/charts/federation.ts index c48613ffac..07492cf6c2 100644 --- a/packages/backend/src/server/api/endpoints/charts/federation.ts +++ b/packages/backend/src/server/api/endpoints/charts/federation.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(federationChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/hashtag.ts b/packages/backend/src/server/api/endpoints/charts/hashtag.ts index 3cb0784ba4..537bb45bf1 100644 --- a/packages/backend/src/server/api/endpoints/charts/hashtag.ts +++ b/packages/backend/src/server/api/endpoints/charts/hashtag.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(hashtagChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/instance.ts b/packages/backend/src/server/api/endpoints/charts/instance.ts index 2da3cd3c3a..cd5c044ad9 100644 --- a/packages/backend/src/server/api/endpoints/charts/instance.ts +++ b/packages/backend/src/server/api/endpoints/charts/instance.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(instanceChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/notes.ts b/packages/backend/src/server/api/endpoints/charts/notes.ts index c48bc67e1c..b30f0894c2 100644 --- a/packages/backend/src/server/api/endpoints/charts/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/notes.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(notesChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/drive.ts b/packages/backend/src/server/api/endpoints/charts/user/drive.ts index 62f7afa435..cc1aac5fea 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/drive.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserDriveChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/following.ts b/packages/backend/src/server/api/endpoints/charts/user/following.ts index d6d2d5e3ee..1b68bdca1c 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/following.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/following.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserFollowingChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/notes.ts b/packages/backend/src/server/api/endpoints/charts/user/notes.ts index becde8b1df..55e6368187 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/notes.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserNotesChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts index 8f4d9a812a..f72424d2cf 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(perUserReactionsChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/charts/users.ts b/packages/backend/src/server/api/endpoints/charts/users.ts index 855fc6cd07..2dfdfefd78 100644 --- a/packages/backend/src/server/api/endpoints/charts/users.ts +++ b/packages/backend/src/server/api/endpoints/charts/users.ts @@ -8,7 +8,7 @@ export const meta = { res: getJsonSchema(usersChart.schema), } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { span: { type: 'string', enum: ['day', 'hour'] }, diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index e7dc25fe40..7700382bd3 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index b6ebf866b8..86164e69af 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index a263e10521..7f712450ae 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/list.ts b/packages/backend/src/server/api/endpoints/clips/list.ts index 959b60e6f9..b8ee72af7c 100644 --- a/packages/backend/src/server/api/endpoints/clips/list.ts +++ b/packages/backend/src/server/api/endpoints/clips/list.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index dd76e396bf..698b9d428d 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/show.ts b/packages/backend/src/server/api/endpoints/clips/show.ts index 7fe827a967..e1add3a0a6 100644 --- a/packages/backend/src/server/api/endpoints/clips/show.ts +++ b/packages/backend/src/server/api/endpoints/clips/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index b864497349..97134ac79a 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clipId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive.ts b/packages/backend/src/server/api/endpoints/drive.ts index 5fc1f64cf0..5ff383f0f4 100644 --- a/packages/backend/src/server/api/endpoints/drive.ts +++ b/packages/backend/src/server/api/endpoints/drive.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index 8ca9daed4d..998d964bc3 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index 20238c1b96..440dc856fd 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts index 8b7af3e54a..853723016e 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts @@ -14,7 +14,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { md5: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index f5791f6ec7..89c6c99f36 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -35,7 +35,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, @@ -48,6 +48,7 @@ const paramDef = { } as const; // eslint-disable-next-line import/no-default-export +// @ts-ignore export default define(meta, paramDef, async (ps, user, _, file, cleanup) => { // Get 'name' parameter let name = ps.name || file.originalname; diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 664637a68f..8ae7e7effe 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts index 98de790c0d..feb738be0d 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { md5: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/find.ts b/packages/backend/src/server/api/endpoints/drive/files/find.ts index 8d30c29da6..5419ba9196 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/show.ts b/packages/backend/src/server/api/endpoints/drive/files/show.ts index 8edb8785bc..932e692c4c 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/show.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index d77deea7db..3972e56084 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index a4619ebf36..5c688e883a 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -18,7 +18,7 @@ export const meta = { kind: 'write:drive', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { url: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index a543ae27df..4d8bc32dd7 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index ab48d5599e..994c537f9f 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', default: "Untitled", maxLength: 200 }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index 51c0340529..58b9919595 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index 057f40b1cc..333502f706 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/find.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/show.ts b/packages/backend/src/server/api/endpoints/drive/folders/show.ts index d31d7a4276..4bbd2dcf11 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index c70b5a0d54..a4393d99b0 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { folderId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 921ae4c221..9d5cb02c70 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/email-address/available.ts b/packages/backend/src/server/api/endpoints/email-address/available.ts index cb740ffae7..8fee4ce509 100644 --- a/packages/backend/src/server/api/endpoints/email-address/available.ts +++ b/packages/backend/src/server/api/endpoints/email-address/available.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { emailAddress: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/endpoint.ts b/packages/backend/src/server/api/endpoints/endpoint.ts index b8fe030e8c..7c528114f2 100644 --- a/packages/backend/src/server/api/endpoints/endpoint.ts +++ b/packages/backend/src/server/api/endpoints/endpoint.ts @@ -7,7 +7,7 @@ export const meta = { tags: ['meta'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { endpoint: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/endpoints.ts b/packages/backend/src/server/api/endpoints/endpoints.ts index b090e0dced..ef6efc6fb3 100644 --- a/packages/backend/src/server/api/endpoints/endpoints.ts +++ b/packages/backend/src/server/api/endpoints/endpoints.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts index f0ab63f74b..3bffbc82bd 100644 --- a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index 5960e482c0..b716552322 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 4f139b0c45..373c432be5 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 494b5120ab..fb25199c73 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index cead515d81..590f8a7e86 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index ebdc54d0a6..59661ea7c0 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -8,7 +8,7 @@ export const meta = { requireCredential: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index 294894cd92..f35471f062 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { host: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/following/create.ts b/packages/backend/src/server/api/endpoints/following/create.ts index 1edb3517a0..a18c44a1d8 100644 --- a/packages/backend/src/server/api/endpoints/following/create.ts +++ b/packages/backend/src/server/api/endpoints/following/create.ts @@ -57,7 +57,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/delete.ts b/packages/backend/src/server/api/endpoints/following/delete.ts index 2eb8636816..ec32c2c888 100644 --- a/packages/backend/src/server/api/endpoints/following/delete.ts +++ b/packages/backend/src/server/api/endpoints/following/delete.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index 8a1da3d299..137d366fce 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/requests/accept.ts b/packages/backend/src/server/api/endpoints/following/requests/accept.ts index 7040efcc80..adbbb3404a 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/accept.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/accept.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index 4204f8526a..5e949af9de 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts @@ -33,7 +33,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index 17d576d1c0..563223fcae 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -35,7 +35,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/following/requests/reject.ts b/packages/backend/src/server/api/endpoints/following/requests/reject.ts index 9e345aa15f..f1502eba13 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/reject.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/reject.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index 6b347f9dea..ad994c386a 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 57ead79826..9e5019ddef 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index c36e80b83c..40c9efaf51 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index d64937d0bc..c963dc86d1 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -29,7 +29,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { title: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index 82ffd62d60..7fafc9288a 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index 73d5a0ea99..ca6c06cf9e 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts index 819d360b14..0f8f3a6068 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index fc38174810..30ccaf167e 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index 1a86b56bc6..2b2e26aa5d 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { postId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/get-online-users-count.ts b/packages/backend/src/server/api/endpoints/get-online-users-count.ts index 855b9fc342..374d819ce7 100644 --- a/packages/backend/src/server/api/endpoints/get-online-users-count.ts +++ b/packages/backend/src/server/api/endpoints/get-online-users-count.ts @@ -9,7 +9,7 @@ export const meta = { requireCredential: false, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 68f2b2bf57..3bd5305bd4 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 9aa08ed28e..2af6b6d77c 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index 79b9613086..0770882141 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tag: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index de3e453c3e..6da5b90b28 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -53,7 +53,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index 1760732c1a..ff06d925dd 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tag: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index 091276ea27..f9c58c2479 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -13,7 +13,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index 8d82ab3886..1646b7bd89 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts index 5052afda97..52a0afcbfd 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts @@ -21,7 +21,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { clientDataJSON: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts index 2830f8994a..d9d2ec66c1 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { value: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts index da3ff421a7..86fc4fdffb 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts @@ -14,7 +14,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index 32acc838b7..e550698abb 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -11,7 +11,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts index 3004ce36a1..0469912340 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts @@ -9,7 +9,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts index b8e89bac72..c1ca445825 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/apps.ts b/packages/backend/src/server/api/endpoints/i/apps.ts index f45b6745b8..0fe3db2d9f 100644 --- a/packages/backend/src/server/api/endpoints/i/apps.ts +++ b/packages/backend/src/server/api/endpoints/i/apps.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { sort: { type: 'string', enum: ['+createdAt', '-createdAt', '+lastUsedAt', '-lastUsedAt'] }, diff --git a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts index e417f3e81a..e2f5ceb7e1 100644 --- a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts +++ b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/change-password.ts b/packages/backend/src/server/api/endpoints/i/change-password.ts index eac60ee183..e68d18b86d 100644 --- a/packages/backend/src/server/api/endpoints/i/change-password.ts +++ b/packages/backend/src/server/api/endpoints/i/change-password.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { currentPassword: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index 6f689c0b4e..188d2257aa 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -11,7 +11,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/export-blocking.ts b/packages/backend/src/server/api/endpoints/i/export-blocking.ts index afa6f2fc8e..808b546bdb 100644 --- a/packages/backend/src/server/api/endpoints/i/export-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/export-blocking.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/export-following.ts b/packages/backend/src/server/api/endpoints/i/export-following.ts index 4dd8cda398..10f8ee9ab2 100644 --- a/packages/backend/src/server/api/endpoints/i/export-following.ts +++ b/packages/backend/src/server/api/endpoints/i/export-following.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { excludeMuting: { type: 'boolean', default: false }, diff --git a/packages/backend/src/server/api/endpoints/i/export-mute.ts b/packages/backend/src/server/api/endpoints/i/export-mute.ts index ca8a7b997c..ab39508534 100644 --- a/packages/backend/src/server/api/endpoints/i/export-mute.ts +++ b/packages/backend/src/server/api/endpoints/i/export-mute.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/export-notes.ts b/packages/backend/src/server/api/endpoints/i/export-notes.ts index fc155d9d0f..770444d68b 100644 --- a/packages/backend/src/server/api/endpoints/i/export-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/export-notes.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts index 22cbf973f8..c0d9d924bd 100644 --- a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts @@ -11,7 +11,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index 45f5d99cce..d6c12582d0 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index 7578ed3216..173a502622 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index fbab8795ca..31e9636f84 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts index 2b31b89ff1..c760dd0e23 100644 --- a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index b90bfb1402..e9cf6e562e 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -40,7 +40,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/import-following.ts b/packages/backend/src/server/api/endpoints/i/import-following.ts index 75388502a5..d9c831daf8 100644 --- a/packages/backend/src/server/api/endpoints/i/import-following.ts +++ b/packages/backend/src/server/api/endpoints/i/import-following.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index e1c3df33e1..ac61a6c852 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -40,7 +40,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index eb1302a98c..68f2b377a9 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { fileId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index bb1d6a49b3..cecaa8ac44 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 60ac3ccde1..d3b68acdc5 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -30,7 +30,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index dbc58021b9..09cff4a0fb 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index a09618ebe8..a4dd64564a 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts index b0185a3e37..e6eb8d7ef0 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -10,7 +10,7 @@ export const meta = { kind: 'write:account', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts index 45638c2579..12038999ae 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -10,7 +10,7 @@ export const meta = { kind: 'write:account', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/read-announcement.ts b/packages/backend/src/server/api/endpoints/i/read-announcement.ts index f3cedddb35..2d8c723e4e 100644 --- a/packages/backend/src/server/api/endpoints/i/read-announcement.ts +++ b/packages/backend/src/server/api/endpoints/i/read-announcement.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { announcementId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts index 71a3ea08af..1462b902c4 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -10,7 +10,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts index 0429cd283a..c371da87d8 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { scope: { type: 'array', default: [], items: { diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts index 194a922718..bd243946b0 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get.ts b/packages/backend/src/server/api/endpoints/i/registry/get.ts index 7d413e3528..2bc6975bb3 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index 52e0d6fac5..78bb9dd348 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { scope: { type: 'array', default: [], items: { diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys.ts b/packages/backend/src/server/api/endpoints/i/registry/keys.ts index c494ed8f5c..5f627125d5 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { scope: { type: 'array', default: [], items: { diff --git a/packages/backend/src/server/api/endpoints/i/registry/remove.ts b/packages/backend/src/server/api/endpoints/i/registry/remove.ts index 5bc55bd297..6a005d10d4 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/remove.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/remove.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index e04d123a1f..09de7125c9 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/i/registry/set.ts b/packages/backend/src/server/api/endpoints/i/registry/set.ts index c78f4383be..28d9555b1c 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/set.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/set.ts @@ -9,7 +9,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { key: { type: 'string', minLength: 1 }, diff --git a/packages/backend/src/server/api/endpoints/i/revoke-token.ts b/packages/backend/src/server/api/endpoints/i/revoke-token.ts index 14800346c1..b889e795be 100644 --- a/packages/backend/src/server/api/endpoints/i/revoke-token.ts +++ b/packages/backend/src/server/api/endpoints/i/revoke-token.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tokenId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index 468972c239..f7a98a2332 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -8,7 +8,7 @@ export const meta = { secure: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index 895bfd0c28..5ab1e95c59 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index 1450eabc2a..21a2081836 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { password: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 0a5188609b..d800f23f8e 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -67,7 +67,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { ...Users.nameSchema, nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts index 6c38240913..a026d8d669 100644 --- a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts +++ b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index 5c1c040cc3..cb27f37fbb 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages.ts b/packages/backend/src/server/api/endpoints/messaging/messages.ts index ce477feac4..a21f8d8fc1 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index 60b1e2cdce..c2f9e71b5c 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -64,7 +64,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts index 67ecd4a1e6..8f5d6da665 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { messageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts index 1d0ddaf98f..2a18d9c379 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { messageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index fdd1586ca5..5b5604f6a6 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -440,7 +440,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { detail: { type: 'boolean', default: true }, diff --git a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts index e61c78754f..56fc459d7e 100644 --- a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts +++ b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { session: { type: 'string', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index 3ef97a1491..b8439cd3f6 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 8a88e13039..ff66aa26cf 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index fd8443e2b7..a728affe05 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 }, diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index 8dee11fb93..5d08f34dac 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index 0106bac516..28c49b0e63 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { local: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index ea2c166b75..43471b8ed5 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/clips.ts b/packages/backend/src/server/api/endpoints/notes/clips.ts index 2caa3a499f..2209894a96 100644 --- a/packages/backend/src/server/api/endpoints/notes/clips.ts +++ b/packages/backend/src/server/api/endpoints/notes/clips.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index c199a3f831..c785496f2e 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 7d81abc3a7..7ac318c501 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -95,7 +95,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { visibility: { type: 'string', enum: ['public', 'home', 'followers', 'specified'], default: "public" }, diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 62a2a98469..6084c93240 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -33,7 +33,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 570e2354ba..eaf2b1ac0f 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index b33a5f148b..1a64fc430e 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index 8a4297de62..11738cbe26 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index 23ca8752c9..54cf51c135 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { withFiles: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index ba6f3b5927..f75cbeb008 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 7c118317d6..9793919487 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { withFiles: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 265882fa70..41f2ad5244 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { following: { type: 'boolean', default: false }, diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index 4030694b58..0f2d4699de 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 739df8a03c..d889ba6f1f 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -58,7 +58,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index fdcaed64e1..746344df3b 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -29,7 +29,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index a898b3249a..9edbabc469 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index 53cadac7c9..d5e2e138a8 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -32,7 +32,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index aa5c2c0a45..a964a0c766 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index b88e3d7168..78559abd5a 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index bf18a20b97..ff55f862aa 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { tag: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index bcb9c2b8a1..7034645956 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index 8f75eeb5e8..a300f1aefa 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/state.ts b/packages/backend/src/server/api/endpoints/notes/state.ts index cf5f08ea9a..2e7f1f75c3 100644 --- a/packages/backend/src/server/api/endpoints/notes/state.ts +++ b/packages/backend/src/server/api/endpoints/notes/state.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index 4068a8a571..7b3c88785b 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -21,7 +21,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index 09b64f7277..66d631640a 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index c06a98feaa..14d0d71704 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index d85c8b96f9..a1d8fae10b 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index c10d277de1..5b39239279 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -27,7 +27,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 018e3e06a8..68a15f05fb 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -30,7 +30,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/watching/create.ts b/packages/backend/src/server/api/endpoints/notes/watching/create.ts index b19d370027..ed35638329 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/create.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts index f9ceb49278..1918b887ef 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index b5bfb34f4b..590f1c540f 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -12,7 +12,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { body: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts index 12dc43de16..5ad6605e7f 100644 --- a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -10,7 +10,7 @@ export const meta = { kind: 'write:notifications', } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/notifications/read.ts b/packages/backend/src/server/api/endpoints/notifications/read.ts index 6e5b5616dd..93ac75f649 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { notificationId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/page-push.ts b/packages/backend/src/server/api/endpoints/page-push.ts index 20334f33fc..690cd0884d 100644 --- a/packages/backend/src/server/api/endpoints/page-push.ts +++ b/packages/backend/src/server/api/endpoints/page-push.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index 6c00a2f779..c6d50e5cdf 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { title: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/pages/delete.ts b/packages/backend/src/server/api/endpoints/pages/delete.ts index c41373bb7c..2933e04174 100644 --- a/packages/backend/src/server/api/endpoints/pages/delete.ts +++ b/packages/backend/src/server/api/endpoints/pages/delete.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/featured.ts b/packages/backend/src/server/api/endpoints/pages/featured.ts index 38aa4dfacc..dbd8737b08 100644 --- a/packages/backend/src/server/api/endpoints/pages/featured.ts +++ b/packages/backend/src/server/api/endpoints/pages/featured.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index d286fd2bfd..0eb110732f 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index 95243e411f..e330460f23 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -23,7 +23,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index 582c924d91..f8efe8969a 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 686271cf46..8c81ea7463 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -42,7 +42,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { pageId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/ping.ts b/packages/backend/src/server/api/endpoints/ping.ts index 964401e19b..4f68965598 100644 --- a/packages/backend/src/server/api/endpoints/ping.ts +++ b/packages/backend/src/server/api/endpoints/ping.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index 83657f8bf9..61c67949cf 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/promo/read.ts b/packages/backend/src/server/api/endpoints/promo/read.ts index 99be33fb0c..b811159834 100644 --- a/packages/backend/src/server/api/endpoints/promo/read.ts +++ b/packages/backend/src/server/api/endpoints/promo/read.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { noteId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/request-reset-password.ts b/packages/backend/src/server/api/endpoints/request-reset-password.ts index 193c3ee79d..af190583c0 100644 --- a/packages/backend/src/server/api/endpoints/request-reset-password.ts +++ b/packages/backend/src/server/api/endpoints/request-reset-password.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/reset-db.ts b/packages/backend/src/server/api/endpoints/reset-db.ts index 1c1cb3f136..5a72c306ba 100644 --- a/packages/backend/src/server/api/endpoints/reset-db.ts +++ b/packages/backend/src/server/api/endpoints/reset-db.ts @@ -10,7 +10,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index 04048b9ef1..880ff682fb 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -12,7 +12,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { token: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index 4a5bc6a86c..97245575e8 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -8,7 +8,7 @@ export const meta = { tags: ['meta'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/stats.ts b/packages/backend/src/server/api/endpoints/stats.ts index 8abae921ac..7863d439ca 100644 --- a/packages/backend/src/server/api/endpoints/stats.ts +++ b/packages/backend/src/server/api/endpoints/stats.ts @@ -43,7 +43,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index 459b0dd969..9971bfb7d0 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -25,7 +25,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { endpoint: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/sw/unregister.ts b/packages/backend/src/server/api/endpoints/sw/unregister.ts index ec994c37c2..fc5fb0ce92 100644 --- a/packages/backend/src/server/api/endpoints/sw/unregister.ts +++ b/packages/backend/src/server/api/endpoints/sw/unregister.ts @@ -7,7 +7,7 @@ export const meta = { requireCredential: true, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { endpoint: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/test.ts b/packages/backend/src/server/api/endpoints/test.ts index 820448e677..ee04009308 100644 --- a/packages/backend/src/server/api/endpoints/test.ts +++ b/packages/backend/src/server/api/endpoints/test.ts @@ -4,7 +4,7 @@ export const meta = { requireCredential: false, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { required: { type: 'boolean' }, diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index 6e38d4d310..4564784a9b 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: Users.localUsernameSchema, diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 0c03ac05c3..2406fcd2fc 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index e224bdf603..7abb94e2cf 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -6,7 +6,7 @@ export const meta = { tags: ['users', 'clips'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 5607b4cc73..75f13a2929 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 36943232d1..b1af55169c 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index e874a54c77..7accc0b627 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -6,7 +6,7 @@ export const meta = { tags: ['users', 'gallery'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts index a08587cd16..5173982840 100644 --- a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -39,7 +39,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/create.ts b/packages/backend/src/server/api/endpoints/users/groups/create.ts index e7bc95791f..358d3828a0 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/create.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/create.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/delete.ts b/packages/backend/src/server/api/endpoints/users/groups/delete.ts index cb30b4d813..ca8d864dcd 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts index 7a6a620cb3..31d3461280 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { invitationId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts index b5c7f0908a..29b7612a8a 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { invitationId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/invite.ts b/packages/backend/src/server/api/endpoints/users/groups/invite.ts index ba78a28a38..31eef02b2f 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invite.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invite.ts @@ -40,7 +40,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/joined.ts b/packages/backend/src/server/api/endpoints/users/groups/joined.ts index 192a52a66b..465585376e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/joined.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/joined.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/users/groups/leave.ts b/packages/backend/src/server/api/endpoints/users/groups/leave.ts index b7c7b328fd..56b5330c83 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/leave.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/leave.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/owned.ts b/packages/backend/src/server/api/endpoints/users/groups/owned.ts index 4592fc437f..a3724a0547 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/owned.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/owned.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/users/groups/pull.ts b/packages/backend/src/server/api/endpoints/users/groups/pull.ts index d50f61b159..dd93faa62e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/pull.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/show.ts b/packages/backend/src/server/api/endpoints/users/groups/show.ts index 230254060d..799ec3202e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/show.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts index 4b5206fa18..bb3b7f11c2 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts @@ -37,7 +37,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/groups/update.ts b/packages/backend/src/server/api/endpoints/users/groups/update.ts index 0714fb4bd4..6c8851889a 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/update.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/update.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { groupId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index 0a74424e0e..c0c37f96f1 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -17,7 +17,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { name: { type: 'string', minLength: 1, maxLength: 100 }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 6795a227dc..0f7fdbc908 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -18,7 +18,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/list.ts b/packages/backend/src/server/api/endpoints/users/lists/list.ts index d439723403..5245c57849 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/list.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/list.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: {}, required: [], diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index 5eca5a999d..45b0b41564 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -26,7 +26,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 68a1f00774..252f7e6e19 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -38,7 +38,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/show.ts b/packages/backend/src/server/api/endpoints/users/lists/show.ts index 3e9aa836ba..91a2bf55a4 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/show.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/show.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/lists/update.ts b/packages/backend/src/server/api/endpoints/users/lists/update.ts index ee1489fc6a..3e3f6ec9fe 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/update.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/update.ts @@ -24,7 +24,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { listId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 956d90b7ad..4c27fb8ee4 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -31,7 +31,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index 873b5e80fa..f7b39b75fd 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -6,7 +6,7 @@ export const meta = { tags: ['users', 'pages'], } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index 8d968210bc..c9b5a95639 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -28,7 +28,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 4a2d8d7e4a..78c2f3e1a4 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -22,7 +22,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, diff --git a/packages/backend/src/server/api/endpoints/users/relation.ts b/packages/backend/src/server/api/endpoints/users/relation.ts index fac1a4b92d..140126cab5 100644 --- a/packages/backend/src/server/api/endpoints/users/relation.ts +++ b/packages/backend/src/server/api/endpoints/users/relation.ts @@ -93,7 +93,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { diff --git a/packages/backend/src/server/api/endpoints/users/report-abuse.ts b/packages/backend/src/server/api/endpoints/users/report-abuse.ts index 1df5e1573f..717724a4cf 100644 --- a/packages/backend/src/server/api/endpoints/users/report-abuse.ts +++ b/packages/backend/src/server/api/endpoints/users/report-abuse.ts @@ -34,7 +34,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 433779ae2d..15a93bc4f8 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -20,7 +20,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { username: { type: 'string', nullable: true }, diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 8c28e7c3a6..9d772f0968 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -19,7 +19,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { query: { type: 'string' }, diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index 29c90963ad..cb42cc80a0 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -44,7 +44,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, diff --git a/packages/backend/src/server/api/endpoints/users/stats.ts b/packages/backend/src/server/api/endpoints/users/stats.ts index 29dd8fdf93..2f4ca10fc1 100644 --- a/packages/backend/src/server/api/endpoints/users/stats.ts +++ b/packages/backend/src/server/api/endpoints/users/stats.ts @@ -16,7 +16,7 @@ export const meta = { }, } as const; -const paramDef = { +export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, From ec632e6694607c6b57b34ba2287f0ea469bd4075 Mon Sep 17 00:00:00 2001 From: xianon Date: Sun, 20 Feb 2022 16:07:29 +0900 Subject: [PATCH 20/95] =?UTF-8?q?=E3=82=BF=E3=83=83=E3=83=81=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E3=81=A7=E3=82=A6=E3=82=A3=E3=82=B8=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=81=AE=E7=B7=A8=E9=9B=86=E3=82=84=E5=89=8A=E9=99=A4?= =?UTF-8?q?=E3=81=8C=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=20(#8328)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/components/widgets.vue | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/widgets.vue b/packages/client/src/components/widgets.vue index ccde5fbe55..da9d935281 100644 --- a/packages/client/src/components/widgets.vue +++ b/packages/client/src/components/widgets.vue @@ -12,13 +12,14 @@ @@ -121,10 +122,6 @@ export default defineComponent({ position: relative; cursor: move; - > *:not(.remove):not(.config) { - pointer-events: none; - } - > .config, > .remove { position: absolute; From a1c7c1fb49f0b09aa382fa00c9883bfcd5dc5d57 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 Feb 2022 16:07:43 +0900 Subject: [PATCH 21/95] remove max note text length setting Resolve #8323 --- CHANGELOG.md | 3 +++ locales/ja-JP.yml | 1 - .../1645340161439-remove-max-note-text-length.js | 13 +++++++++++++ packages/backend/src/const.ts | 2 ++ packages/backend/src/models/entities/meta.ts | 6 ------ .../src/server/api/endpoints/admin/update-meta.ts | 5 ----- packages/backend/src/server/api/endpoints/meta.ts | 6 ------ .../src/server/api/endpoints/notes/create.ts | 14 ++------------ packages/backend/src/server/nodeinfo.ts | 3 ++- packages/client/src/pages/admin/settings.vue | 8 -------- 10 files changed, 22 insertions(+), 39 deletions(-) create mode 100644 packages/backend/migration/1645340161439-remove-max-note-text-length.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 677fb5698b..9629c970ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ You should also include the user name that made the change. ## 12.x.x (unreleased) +### Changes +- ノートの最大文字数を設定できる機能が廃止され、デフォルトで一律3000文字になりました + ### Improvements - diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index f4c9d19981..840e1beeee 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -422,7 +422,6 @@ next: "次" retype: "再入力" noteOf: "{user}のノート" inviteToGroup: "グループに招待" -maxNoteTextLength: "ノートの文字数制限" quoteAttached: "引用付き" quoteQuestion: "引用として添付しますか?" noMessagesYet: "まだチャットはありません" diff --git a/packages/backend/migration/1645340161439-remove-max-note-text-length.js b/packages/backend/migration/1645340161439-remove-max-note-text-length.js new file mode 100644 index 0000000000..63e7d25ee5 --- /dev/null +++ b/packages/backend/migration/1645340161439-remove-max-note-text-length.js @@ -0,0 +1,13 @@ +const { MigrationInterface, QueryRunner } = require("typeorm"); + +module.exports = class removeMaxNoteTextLength1645340161439 { + name = 'removeMaxNoteTextLength1645340161439' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "maxNoteTextLength"`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "maxNoteTextLength" integer NOT NULL DEFAULT '500'`); + } +} diff --git a/packages/backend/src/const.ts b/packages/backend/src/const.ts index b00bd81655..6d3b9559e8 100644 --- a/packages/backend/src/const.ts +++ b/packages/backend/src/const.ts @@ -1,3 +1,5 @@ +export const MAX_NOTE_TEXT_LENGTH = 3000; + export const USER_ONLINE_THRESHOLD = 1000 * 60 * 10; // 10min export const USER_ACTIVE_THRESHOLD = 1000 * 60 * 60 * 24 * 3; // 3days diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index 1426c79c51..3031642478 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -205,12 +205,6 @@ export class Meta { }) public remoteDriveCapacityMb: number; - @Column('integer', { - default: 500, - comment: 'Max allowed note text length in characters', - }) - public maxNoteTextLength: number; - @Column('varchar', { length: 128, nullable: true, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index ecede8a049..509e120e79 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -36,7 +36,6 @@ export const paramDef = { logoImageUrl: { type: 'string', nullable: true }, name: { type: 'string', nullable: true }, description: { type: 'string', nullable: true }, - maxNoteTextLength: { type: 'integer', maximum: 8192 }, localDriveCapacityMb: { type: 'integer' }, remoteDriveCapacityMb: { type: 'integer' }, cacheRemoteFiles: { type: 'boolean' }, @@ -164,10 +163,6 @@ export default define(meta, paramDef, async (ps, me) => { set.description = ps.description; } - if (ps.maxNoteTextLength) { - set.maxNoteTextLength = ps.maxNoteTextLength; - } - if (ps.localDriveCapacityMb !== undefined) { set.localDriveCapacityMb = ps.localDriveCapacityMb; } diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 5b5604f6a6..9ea75009e6 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -138,11 +138,6 @@ export const meta = { type: 'string', optional: false, nullable: true, }, - maxNoteTextLength: { - type: 'number', - optional: false, nullable: false, - default: 500, - }, emojis: { type: 'array', optional: false, nullable: false, @@ -506,7 +501,6 @@ export default define(meta, paramDef, async (ps, me) => { iconUrl: instance.iconUrl, backgroundImageUrl: instance.backgroundImageUrl, logoImageUrl: instance.logoImageUrl, - maxNoteTextLength: Math.min(instance.maxNoteTextLength, DB_MAX_NOTE_TEXT_LENGTH), emojis: await Emojis.packMany(emojis), ads: ads.map(ad => ({ id: ad.id, diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 7ac318c501..6bf696b9d1 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -1,24 +1,14 @@ import ms from 'ms'; -import { length } from 'stringz'; import create from '@/services/note/create'; import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; import { ApiError } from '../../error'; import { User } from '@/models/entities/user'; import { Users, DriveFiles, Notes, Channels, Blockings } from '@/models/index'; import { DriveFile } from '@/models/entities/drive-file'; import { Note } from '@/models/entities/note'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; import { noteVisibilities } from '../../../../types'; import { Channel } from '@/models/entities/channel'; - -let maxNoteTextLength = 500; - -setInterval(() => { - fetchMeta().then(m => { - maxNoteTextLength = m.maxNoteTextLength; - }); -}, 3000); +import { MAX_NOTE_TEXT_LENGTH } from '@/const'; export const meta = { tags: ['notes'], @@ -102,7 +92,7 @@ export const paramDef = { visibleUserIds: { type: 'array', uniqueItems: true, items: { type: 'string', format: 'misskey:id', } }, - text: { type: 'string', nullable: true, maxLength: 3000, default: null }, + text: { type: 'string', nullable: true, maxLength: MAX_NOTE_TEXT_LENGTH, default: null }, cw: { type: 'string', nullable: true, maxLength: 100 }, localOnly: { type: 'boolean', default: false }, noExtractMentions: { type: 'boolean', default: false }, diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 4209fc7f14..25eca291db 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -3,6 +3,7 @@ import config from '@/config/index'; import { fetchMeta } from '@/misc/fetch-meta'; import { Users, Notes } from '@/models/index'; import { MoreThan } from 'typeorm'; +import { MAX_NOTE_TEXT_LENGTH } from '@/const'; const router = new Router(); @@ -69,7 +70,7 @@ const nodeinfo2 = async () => { emailRequiredForSignup: meta.emailRequiredForSignup, enableHcaptcha: meta.enableHcaptcha, enableRecaptcha: meta.enableRecaptcha, - maxNoteTextLength: meta.maxNoteTextLength, + maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, enableTwitterIntegration: meta.enableTwitterIntegration, enableGithubIntegration: meta.enableGithubIntegration, enableDiscordIntegration: meta.enableDiscordIntegration, diff --git a/packages/client/src/pages/admin/settings.vue b/packages/client/src/pages/admin/settings.vue index 81204f6e2f..17f7842ab2 100644 --- a/packages/client/src/pages/admin/settings.vue +++ b/packages/client/src/pages/admin/settings.vue @@ -52,11 +52,6 @@ - - - - - @@ -186,7 +181,6 @@ export default defineComponent({ bannerUrl: null, backgroundImageUrl: null, themeColor: null, - maxNoteTextLength: 0, enableLocalTimeline: false, enableGlobalTimeline: false, pinnedUsers: '', @@ -216,7 +210,6 @@ export default defineComponent({ this.themeColor = meta.themeColor; this.maintainerName = meta.maintainerName; this.maintainerEmail = meta.maintainerEmail; - this.maxNoteTextLength = meta.maxNoteTextLength; this.enableLocalTimeline = !meta.disableLocalTimeline; this.enableGlobalTimeline = !meta.disableGlobalTimeline; this.pinnedUsers = meta.pinnedUsers.join('\n'); @@ -244,7 +237,6 @@ export default defineComponent({ themeColor: this.themeColor === '' ? null : this.themeColor, maintainerName: this.maintainerName, maintainerEmail: this.maintainerEmail, - maxNoteTextLength: this.maxNoteTextLength, disableLocalTimeline: !this.enableLocalTimeline, disableGlobalTimeline: !this.enableGlobalTimeline, pinnedUsers: this.pinnedUsers.split('\n'), From 6994136fb327d9c2a69fa24de80c53869aa88de2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 Feb 2022 16:08:09 +0900 Subject: [PATCH 22/95] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9629c970ea..b9c0ddf27d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ You should also include the user name that made the change. ### Bugfixes - Client: リアクションピッカーの高さが低くなったまま戻らないことがあるのを修正 @syuilo +- Client: タッチ操作だとウィジェットの編集がしにくいのを修正 @xianonn ## 12.107.0 (2022/02/12) From 92f5027c3cb17de4940436147a9653a787be55d7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 Feb 2022 16:53:06 +0900 Subject: [PATCH 23/95] =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E3=81=AE=E8=BF=BD=E5=8A=A0=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E3=82=92=E6=9C=80=E5=A4=A716=E3=81=BE=E3=81=A7=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close #8225 Close #8234 --- CHANGELOG.md | 2 +- locales/ja-JP.yml | 2 +- .../src/server/api/endpoints/i/update.ts | 2 +- .../client/src/pages/settings/profile.vue | 127 ++++++------------ 4 files changed, 44 insertions(+), 89 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c0ddf27d..c78be1b090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ You should also include the user name that made the change. - ノートの最大文字数を設定できる機能が廃止され、デフォルトで一律3000文字になりました ### Improvements -- +- プロフィールの追加情報を最大16まで保存できるように ### Bugfixes - Client: リアクションピッカーの高さが低くなったまま戻らないことがあるのを修正 @syuilo diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 840e1beeee..df67fb89b3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1290,7 +1290,7 @@ _profile: youCanIncludeHashtags: "ハッシュタグを含めることができます。" metadata: "追加情報" metadataEdit: "追加情報を編集" - metadataDescription: "プロフィールに表として4つまでの追加情報を表示することができます。" + metadataDescription: "プロフィールに表として追加情報を表示することができます。" metadataLabel: "ラベル" metadataContent: "内容" changeAvatar: "アバター画像を変更" diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index d800f23f8e..3488082ab2 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -79,7 +79,7 @@ export const paramDef = { bannerId: { type: 'string', format: 'misskey:id', nullable: true }, fields: { type: 'array', minItems: 0, - maxItems: 8, + maxItems: 16, items: { type: 'object', properties: { diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 9b30d1c8e0..e463a4271f 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -32,8 +32,26 @@ - - {{ i18n.ts._profile.metadataEdit }} + + + + + +

+ @@ -52,6 +70,8 @@ import FormInput from '@/components/form/input.vue'; import FormTextarea from '@/components/form/textarea.vue'; import FormSwitch from '@/components/form/switch.vue'; import FormSelect from '@/components/form/select.vue'; +import FormSplit from '@/components/form/split.vue'; +import FormFolder from '@/components/form/folder.vue'; import FormSlot from '@/components/form/slot.vue'; import { host, langs } from '@/config'; import { selectFile } from '@/scripts/select-file'; @@ -72,23 +92,31 @@ const profile = reactive({ alwaysMarkNsfw: $i.alwaysMarkNsfw, }); -const additionalFields = reactive({ - fieldName0: $i.fields[0] ? $i.fields[0].name : null, - fieldValue0: $i.fields[0] ? $i.fields[0].value : null, - fieldName1: $i.fields[1] ? $i.fields[1].name : null, - fieldValue1: $i.fields[1] ? $i.fields[1].value : null, - fieldName2: $i.fields[2] ? $i.fields[2].name : null, - fieldValue2: $i.fields[2] ? $i.fields[2].value : null, - fieldName3: $i.fields[3] ? $i.fields[3].name : null, - fieldValue3: $i.fields[3] ? $i.fields[3].value : null, -}); - watch(() => profile, () => { save(); }, { deep: true, }); +const fields = reactive($i.fields.map(field => ({ name: field.name, value: field.value }))); + +function addField() { + fields.push({ + name: '', + value: '', + }); +} + +while (fields.length < 4) { + addField(); +} + +function saveFields() { + os.apiWithDialog('i/update', { + fields: fields.filter(field => field.name !== '' && field.value !== ''), + }); +} + function save() { os.apiWithDialog('i/update', { name: profile.name || null, @@ -123,79 +151,6 @@ function changeBanner(ev) { }); } -async function editMetadata() { - const { canceled, result } = await os.form(i18n.ts._profile.metadata, { - fieldName0: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 1', - default: additionalFields.fieldName0, - }, - fieldValue0: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 1', - default: additionalFields.fieldValue0, - }, - fieldName1: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 2', - default: additionalFields.fieldName1, - }, - fieldValue1: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 2', - default: additionalFields.fieldValue1, - }, - fieldName2: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 3', - default: additionalFields.fieldName2, - }, - fieldValue2: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 3', - default: additionalFields.fieldValue2, - }, - fieldName3: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 4', - default: additionalFields.fieldName3, - }, - fieldValue3: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 4', - default: additionalFields.fieldValue3, - }, - }); - if (canceled) return; - - additionalFields.fieldName0 = result.fieldName0; - additionalFields.fieldValue0 = result.fieldValue0; - additionalFields.fieldName1 = result.fieldName1; - additionalFields.fieldValue1 = result.fieldValue1; - additionalFields.fieldName2 = result.fieldName2; - additionalFields.fieldValue2 = result.fieldValue2; - additionalFields.fieldName3 = result.fieldName3; - additionalFields.fieldValue3 = result.fieldValue3; - - const fields = [ - { name: additionalFields.fieldName0, value: additionalFields.fieldValue0 }, - { name: additionalFields.fieldName1, value: additionalFields.fieldValue1 }, - { name: additionalFields.fieldName2, value: additionalFields.fieldValue2 }, - { name: additionalFields.fieldName3, value: additionalFields.fieldValue3 }, - ]; - - os.api('i/update', { - fields, - }).then(i => { - os.success(); - }).catch(err => { - os.alert({ - type: 'error', - text: err.id - }); - }); -} - defineExpose({ [symbols.PAGE_INFO]: { title: i18n.ts.profile, From 4e7fa8216e63fd71fcbe398d1f3e064056c57a53 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 Feb 2022 19:01:06 +0900 Subject: [PATCH 24/95] =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=A4=E3=83=99?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=82=BF=E3=83=96=E3=81=A7=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=81=97=E7=9B=B4=E3=81=99=E3=81=A8=E6=96=87?= =?UTF-8?q?=E5=AD=97=E6=95=B0=E3=81=8CNaN=E3=81=AB=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/api/endpoints/meta.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 9ea75009e6..afc6d2805f 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -4,6 +4,7 @@ import { fetchMeta } from '@/misc/fetch-meta'; import { Ads, Emojis, Users } from '@/models/index'; import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; import { MoreThan } from 'typeorm'; +import { MAX_NOTE_TEXT_LENGTH } from '@/const'; export const meta = { tags: ['meta'], @@ -138,6 +139,10 @@ export const meta = { type: 'string', optional: false, nullable: true, }, + maxNoteTextLength: { + type: 'number', + optional: false, nullable: false, + }, emojis: { type: 'array', optional: false, nullable: false, @@ -501,6 +506,7 @@ export default define(meta, paramDef, async (ps, me) => { iconUrl: instance.iconUrl, backgroundImageUrl: instance.backgroundImageUrl, logoImageUrl: instance.logoImageUrl, + maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, // 後方互換性のため emojis: await Emojis.packMany(emojis), ads: ads.map(ad => ({ id: ad.id, From 9422f88451495e3dc84e04b57d1bd500257d2933 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 Feb 2022 19:01:13 +0900 Subject: [PATCH 25/95] :art: --- packages/client/src/pages/settings/profile.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index e463a4271f..d79f846e3d 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -48,8 +48,8 @@ - {{ i18n.ts.add }} - {{ i18n.ts.save }} + {{ i18n.ts.add }} + {{ i18n.ts.save }} From 65be8daa1577ff6187722186819ae9c7401d1a8f Mon Sep 17 00:00:00 2001 From: Filip Hanes Date: Sun, 20 Feb 2022 16:16:40 +0100 Subject: [PATCH 26/95] add sk-SK lang to locales/index.js (#8325) --- locales/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/locales/index.js b/locales/index.js index 8350b3d9c4..b271b79b73 100644 --- a/locales/index.js +++ b/locales/index.js @@ -34,6 +34,7 @@ const languages = [ 'pl-PL', 'pt-PT', 'ru-RU', + 'sk-SK', 'ug-CN', 'uk-UA', 'zh-CN', From a28daf7f446c2b2e7e3ded088c45a7d44ebfc9e9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 Feb 2022 16:17:16 +0900 Subject: [PATCH 27/95] feat: add pub & sub item for federation chart --- CHANGELOG.md | 1 + .../1645599900873-federation-chart-pubsub.js | 15 +++++++++ .../chart/charts/entities/federation.ts | 1 + .../src/services/chart/charts/federation.ts | 14 +++++++- packages/client/src/components/chart.vue | 32 +++++++++++-------- 5 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 packages/backend/migration/1645599900873-federation-chart-pubsub.js diff --git a/CHANGELOG.md b/CHANGELOG.md index c78be1b090..0c918ec53d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ You should also include the user name that made the change. ### Improvements - プロフィールの追加情報を最大16まで保存できるように +- 連合チャートにPub&Subを追加 ### Bugfixes - Client: リアクションピッカーの高さが低くなったまま戻らないことがあるのを修正 @syuilo diff --git a/packages/backend/migration/1645599900873-federation-chart-pubsub.js b/packages/backend/migration/1645599900873-federation-chart-pubsub.js new file mode 100644 index 0000000000..f695d123ab --- /dev/null +++ b/packages/backend/migration/1645599900873-federation-chart-pubsub.js @@ -0,0 +1,15 @@ +const { MigrationInterface, QueryRunner } = require("typeorm"); + +module.exports = class federationChartPubsub1645599900873 { + name = 'federationChartPubsub1645599900873' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___pubsub" smallint NOT NULL DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___pubsub" smallint NOT NULL DEFAULT '0'`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___pubsub"`); + await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___pubsub"`); + } +} diff --git a/packages/backend/src/services/chart/charts/entities/federation.ts b/packages/backend/src/services/chart/charts/entities/federation.ts index 6b2089f0b4..3ed5d7352a 100644 --- a/packages/backend/src/services/chart/charts/entities/federation.ts +++ b/packages/backend/src/services/chart/charts/entities/federation.ts @@ -8,6 +8,7 @@ export const schema = { 'stalled': { uniqueIncrement: true, range: 'small' }, 'sub': { accumulate: true, range: 'small' }, 'pub': { accumulate: true, range: 'small' }, + 'pubsub': { accumulate: true, range: 'small' }, } as const; export const entity = Chart.schemaToEntity(name, schema); diff --git a/packages/backend/src/services/chart/charts/federation.ts b/packages/backend/src/services/chart/charts/federation.ts index 211ba1debc..020f89fe72 100644 --- a/packages/backend/src/services/chart/charts/federation.ts +++ b/packages/backend/src/services/chart/charts/federation.ts @@ -20,7 +20,11 @@ export default class FederationChart extends Chart { @autobind protected async tickMinor(): Promise>> { - const [sub, pub] = await Promise.all([ + const pubsubSubQuery = Followings.createQueryBuilder('f') + .select('f.followerHost') + .where('f.followerHost IS NOT NULL'); + + const [sub, pub, pubsub] = await Promise.all([ Followings.createQueryBuilder('following') .select('COUNT(DISTINCT following.followeeHost)') .where('following.followeeHost IS NOT NULL') @@ -31,11 +35,19 @@ export default class FederationChart extends Chart { .where('following.followerHost IS NOT NULL') .getRawOne() .then(x => parseInt(x.count, 10)), + Followings.createQueryBuilder('following') + .select('COUNT(DISTINCT following.followeeHost)') + .where('following.followeeHost IS NOT NULL') + .andWhere(`following.followerHost IN (${ pubsubSubQuery.getQuery() })`) + .setParameters(pubsubSubQuery.getParameters()) + .getRawOne() + .then(x => parseInt(x.count, 10)), ]); return { 'sub': sub, 'pub': pub, + 'pubsub': pubsub, }; } diff --git a/packages/client/src/components/chart.vue b/packages/client/src/components/chart.vue index b90c790c3f..3787c5f066 100644 --- a/packages/client/src/components/chart.vue +++ b/packages/client/src/components/chart.vue @@ -70,6 +70,7 @@ const colors = { red: '#FF4560', purple: '#e300db', orange: '#fe6919', + lime: '#c7f400', }; const colorSets = [colors.blue, colors.green, colors.yellow, colors.red, colors.purple]; const getColor = (i) => { @@ -224,7 +225,7 @@ export default defineComponent({ axis: 'y', colors: { 0: alpha(x.color ? x.color : getColor(i), 0), - [maxes[i]]: alpha(x.color ? x.color : getColor(i), 0.15), + [maxes[i]]: alpha(x.color ? x.color : getColor(i), 0.175), }, }, }, @@ -373,16 +374,6 @@ export default defineComponent({ const raw = await os.api('charts/federation', { limit: props.limit, span: props.span }); return { series: [{ - name: 'Sub', - type: 'area', - data: format(raw.sub), - color: colors.orange, - }, { - name: 'Pub', - type: 'area', - data: format(raw.pub), - color: colors.purple, - }, { name: 'Received', type: 'area', data: format(raw.inboxInstances), @@ -397,6 +388,21 @@ export default defineComponent({ type: 'area', data: format(raw.stalled), color: colors.red, + }, { + name: 'Pub & Sub', + type: 'area', + data: format(raw.pubsub), + color: colors.lime, + }, { + name: 'Pub', + type: 'area', + data: format(raw.pub), + color: colors.purple, + }, { + name: 'Sub', + type: 'area', + data: format(raw.sub), + color: colors.orange, }], }; }; @@ -529,12 +535,12 @@ export default defineComponent({ name: 'Write', type: 'area', data: format(raw.write), - color: colors.blue, + color: colors.lime, }, { name: 'Read', type: 'area', data: format(raw.read), - color: '#888888', + color: colors.blue, }, { name: '< Week', type: 'area', From bd07c7312a96b19aa81f49fafbbf8414b2183139 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Wed, 23 Feb 2022 12:17:43 +0100 Subject: [PATCH 28/95] fix: also recognize "shortcut icon" favicon (#8220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * also recognize "shortcut icon" favicon Not using querySelector for this because it uses jsdom which might be slower. Reversing the order because WHATWG says the last appropriate link should be used. * also fetchIconUrl * br * improve readability * fix * フォールバックにhrefの評価を含める * fix val name * 将来的な拡張を考えたコードにした Co-authored-by: tamaina Co-authored-by: syuilo --- .../src/services/fetch-instance-metadata.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/services/fetch-instance-metadata.ts b/packages/backend/src/services/fetch-instance-metadata.ts index 2c401508a9..95601bfd82 100644 --- a/packages/backend/src/services/fetch-instance-metadata.ts +++ b/packages/backend/src/services/fetch-instance-metadata.ts @@ -156,7 +156,8 @@ async function fetchFaviconUrl(instance: Instance, doc: DOMWindow['document'] | const url = 'https://' + instance.host; if (doc) { - const href = doc.querySelector('link[rel="icon"]')?.getAttribute('href'); + // https://github.com/misskey-dev/misskey/pull/8220#issuecomment-1025104043 + const href = Array.from(doc.getElementsByTagName('link')).reverse().find(link => link.relList.contains('icon'))?.href; if (href) { return (new URL(href, url)).href; @@ -186,11 +187,16 @@ async function fetchIconUrl(instance: Instance, doc: DOMWindow['document'] | nul if (doc) { const url = 'https://' + instance.host; - const hrefAppleTouchIconPrecomposed = doc.querySelector('link[rel="apple-touch-icon-precomposed"]')?.getAttribute('href'); - const hrefAppleTouchIcon = doc.querySelector('link[rel="apple-touch-icon"]')?.getAttribute('href'); - const hrefIcon = doc.querySelector('link[rel="icon"]')?.getAttribute('href'); - - const href = hrefAppleTouchIconPrecomposed || hrefAppleTouchIcon || hrefIcon; + // https://github.com/misskey-dev/misskey/pull/8220#issuecomment-1025104043 + const links = Array.from(doc.getElementsByTagName('link')).reverse(); + // https://github.com/misskey-dev/misskey/pull/8220/files/0ec4eba22a914e31b86874f12448f88b3e58dd5a#r796487559 + const href = + [ + links.find(link => link.relList.contains('apple-touch-icon-precomposed'))?.href, + links.find(link => link.relList.contains('apple-touch-icon'))?.href, + links.find(link => link.relList.contains('icon'))?.href, + ] + .find(href => href); if (href) { return (new URL(href, url)).href; From 9952418b3a90d6c632c28311222f18b0dccda127 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 Feb 2022 21:31:48 +0900 Subject: [PATCH 29/95] update deps --- packages/backend/package.json | 20 ++-- packages/backend/yarn.lock | 174 ++++++++++++++++++---------------- packages/client/package.json | 10 +- packages/client/yarn.lock | 118 +++++++++++------------ 4 files changed, 164 insertions(+), 158 deletions(-) diff --git a/packages/backend/package.json b/packages/backend/package.json index b9433f7f35..e608633906 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -42,7 +42,7 @@ "@types/koa__multer": "2.0.4", "@types/koa__router": "8.0.11", "@types/mocha": "9.1.0", - "@types/node": "17.0.18", + "@types/node": "17.0.19", "@types/node-fetch": "3.0.3", "@types/nodemailer": "6.4.4", "@types/oauth": "0.9.1", @@ -66,19 +66,19 @@ "@types/uuid": "8.3.4", "@types/web-push": "3.3.2", "@types/websocket": "1.0.5", - "@types/ws": "8.2.2", - "@typescript-eslint/eslint-plugin": "5.12.0", - "@typescript-eslint/parser": "5.12.0", + "@types/ws": "8.2.3", + "@typescript-eslint/eslint-plugin": "5.12.1", + "@typescript-eslint/parser": "5.12.1", "abort-controller": "3.0.0", "ajv": "8.10.0", "archiver": "5.3.0", "autobind-decorator": "2.4.0", "autwh": "0.1.0", - "aws-sdk": "2.1067.0", + "aws-sdk": "2.1079.0", "bcryptjs": "2.4.3", "blurhash": "1.1.5", "broadcast-channel": "4.10.0", - "bull": "4.5.5", + "bull": "4.6.2", "cacheable-lookup": "6.0.4", "cafy": "15.2.1", "cbor": "8.1.0", @@ -119,7 +119,7 @@ "mfm-js": "0.21.0", "mime-types": "2.1.34", "misskey-js": "0.0.14", - "mocha": "9.2.0", + "mocha": "9.2.1", "ms": "3.0.0-canary.1", "multer": "1.4.4", "nested-property": "4.0.0", @@ -138,7 +138,7 @@ "qrcode": "1.5.0", "random-seed": "0.3.0", "ratelimiter": "3.4.1", - "re2": "1.17.3", + "re2": "1.17.4", "redis": "3.1.2", "redis-lock": "0.1.4", "reflect-metadata": "0.1.13", @@ -155,7 +155,7 @@ "style-loader": "3.3.1", "summaly": "2.5.0", "syslog-pro": "1.0.0", - "systeminformation": "5.11.3", + "systeminformation": "5.11.4", "throttle-debounce": "3.0.1", "tinycolor2": "1.4.2", "tmp": "0.2.1", @@ -175,7 +175,7 @@ "xev": "2.0.1" }, "devDependencies": { - "@redocly/openapi-core": "1.0.0-beta.82", + "@redocly/openapi-core": "1.0.0-beta.83", "@types/fluent-ffmpeg": "2.1.20", "cross-env": "7.0.3", "execa": "6.1.0" diff --git a/packages/backend/yarn.lock b/packages/backend/yarn.lock index c1932a9053..0a8a38822c 100644 --- a/packages/backend/yarn.lock +++ b/packages/backend/yarn.lock @@ -216,10 +216,10 @@ require-from-string "^2.0.2" uri-js "^4.2.2" -"@redocly/openapi-core@1.0.0-beta.82": - version "1.0.0-beta.82" - resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.0.0-beta.82.tgz#5f232e9c8f82499c2d96d9268b22423c8f859fe2" - integrity sha512-bJ0WclpgkFv4aa5QWU83ARCv3VQJy9U94reb1chOTg9s2bsTHbYuUwRv6G370a7lFXX86AyB3dT5IzS6GytLlA== +"@redocly/openapi-core@1.0.0-beta.83": + version "1.0.0-beta.83" + resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.0.0-beta.83.tgz#df1324cc6f1874ecf3046e503192cf872f134a2f" + integrity sha512-XwlxMAmNEQeyBfODXVg2iBpSUqzCwT2zI+7o5iKxjUwJ+5ZugNOYjZGGM3Q9rJGqzFVwLKdElM5a1MlhPvlu4Q== dependencies: "@redocly/ajv" "^8.6.4" "@types/node" "^14.11.8" @@ -634,10 +634,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50" integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA== -"@types/node@17.0.18": - version "17.0.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.18.tgz#3b4fed5cfb58010e3a2be4b6e74615e4847f1074" - integrity sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA== +"@types/node@17.0.19": + version "17.0.19" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.19.tgz#726171367f404bfbe8512ba608a09ebad810c7e6" + integrity sha512-PfeQhvcMR4cPFVuYfBN4ifG7p9c+Dlh3yUZR6k+5yQK7wX3gDgVxBly4/WkBRs9x4dmcy1TVl08SY67wwtEvmA== "@types/node@^14.11.8": version "14.17.9" @@ -824,10 +824,10 @@ dependencies: "@types/node" "*" -"@types/ws@8.2.2": - version "8.2.2" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.2.2.tgz#7c5be4decb19500ae6b3d563043cd407bf366c21" - integrity sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg== +"@types/ws@8.2.3": + version "8.2.3" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.2.3.tgz#0bca6b03ba2f41e0fab782d4a573fe284aa907ae" + integrity sha512-ahRJZquUYCdOZf/rCsWg88S0/+cb9wazUBHv6HZEe3XdYaBe2zr/slM8J28X07Hn88Pnm4ezo7N8/ofnOgrPVQ== dependencies: "@types/node" "*" @@ -836,14 +836,14 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== -"@typescript-eslint/eslint-plugin@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz#bb46dd7ce7015c0928b98af1e602118e97df6c70" - integrity sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ== +"@typescript-eslint/eslint-plugin@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz#b2cd3e288f250ce8332d5035a2ff65aba3374ac4" + integrity sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw== dependencies: - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/type-utils" "5.12.0" - "@typescript-eslint/utils" "5.12.0" + "@typescript-eslint/scope-manager" "5.12.1" + "@typescript-eslint/type-utils" "5.12.1" + "@typescript-eslint/utils" "5.12.1" debug "^4.3.2" functional-red-black-tree "^1.0.1" ignore "^5.1.8" @@ -851,69 +851,69 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/parser@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.0.tgz#0ca669861813df99ce54916f66f524c625ed2434" - integrity sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog== +"@typescript-eslint/parser@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.1.tgz#b090289b553b8aa0899740d799d0f96e6f49771b" + integrity sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw== dependencies: - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/typescript-estree" "5.12.0" + "@typescript-eslint/scope-manager" "5.12.1" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/typescript-estree" "5.12.1" debug "^4.3.2" -"@typescript-eslint/scope-manager@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e" - integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ== +"@typescript-eslint/scope-manager@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz#58734fd45d2d1dec49641aacc075fba5f0968817" + integrity sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ== dependencies: - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/visitor-keys" "5.12.0" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/visitor-keys" "5.12.1" -"@typescript-eslint/type-utils@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz#aaf45765de71c6d9707c66ccff76ec2b9aa31bb6" - integrity sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q== +"@typescript-eslint/type-utils@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz#8d58c6a0bb176b5e9a91581cda1a7f91a114d3f0" + integrity sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg== dependencies: - "@typescript-eslint/utils" "5.12.0" + "@typescript-eslint/utils" "5.12.1" debug "^4.3.2" tsutils "^3.21.0" -"@typescript-eslint/types@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8" - integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ== +"@typescript-eslint/types@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.1.tgz#46a36a28ff4d946821b58fe5a73c81dc2e12aa89" + integrity sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA== -"@typescript-eslint/typescript-estree@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2" - integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ== +"@typescript-eslint/typescript-estree@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz#6a9425b9c305bcbc38e2d1d9a24c08e15e02b722" + integrity sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw== dependencies: - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/visitor-keys" "5.12.0" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/visitor-keys" "5.12.1" debug "^4.3.2" globby "^11.0.4" is-glob "^4.0.3" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/utils@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af" - integrity sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw== +"@typescript-eslint/utils@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.1.tgz#447c24a05d9c33f9c6c64cb48f251f2371eef920" + integrity sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/typescript-estree" "5.12.0" + "@typescript-eslint/scope-manager" "5.12.1" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/typescript-estree" "5.12.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16" - integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg== +"@typescript-eslint/visitor-keys@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz#f722da106c8f9695ae5640574225e45af3e52ec3" + integrity sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A== dependencies: - "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/types" "5.12.1" eslint-visitor-keys "^3.0.0" "@ungap/promise-all-settled@1.1.2": @@ -1252,10 +1252,10 @@ autwh@0.1.0: dependencies: oauth "0.9.15" -aws-sdk@2.1067.0: - version "2.1067.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1067.0.tgz#2e7f5a2d765fcf77a45f25fdd1f12a64942628a7" - integrity sha512-3Ys1k4cNQy4z37IpPjQ9c5ldkXMeZGbWoarKHynPPY3WCEj+Nw2u6zk484fA9/lTHNN3YesLuZ0OmEzGgjFEOw== +aws-sdk@2.1079.0: + version "2.1079.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1079.0.tgz#41ede54aa4ba5ce77d4ffe202f9a1ee7869da2a8" + integrity sha512-WHYWiye9f2XYQ33Rj/uVw4VF/Qq/xrB9NDnGlRhgK8Ga7T20+8/iZD5/Z8wICVNZTsfUZ3g6LfkeZ1l+LZhHKw== dependencies: buffer "4.9.2" events "1.1.1" @@ -1476,15 +1476,15 @@ bufferutil@^4.0.1: dependencies: node-gyp-build "~3.7.0" -bull@4.5.5: - version "4.5.5" - resolved "https://registry.yarnpkg.com/bull/-/bull-4.5.5.tgz#6521e514aaff77d3d40f780dd0214e1738c16b32" - integrity sha512-4GX9zoDwkSgdITGWUWGb1kwddgffOyeTLxeBzANbXhBGFb5/HypwsMrInyWQ4GmpZG/oM3oQpUqr+KGX8s7K4Q== +bull@4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/bull/-/bull-4.6.2.tgz#fdde3b13245cff79571d85c4702884dfbf419b27" + integrity sha512-RA6wnL+rZ2GRHMhz+UxFEn7hlLBpxPEiW4A0UY3YwWnheRA55AT4MC0PknxqO1K55pGFKSh/GpHQaj8flJMm+w== dependencies: cron-parser "^4.2.1" debuglog "^1.0.0" get-port "^5.1.1" - ioredis "^4.27.0" + ioredis "^4.28.5" lodash "^4.17.21" msgpackr "^1.5.2" p-timeout "^3.2.0" @@ -3595,16 +3595,17 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" -ioredis@^4.27.0: - version "4.27.6" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.27.6.tgz#a53d427d3fe75fbd10ed7ad150ce00559df8dcf8" - integrity sha512-6W3ZHMbpCa8ByMyC1LJGOi7P2WiOKP9B3resoZOVLDhi+6dDBOW+KNsRq3yI36Hmnb2sifCxHX+YSarTeXh48A== +ioredis@^4.28.5: + version "4.28.5" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.28.5.tgz#5c149e6a8d76a7f8fa8a504ffc85b7d5b6797f9f" + integrity sha512-3GYo0GJtLqgNXj4YhrisLaNNvWSNwSS2wS4OELGfGxH8I69+XfNdnmV1AyN+ZqMh0i7eX+SWjrwFKDBDgfBC1A== dependencies: cluster-key-slot "^1.1.0" debug "^4.3.1" denque "^1.1.0" lodash.defaults "^4.2.0" lodash.flatten "^4.4.0" + lodash.isarguments "^3.1.0" p-map "^2.1.0" redis-commands "1.7.0" redis-errors "^1.2.0" @@ -4372,6 +4373,11 @@ lodash.foreach@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-4.5.0.tgz#1a6a35eace401280c7f06dddec35165ab27e3e53" integrity sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM= +lodash.isarguments@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + integrity sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo= + lodash.isequal@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" @@ -4683,10 +4689,10 @@ mkdirp@^1.0.3, mkdirp@^1.0.4, mkdirp@~1.0.3: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mocha@9.2.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.0.tgz#2bfba73d46e392901f877ab9a47b7c9c5d0275cc" - integrity sha512-kNn7E8g2SzVcq0a77dkphPsDSN7P+iYkqE0ZsGCYWRsoiKjOt+NvXfaagik8vuDa6W5Zw3qxe8Jfpt5qKf+6/Q== +mocha@9.2.1: + version "9.2.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.1.tgz#a1abb675aa9a8490798503af57e8782a78f1338e" + integrity sha512-T7uscqjJVS46Pq1XDXyo9Uvey9gd3huT/DD9cYBb4K2Xc/vbKRPUWK067bxDQRK0yIz6Jxk73IrnimvASzBNAQ== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" @@ -5738,10 +5744,10 @@ rdf-canonize@^3.0.0: dependencies: setimmediate "^1.0.5" -re2@1.17.3: - version "1.17.3" - resolved "https://registry.yarnpkg.com/re2/-/re2-1.17.3.tgz#8cceb48f52c45b860b1f67cee8a44726f7d05e9a" - integrity sha512-Dp5iWVR8W3C7Nm9DziMY4BleMPRb/pe6kvfbzLv80dVYaXRc9jRnwwNqU0oE/taRm0qYR1+Qrtzk9rPjS9ecaQ== +re2@1.17.4: + version "1.17.4" + resolved "https://registry.yarnpkg.com/re2/-/re2-1.17.4.tgz#7bf29290bdde963014e77bd2c2e799a6d788386e" + integrity sha512-xyZ4h5PqE8I9tAxTh3G0UttcK5ufrcUxReFjGzfX61vtanNbS1XZHjnwRSyPcLgChI4KLxVgOT/ioZXnUAdoTA== dependencies: install-artifact-from-github "^1.3.0" nan "^2.15.0" @@ -6464,10 +6470,10 @@ syslog-pro@1.0.0: dependencies: moment "^2.22.2" -systeminformation@5.11.3: - version "5.11.3" - resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-5.11.3.tgz#8d14a444d398eadce5cb973a3d3d0ebb454ffcd9" - integrity sha512-sjvlk4SUefhwrONUeLijXt+NQyptAiqShd5v6bFJFNr9EVJUr3YSnNxDqCz0gp5EJBUj88pL1ssc8ZHPtngBOw== +systeminformation@5.11.4: + version "5.11.4" + resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-5.11.4.tgz#3ed99533c67d0b4bd357871687e014f1c2a37194" + integrity sha512-rh7bjpjP5whUaTknim5CiGdAiKZcgWhmbmxjzBRXDWqUc/k67bz2OP+03DdcX6/SN/CDSAi/NeUwM5o2gjHJoA== tapable@^2.2.0: version "2.2.0" diff --git a/packages/client/package.json b/packages/client/package.json index 2957251bfc..933c59101b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -34,8 +34,8 @@ "@types/webpack": "5.28.0", "@types/webpack-stream": "3.2.12", "@types/websocket": "1.0.5", - "@types/ws": "8.2.2", - "@typescript-eslint/parser": "5.12.0", + "@types/ws": "8.2.3", + "@typescript-eslint/parser": "5.12.1", "@vue/compiler-sfc": "3.2.31", "abort-controller": "3.0.0", "autobind-decorator": "2.4.0", @@ -54,7 +54,7 @@ "date-fns": "2.28.0", "escape-regexp": "0.0.1", "eslint": "8.9.0", - "eslint-plugin-vue": "8.4.1", + "eslint-plugin-vue": "8.5.0", "eventemitter3": "4.0.7", "feed": "4.2.2", "glob": "7.2.0", @@ -68,7 +68,7 @@ "matter-js": "0.18.0", "mfm-js": "0.21.0", "misskey-js": "0.0.14", - "mocha": "9.2.0", + "mocha": "9.2.1", "ms": "2.1.3", "nested-property": "4.0.0", "parse5": "6.0.1", @@ -121,7 +121,7 @@ "ws": "8.5.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "5.12.0", + "@typescript-eslint/eslint-plugin": "5.12.1", "cross-env": "7.0.3", "cypress": "9.5.0", "eslint-plugin-import": "2.25.4", diff --git a/packages/client/yarn.lock b/packages/client/yarn.lock index 38f9906080..fa97813522 100644 --- a/packages/client/yarn.lock +++ b/packages/client/yarn.lock @@ -563,10 +563,10 @@ dependencies: "@types/node" "*" -"@types/ws@8.2.2": - version "8.2.2" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.2.2.tgz#7c5be4decb19500ae6b3d563043cd407bf366c21" - integrity sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg== +"@types/ws@8.2.3": + version "8.2.3" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.2.3.tgz#0bca6b03ba2f41e0fab782d4a573fe284aa907ae" + integrity sha512-ahRJZquUYCdOZf/rCsWg88S0/+cb9wazUBHv6HZEe3XdYaBe2zr/slM8J28X07Hn88Pnm4ezo7N8/ofnOgrPVQ== dependencies: "@types/node" "*" @@ -577,14 +577,14 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz#bb46dd7ce7015c0928b98af1e602118e97df6c70" - integrity sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ== +"@typescript-eslint/eslint-plugin@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz#b2cd3e288f250ce8332d5035a2ff65aba3374ac4" + integrity sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw== dependencies: - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/type-utils" "5.12.0" - "@typescript-eslint/utils" "5.12.0" + "@typescript-eslint/scope-manager" "5.12.1" + "@typescript-eslint/type-utils" "5.12.1" + "@typescript-eslint/utils" "5.12.1" debug "^4.3.2" functional-red-black-tree "^1.0.1" ignore "^5.1.8" @@ -592,69 +592,69 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/parser@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.0.tgz#0ca669861813df99ce54916f66f524c625ed2434" - integrity sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog== +"@typescript-eslint/parser@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.1.tgz#b090289b553b8aa0899740d799d0f96e6f49771b" + integrity sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw== dependencies: - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/typescript-estree" "5.12.0" + "@typescript-eslint/scope-manager" "5.12.1" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/typescript-estree" "5.12.1" debug "^4.3.2" -"@typescript-eslint/scope-manager@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e" - integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ== +"@typescript-eslint/scope-manager@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz#58734fd45d2d1dec49641aacc075fba5f0968817" + integrity sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ== dependencies: - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/visitor-keys" "5.12.0" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/visitor-keys" "5.12.1" -"@typescript-eslint/type-utils@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz#aaf45765de71c6d9707c66ccff76ec2b9aa31bb6" - integrity sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q== +"@typescript-eslint/type-utils@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz#8d58c6a0bb176b5e9a91581cda1a7f91a114d3f0" + integrity sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg== dependencies: - "@typescript-eslint/utils" "5.12.0" + "@typescript-eslint/utils" "5.12.1" debug "^4.3.2" tsutils "^3.21.0" -"@typescript-eslint/types@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8" - integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ== +"@typescript-eslint/types@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.1.tgz#46a36a28ff4d946821b58fe5a73c81dc2e12aa89" + integrity sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA== -"@typescript-eslint/typescript-estree@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2" - integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ== +"@typescript-eslint/typescript-estree@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz#6a9425b9c305bcbc38e2d1d9a24c08e15e02b722" + integrity sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw== dependencies: - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/visitor-keys" "5.12.0" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/visitor-keys" "5.12.1" debug "^4.3.2" globby "^11.0.4" is-glob "^4.0.3" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/utils@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af" - integrity sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw== +"@typescript-eslint/utils@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.1.tgz#447c24a05d9c33f9c6c64cb48f251f2371eef920" + integrity sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/typescript-estree" "5.12.0" + "@typescript-eslint/scope-manager" "5.12.1" + "@typescript-eslint/types" "5.12.1" + "@typescript-eslint/typescript-estree" "5.12.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16" - integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg== +"@typescript-eslint/visitor-keys@5.12.1": + version "5.12.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz#f722da106c8f9695ae5640574225e45af3e52ec3" + integrity sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A== dependencies: - "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/types" "5.12.1" eslint-visitor-keys "^3.0.0" "@ungap/promise-all-settled@1.1.2": @@ -2415,10 +2415,10 @@ eslint-plugin-import@2.25.4: resolve "^1.20.0" tsconfig-paths "^3.12.0" -eslint-plugin-vue@8.4.1: - version "8.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-8.4.1.tgz#0a25493bbfee6baa21614e637e3fd390617c0bb4" - integrity sha512-nmWOhNmDx9TZ+yP9ZhezTkZUupSHsYA2TocRm+efPSXMOyFrVczVlaIuQcLBjCtI8CbkBiUQ3VcyQsjlIhDrhA== +eslint-plugin-vue@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-8.5.0.tgz#65832bba43ca713fa5da16bdfcf55d0095677f6f" + integrity sha512-i1uHCTAKOoEj12RDvdtONWrGzjFm/djkzqfhmQ0d6M/W8KM81mhswd/z+iTZ0jCpdUedW3YRgcVfQ37/J4zoYQ== dependencies: eslint-utils "^3.0.0" natural-compare "^1.4.0" @@ -4013,10 +4013,10 @@ mkdirp@~0.5.1: dependencies: minimist "^1.2.5" -mocha@9.2.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.0.tgz#2bfba73d46e392901f877ab9a47b7c9c5d0275cc" - integrity sha512-kNn7E8g2SzVcq0a77dkphPsDSN7P+iYkqE0ZsGCYWRsoiKjOt+NvXfaagik8vuDa6W5Zw3qxe8Jfpt5qKf+6/Q== +mocha@9.2.1: + version "9.2.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.1.tgz#a1abb675aa9a8490798503af57e8782a78f1338e" + integrity sha512-T7uscqjJVS46Pq1XDXyo9Uvey9gd3huT/DD9cYBb4K2Xc/vbKRPUWK067bxDQRK0yIz6Jxk73IrnimvASzBNAQ== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" From c0fd7697b9d1e9b0d22bf9d10870b8ac94be659b Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 Feb 2022 23:40:31 +0900 Subject: [PATCH 30/95] enhance(client): improve launch pad usability --- packages/client/src/components/launch-pad.vue | 121 +++++++++--------- packages/client/src/components/ui/modal.vue | 3 +- packages/client/src/ui/_common_/sidebar.vue | 88 ++++++------- packages/client/src/ui/classic.header.vue | 6 +- packages/client/src/ui/classic.sidebar.vue | 1 + 5 files changed, 103 insertions(+), 116 deletions(-) diff --git a/packages/client/src/components/launch-pad.vue b/packages/client/src/components/launch-pad.vue index 9076cfb39f..119f164c2c 100644 --- a/packages/client/src/components/launch-pad.vue +++ b/packages/client/src/components/launch-pad.vue @@ -1,6 +1,6 @@