import { ContainerModule } from 'inversify'; import { LoggerFactory } from '@webpieces/core-util'; import { WebpiecesConfig } from './WebpiecesConfig'; import { AppModules } from './AppModules'; import { ApiFactory } from './ApiFactory'; /** * RuntimeSetupOptions - the environment/wiring inputs to {@link setupRuntime} (everything NOT * declared by the app's {@link AppModules}): the logging backend, whether to include the platform * default headers, and config. Data-only structure (a class, per the webpieces guidelines). The * app's own binding modules + route groups + headers come from the AppModules passed alongside; * the test-override module is the separate `appOverrides` param of {@link setupRuntime}. * * Headers: {@link HeaderRegistry.configure} registers the platform defaults (when * `platformHeaders` is true) plus AppModules.getHeaders() (by convention the company-wide set). */ export declare class RuntimeSetupOptions { /** This service's name — published to ServiceInfo. Names every log line and stamps * `requestIdSource` on request-ids this service mints. Must be non-blank. */ readonly svcName: string; /** This build's version — published to ServiceInfo alongside svcName. Opaque to webpieces * (a git SHA, a semver tag, a CI build number); it just has to identify THIS build so a log * line can say which one emitted it. Must be non-blank. */ readonly svcVersion: string; /** Logging backend to install (LogManager.setFactory). */ readonly loggerFactory: LoggerFactory; /** Include the webpieces platform default headers. */ readonly platformHeaders: boolean; /** Optional WebpiecesConfig (e.g. recording flags); defaults to a fresh one. */ readonly config?: WebpiecesConfig | undefined; constructor( /** This service's name — published to ServiceInfo. Names every log line and stamps * `requestIdSource` on request-ids this service mints. Must be non-blank. */ svcName: string, /** This build's version — published to ServiceInfo alongside svcName. Opaque to webpieces * (a git SHA, a semver tag, a CI build number); it just has to identify THIS build so a log * line can say which one emitted it. Must be non-blank. */ svcVersion: string, /** Logging backend to install (LogManager.setFactory). */ loggerFactory: LoggerFactory, /** Include the webpieces platform default headers. */ platformHeaders?: boolean, /** Optional WebpiecesConfig (e.g. recording flags); defaults to a fresh one. */ config?: WebpiecesConfig | undefined); } /** * setupRuntime - the ONE canonical, TRANSPORT-FREE startup sequence, reusable by any company/app * AND any framework adapter (express, fastify, a serverless handler, ...). It runs, in the correct * fail-fast order: * * 1. HeaderRegistry.configure (filters read it at construction; logging masks off it) * 2. LogManager.setFactory (fails fast unless the registry is configured first) * 3. build the router + DI container (from appModules.getBindingModules()) * 4. configure each appModules.getRoutingModules() onto the router (addRoutes/addFilter) * * and returns the built {@link ApiFactory} — `apiClients()` for a transport to bind, or * `createApiClient()` for in-process tests. There is NO express (or any transport) here; a * transport adapter (e.g. WebpiecesExpressRouter in @webpieces/http-server) serves the result. */ export declare function setupRuntime(options: RuntimeSetupOptions, appModules: AppModules, /** A single DI module loaded LAST so tests can rebind bindings to mocks. * Or special case servers that want to override specific things */ appOverrides?: ContainerModule): Promise;