UNPKG

1.73 kBTypeScriptView Raw
1import { Application, Context } from '@loopback/core';
2import { Bootable, BootExecutionOptions, BootOptions } from './types';
3/**
4 * The Bootstrapper class provides the `boot` function that is responsible for
5 * finding and executing the Booters in an application based on given options.
6 *
7 * NOTE: Bootstrapper should be bound as a SINGLETON so it can be cached as
8 * it does not maintain any state of it's own.
9 *
10 * @param app - Application instance
11 * @param projectRoot - The root directory of the project, relative to which all other paths are resolved
12 * @param bootOptions - The BootOptions describing the conventions to be used by various Booters
13 */
14export declare class Bootstrapper {
15 private app;
16 private projectRoot;
17 private bootOptions;
18 constructor(app: Application & Bootable, projectRoot: string, bootOptions?: BootOptions);
19 /**
20 * Function is responsible for calling all registered Booter classes that
21 * are bound to the Application instance. Each phase of an instance must
22 * complete before the next phase is started.
23 *
24 * @param execOptions - Execution options for boot. These
25 * determine the phases and booters that are run.
26 * @param ctx - Optional Context to use to resolve bindings. This is
27 * primarily useful when running app.boot() again but with different settings
28 * (in particular phases) such as 'start' / 'stop'. Using a returned Context from
29 * a previous boot call allows DI to retrieve the same instances of Booters previously
30 * used as they are bound using a CONTEXT scope. This is important as Booter instances
31 * may maintain state.
32 */
33 boot(execOptions?: BootExecutionOptions, ctx?: Context): Promise<Context>;
34}