UNPKG

@opra/common

Version:
85 lines (84 loc) 2.99 kB
import type { Combine, ThunkAsync, Type } from 'ts-gems'; import { TypeThunkAsync } from 'ts-gems/lib/types'; import { Validator } from 'valgen'; import { OpraSchema } from '../../schema/index.js'; import { DataTypeMap } from '../common/data-type-map.js'; import { DocumentElement } from '../common/document-element.js'; import { DataType } from '../data-type/data-type.js'; import type { EnumType } from '../data-type/enum-type.js'; import { MQOperationDecorator } from '../decorators/mq-operation.decorator.js'; import type { MQController } from './mq-controller.js'; import type { MQHeader } from './mq-header'; import type { MQOperationResponse } from './mq-operation-response.js'; /** * @namespace MQOperation */ export declare namespace MQOperation { interface Metadata extends Pick<OpraSchema.MQOperation, 'description' | 'channel'> { type: TypeThunkAsync | string; keyType?: TypeThunkAsync | string; types?: ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray>[]; headers?: MQHeader.Metadata[]; response?: MQOperationResponse.Metadata; designType?: Type; keyDesignType?: Type; } interface Options extends Partial<Pick<Metadata, 'description' | 'keyType'>> { channel?: (string | RegExp) | (string | RegExp)[]; } interface InitArguments extends Combine<{ name: string; types?: DataType[]; type?: DataType | string | Type; keyType?: DataType | string | Type; }, Pick<Metadata, 'description' | 'channel' | 'designType' | 'keyDesignType'>> { } } /** * Type definition for MQOperation * @class MQOperation */ export interface MQOperationStatic { /** * Class constructor of MQOperation * @param controller * @param args */ new (controller: MQController, args: MQOperation.InitArguments): MQOperation; /** * Property decorator * @param type * @param options */ <T extends MQOperation.Options>(type: ThunkAsync<Type> | string, options?: T): MQOperationDecorator; prototype: MQOperation; } /** * @class MQOperation */ export interface MQOperation extends MQOperationClass { } /** * MQOperation */ export declare const MQOperation: MQOperationStatic; /** * @class MQOperation */ declare class MQOperationClass extends DocumentElement { readonly owner: MQController; readonly name: string; channel: string | RegExp | (string | RegExp)[]; description?: string; type: DataType; keyType?: DataType; types: DataTypeMap; headers: MQHeader[]; response: MQOperationResponse; designType?: Type; keyDesignType?: Type; findHeader(paramName: string): MQHeader | undefined; toJSON(): OpraSchema.MQOperation; generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions, properties?: any): Validator; generateKeyCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions, properties?: any): Validator; } export {};