Skip to content

Commit a0a5e3f

Browse files
committed
Temporarily include lib in git
1 parent 0e30167 commit a0a5e3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2878
-0
lines changed

Diff for: lib/Common/index.d.ts

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* This module defines types, enums and interfaces common to the other modules.
5+
*/
6+
/// <reference types="node" />
7+
import { IncomingHttpHeaders } from "http";
8+
export interface InvocationResponse {
9+
bodyJson: string;
10+
headers: IncomingHttpHeaders;
11+
}
12+
export interface NativeClient {
13+
initializeClient: (userAgent: string) => void;
14+
done: (id: string, bodyString: string) => void;
15+
error: (id: string, bodyString: string, xrayString: string) => void;
16+
next: () => Promise<InvocationResponse>;
17+
}
18+
export declare enum INVOKE_HEADER {
19+
ClientContext = "lambda-runtime-client-context",
20+
CognitoIdentity = "lambda-runtime-cognito-identity",
21+
ARN = "lambda-runtime-invoked-function-arn",
22+
AWSRequestId = "lambda-runtime-aws-request-id",
23+
DeadlineMs = "lambda-runtime-deadline-ms",
24+
XRayTrace = "lambda-runtime-trace-id"
25+
}
26+
export interface IEnvironmentData {
27+
functionVersion?: string;
28+
functionName?: string;
29+
memoryLimitInMB?: string;
30+
logGroupName?: string;
31+
logStreamName?: string;
32+
}
33+
export interface IHeaderData {
34+
clientContext?: string;
35+
identity?: string;
36+
invokedFunctionArn?: string;
37+
awsRequestId?: string;
38+
getRemainingTimeInMillis: () => number;
39+
}
40+
export declare type ErrorStringOrUndefined = Error | string | undefined;
41+
export declare type ErrorStringOrUndefinedOrNull = ErrorStringOrUndefined | null;
42+
/**
43+
*
44+
*/
45+
export interface ICallbackContext {
46+
callbackWaitsForEmptyEventLoop: boolean;
47+
succeed: (result: unknown) => void;
48+
fail: (err: ErrorStringOrUndefinedOrNull) => void;
49+
done: (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void;
50+
}
51+
export declare type CallbackFunction = (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void;
52+
export interface IBeforeExitListener {
53+
invoke: () => void;
54+
reset: () => () => void;
55+
set: (listener: () => void) => () => void;
56+
}
57+
export interface IErrorCallbacks {
58+
uncaughtException: (err: Error) => void;
59+
unhandledRejection: (err: Error) => void;
60+
}
61+
export declare type HandlerFunction = (body: unknown, data: IEnvironmentData & IHeaderData, callback: CallbackFunction) => PromiseLike<unknown> | unknown;
62+
//# sourceMappingURL=index.d.ts.map

Diff for: lib/Common/index.d.ts.map

+1
Original file line numberDiff line numberDiff line change

Diff for: lib/Common/index.js

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/Errors/XRayError.d.ts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2+
/**
3+
* prepare an exception blob for sending to AWS X-Ray
4+
* transform an Error, or Error-like, into an exception parseable by X-Ray's service.
5+
* {
6+
* "name": "CustomException",
7+
* "message": "Something bad happend!",
8+
* "stack": [
9+
* "exports.handler (/var/function/node_modules/event_invoke.js:3:502)
10+
* ]
11+
* }
12+
* =>
13+
* {
14+
* "working_directory": "/var/function",
15+
* "exceptions": [
16+
* {
17+
* "type": "CustomException",
18+
* "message": "Something bad happend!",
19+
* "stack": [
20+
* {
21+
* "path": "/var/function/event_invoke.js",
22+
* "line": 502,
23+
* "label": "exports.throw_custom_exception"
24+
* }
25+
* ]
26+
* }
27+
* ],
28+
* "paths": [
29+
* "/var/function/event_invoke.js"
30+
* ]
31+
* }
32+
*/
33+
export declare const toFormatted: (err: unknown) => string;
34+
//# sourceMappingURL=XRayError.d.ts.map

Diff for: lib/Errors/XRayError.d.ts.map

+1
Original file line numberDiff line numberDiff line change

Diff for: lib/Errors/XRayError.js

+87
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/Errors/index.d.ts

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Defines custom error types throwable by the runtime.
5+
*/
6+
export declare function isError(obj: any): obj is Error;
7+
interface RuntimeErrorResponse {
8+
errorType: string;
9+
errorMessage: string;
10+
trace: string[];
11+
}
12+
/**
13+
* Attempt to convert an object into a response object.
14+
* This method accounts for failures when serializing the error object.
15+
*/
16+
export declare function toRuntimeResponse(error: unknown): RuntimeErrorResponse;
17+
/**
18+
* Format an error with the expected properties.
19+
* For compatability, the error string always starts with a tab.
20+
*/
21+
export declare const toFormatted: (error: unknown) => string;
22+
export declare class ExtendedError extends Error {
23+
code?: number;
24+
custom?: string;
25+
reason?: string;
26+
promise?: Promise<any>;
27+
constructor(reason?: string);
28+
}
29+
export declare class ImportModuleError extends ExtendedError {
30+
}
31+
export declare class HandlerNotFound extends ExtendedError {
32+
}
33+
export declare class MalformedHandlerName extends ExtendedError {
34+
}
35+
export declare class UserCodeSyntaxError extends ExtendedError {
36+
}
37+
export declare class UnhandledPromiseRejection extends ExtendedError {
38+
constructor(reason?: string, promise?: Promise<any>);
39+
}
40+
export {};
41+
//# sourceMappingURL=index.d.ts.map

Diff for: lib/Errors/index.d.ts.map

+1
Original file line numberDiff line numberDiff line change

0 commit comments

Comments
 (0)