import { createStartupRuntimeHandlers } from '../startup-runtime-handlers'; import type { ComposerInputs, ComposerOutputs } from './contracts'; type StartupRuntimeHandlersDeps = Parameters< typeof createStartupRuntimeHandlers >[0]; type StartupRuntimeHandlers = ReturnType< typeof createStartupRuntimeHandlers >; export type HeadlessStartupComposerOptions< TCliArgs, TStartupState, TStartupBootstrapRuntimeDeps, > = ComposerInputs<{ startupRuntimeHandlersDeps: StartupRuntimeHandlersDeps< TCliArgs, TStartupState, TStartupBootstrapRuntimeDeps >; }>; export type HeadlessStartupComposerResult< TCliArgs, TStartupState, TStartupBootstrapRuntimeDeps, > = ComposerOutputs< Pick< StartupRuntimeHandlers, 'appLifecycleRuntimeRunner' | 'runAndApplyStartupState' > >; export function composeHeadlessStartupHandlers< TCliArgs, TStartupState, TStartupBootstrapRuntimeDeps, >( options: HeadlessStartupComposerOptions, ): HeadlessStartupComposerResult { const { appLifecycleRuntimeRunner, runAndApplyStartupState } = createStartupRuntimeHandlers( options.startupRuntimeHandlersDeps, ); return { appLifecycleRuntimeRunner, runAndApplyStartupState, }; }