mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Updated aws-lambda (#10966)
* Updated aws-lambda Fixed issue #10956 * Bring back old functions for Node.js Runtime v0.10.42 Bring back old functions for Node.js Runtime v0.10.42
This commit is contained in:
parent
b74d0bee45
commit
90c2247f74
@ -4,55 +4,29 @@ import lambda = require('aws-lambda');
|
||||
|
||||
var str: string;
|
||||
var date: Date;
|
||||
var sns: lambda.SNS;
|
||||
var kinesis: lambda.Kinesis;
|
||||
var recordsList: lambda.Record[];
|
||||
var anyObj: any;
|
||||
var num: number;
|
||||
var identity: lambda.Identity;
|
||||
var identity: lambda.CognitoIdentity;
|
||||
var error: Error;
|
||||
|
||||
/* Records */
|
||||
var records: lambda.Records;
|
||||
|
||||
recordsList = records.Records;
|
||||
|
||||
/* Record */
|
||||
var record: lambda.Record;
|
||||
|
||||
str = record.EventVersion;
|
||||
str = record.EventSubscriptionArn;
|
||||
str = record.EnventSource;
|
||||
sns = record.Sns;
|
||||
kinesis = record.kinesis;
|
||||
|
||||
/* SNS */
|
||||
str = sns.Type;
|
||||
str = sns.MessageId;
|
||||
str = sns.TopicArn;
|
||||
str = sns.Subject;
|
||||
str = sns.Message;
|
||||
date = sns.Timestamp;
|
||||
|
||||
/* Kinesis */
|
||||
var kinesis: lambda.Kinesis;
|
||||
|
||||
str = kinesis.data;
|
||||
var b: boolean;
|
||||
var clientCtx: lambda.ClientContext;
|
||||
|
||||
/* Context */
|
||||
var context: lambda.Context;
|
||||
|
||||
context.log(str, anyObj);
|
||||
context.fail(str);
|
||||
context.succeed(str);
|
||||
context.succeed(anyObj);
|
||||
context.succeed(str, anyObj);
|
||||
b = context.callbackWaitsForEmptyEventLoop;
|
||||
str = context.functionName;
|
||||
str = context.functionVersion;
|
||||
str = context.invokedFunctionArn;
|
||||
num = context.memoryLimitInMB;
|
||||
str = context.awsRequestId;
|
||||
num = context.getRemainingTimeInMillis();
|
||||
str = context.logGroupName;
|
||||
str = context.logStreamName;
|
||||
identity = context.identity;
|
||||
clientCtx = context.clientContext;
|
||||
|
||||
/* Identity */
|
||||
var identity: lambda.Identity;
|
||||
/* CognitoIdentity */
|
||||
var identity: lambda.CognitoIdentity;
|
||||
|
||||
str = identity.cognitoIdentityId;
|
||||
str = identity.cognitoIdentityPoolId;
|
||||
|
||||
83
aws-lambda/aws-lambda.d.ts
vendored
83
aws-lambda/aws-lambda.d.ts
vendored
@ -1,55 +1,68 @@
|
||||
// Type definitions for AWS Lambda
|
||||
// Project: http://docs.aws.amazon.com/lambda
|
||||
// Definitions by: Michael Skarum <https://github.com/skarum>
|
||||
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "aws-lambda" {
|
||||
// Context
|
||||
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
|
||||
interface Context {
|
||||
// Properties
|
||||
callbackWaitsForEmptyEventLoop: boolean;
|
||||
functionName: string;
|
||||
functionVersion: string;
|
||||
invokedFunctionArn: string;
|
||||
memoryLimitInMB: number;
|
||||
awsRequestId: string;
|
||||
logGroupName: string;
|
||||
logStreamName: string;
|
||||
identity?: CognitoIdentity;
|
||||
clientContext?: ClientContext;
|
||||
|
||||
// Functions
|
||||
getRemainingTimeInMillis(): number;
|
||||
|
||||
export interface Records {
|
||||
Records: Record[];
|
||||
}
|
||||
interface Record {
|
||||
EventVersion: string;
|
||||
EventSubscriptionArn: string;
|
||||
EnventSource: string;
|
||||
Sns: SNS;
|
||||
kinesis: Kinesis;
|
||||
}
|
||||
interface SNS {
|
||||
Type: string;
|
||||
MessageId: string;
|
||||
TopicArn: string;
|
||||
Subject: string;
|
||||
Message: string;
|
||||
Timestamp: Date;
|
||||
}
|
||||
|
||||
interface Kinesis {
|
||||
data: string;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
// Functions for compatibility with earlier Node.js Runtime v0.10.42
|
||||
log(message: string, object: any): void;
|
||||
fail(message: string): void;
|
||||
succeed(message: string): void;
|
||||
succeed(object: any): void;
|
||||
succeed(message: string, object: any): void;
|
||||
awsRequestId: string;
|
||||
getRemainingTimeInMillis(): number;
|
||||
/** Information about the Amazon Cognito identity provider when invoked through the AWS Mobile SDK. It can be null. */
|
||||
identity?: Identity;
|
||||
succeed(message: string, object: any): void;
|
||||
}
|
||||
|
||||
interface Identity {
|
||||
|
||||
interface CognitoIdentity {
|
||||
cognitoIdentityId: string;
|
||||
cognitoIdentityPoolId: string;
|
||||
}
|
||||
|
||||
|
||||
interface ClientContext {
|
||||
client: ClientContextClient;
|
||||
Custom?: any;
|
||||
env: ClientContextEnv;
|
||||
}
|
||||
|
||||
interface ClientContextClient {
|
||||
installationId: string;
|
||||
appTitle: string;
|
||||
appVersionName: string;
|
||||
appVersionCode: string;
|
||||
appPackageName: string;
|
||||
}
|
||||
|
||||
interface ClientContextEnv {
|
||||
platformVersion: string;
|
||||
platform: string;
|
||||
make: string;
|
||||
model: string;
|
||||
locale: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional callback parameter.
|
||||
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
|
||||
*
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
*/
|
||||
export type Callback = (error?: Error, result?: any) => void;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user