UNPKG

@adpt/cli

Version:
67 lines 2.31 kB
"use strict"; /* * Copyright 2018-2019 Unbounded Systems, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); // FIXME(mark): Come up with a MUCH better solution for doing runtime type // checking than this. const utils_1 = require("@adpt/utils"); function verifyAdaptModule(val) { utils_1.validateProps("AdaptModule", val, { ProjectCompileError: "function", ProjectRunError: "function", listDeployments: "function", createDeployment: "function", destroyDeployment: "function", updateDeployment: "function", fetchStatus: "function", }); return val; } exports.verifyAdaptModule = verifyAdaptModule; function verifyDeployState(val) { if (val == null) throw new utils_1.ValidationError("DeployState", "value is null"); if (val.type === "success") { utils_1.validateProps("DeployState", val, { messages: "object", summary: "object", domXml: "string", stateJson: "string", deployID: "string", }); } else if (val.type === "error") { utils_1.validateProps("DeployState", val, { messages: "object", summary: "object", }); } verifyMessages(val.messages); return val; } exports.verifyDeployState = verifyDeployState; function verifyMessages(val) { if (val == null) throw new utils_1.ValidationError("Message[]", "value is null"); if (typeof val.length !== "number") throw new utils_1.ValidationError("Message[]", "length is invalid"); for (const m of val) { utils_1.validateMessage(m); } return val; } exports.verifyMessages = verifyMessages; //# sourceMappingURL=adapt_shared.js.map