mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #15451 from moskalyk/master
@types/aws-lambda-mock-context
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { context } from "aws-lambda-mock-context";
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
const launchRequestJson: any = {
|
||||
request: {
|
||||
locale: "en-US",
|
||||
requestId: "amzn1.echo-api.request.[unique-value-here]",
|
||||
timestamp: "2016-10-27T18:21:44Z",
|
||||
type: "LaunchRequest",
|
||||
},
|
||||
session: {
|
||||
application: {applicationId: "amzn1.ask.skill.[unique-value-here]"},
|
||||
attributes: {},
|
||||
new: false,
|
||||
sessionId: "amzn1.echo-api.session.[unique-value-here]",
|
||||
user: {userId: "amzn1.ask.account.[unique-value-here]"},
|
||||
},
|
||||
version: "1.0",
|
||||
};
|
||||
|
||||
const ctx = context();
|
||||
const alexa = Alexa.handler(launchRequestJson, ctx);
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for AWS Lambda Mock Context SDK 1.0
|
||||
// Project: https://github.com/moskalyk/typed-aws-lambda-mock-context
|
||||
// Definitions by: Morgan Moskalyk <morgan.moskalyk@gmail.com>, Anand Nimkar <anand.a.nimkar@gmail.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function context(options?: Options): Context;
|
||||
|
||||
interface Context {
|
||||
Promise: Promise<any>;
|
||||
callbackWaitsForEmptyEventLoop: boolean;
|
||||
functionName: string;
|
||||
functionVersion: string;
|
||||
invokedFunctionArn: string;
|
||||
memoryLimitInMB: string;
|
||||
awsRequestId: string;
|
||||
invokeid: string;
|
||||
logGroupName: string;
|
||||
logStreamName: string;
|
||||
getRemainingTimeInMillis: number;
|
||||
succeed(result: any): Promise<any>;
|
||||
fail(err: any): Promise<any>;
|
||||
done(err: any, result: any): Promise<any>;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
region: string;
|
||||
account: string;
|
||||
functionName: string;
|
||||
functionVersion: string;
|
||||
memoryLimitInMB: string;
|
||||
alias?: string;
|
||||
}
|
||||
|
||||
export { context };
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aws-lambda-mock-context-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Reference in New Issue
Block a user