Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Core

This is the main class of the framework, it handles the routing, the services initialization and resolution

Hierarchy

  • EventEmitter
    • Core

Constructors

Properties

_ajv: any

JSON Schema validator instance

_ajvSchemas: any

JSON Schema registry

_configFile: string
_currentExecutor: any

Current executor

_init: Promise<void>

Init promise to ensure, webda is initiated Used for init() method

_initPromise: Promise<void>
_initTime: number
_initiated: boolean = false
_requestFilters: RequestFilter<Context>[] = []

CORS Filter registry

Added via [[Webda.registerRequestFilter]] See [[CorsFilter]]

application: Application
failedServices: object

Type declaration

  • [key: string]: any
router: Router = new Router(this)
defaultMaxListeners: number

Methods

  • _getSetters(obj: any): any[]
  • Return all methods that are setters (startsWith("set"))

    Parameters

    • obj: any

      service get setter from

    Returns any[]

  • addListener(event: string | symbol, listener: function): this
  • addRoute(url: string, info: RouteInfo): void
  • autoConnectServices(): void
  • checkRequest(ctx: Context): Promise<boolean>
  • emit(event: string | symbol, ...args: any[]): boolean
  • emitSync(event: any, ...data: any[]): Promise<any[]>
  • Emit the event with data and wait for Promise to finish if listener returned a Promise

    Parameters

    • event: any
    • Rest ...data: any[]

    Returns Promise<any[]>

  • eventNames(): Array<string | symbol>
  • exportOpenAPI(skipHidden?: boolean): Document
  • flushHeaders(context: Context): void
  • getAppPath(subpath?: string): string
  • getDeployers(): object
  • getGlobalParams(): any
  • getLocales(): string[]
  • To define the locales just add a locales: ['en-GB', 'fr-FR'] in your host global configuration

    Returns string[]

    The configured locales or "en-GB" if none are defined

  • getMaxListeners(): number
  • getModel(name: any): any
  • Check for a model name and return the wanted class or throw exception if none found

    Parameters

    • name: any

      The model name to retrieve

    Returns any

  • getModels(): object
  • getSalt(): string
  • getSecret(): string
  • This should return a "turning" secret with cache and a service to modify it every x mins WARNING The security is lower without this "turning" secret, you can still set the global.secret parameter

    Dont rely on this method, it will probably disapear to avoid secret leak

    deprecated

    Returns string

    Current secret

  • getService<T>(name?: string): T
  • Check for a service name and return the wanted singleton or undefined if none found

    Type parameters

    Parameters

    • Default value name: string = ""

      The service name to retrieve

    Returns T

  • getServiceParams(service: string): any
  • getServices(): object
  • getServicesImplementations(type?: any): object
  • Return a map of services that extends type

    Parameters

    • Default value type: any = undefined

      The type of implementation

    Returns object

  • getStores(): object
  • getVersion(): string
  • getWorkerOutput(): WorkerOutput
  • init(): Promise<void>
  • initBeanRoutes(serviceBean: Service): void
  • initStatics(): void
  • isDebug(): boolean
  • jsonFilter(key: string, value: any): any
  • listenerCount(type: string | symbol): number
  • listeners(event: string | symbol): Function[]
  • newContext<T>(httpContext: HttpContext, stream?: any, noInit?: boolean): Promise<T>
  • Create a new context for a request

    Type parameters

    Parameters

    • httpContext: HttpContext

      THe HTTP request context

    • Default value stream: any = undefined

      The request output stream if any

    • Default value noInit: boolean = false

    Returns Promise<T>

    A new context object to pass along

  • off(event: string | symbol, listener: function): this
  • on(event: string | symbol, listener: function): this
  • once(event: string | symbol, listener: function): this
  • parameter(name: string): any
  • prependListener(event: string | symbol, listener: function): this
  • prependOnceListener(event: string | symbol, listener: function): this
  • rawListeners(event: string | symbol): Function[]
  • registerModel(name: string, clazz: any): void
  • reinit(updates: any): Promise<void>
  • reinitResolvedRoutes(): void
  • removeAllListeners(event?: string | symbol): this
  • removeListener(event: string | symbol, listener: function): this
  • removeRoute(url: string): void
  • sandbox(executor: any, code: any): any
  • setMaxListeners(n: number): this
  • toPublicJSON(object: any): string
  • Convert an object to JSON using the Webda json filter

    Parameters

    • object: any

      The object to export

    Returns string

    The export of the strip object ( removed all attribute with _ )

  • updateContextWithRoute(ctx: Context): boolean
  • validate(object: any, schema: any): any
  • validationLastErrors(): any
  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Generated using TypeDoc