zcatalyst-cli
Version:
Command Line Tool for CATALYST
70 lines (69 loc) • 2.68 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.python = exports.java = exports.node = void 0;
const fn_utils_1 = require("../../../../fn-utils");
const throbber_1 = __importDefault(require("../../../../throbber"));
function deploy(targets, lang) {
return __awaiter(this, void 0, void 0, function* () {
if (targets === undefined || targets.length === 0) {
return;
}
const throbber = throbber_1.default.getInstance();
switch (lang) {
case 'java': {
yield fn_utils_1.fnUtils.java.validate(targets);
break;
}
case 'node': {
yield fn_utils_1.fnUtils.node.validate(targets);
break;
}
case 'python': {
yield fn_utils_1.fnUtils.python.validate(targets);
break;
}
}
return Promise.all(targets
.filter((target) => {
if (!target.valid) {
throbber.remove('function_deploy_' + target.name);
}
return target.valid;
})
.map((target) => __awaiter(this, void 0, void 0, function* () {
yield fn_utils_1.fnUtils.common.pack(target);
throbber.remove('function_deploy_' + target.name);
return target;
})));
});
}
function node(targets) {
return __awaiter(this, void 0, void 0, function* () {
return deploy(targets, 'node');
});
}
exports.node = node;
function java(targets) {
return __awaiter(this, void 0, void 0, function* () {
return deploy(targets, 'java');
});
}
exports.java = java;
function python(targets) {
return __awaiter(this, void 0, void 0, function* () {
return deploy(targets, 'python');
});
}
exports.python = python;