/** * @module server */ /** End Typedoc Module Declaration */ import { ReflectiveInjector } from '@angular/core'; import { Logger } from '../../common/services/logger.service'; import { EntityType, RegistryEntityStatic, EntityMetadata } from '../../common/registry/entityRegistry'; /** * Provides abstract class for all bootstrappers to extend with, common interface for the * bootstrap function to have a single pattern to invoke the bootstrappers */ export declare abstract class EntityBootstrapper { /** Array of all entities retrieved from the [[EntityRegistry]] */ protected entities: RegistryEntityStatic[]; /** Reference to the Injector instance. Can be set with [[setInjector]]*/ protected injector: ReflectiveInjector; /** Instance of Logger, initialized with the current implementations class name as source */ protected logger: Logger; /** * Interface to get all injectable entities. Note that some bootstrappers should simply return * an empty array when their entities are not injectable. See [[ModelBootstrapper.getInjectableEntities]] * for an example of this. */ abstract getInjectableEntities(): RegistryEntityStatic[]; /** * Kick off the bootstrapping function. The logger instance is assigned here as the injector is * not available at constructor time. * @returns {void|Promise} */ invokeBootstrap(): void | Promise; /** * Assign the current Injector to the class * @param injector * @returns {EntityBootstrapper} */ setInjector(injector: ReflectiveInjector): this; /** * Resolve & retrieve an instance of the entity from the injector. Note that depending on the * provider definition, this could be a different class to the passed token * @param token * @returns {T} */ protected getInstance(token: RegistryEntityStatic): T; /** * Run the bootstrap method. If the implementation returns a promise, bootstrapping is halted * until the promise resolves. If promise is rejected, bootstrapping is aborted. */ protected abstract bootstrap(): void | Promise; /** * Retrieve all entities of the given type, converted from Map to Array * @param type * @returns {any[]} */ protected getFromRegistry(type: EntityType): RegistryEntityStatic[]; /** * Retrieve the entities from the registry. * * @param type * @returns {RegistryEntityStatic[]} */ protected getEntitiesFromRegistry(type: EntityType): RegistryEntityStatic[]; }