aws-lambda-mock-context: Provides its own types (#39657)

This commit is contained in:
Alexander T
2019-11-04 13:05:06 -08:00
committed by Nathan Shively-Sanders
parent 30816366ce
commit 614f385014
5 changed files with 6 additions and 88 deletions
+6
View File
@@ -186,6 +186,12 @@
"sourceRepoURL": "https://github.com/andreypopp/autobind-decorator",
"asOfVersion": "2.1.0"
},
{
"libraryName": "aws-lambda-mock-context",
"typingsPackageName": "aws-lambda-mock-context",
"sourceRepoURL": "https://github.com/moskalyk/typed-aws-lambda-mock-context",
"asOfVersion": "3.2.0"
},
{
"libraryName": "autolinker",
"typingsPackageName": "autolinker",
@@ -1,22 +0,0 @@
import context = require("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);
-35
View File
@@ -1,35 +0,0 @@
// 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
// TypeScript Version: 2.2
declare function context(options?: Options): Context;
export = 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;
}
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"aws-lambda-mock-context-tests.ts"
]
}
@@ -1,8 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"npm-naming": false,
"dt-header": false
}
}