import { Message, RequestMessage, RequestType, RequestType0, RequestType1, RequestType2, RequestType3, RequestType4, RequestType5, RequestType6, RequestType7, RequestType8, RequestType9, ResponseMessage, ResponseError, NotificationMessage, NotificationType, NotificationType0, NotificationType1, NotificationType2, NotificationType3, NotificationType4, NotificationType5, NotificationType6, NotificationType7, NotificationType8, NotificationType9, _EM, ParameterStructures } from './messages'; import type { Disposable } from './disposable'; import { Event } from './events'; import { CancellationToken, AbstractCancellationTokenSource } from './cancellation'; import { MessageReader } from './messageReader'; import { MessageWriter } from './messageWriter'; export type ProgressToken = number | string; export declare namespace ProgressToken { function is(value: any): value is number | string; } interface ProgressParams { /** * The progress token provided by the client or server. */ token: ProgressToken; /** * The progress data. */ value: T; } export declare class ProgressType { /** * Clients must not use these properties. They are here to ensure correct typing. * in TypeScript */ readonly __: [PR, _EM] | undefined; readonly _pr: PR | undefined; constructor(); } export type HandlerResult = R | ResponseError | Thenable | Thenable> | Thenable>; export interface StarRequestHandler { (method: string, params: any[] | object | undefined, token: CancellationToken): HandlerResult; } export interface GenericRequestHandler { (...params: any[]): HandlerResult; } export interface RequestHandler0 { (token: CancellationToken): HandlerResult; } export interface RequestHandler { (params: P, token: CancellationToken): HandlerResult; } export interface RequestHandler1 { (p1: P1, token: CancellationToken): HandlerResult; } export interface RequestHandler2 { (p1: P1, p2: P2, token: CancellationToken): HandlerResult; } export interface RequestHandler3 { (p1: P1, p2: P2, p3: P3, token: CancellationToken): HandlerResult; } export interface RequestHandler4 { (p1: P1, p2: P2, p3: P3, p4: P4, token: CancellationToken): HandlerResult; } export interface RequestHandler5 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, token: CancellationToken): HandlerResult; } export interface RequestHandler6 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, token: CancellationToken): HandlerResult; } export interface RequestHandler7 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, token: CancellationToken): HandlerResult; } export interface RequestHandler8 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, token: CancellationToken): HandlerResult; } export interface RequestHandler9 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, token: CancellationToken): HandlerResult; } export interface StarNotificationHandler { (method: string, params: any[] | object | undefined): void; } export interface GenericNotificationHandler { (...params: any[]): void; } export interface NotificationHandler0 { (): void; } export interface NotificationHandler

