///
import { Application as ExpressApplication, Request, Response } from 'express';
import { RequestHandler } from 'express-serve-static-core';
import { Socket, Server as IOServer } from 'socket.io';
import { EventEmitter } from 'events';
import { Server as HttpServer, IncomingMessage, ServerResponse } from 'http';
import { Transporter } from 'nodemailer';
import { Connection } from 'typeorm';
import User from './models/user';
import Group from './models/group';
declare global {
namespace Express {
interface Request {
user: User | null;
mitamaApp: Application;
workspace: Workspace;
}
interface Response {
mitamaApp: Application;
workspace: Workspace;
}
}
}
export declare class Application extends EventEmitter {
express: ExpressApplication;
entities: any[];
label: string;
path: string;
name: string;
resourcePath: string;
_settings: {};
_database: Connection;
_io: (socket: Socket) => void;
workspace: Workspace;
constructor();
handle(req: Request | IncomingMessage, res: Response | ServerResponse): any;
get settings(): {};
set settings(data: {});
resolve(path: string): string;
use(path: string, ...handlers: RequestHandler[]): void;
param(name: string, handler: RequestHandler): void;
post(path: string, ...handlers: RequestHandler[]): void;
get(path: string, ...handlers: RequestHandler[]): void;
put(path: string, ...handlers: RequestHandler[]): void;
patch(path: string, ...handlers: RequestHandler[]): void;
delete(path: string, ...handlers: RequestHandler[]): void;
head(path: string, ...handlers: RequestHandler[]): void;
options(path: string, ...handlers: RequestHandler[]): void;
io(callback: (socket: Socket) => void): void;
migrate(): Promise;
database(): Promise;
}
export declare class Workspace extends Application {
port: number;
apps: {
[key: string]: Application;
};
rootPath: string;
config: {};
_ioServer: IOServer;
_http: HttpServer;
mailer: Transporter;
mailFrom: string;
jwtSecret: string;
entities: (typeof Group | typeof User)[];
constructor();
saveAppSettings(label: string, settings: {}): void;
mount(label: string, path: string, app: Application, settings?: {}): void;
setMailer(options: any): void;
loadConfig(): void;
listen(port?: number): this;
moksha(): Promise;
get baseUrl(): string;
}
export * as pandit from 'pandit';
export * as orm from 'typeorm';
export { default as authMiddleware } from './middlewares/auth';
export { Router, Request, Response, static as serveStatic, json, raw, text, urlencoded } from 'express';
export { User, Group };