import { mergeConcatMany } from 'oak-domain/lib/utils/lodash'; import BackendRuntimeContext from '@project/context/BackendRuntimeContext'; import FrontendRuntimeContext from '@project/context/FrontendRuntimeContext'; import { EntityDict, storageSchema } from '@project/oak-app-domain'; import triggers from '@project/triggers'; import checkers from '@project/checkers'; import watchers from '@project/watchers'; import timers from '@project/timers'; import data from '@project/data'; import startRoutines from '@project/routines/start'; import { importations, exportations } from '@project/ports'; import { create as createFeatures, FeatureDict } from '@project/features'; import aspects from '@project/aspects'; import common from '@project/configuration'; import render from '@project/configuration/render'; import { initialize as initFrontend } from 'oak-frontend-base/es/initialize'; import { BasicFeatures } from 'oak-frontend-base/es/features'; import DebugConnector from 'oak-frontend-base/es/utils/DebugConnector'; export default function initialize() { const totalTriggers = mergeConcatMany([triggers] as Array)!, totalAspects = mergeConcatMany([aspects] as Array)!, totalCheckers = mergeConcatMany([checkers] as Array)!, totalWatchers = mergeConcatMany([watchers] as Array)!, totalTimers = mergeConcatMany([timers] as Array)!, totalStartRoutines = mergeConcatMany([startRoutines] as Array)!, totalData = mergeConcatMany([data] as Array)!, totalImportations = mergeConcatMany([importations] as Array)!, totalExportations = mergeConcatMany([exportations] as Array)!, totalCommon = mergeConcatMany([common] as Array)!; const debugConnector = new DebugConnector( storageSchema, (store) => new BackendRuntimeContext(store), totalAspects, totalTriggers, totalCheckers, totalWatchers, totalTimers, totalStartRoutines, totalData, totalCommon, totalImportations, totalExportations ); const totalFeatures = {} as FeatureDict & BasicFeatures; // @ts-ignore const { features } = initFrontend( storageSchema, (store) => new FrontendRuntimeContext(store, totalFeatures), debugConnector, totalCheckers, totalCommon, render ); Object.assign(totalFeatures, features); const appFeatures = createFeatures(totalFeatures); Object.assign(totalFeatures, appFeatures); return { features: totalFeatures, }; }