{ (params: P): void; } export interface NotificationHandler1 { (p1: P1): void; } export interface NotificationHandler2 { (p1: P1, p2: P2): void; } export interface NotificationHandler3 { (p1: P1, p2: P2, p3: P3): void; } export interface NotificationHandler4 { (p1: P1, p2: P2, p3: P3, p4: P4): void; } export interface NotificationHandler5 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): void; } export interface NotificationHandler6 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): void; } export interface NotificationHandler7 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): void; } export interface NotificationHandler8 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): void; } export interface NotificationHandler9 { (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): void; } export interface Logger { error(message: string): void; warn(message: string): void; info(message: string): void; log(message: string): void; } export declare const NullLogger: Logger; export declare enum Trace { Off = 0, Messages = 1, Compact = 2, Verbose = 3 } export declare namespace TraceValues { /** * Turn tracing off. */ const Off: 'off'; /** * Trace messages only. */ const Messages: 'messages'; /** * Compact message tracing. */ const Compact: 'compact'; /** * Verbose message tracing. */ const Verbose: 'verbose'; } export type TraceValues = 'off' | 'messages' | 'compact' | 'verbose'; export declare namespace Trace { function fromString(value: string): Trace; function toString(value: Trace): TraceValues; } export declare enum TraceFormat { Text = "text", JSON = "json" } export declare namespace TraceFormat { function fromString(value: string): TraceFormat; } export interface TraceOptions { sendNotification?: boolean; traceFormat?: TraceFormat; } export interface SetTraceParams { value: TraceValues; } export declare namespace SetTraceNotification { const type: NotificationType; } export interface LogTraceParams { message: string; verbose?: string; } export declare namespace LogTraceNotification { const type: NotificationType; } export interface Tracer { log(dataObject: any): void; log(message: string, data?: string): void; } export declare enum ConnectionErrors { /** * The connection is closed. */ Closed = 1, /** * The connection got disposed. */ Disposed = 2, /** * The connection is already in listening mode. */ AlreadyListening = 3 } export declare class ConnectionError extends Error { readonly code: ConnectionErrors; constructor(code: ConnectionErrors, message: string); } export type ConnectionStrategy = { cancelUndispatched?: (message: Message, next: (message: Message) => ResponseMessage | undefined) => ResponseMessage | undefined; }; export declare namespace ConnectionStrategy { function is(value: any): value is ConnectionStrategy; } export type CancellationId = number | string; export interface IdCancellationReceiverStrategy { kind?: 'id'; /** * Creates a CancellationTokenSource from a cancellation id. * * @param id The cancellation id. */ createCancellationTokenSource(id: CancellationId): AbstractCancellationTokenSource; /** * An optional method to dispose the strategy. */ dispose?(): void; } export declare namespace IdCancellationReceiverStrategy { function is(value: any): value is IdCancellationReceiverStrategy; } export interface RequestCancellationReceiverStrategy { kind: 'request'; /** * Create a cancellation token source from a given request message. * * @param requestMessage The request message. */ createCancellationTokenSource(requestMessage: RequestMessage): AbstractCancellationTokenSource; /** * An optional method to dispose the strategy. */ dispose?(): void; } export declare namespace RequestCancellationReceiverStrategy { function is(value: any): value is RequestCancellationReceiverStrategy; } /** * This will break with the next major version and will become * export type CancellationReceiverStrategy = IdCancellationReceiverStrategy | RequestCancellationReceiverStrategy; */ export type CancellationReceiverStrategy = IdCancellationReceiverStrategy; export declare namespace CancellationReceiverStrategy { const Message: CancellationReceiverStrategy; function is(value: any): value is CancellationReceiverStrategy; } export interface CancellationSenderStrategy { /** * Hook to enable cancellation for the given request. * * @param request The request to enable cancellation for. */ enableCancellation?(request: RequestMessage): void; /** * Send cancellation for the given cancellation id * * @param conn The connection used. * @param id The cancellation id. */ sendCancellation(conn: MessageConnection, id: CancellationId): Promise; /** * Cleanup any cancellation state for the given cancellation id. After this * method has been call no cancellation will be sent anymore for the given id. * * @param id The cancellation id. */ cleanup(id: CancellationId): void; /** * An optional method to dispose the strategy. */ dispose?(): void; } export declare namespace CancellationSenderStrategy { const Message: CancellationSenderStrategy; function is(value: any): value is CancellationSenderStrategy; } export interface CancellationStrategy { receiver: CancellationReceiverStrategy | RequestCancellationReceiverStrategy; sender: CancellationSenderStrategy; } export declare namespace CancellationStrategy { const Message: CancellationStrategy; function is(value: any): value is CancellationStrategy; } export interface MessageStrategy { handleMessage(message: Message, next: (message: Message) => void): void; } export declare namespace MessageStrategy { function is(value: any): value is MessageStrategy; } export interface ConnectionOptions { cancellationStrategy?: CancellationStrategy; connectionStrategy?: ConnectionStrategy; messageStrategy?: MessageStrategy; } export declare namespace ConnectionOptions { function is(value: any): value is ConnectionOptions; } export interface MessageConnection { sendRequest(type: RequestType0, token?: CancellationToken): Promise; sendRequest(type: RequestType, params: P, token?: CancellationToken): Promise; sendRequest(type: RequestType1, p1: P1, token?: CancellationToken): Promise; sendRequest(type: RequestType2, p1: P1, p2: P2, token?: CancellationToken): Promise; sendRequest(type: RequestType3, p1: P1, p2: P2, p3: P3, token?: CancellationToken): Promise; sendRequest(type: RequestType4, p1: P1, p2: P2, p3: P3, p4: P4, token?: CancellationToken): Promise; sendRequest(type: RequestType5, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, token?: CancellationToken): Promise; sendRequest(type: RequestType6, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, token?: CancellationToken): Promise; sendRequest(type: RequestType7, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, token?: CancellationToken): Promise; sendRequest(type: RequestType8, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, token?: CancellationToken): Promise; sendRequest(type: RequestType9, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, token?: CancellationToken): Promise; sendRequest(method: string, r0?: ParameterStructures | any, ...rest: any[]): Promise; onRequest(type: RequestType0, handler: RequestHandler0): Disposable; onRequest(type: RequestType, handler: RequestHandler): Disposable; onRequest(type: RequestType1, handler: RequestHandler1): Disposable; onRequest(type: RequestType2, handler: RequestHandler2): Disposable; onRequest(type: RequestType3, handler: RequestHandler3): Disposable; onRequest(type: RequestType4, handler: RequestHandler4): Disposable; onRequest(type: RequestType5, handler: RequestHandler5): Disposable; onRequest(type: RequestType6, handler: RequestHandler6): Disposable; onRequest(type: RequestType7, handler: RequestHandler7): Disposable; onRequest(type: RequestType8, handler: RequestHandler8): Disposable; onRequest(type: RequestType9, handler: RequestHandler9): Disposable; onRequest(method: string, handler: GenericRequestHandler): Disposable; onRequest(handler: StarRequestHandler): Disposable; hasPendingResponse(): boolean; sendNotification(type: NotificationType0): Promise; sendNotification

(type: NotificationType

, params?: P): Promise; sendNotification(type: NotificationType1, p1: P1): Promise; sendNotification(type: NotificationType2, p1: P1, p2: P2): Promise; sendNotification(type: NotificationType3, p1: P1, p2: P2, p3: P3): Promise; sendNotification(type: NotificationType4, p1: P1, p2: P2, p3: P3, p4: P4): Promise; sendNotification(type: NotificationType5, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): Promise; sendNotification(type: NotificationType6, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): Promise; sendNotification(type: NotificationType7, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): Promise; sendNotification(type: NotificationType8, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): Promise; sendNotification(type: NotificationType9, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): Promise; sendNotification(method: string, r0?: ParameterStructures | any, ...rest: any[]): Promise; onNotification(type: NotificationType0, handler: NotificationHandler0): Disposable; onNotification

(type: NotificationType

, handler: NotificationHandler

): Disposable; onNotification(type: NotificationType1, handler: NotificationHandler1): Disposable; onNotification(type: NotificationType2, handler: NotificationHandler2): Disposable; onNotification(type: NotificationType3, handler: NotificationHandler3): Disposable; onNotification(type: NotificationType4, handler: NotificationHandler4): Disposable; onNotification(type: NotificationType5, handler: NotificationHandler5): Disposable; onNotification(type: NotificationType6, handler: NotificationHandler6): Disposable; onNotification(type: NotificationType7, handler: NotificationHandler7): Disposable; onNotification(type: NotificationType8, handler: NotificationHandler8): Disposable; onNotification(type: NotificationType9, handler: NotificationHandler9): Disposable; onNotification(method: string, handler: GenericNotificationHandler): Disposable; onNotification(handler: StarNotificationHandler): Disposable; onUnhandledNotification: Event; onProgress

(type: ProgressType

, token: string | number, handler: NotificationHandler

): Disposable; sendProgress

(type: ProgressType

, token: string | number, value: P): Promise; onUnhandledProgress: Event>; trace(value: Trace, tracer: Tracer, sendNotification?: boolean): Promise; trace(value: Trace, tracer: Tracer, traceOptions?: TraceOptions): Promise; onError: Event<[Error, Message | undefined, number | undefined]>; onClose: Event; listen(): void; end(): void; onDispose: Event; dispose(): void; inspect(): void; } export declare function createMessageConnection(messageReader: MessageReader, messageWriter: MessageWriter, _logger?: Logger, options?: ConnectionOptions): MessageConnection; export {};