pandora
Version:
A powerful and lightweight application manager for Node.js applications powered by TypeScript.
62 lines • 2.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ServiceUtils_1 = require("../service/ServiceUtils");
class ServiceRepresentationChainModifier {
constructor(representation, procfileReconciler) {
this.representation = representation;
this.procfileReconciler = procfileReconciler;
}
name(serviceName) {
if (!serviceName) {
return this.representation.serviceName;
}
ServiceUtils_1.ServiceUtils.checkName(serviceName);
this.representation.serviceName = serviceName;
return this;
}
process(processName) {
if (!processName) {
return this.representation.category;
}
this.representation.category = processName;
return this;
}
config(configResolver) {
if (!configResolver) {
return this.representation.config;
}
if ('function' === typeof configResolver) {
this.representation.configResolver = configResolver;
return this;
}
this.representation.config = configResolver;
return this;
}
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;
}
/**
* Publish this service upon IPC-Hub
* @param {boolean} enable
*/
publish(enable = true) {
this.representation.publishToHub = enable;
}
/**
* Drop this service like never happened
*/
drop() {
this.procfileReconciler.dropServiceByName(this.representation.serviceName);
}
}
exports.ServiceRepresentationChainModifier = ServiceRepresentationChainModifier;
//# sourceMappingURL=ServiceRepresentationChainModifier.js.map