import { AgentInfo , CommunicationBinding , CommunicationBindingOptions , CommunicationBindingWithOptions , Identity , IoActor , IoSource , } from ".." ; /**
 * Configuration options for Coaty container components,
 * such as controllers, communication manager, and runtime.
 *
 * Configuration objects conform to JSON format in order
 * to be serializable.
 */ export interface Configuration { /**
     * Common options shared by container components (optional).
     */ common ? : CommonOptions ; /**
     * Options used for communication.
     */ communication : CommunicationOptions ; /**
     * Controller configuration options (optional).
     */ controllers ? : ControllerConfig ; /**
     * Options used to connect to databases (optional).
     */ databases ? : DatabaseOptions ; } /**
 * Common options shared by container components.
 */ export interface CommonOptions { /**
     * Specify IO nodes associated with IO contexts for IO routing (optional).
     *
     * Each IO node definition is hashed by the IO context name the node should
     * be associated with. An IO node definition includes IO sources and/or IO
     * actors, and node-specific characteristics to be used for IO routing.
     *
     * If neither IO sources nor IO actors are specified for an IO node, its
     * node definition is ignored.
     */ ioContextNodes ? : { [ ioContextName ] : { ioSources ? : IoSource [ ] ; ioActors ? : IoActor [ ] ; characteristics ? : { [ key ] : any ; } ; } ; } ; remarks agentIdentity ? : Partial < Identity > ; /**
     * Agent information generated and injected into the configuration when the
     * agent project is build (optional).
     *
     * To be used locally by an agent to access build and release information of
     * the application for displaying, logging, etc.
     */ agentInfo ? : AgentInfo ; /**
     * Additional application-specific properties (optional).
     *
     * Useful to inject service instances to be shared among controllers.
     */ extra ? : { [ key ] : any ; } ; } /**
 * Options used for communication.
 */ export interface CommunicationOptions { remarks binding ? : CommunicationBindingWithOptions < CommunicationBinding < CommunicationBindingOptions > , CommunicationBindingOptions > ; deprecated namespace ? : string ; deprecated shouldEnableCrossNamespacing ? : boolean ; /**
     * Determines whether the communication manager should start initially when
     * the container has been resolved. Its value defaults to false.
     */ shouldAutoStart ? : boolean ; deprecated useProtocolCompliantClientId ? : boolean ; deprecated brokerUrl ? : string ; deprecated mqttClientOptions ? : any ; } /**
 * Controller options mapped by controller name (as specified in `Components`).
 */ export interface ControllerConfig { [ controllerName ] : ControllerOptions ; } /**
 * Controller-specific options
 */ export interface ControllerOptions { /**
     * Any application-specific controller options.
     */ [ key ] : any ; } /**
 * Database access options mapped by a unique database key.
 */ export interface DatabaseOptions { /**
     * Database connection info indexed by a database key.
     */ [ databaseKey ] : DbConnectionInfo ; } /**
 * Describes information used to connect to a specific database server using
 * a specific database adapter.
 *
 * DbConnectionInfo objects conform to JSON format in order
 * to be serializable (see interface `DatabaseOptions`).
 */ export interface DbConnectionInfo { /**
     * The name of the adapter used to interact with a specific database server.
     *
     * The name of the adapter specified here must be associated with a built-in
     * or custom adapter type by using the `DbAdapterFactory.registerAdapter`
     * method or by specifying the adapter type on first use when creating a new
     * `DbContext` or `DbLocalContext`.
     */ adapter : string ; /**
     * Adapter-specific configuration options (optional).
     */ adapterOptions ? : any ; /**
     * An adapter-specific connection string or Url containing connection
     * details (optional).
     * Use alternatively to or in combination with `connectionOptions`.
     */ connectionString ? : string ; /**
     * Adapter-specific connection options (optional).
     * Use alternatively to or in combination with `connectionString`.
     */ connectionOptions ? : any ; } param primary param secondary throws export function mergeConfigurations ( primary , secondary ) { const result = { } ; Object . keys ( primary ) . forEach ( prop => { result [ prop ] = Object . assign ( { } , primary [ prop ] ) ; } ) ; Object . keys ( secondary ) . forEach ( prop => { const config = secondary [ prop ] ; const primaryConfig = result [ prop ] ; if ( primaryConfig === undefined ) { result [ prop ] = Object . assign ( { } , config ) ; } else { Object . keys ( config ) . forEach ( p => { if ( primaryConfig [ p ] === undefined ) { primaryConfig [ p ] = config [ p ] ; } } ) ; } } ) ; if ( result . communication === undefined ) { throw new Error ( "Missing 'communication' configuration options in merged configuration." ) ; } return result as Configuration ; }