import ServiceFactory from "./business/service-factory"; import EntityBase from "./types/entity-base-type"; import ServiceType from "./types/service-type"; import ConfigType from "./types/config-type"; import MongooseHelperConfigType from "./types/mongoose-helper-config"; import { Application } from "express"; import { AuthConfigType } from "./types/auth-config-type"; import IIdentity from "./types/identity-interface"; import EntityConfig from "./types/entity-type"; import mongoose, { Schema } from "mongoose"; import GetResponseType from "./types/get-response-type"; import ServiceBase from "./business/base/service-base"; import CustomRoute from "./types/custom-route.type"; export { ServiceFactory, ServiceBase, EntityBase, ServiceType, ConfigType, MongooseHelperConfigType, IIdentity, GetResponseType, CustomRoute }; declare class SpryJs { constructor(); /** * Initialize Spry instance * @param {number} port Port to listen * @returns {Promise} Express application object */ init(port?: number | string): Promise; /** * Initialize Spry instance for testing * @returns {Promise} Express application object */ initTest(): Promise; /** * Enable JWT authentication. * @param {Partial} config - Partial config to be used * @param {string} config.tokenSecret - String to be used for token security * @param {string} config.salt - String to be used for user password encryption * @param {number} config.expiresIn - In seconds: Time for token to expire. Defaults to 24 hours * @param {any} config.model - user model to be used. Must include username and password * @returns {Promise} Void promise */ useAuthentication(config: Partial): Promise; /** * Enable morgan HTTP request logger middleware. * https://github.com/expressjs/morgan#readme * @param {string} format - pre-defined formats. Defaults to 'dev' */ useMorgan(format?: string): void; /** Enable MongoDB initialization for data storage layer * @param {string} connectionString - MongoDB Connection string * @param {boolean} useTimestamps - Enable timestamps on database entities * @returns {Promise} Promise with status of connection initialization */ useMongo(config: MongooseHelperConfigType): Promise; /** * Register new entity in the application * @param {EntityConfig} config - Entity configuration related * @param {string} config.name - Name of the entity. * @param {any} config.model - Model for the entity. Required if no schema is provided * @param {mongoose.Schema} config.schema - Mongoose schema. Required if model is not provided * @param {string} config.path - Path for the API endpoint. Defaults to the name of the entity * @param {string} config.keyword - Property name to be used with searchByKeyword method * @param {SpryConfig} config.config - Configuration object * @param {IService} config.service - Service class for API logic. If no service is provided, default service will be created */ registerEntity(config: EntityConfig): Promise; /** Create new model for MongoDB */ createModel(name: string, schema: Schema): mongoose.Model; /** * Maps an user property to a specific entity. Mapped propertis will be filled automatically * when creating a new record of the entity * @param {string} property User property to be mapped * @param {string} entity Entity to be mapped with */ mapUserProperty(property: string, entity: string, targetProperty?: string, required?: boolean): void; private addEntity; private get app(); } declare const _default: SpryJs; export default _default;