// MOST Web Framework 2.0 Codename Blueshift Copyright (c) 2019-2023, THEMOST LP All rights reserved // tslint:disable-next-line:ordered-imports import {ConfigurationBase, IApplicationService, ApplicationBase} from '@themost/common'; import {ApplicationServiceConstructor} from '@themost/common/app'; import {DataAdapterConstructor, DefaultDataContext, ODataModelBuilder} from '@themost/data'; import {Application, RequestHandler, Router} from 'express'; import {BehaviorSubject} from 'rxjs'; export 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; }[]; } export declare class ApplicationServiceRouter implements IApplicationService { public serviceRouter: Router; public getApplication(): ApplicationBase; } export declare interface CreateApplicationContext { createContext(): ExpressDataContext; } export 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 */ export 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 */ export interface InteractiveUser { name: string; /** * Gets or sets a string which represents the current authentication type e.g. Basic, Bearer, None etc */ authenticationType?: string; } export 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; } }