@omnia/tooling-composers
Version:
Provide tooling to work with manifest things.
29 lines (28 loc) • 1.35 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceComposer = void 0;
const Utils_1 = require("./Utils");
const WebAppServiceComposer_1 = require("./WebAppServiceComposer");
const WorkerServiceComposer_1 = require("./WorkerServiceComposer");
const CustomServiceComposer_1 = require("./CustomServiceComposer");
class ServiceComposer {
constructor(manifestId, manifestName, serviceInfo) {
// TODO wait hot reload update not execute composer two times
this.manifestId = manifestId;
this.manifestName = manifestName;
this.serviceInfo = serviceInfo;
this.AsWebApp = () => {
return new WebAppServiceComposer_1.WebAppServiceComposer(this.manifestId, this.manifestName, this.serviceInfo);
};
this.AsWorker = () => {
return new WorkerServiceComposer_1.WorkerServiceComposer(this.manifestId, this.manifestName, this.serviceInfo);
};
this.AsCustom = () => {
return new CustomServiceComposer_1.CustomServiceComposer(this.manifestId, this.manifestName, this.serviceInfo);
};
if (!Utils_1.Utils.isValidGuid(this.manifestId)) {
throw new Error("Can't register service with id: " + this.manifestId + " must be a valid Guid");
}
}
}
exports.ServiceComposer = ServiceComposer;