UNPKG

@opra/common

Version:
84 lines (83 loc) 2.55 kB
import type { Combine, ThunkAsync, Type } from 'ts-gems'; import { ResponsiveMap } from '../../helpers/index.js'; import { OpraSchema } from '../../schema/index.js'; import { DataTypeMap } from '../common/data-type-map.js'; import { DocumentElement } from '../common/document-element.js'; import type { EnumType } from '../data-type/enum-type.js'; import { MQControllerDecoratorFactory } from '../decorators/mq-controller.decorator.js'; import { nodeInspectCustom } from '../utils/inspect.util.js'; import type { MQApi } from './mq-api.js'; import type { MQHeader } from './mq-header'; import type { MQOperation } from './mq-operation.js'; /** * @namespace MQController */ export declare namespace MQController { interface Metadata extends Pick<OpraSchema.MQController, 'description'> { name: string; types?: ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray>[]; operations?: Record<string, MQOperation.Metadata>; headers?: MQHeader.Metadata[]; } interface Options extends Partial<Pick<OpraSchema.MQController, 'description'>> { name?: string; } interface InitArguments extends Combine<{ instance?: object; ctor?: Type; }, Pick<Metadata, 'name' | 'description'>> { } } /** * Type definition for MQController * @class MQController */ export interface MQControllerStatic extends MQControllerDecoratorFactory { /** * Class constructor of MQController * @param owner * @param args */ new (owner: MQApi | MQController, args: MQController.InitArguments): MQController; prototype: MQController; } /** * Type definition of MQController prototype * @interface MQController */ export interface MQController extends MQControllerClass { } /** * MQController */ export declare const MQController: MQControllerStatic; /** * * @class MQController */ declare class MQControllerClass extends DocumentElement { protected _controllerReverseMap: WeakMap<Type, MQController | null>; readonly kind: OpraSchema.MQController.Kind; readonly name: string; description?: string; path: string; instance?: any; ctor?: Type; headers: MQHeader[]; operations: ResponsiveMap<MQOperation>; types: DataTypeMap; findHeader(paramName: string, location?: OpraSchema.HttpParameterLocation): MQHeader | undefined; /** * */ toString(): string; /** * */ toJSON(): OpraSchema.MQController; /** * */ protected [nodeInspectCustom](): string; } export {};