2021-03-18 22:40:02 +00:00
|
|
|
import { GristLoadConfig } from 'app/common/gristUrls';
|
|
|
|
import { Document } from 'app/gen-server/entity/Document';
|
|
|
|
import { Organization } from 'app/gen-server/entity/Organization';
|
|
|
|
import { Workspace } from 'app/gen-server/entity/Workspace';
|
2021-08-17 15:22:30 +00:00
|
|
|
import { HomeDBManager } from 'app/gen-server/lib/HomeDBManager';
|
2020-07-21 13:20:51 +00:00
|
|
|
import * as Comm from 'app/server/lib/Comm';
|
2021-03-18 22:40:02 +00:00
|
|
|
import { Hosts } from 'app/server/lib/extractOrg';
|
|
|
|
import { ICreate } from 'app/server/lib/ICreate';
|
2021-09-13 21:29:35 +00:00
|
|
|
import { IDocStorageManager } from 'app/server/lib/IDocStorageManager';
|
2021-03-18 22:40:02 +00:00
|
|
|
import { IPermitStore } from 'app/server/lib/Permit';
|
|
|
|
import { Sessions } from 'app/server/lib/Sessions';
|
2020-07-21 13:20:51 +00:00
|
|
|
import * as express from 'express';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Basic information about a Grist server. Accessible in many
|
|
|
|
* contexts, including request handlers and ActiveDoc methods.
|
|
|
|
*/
|
|
|
|
export interface GristServer {
|
|
|
|
readonly create: ICreate;
|
|
|
|
getHost(): string;
|
|
|
|
getHomeUrl(req: express.Request, relPath?: string): string;
|
|
|
|
getHomeUrlByDocId(docId: string, relPath?: string): Promise<string>;
|
2021-03-18 22:40:02 +00:00
|
|
|
getDocUrl(docId: string): Promise<string>;
|
2021-06-17 20:48:46 +00:00
|
|
|
getOrgUrl(orgKey: string|number): Promise<string>;
|
2021-03-18 22:40:02 +00:00
|
|
|
getResourceUrl(resource: Organization|Workspace|Document): Promise<string>;
|
|
|
|
getGristConfig(): GristLoadConfig;
|
2021-01-12 15:48:40 +00:00
|
|
|
getPermitStore(): IPermitStore;
|
2021-08-16 15:11:17 +00:00
|
|
|
getExternalPermitStore(): IPermitStore;
|
|
|
|
getSessions(): Sessions;
|
2021-08-17 15:22:30 +00:00
|
|
|
getComm(): Comm;
|
|
|
|
getHosts(): Hosts;
|
|
|
|
getHomeDBManager(): HomeDBManager;
|
2021-09-13 21:29:35 +00:00
|
|
|
getStorageManager(): IDocStorageManager;
|
2020-07-21 13:20:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface GristLoginMiddleware {
|
2021-08-16 15:11:17 +00:00
|
|
|
getLoginRedirectUrl(req: express.Request, target: URL): Promise<string>;
|
|
|
|
getSignUpRedirectUrl(req: express.Request, target: URL): Promise<string>;
|
|
|
|
getLogoutRedirectUrl(req: express.Request, nextUrl: URL): Promise<string>;
|
2020-07-21 13:20:51 +00:00
|
|
|
|
|
|
|
// Returns arbitrary string for log.
|
2021-08-17 15:22:30 +00:00
|
|
|
addEndpoints(app: express.Express): Promise<string>;
|
2020-07-21 13:20:51 +00:00
|
|
|
}
|