moleculer-api
Version:
A dynamic API Gateway for MoleculerJS which updates REST endpoints and aggregated GraphQL schema, access control policy for each action calls from metadata of remote services schema without restart or deployment.
31 lines (30 loc) • 1.41 kB
TypeScript
import { RecursivePartial } from "../../interface";
import { Logger } from "../../logger";
import { Branch, Version } from "../../schema";
import { Route, ServerApplicationComponent, ServerApplicationComponentConstructorOptions, ServerApplicationComponentModules } from "./component";
import { APIRequestContextFactory } from "./context";
export declare type ServerApplicationProps = {
logger: Logger;
contextFactories: ReadonlyArray<APIRequestContextFactory<any>>;
};
export declare type ServerApplicationOptions = {} & ServerApplicationComponentConstructorOptions;
export declare class ServerApplication {
protected readonly props: ServerApplicationProps;
readonly components: ReadonlyArray<ServerApplicationComponent<Route>>;
private readonly componentBranchHandlerMap;
private readonly componentsAliasedVersions;
private readonly staticRoutes;
constructor(props: ServerApplicationProps, opts?: RecursivePartial<ServerApplicationOptions>);
get componentModules(): ServerApplicationComponentModules;
start(): Promise<void>;
stop(): Promise<void>;
private readonly lock;
mountBranchHandler(branch: Branch): Promise<void>;
unmountBranchHandler(branch: Branch): Promise<void>;
addStaticRoute(route: Route): this;
get routes(): {
branch: Readonly<Branch>;
version: Readonly<Version>;
route: Readonly<Route>;
}[];
}