import { ServiceRepresentation } from '../domain' ; import { ServiceUtils } from '../service/ServiceUtils' ; import { ProcfileReconciler } from './ProcfileReconciler' ; export class ServiceRepresentationChainModifier { procfileReconciler : ProcfileReconciler ; representation : ServiceRepresentation ; constructor ( representation , procfileReconciler ) { this . representation = representation ; this . procfileReconciler = procfileReconciler ; } param serviceName return { ServiceRepresentationChainModifier } name ( ) ; name ( serviceName ) ; name ( serviceName ? ) { if ( ! serviceName ) { return this . representation . serviceName ; } ServiceUtils . checkName ( serviceName ) ; this . representation . serviceName = serviceName ; return this ; } param processName return { ServiceRepresentationChainModifier } process ( ) ; process ( processName ) ; process ( processName ? ) { if ( ! processName ) { return this . representation . category ; } this . representation . category = processName ; return this ; } param configResolver return { ServiceRepresentationChainModifier } config ( ) ; config ( configResolver ) ; config ( configResolver ? ) { if ( ! configResolver ) { return this . representation . config ; } if ( 'function' === typeof configResolver ) { this . representation . configResolver = configResolver ; return this ; } this . representation . config = configResolver ; return this ; } param servicesName return { ServiceRepresentationChainModifier } dependency ( ) ; dependency ( servicesName ) ; dependency ( servicesName ? ) { if ( ! servicesName ) { return this . representation . dependencies ; } this . representation . dependencies = this . representation . dependencies || [ ] ; if ( Array . isArray ( servicesName ) ) { this . representation . dependencies . push . apply ( this . representation . dependencies , servicesName ) ; return this ; } this . representation . dependencies . push ( servicesName ) ; return this ; } param { boolean } enable publish ( enable = true ) { this . representation . publishToHub = enable ; return this ; } /**
     * Drop this service like never happened
     */ drop ( ) { this . procfileReconciler . dropServiceByName ( this . representation . serviceName ) ; } }