Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
CommonOptions,
faastAws,
faastLocal,
FaastModuleProxy,
LocalOptions,
log,
} from "faastjs";
import mergeOptions from "merge-options";
import semver from "semver";
import { assertNonNullable } from "./assert";
import * as compilerFaastFunctions from "./compiler-core";
import { DuckConfig } from "./duckconfig";
import { logger } from "./logger";
// change to stdout
log.info.log = console.log.bind(console);
export async function getFaastCompiler(
config: DuckConfig
): Promise> {
logger.info("Initializing batch mode");
const batch = assertNonNullable(config.batch);
const batchOptions = getBatchOptions(config);
const m =
batch === "aws"
? await faastAws(compilerFaastFunctions, batchOptions as AwsOptions)
: batch === "local"
? await faastLocal(compilerFaastFunctions, batchOptions as LocalOptions)
: null;
if (!m) {
throw new TypeError(`Unsupported batch mode: ${batch}`);
}