<commit_before>import 'bluebird-global'
import LicensingService from 'common/licensing-service'
import { GhostService } from 'core/bpfs'
import { ConfigProvider } from 'core/config'
import Database from 'core/database'
import { LoggerProvider } from 'core/logger'
import { LocalActionServer as LocalActionServerImpl } from 'core/user-code'
import { FatalError } from 'errors'
import 'reflect-metadata'

import { Botpress as Core } from './botpress'
import { container } from './inversify/app.inversify'
import { TYPES } from './types'

export interface BotpressApp {
  botpress: Core
  logger: LoggerProvider
  config: ConfigProvider
  ghost: GhostService
  database: Database
  localActionServer: LocalActionServerImpl
}

export function createApp(): BotpressApp {
  try {
    const app = {
      botpress: container.get<Core>(TYPES.Botpress),
      logger: container.get<LoggerProvider>(TYPES.LoggerProvider),
      config: container.get<ConfigProvider>(TYPES.ConfigProvider),
      ghost: container.get<GhostService>(TYPES.GhostService),
      database: container.get<Database>(TYPES.Database),
      localActionServer: container.get<LocalActionServerImpl>(TYPES.LocalActionServer),
      licensing: container.get<LicensingService>(TYPES.LicensingService)
    }

    app.licensing.installProtection()

    return app
  } catch (err) {
    throw new FatalError(err, 'Error during initialization')
  }
}

export function createLoggerProvider(): LoggerProvider {
  return container.get<LoggerProvider>(TYPES.LoggerProvider)
}<commit_msg>fix(core): fix generating diag report with the pro version (#5062)<commit_after>import 'bluebird-global'
import LicensingService from 'common/licensing-service'
import { GhostService } from 'core/bpfs'
import { ConfigProvider } from 'core/config'
import Database from 'core/database'
import { LoggerProvider } from 'core/logger'
import { LocalActionServer as LocalActionServerImpl } from 'core/user-code'
import { FatalError } from 'errors'
import 'reflect-metadata'

import { Botpress as Core } from './botpress'
import { container } from './inversify/app.inversify'
import { TYPES } from './types'

export interface BotpressApp {
  botpress: Core
  logger: LoggerProvider
  config: ConfigProvider
  ghost: GhostService
  database: Database
  localActionServer: LocalActionServerImpl
}

let app: BotpressApp

export function createApp(): BotpressApp {
  if (app) {
    return app
  }

  try {
    app = {
      botpress: container.get<Core>(TYPES.Botpress),
      logger: container.get<LoggerProvider>(TYPES.LoggerProvider),
      config: container.get<ConfigProvider>(TYPES.ConfigProvider),
      ghost: container.get<GhostService>(TYPES.GhostService),
      database: container.get<Database>(TYPES.Database),
      localActionServer: container.get<LocalActionServerImpl>(TYPES.LocalActionServer)
    }

    const licensing = container.get<LicensingService>(TYPES.LicensingService)
    licensing.installProtection()

    return app
  } catch (err) {
    throw new FatalError(err, 'Error during initialization')
  }
}

export function createLoggerProvider(): LoggerProvider {
  return container.get<LoggerProvider>(TYPES.LoggerProvider)
}
{'fraction_non_alphanumeric': 0.10232997481108312, 'fraction_numerical': 0.0012594458438287153, 'mean_word_length': 4.960600375234522, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7034293', 'n_tokens_mistral': 901, 'n_tokens_neox': 906, 'n_words': 218}