import { IApplicationService, ApplicationBase, ConfigurationBase, ApplicationService } from '@themost/common'; import { ApplicationServiceConstructor } from '@themost/common/app'; import { DataAdapterConstructor, ODataModelBuilder, DefaultDataContext, DataContext } from '@themost/data'; import { Router, Application, RequestHandler, Request, Response, NextFunction } from 'express'; import { BehaviorSubject } from 'rxjs'; // MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved declare interface ApplicationConfiguration { [key: string]: unknown; services?: { serviceType: string; strategyType?: string }[]; settings?: { [key: string]: unknown, crypto?: { algorithm: string, key: string, }, auth?: { [key: string]: unknown, unattendedExecutionAccount?: string; }, schema?: { loaders?: { loaderType: string;}[]; }, i18n?: { defaultLocale: string; locales: string[]; } } adapterTypes?: { name: string; invariantName: string; type: string | DataAdapterConstructor; }[]; adapters?: { name: string; invariantName: string; default?: boolean; options: unknown; }[]; } declare class ApplicationServiceRouter implements IApplicationService { public serviceRouter: Router; public getApplication(): ApplicationBase; } declare interface CreateApplicationContext { createContext(): ExpressDataContext; } declare class ExpressDataApplication implements ApplicationBase, CreateApplicationContext { public readonly container: BehaviorSubject; public readonly serviceRouter: BehaviorSubject; constructor(configPathOrSource?: string | unknown); configuration: ConfigurationBase; useStrategy(serviceCtor: ApplicationServiceConstructor, strategyCtor: ApplicationServiceConstructor): this; useService(serviceCtor: ApplicationServiceConstructor): this; public useModelBuilder(): ODataModelBuilder; public getBuilder(): ODataModelBuilder; public hasStrategy(serviceCtor: ApplicationServiceConstructor): boolean; public hasService(serviceCtor: ApplicationServiceConstructor): boolean; public getStrategy(serviceCtor: ApplicationServiceConstructor): T; hasService(serviceCtor: ApplicationServiceConstructor): boolean; getService(serviceCtor: ApplicationServiceConstructor): T; public createContext(): ExpressDataContext; public execute(callable: void, callback: void): void; public getConfiguration(): ConfigurationBase; public middleware(app?: any): RequestHandler; } /** * Holds user information of a data context */ interface AuthenticatedUser { /** * Gets or sets a string which represents the name of the user */ name: string; /** * Gets or sets a string which represents the current authentication type e.g. Basic, Bearer, None etc */ authenticationType?: string; /** * Gets or sets a string which represents a token associated with this user */ authenticationToken?: string; /** * Gets or sets a scope if current authentication type is associated with scopes like OAuth2 authentication */ authenticationScope?: string; /** * Gets or sets a key returned by authentication provider and identifies this user e.g. The id of the user */ authenticationProviderKey?: any; } /** * Holds user information when a data context is in unattended mode */ interface InteractiveUser { name: string; /** * Gets or sets a string which represents the current authentication type e.g. Basic, Bearer, None etc */ authenticationType?: string; } declare class ExpressDataContext extends DefaultDataContext { public application: ExpressDataApplication; public getConfiguration(): ConfigurationBase; public getApplication(): ExpressDataApplication; public getStrategy(serviceCtor: new() => T): T; public engine(extension: string): any; } declare global { namespace Express { interface Request { context: ExpressDataContext; } } } declare global { namespace http { interface IncomingMessage { parentReq?: IncomingMessage; } } namespace Express { interface Request { parentReq?: Request; } } } declare module '@themost/common' { interface DataAdapterBase { dispose(): void; } } declare module '@themost/data' { interface ODataConventionModelBuilder { initializeSync(): void; } } // MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved declare interface ServiceConfigurationElement { serviceType: string; strategyType: string; } declare class ServicesConfiguration { public static config(app: ExpressDataApplication): void; } // MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved declare interface BindEntitySetOptions { from?: string; } declare interface EntitySetOptions { entitySet?: string; entitySetActionFrom?: string; entitySetFunctionFrom?: string; navigationPropertyFrom?: string; entityActionFrom?: string; entityFunctionFrom?: string; } declare interface EntityOptions { entitySet?: string; navigationPropertyFrom?: string; entityActionFrom?: string; entityFunctionFrom?: string; } declare function bindEntitySet(options?: BindEntitySetOptions): RequestHandler; declare function getEntitySetIndex(): RequestHandler; declare function getMetadataDocument(): RequestHandler; declare function getEntitySet(options?: EntitySetOptions): RequestHandler; declare function postEntitySet(options?: EntitySetOptions): RequestHandler; declare function deleteEntitySet(options?: EntitySetOptions): RequestHandler; declare function getEntity(options?: EntityOptions): RequestHandler; declare function postEntity(options?: EntityOptions): RequestHandler; declare function deleteEntity(options?: EntityOptions): RequestHandler; declare function getEntityNavigationProperty(options?: EntityOptions): RequestHandler; declare function getEntitySetFunction(options?: EntitySetOptions): RequestHandler; declare function postEntitySetFunction(options?: EntitySetOptions): RequestHandler; declare function postEntitySetAction(options?: EntitySetOptions): RequestHandler; declare function getEntityFunction(options?: EntityOptions): RequestHandler; declare function postEntityAction(options?: EntityOptions): RequestHandler; // MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved declare function dateReviver(key: string, value: any): any; // MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved declare const serviceRouter: Router; // noinspection JSUnusedGlobalSymbols declare function readStream(stream: ReadableStream): Buffer; declare function getServiceRouter(app: Application): Router; // MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved declare class HttpResponseFormatter { public data: any; constructor(app: any); public execute(req: Request, res: Response): Promise; } // noinspection JSUnusedGlobalSymbols declare class JsonResponseFormatter extends HttpResponseFormatter { } declare class XmlResponseFormatter extends HttpResponseFormatter { } declare interface ResponseFormatterWrapper { for(req: Request, res: Response): any; } declare class ResponseFormatter extends ApplicationService { public formatters: Map void>; constructor(app: any); public format(data?: any): ResponseFormatterWrapper; } // noinspection JSUnusedGlobalSymbols declare interface StreamResponse { contentLocation?: string; contentDisposition?: string; contentLanguage?: string; contentEncoding?: string; contentMD5?: string; } declare class StreamFormatter { public data: any; constructor(data: any); public execute(req: Request, res: Response, next: NextFunction): void; } declare interface CreateContextService { createContext(): DataContext; } declare function setContext(app: CreateContextService): RequestHandler; declare function finalizeContext(): RequestHandler export { ApplicationConfiguration, ApplicationServiceRouter, AuthenticatedUser, BindEntitySetOptions, CreateApplicationContext, CreateContextService, EntityOptions, EntitySetOptions, ExpressDataApplication, ExpressDataContext, HttpResponseFormatter, InteractiveUser, JsonResponseFormatter, ResponseFormatter, ResponseFormatterWrapper, ServiceConfigurationElement, ServicesConfiguration, StreamFormatter, StreamResponse, XmlResponseFormatter, bindEntitySet, dateReviver, deleteEntity, deleteEntitySet, finalizeContext, getEntity, getEntityFunction, getEntityNavigationProperty, getEntitySet, getEntitySetFunction, getEntitySetIndex, getMetadataDocument, getServiceRouter, postEntity, postEntityAction, postEntitySet, postEntitySetAction, postEntitySetFunction, readStream, serviceRouter, setContext }; //# sourceMappingURL=index.d.ts.map