@bitblit/epsilon
Version:
Tiny adapter to simplify building API gateway Lambda APIS
46 lines • 2.29 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RunBackgroundProcessFromCommandLine = void 0;
const common_1 = require("@bitblit/ratchet/common");
/**
* IMPORTANT NOTE
* This file is part of the bootstrapper to bridge from the Epsilon Background processor
* to the AWS Batch processing Docker setup.
*
* DO NOT MESS WITH IT UNLESS YOU REALLY KNOW WHAT YOU ARE DOING.
*
* You are likely to mess it up otherwise.
*/
class RunBackgroundProcessFromCommandLine {
static runFromCliArgs(args) {
return __awaiter(this, void 0, void 0, function* () {
if (args.length > 1) {
const procName = args[0];
const dryRun = args.length > 1 && common_1.BooleanRatchet.parseBool(args[1]);
const data = args.length > 2 ? JSON.parse(args[2]) : null;
const meta = args.length > 3 ? JSON.parse(args[3]) : null;
const epsilon = null; // TODO: How to pass this in?
if (dryRun) {
common_1.Logger.info('Dry-Run, would have sent : %s %j %j', procName, data, meta);
}
else {
yield epsilon.processSingleBackgroundByParts(procName, data, meta);
}
}
else {
console.log('Usage : run-background-process {processName} {dryRun true/false} {dataJson} {metaJson}');
}
});
}
}
exports.RunBackgroundProcessFromCommandLine = RunBackgroundProcessFromCommandLine;
//# sourceMappingURL=run-background-process-from-command-line.js.map