fix
This commit is contained in:
parent
82a17ea427
commit
b14d3cdc32
|
@ -5,8 +5,8 @@ import type { InboxQueue } from '@/core/QueueModule.js';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<'admin/queue/inboc-delayed'> {
|
export default class extends Endpoint<'admin/queue/inbox-delayed'> {
|
||||||
name = 'admin/queue/inboc-delayed' as const;
|
name = 'admin/queue/inbox-delayed' as const;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('queue:inbox') public inboxQueue: InboxQueue,
|
@Inject('queue:inbox') public inboxQueue: InboxQueue,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -930,7 +930,7 @@ export const endpoints = {
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
'admin/queue/inboc-delayed': {
|
'admin/queue/inbox-delayed': {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
|
|
@ -24,10 +24,31 @@ export type RolePolicies = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointDefines = ReadonlyArray<{
|
export type EndpointDefines = ReadonlyArray<{
|
||||||
|
/**
|
||||||
|
* 要求のJSON Schema
|
||||||
|
* 何もないときはundefined
|
||||||
|
* $refは使えない(ajv由来)
|
||||||
|
*/
|
||||||
req: DeepOmit<JSONSchema7, { $ref: never }> | undefined;
|
req: DeepOmit<JSONSchema7, { $ref: never }> | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 応答のJSON Schema
|
||||||
|
* 何もないときはundefined
|
||||||
|
*/
|
||||||
res: JSONSchema7 | undefined;
|
res: JSONSchema7 | undefined;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON Schemaのとき型に変換し、undefinedのときvoid | Record<string, never>を返す
|
||||||
|
*/
|
||||||
|
export type SchemaOrUndefined<T extends JSONSchema7 | undefined, IsResponse extends boolean = false> = T extends JSONSchema7 ? SchemaType<T, References, IsResponse> : (void | Record<string, never>);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reqからresを推論する
|
||||||
|
*/
|
||||||
|
export type ResponseOf<D extends IEndpointMeta, P, IsResponse extends boolean = false, DD extends D['defines'][number] = D['defines'][number]> =
|
||||||
|
P extends SchemaOrUndefined<DD['req'], IsResponse> ? SchemaOrUndefined<DD['res']> : never;
|
||||||
|
|
||||||
export interface IEndpointMeta {
|
export interface IEndpointMeta {
|
||||||
readonly stability?: 'deprecated' | 'experimental' | 'stable';
|
readonly stability?: 'deprecated' | 'experimental' | 'stable';
|
||||||
|
|
||||||
|
@ -127,9 +148,4 @@ export interface IEndpointMeta {
|
||||||
readonly cacheSec?: number;
|
readonly cacheSec?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SchemaOrUndefined<T extends JSONSchema7 | undefined, IsResponse extends boolean = false> = T extends JSONSchema7 ? SchemaType<T, References, IsResponse> : (void | Record<string, never>);
|
|
||||||
|
|
||||||
export type ResponseOf<D extends IEndpointMeta, P, IsResponse extends boolean = false, DD extends D['defines'][number] = D['defines'][number]> =
|
|
||||||
P extends SchemaOrUndefined<DD['req'], IsResponse> ? SchemaOrUndefined<DD['res']> : never;
|
|
||||||
|
|
||||||
export type Endpoints = typeof endpoints;
|
export type Endpoints = typeof endpoints;
|
||||||
|
|
Loading…
Reference in a new issue