mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Converting server-side Comm.js to typescript
Summary: - Add app/common/CommTypes.ts to define types shared by client and server. - Include @types/ws npm package Test Plan: Intended to have no changes in behavior Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3467
This commit is contained in:
28
app/server/declarations.d.ts
vendored
28
app/server/declarations.d.ts
vendored
@@ -2,31 +2,6 @@ declare module "app/server/lib/ActionLog";
|
||||
declare module "app/server/lib/sandboxUtil";
|
||||
declare module "app/server/lib/User";
|
||||
|
||||
declare module "app/server/lib/Comm" {
|
||||
import {Client, ClientMethod} from "app/server/lib/Client";
|
||||
import {ScopedSession} from "app/server/lib/BrowserSession";
|
||||
import * as http from "http";
|
||||
|
||||
class Comm {
|
||||
constructor(server: http.Server, options: any);
|
||||
public broadcastMessage(type: string, messageData: any): void;
|
||||
public destroyAllClients(): void;
|
||||
public setServerVersion(serverVersion: string|null): void;
|
||||
public setServerActivation(active: boolean): void;
|
||||
public getSessionIdFromCookie(gristSidCookie: string): string;
|
||||
public getOrCreateSession(sessionId: string, req: any): ScopedSession;
|
||||
public registerMethods(methods: {[name: string]: ClientMethod}): void;
|
||||
public getClient(clientId: string): Client;
|
||||
public testServerShutdown(): Promise<void>;
|
||||
public testServerRestart(): Promise<void>;
|
||||
public testSetClientPersistence(ttlMs: number): void;
|
||||
}
|
||||
namespace Comm {
|
||||
function sendDocMessage(client: Client, docFD: number, type: string, mesageData: any, fromSelf: boolean): void;
|
||||
}
|
||||
export = Comm;
|
||||
}
|
||||
|
||||
declare module "app/server/lib/shutdown" {
|
||||
export function addCleanupHandler<T>(context: T, method: (this: T) => void, timeout?: number, name?: string): void;
|
||||
export function removeCleanupHandlers<T>(context: T): void;
|
||||
@@ -91,9 +66,6 @@ declare module "app-module-path" {
|
||||
export function addPath(path: string): void;
|
||||
}
|
||||
|
||||
// Used in tests
|
||||
declare module "ws";
|
||||
|
||||
// version of pidusage that has correct ctime on linux
|
||||
declare module '@gristlabs/pidusage' {
|
||||
import * as pidusage from 'pidusage';
|
||||
|
||||
Reference in New Issue
Block a user