UNPKG

@ayanaware/bento

Version:

Modular runtime framework designed to solve complex tasks

61 lines (60 loc) 2.33 kB
import { Bento, BentoOptions } from '../Bento'; import { ApplicationConfig } from './interfaces/ApplicationConfig'; import { ApplicationState } from './interfaces/ApplicationState'; /** * See constructor for more information * * Example usage: * * ```ts * const app = new Application(); * await app.start(); * await app.verify(); * ``` */ export declare class Application { readonly cfg: ApplicationConfig; readonly directory: string; /** Bento Instance */ readonly bento: Bento; /** * Bento Application is a wrapper for common use case Bootstrap files * It abstracts away the use of built in plugins such as `FSEntityLoader` and `FSVariableLoader` * into an easy to digest Configuration Object. Get up and running even faster then before! * * You can override pretty much everything via the `ApplicationConfig` but here are the defaults: * * - Default Variables File: `../env.example.json` or `env.example.json` * - Variables File: `../env.json` or `./env.json` * - Plugins Directory: `./plugins` * - Components Directory: `./components` * * The above paths will only be used if they actually exist on the filesystem. * * Please note: The relative path is determined by the caller of `new Application();` * If you need a custom relative path / working directory you can pass it via * the 2nd argument. ex: `new Application({}, __dirname);` * * **The above is only relevant if you are using the defaults, if you specify paths in * config they must be absolute and won't be prefixed** * * @param cfg ApplicationConfig * @param directory Working directory * @param options Bento Options */ constructor(cfg?: ApplicationConfig, directory?: string, options?: BentoOptions); protected getCallerDirectory(): string; protected exists(location: string | Array<string>): Promise<boolean>; /** * See JSDoc documentation on constructor for more information. * * **Don't forget to call `Application.verify();` after this** */ start(): Promise<void>; /** * **Always call this**. It does sanity checks and makes sure your applicaton is not in a broken state. * * @returns ApplicationState */ verify(): Promise<ApplicationState>; }