UNPKG

open-collaboration-service-process

Version:

A service process for integrating non Typescript projects with the Open Collaboration Tools project

101 lines 3.5 kB
import * as types from 'open-collaboration-protocol'; import { NotificationType, NotificationType2, NotificationType3, RequestType } from 'vscode-jsonrpc'; export declare function isOCPMessage(message: unknown): message is OCPMessage; export interface OCPMessage { method: string; params: unknown[]; target?: string; } export declare const OCPRequest: RequestType<string | OCPMessage, any, string>; export declare const OCPNotification: NotificationType<string | OCPMessage>; export declare const OCPBroadCast: NotificationType<string | OCPMessage>; export declare function fromEncodedOCPMessage(encoded: string): OCPMessage; export declare function toEncodedOCPMessage(message: OCPMessage): string; export declare namespace ToServiceMessages { const LOGIN = "login"; const JOIN_ROOM = "room/joinRoom"; const JOIN_SESSION_REQUEST = "room/joinSessionRequest"; const CREATE_ROOM = "room/createRoom"; const CLOSE_SESSION = "room/closeSession"; const OPEN_DOCUMENT = "awareness/openDocument"; const UPDATE_TEXT_SELECTION = "awareness/updateTextSelection"; const UPDATE_DOCUMENT_CONTENT = "awareness/updateDocument"; } /** * resp params: [token] */ export declare const LoginRequest: RequestType<void, string, void>; export interface SessionData { roomId: string; roomToken: string; authToken?: string; workspace: types.Workspace; } /** * params: [roomId] * resp params: [roomToken, roomId] */ export declare const JoinRoomRequest: RequestType<string, SessionData, void>; /** * params: [workspace] * resp params: [roomId, roomToken] */ export declare const CreateRoomRequest: RequestType<types.Workspace, SessionData, void>; export declare const CloseSessionRequest: RequestType<void, void, void>; export interface TextDocumentInsert { startOffset: number; endOffset?: number; text: string; } export interface ClientTextSelection { start: number; end: number; isReversed: boolean; peer?: string; } /** * params: [type, documentUri, text] * Todo: add more types for other awarness object types */ export declare const OpenDocument: NotificationType3<string, string, string>; /** * params: [documentPath, selections] */ export declare const UpdateTextSelection: NotificationType2<string, ClientTextSelection[]>; /** * params: [documentPath, changes] * Todo: add more types for other awarness object types */ export declare const UpdateDocumentContent: NotificationType2<string, TextDocumentInsert[]>; /** * A request to the application to open the provided URL * the token can be used to authenticate the user * params: [token] */ export declare const Authentication: NotificationType2<string, types.AuthMetadata>; /** * A notification to the application when a session has been joined or created * params: [init data of the session] */ export declare const OnInitNotification: NotificationType<types.InitData>; /** * A request to the application to allow a user to join the current session * params: [user] * resp params: [join accepted] */ export declare const JoinSessionRequest: RequestType<types.User, boolean, void>; /** * params: [error message, stack trace] */ export declare const InternalError: NotificationType<{ message: string; stack?: string; }>; export declare namespace BinaryResponse { function is(message: unknown): message is BinaryResponse; } export interface BinaryResponse { type: 'binaryResponse'; data: string; } //# sourceMappingURL=messages.d.ts.map