From b14d3cdc32e70608708f6e1f9e35adc1dadd5f9d Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 26 May 2023 07:48:48 +0000 Subject: [PATCH] fix --- .../endpoints/admin/queue/inbox-delayed.ts | 4 +-- packages/misskey-js/src/endpoints.ts | 2 +- packages/misskey-js/src/endpoints.types.ts | 26 +++++++++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) 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 e74bf3111d..a602e10728 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 @@ -5,8 +5,8 @@ import type { InboxQueue } from '@/core/QueueModule.js'; // eslint-disable-next-line import/no-default-export @Injectable() -export default class extends Endpoint<'admin/queue/inboc-delayed'> { - name = 'admin/queue/inboc-delayed' as const; +export default class extends Endpoint<'admin/queue/inbox-delayed'> { + name = 'admin/queue/inbox-delayed' as const; constructor( @Inject('queue:inbox') public inboxQueue: InboxQueue, ) { diff --git a/packages/misskey-js/src/endpoints.ts b/packages/misskey-js/src/endpoints.ts index 8f8553a1b6..43475d8709 100644 --- a/packages/misskey-js/src/endpoints.ts +++ b/packages/misskey-js/src/endpoints.ts @@ -930,7 +930,7 @@ export const endpoints = { }, }], }, - 'admin/queue/inboc-delayed': { + 'admin/queue/inbox-delayed': { tags: ['admin'], requireCredential: true, diff --git a/packages/misskey-js/src/endpoints.types.ts b/packages/misskey-js/src/endpoints.types.ts index 4120e68408..38ecdd2e74 100644 --- a/packages/misskey-js/src/endpoints.types.ts +++ b/packages/misskey-js/src/endpoints.types.ts @@ -24,10 +24,31 @@ export type RolePolicies = { }; export type EndpointDefines = ReadonlyArray<{ + /** + * 要求のJSON Schema + * 何もないときはundefined + * $refは使えない(ajv由来) + */ req: DeepOmit | undefined; + + /** + * 応答のJSON Schema + * 何もないときはundefined + */ res: JSONSchema7 | undefined; }>; +/** + * JSON Schemaのとき型に変換し、undefinedのときvoid | Recordを返す + */ +export type SchemaOrUndefined = T extends JSONSchema7 ? SchemaType : (void | Record); + +/** + * reqからresを推論する + */ +export type ResponseOf = + P extends SchemaOrUndefined ? SchemaOrUndefined : never; + export interface IEndpointMeta { readonly stability?: 'deprecated' | 'experimental' | 'stable'; @@ -127,9 +148,4 @@ export interface IEndpointMeta { readonly cacheSec?: number; } -export type SchemaOrUndefined = T extends JSONSchema7 ? SchemaType : (void | Record); - -export type ResponseOf = - P extends SchemaOrUndefined ? SchemaOrUndefined : never; - export type Endpoints = typeof endpoints;