UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

50 lines (49 loc) 2.18 kB
import type { FlowrMessage, IdMessageBase, MessageDefinition } from '../../cli/repl/server/messages/all-messages'; import { type FakeServer, type FakeSocket } from '../../../test/functionality/_helper/net'; import type { KnownParser } from '../../r-bridge/parser'; export interface ServerMessageDescription { readonly title: string; readonly type: 'request' | 'response'; readonly mermaidSequenceDiagram: string; readonly shortDescription: string; readonly definitionPath: string; readonly defRequest?: MessageDefinition<IdMessageBase>; readonly defResponse?: MessageDefinition<IdMessageBase>; readonly additionalDefs?: MessageDefinition<IdMessageBase>[]; readonly text: (shell: KnownParser) => Promise<string>; } /** * Documents a server message for later printing. */ export declare function documentServerMessage(description: ServerMessageDescription): void; /** * Visualizes all documented server messages in markdown format. */ export declare function printServerMessages(treeSitter: KnownParser): Promise<string>; /** * Executes the given function within a server context. */ export declare function inServerContext<T>(shell: KnownParser, fn: (socket: FakeSocket, server: FakeServer) => Promise<T> | T): Promise<T>; interface ResponseMessageInPingPong { readonly type: 'response'; readonly expectedType: FlowrMessage['type']; readonly description?: string | ((msg: IdMessageBase) => string); readonly mark?: boolean; } interface RequestMessageInPingPong { readonly type: 'request'; readonly message: FlowrMessage; readonly description?: string | ((msg: IdMessageBase) => string); readonly mark?: boolean; } export interface MessagePingPongDocumentationArguments { readonly shell: KnownParser; readonly title?: string; readonly messageType?: FlowrMessage['type']; readonly messages: readonly (ResponseMessageInPingPong | RequestMessageInPingPong)[]; } /** * Documents a ping-pong message exchange with the server. */ export declare function documentServerMessageResponse({ shell, title, messageType, messages }: MessagePingPongDocumentationArguments): Promise<string>; export {};