@mcma/aws-lambda-worker-invoker
Advanced tools
Comparing version 0.13.17 to 0.13.18
@@ -0,5 +1,7 @@ | ||
import { Lambda } from "aws-sdk"; | ||
import { WorkerInvoker, WorkerRequestProperties } from "@mcma/worker-invoker"; | ||
export declare function invokeLambdaWorker(workerFunctionId: string, workerRequest: WorkerRequestProperties): Promise<void>; | ||
export declare class LambdaWorkerInvoker extends WorkerInvoker { | ||
constructor(); | ||
private lambda; | ||
constructor(lambda?: Lambda); | ||
protected invokeWorker(workerFunctionId: string, workerRequest: WorkerRequestProperties): Promise<void>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LambdaWorkerInvoker = exports.invokeLambdaWorker = void 0; | ||
exports.LambdaWorkerInvoker = void 0; | ||
const aws_sdk_1 = require("aws-sdk"); | ||
const worker_invoker_1 = require("@mcma/worker-invoker"); | ||
const lambdaClient = new aws_sdk_1.Lambda({ apiVersion: "2015-03-31" }); | ||
async function invokeLambdaWorker(workerFunctionId, workerRequest) { | ||
await lambdaClient.invoke({ | ||
FunctionName: workerFunctionId, | ||
InvocationType: "Event", | ||
LogType: "None", | ||
Payload: JSON.stringify({ | ||
operationName: workerRequest.operationName, | ||
input: workerRequest.input, | ||
tracker: workerRequest.tracker, | ||
}) | ||
}).promise(); | ||
} | ||
exports.invokeLambdaWorker = invokeLambdaWorker; | ||
class LambdaWorkerInvoker extends worker_invoker_1.WorkerInvoker { | ||
constructor() { | ||
super(invokeLambdaWorker); | ||
constructor(lambda = new aws_sdk_1.Lambda({ apiVersion: "2015-03-31" })) { | ||
super(); | ||
this.lambda = lambda; | ||
} | ||
async invokeWorker(workerFunctionId, workerRequest) { | ||
await this.lambda.invoke({ | ||
FunctionName: workerFunctionId, | ||
InvocationType: "Event", | ||
LogType: "None", | ||
Payload: JSON.stringify({ | ||
operationName: workerRequest.operationName, | ||
input: workerRequest.input, | ||
tracker: workerRequest.tracker, | ||
}) | ||
}).promise(); | ||
} | ||
} | ||
exports.LambdaWorkerInvoker = LambdaWorkerInvoker; |
{ | ||
"name": "@mcma/aws-lambda-worker-invoker", | ||
"version": "0.13.17", | ||
"version": "0.13.18", | ||
"description": "Node module with code for invoking MCMA workers running as Lambda functions, via the AWS SDK", | ||
"engines": { | ||
"node": "~10.16.3" | ||
"node": "^12.19.0" | ||
}, | ||
@@ -37,8 +37,8 @@ "type": "commonjs", | ||
"peerDependencies": { | ||
"@mcma/core": "0.13.17", | ||
"@mcma/worker-invoker": "0.13.17" | ||
"@mcma/core": "0.13.18", | ||
"@mcma/worker-invoker": "0.13.18" | ||
}, | ||
"devDependencies": { | ||
"@mcma/core": "0.13.17", | ||
"@mcma/worker-invoker": "0.13.17", | ||
"@mcma/core": "0.13.18", | ||
"@mcma/worker-invoker": "0.13.18", | ||
"@types/node": "^13.7.6", | ||
@@ -45,0 +45,0 @@ "jasmine": "^3.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3838
59