@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
26 lines (25 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.hasCloudSql = exports.hasDeployType = void 0;
const pipeline_1 = require("../../../pipeline/src/index.js");
/** Returns an isAvailable function that checks if ANY component uses one of the given deploy types */
function hasDeployType(...types) {
return contexts => contexts.some(ctx => {
var _a;
return (0, pipeline_1.isOfDeployType)((_a = ctx.deploy) === null || _a === void 0 ? void 0 : _a.config, ...types);
});
}
exports.hasDeployType = hasDeployType;
/** Returns an isAvailable function that checks if ANY component has cloudSql configured */
function hasCloudSql() {
return contexts => contexts.some(ctx => {
var _a, _b, _c;
const cfg = (_a = ctx.deploy) === null || _a === void 0 ? void 0 : _a.config;
if ((0, pipeline_1.isOfDeployType)(cfg, "google-cloudrun")) return !!cfg.cloudSql;
if ((0, pipeline_1.isOfDeployType)(cfg, "kubernetes")) return !!((_c = (_b = cfg.values) === null || _b === void 0 ? void 0 : _b.cloudsql) === null || _c === void 0 ? void 0 : _c.enabled);
return false;
});
}
exports.hasCloudSql = hasCloudSql;