UNPKG

zents

Version:

ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.

55 lines (54 loc) 3.88 kB
/// <reference types="node" /> import type { ArraySchema, BooleanSchema, ObjectSchema } from 'joi'; import type { Class, JsonArray, JsonObject, JsonValue, Promisable } from 'type-fest'; import type { Connection, EntityManager, Repository } from 'typeorm'; import type { Context, ControllerDeclaration, DatabaseSessionStoreAdapterEntity, IncomingParams, LoaderTemplateItem, RequestConfigController, RequestConfigSecurity, Route, TemplateFiltersMapItem } from './interfaces'; import type { IncomingMessage, ServerResponse } from 'http'; import type { DB_TYPE } from './enums'; import type { EmailFactory } from '../email/EmailFactory'; import type { HtmlToTextOptions } from 'html-to-text'; import type { Redis } from 'ioredis'; import type { SecurityProvider } from '../security/SecurityProvider'; import type { SendMailOptions } from 'nodemailer'; import type { Stream } from 'stream'; import type { TemplateResponse } from '../template/TemplateResponse'; import type findMyWay from 'find-my-way'; export declare type ControllerMethodReturnType = Promisable<JsonArray | JsonObject | TemplateResponse | string | void>; export declare type Controllers = Map<string, ControllerDeclaration>; export declare type DatabaseSessionStoreAdapterEntityClass = Class<DatabaseSessionStoreAdapterEntity>; export declare type DatabaseObjectType<T> = T extends DB_TYPE.ORM ? Connection : Redis; export declare type Entities = Map<string, Class>; export declare type Email = EmailFactory; export declare type EmailTemplates = Map<string, string>; export declare type ErrorResponseData = Record<string, unknown> | JsonArray; export declare type HeaderValue = string | string[] | number; export declare type HTTPMethod = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' | 'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' | 'PROPFIND' | 'PROPPATCH' | 'PURGE' | 'PUT' | 'REBIND' | 'REPORT' | 'SEARCH' | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' | 'UNSUBSCRIBE'; export declare type InjectedConnection = Connection; export declare type InjectedEntityManager = EntityManager; export declare type InjectedRepository<T> = Repository<T>; export declare type LoaderTemplates = Map<string, LoaderTemplateItem>; export declare type LogLevel = 'fatal' | 'error' | 'warn' | 'log' | 'info' | 'success' | 'debug' | 'trace'; export declare type MailOptions = Partial<SendMailOptions> & Partial<HtmlToTextOptions> & { template: string; payload?: Record<string, unknown>; engine?: string; keepText?: boolean; }; export declare type NunjucksFilterCallback = (err: any, result: any) => void; export declare type RedisClient = Redis; export declare type RequestConfig = RequestConfigController | RequestConfigSecurity; export declare type RequestHeadersValue = string | string[]; export declare type RequestHeaders = Map<string, RequestHeadersValue>; export declare type ResponseBody = Buffer | Stream | JsonValue | null; export declare type Router = findMyWay.Instance<findMyWay.HTTPVersion.V1>; export declare type RouteHandler = (config: RequestConfig, route: Route, req: IncomingMessage, res: ServerResponse, params: IncomingParams) => void; export declare type SecurityRequestContext = Context<any, { username: string; password: string; }>; export declare type SecurityProviders = Map<string, SecurityProvider>; export declare type Services = Map<string, Class>; export declare type StaticHandler = (req: IncomingMessage, res: ServerResponse, next: () => void) => void; export declare type TemplateFileExtension = 'njk' | 'nunjucks' | 'nunjs' | 'nj' | 'html' | 'htm' | 'template' | 'tmpl' | 'tpl'; export declare type TemplateFiltersMap = Map<string, TemplateFiltersMapItem>; export declare type ValidationSchema = ObjectSchema | ArraySchema | BooleanSchema;