Skip to content

Commit

Permalink
Temporarily include lib in git
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino committed Dec 14, 2020
1 parent 0e30167 commit a0a5e3f
Show file tree
Hide file tree
Showing 41 changed files with 2,878 additions and 0 deletions.
62 changes: 62 additions & 0 deletions lib/Common/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* This module defines types, enums and interfaces common to the other modules.
*/
/// <reference types="node" />
import { IncomingHttpHeaders } from "http";
export interface InvocationResponse {
bodyJson: string;
headers: IncomingHttpHeaders;
}
export interface NativeClient {
initializeClient: (userAgent: string) => void;
done: (id: string, bodyString: string) => void;
error: (id: string, bodyString: string, xrayString: string) => void;
next: () => Promise<InvocationResponse>;
}
export declare enum INVOKE_HEADER {
ClientContext = "lambda-runtime-client-context",
CognitoIdentity = "lambda-runtime-cognito-identity",
ARN = "lambda-runtime-invoked-function-arn",
AWSRequestId = "lambda-runtime-aws-request-id",
DeadlineMs = "lambda-runtime-deadline-ms",
XRayTrace = "lambda-runtime-trace-id"
}
export interface IEnvironmentData {
functionVersion?: string;
functionName?: string;
memoryLimitInMB?: string;
logGroupName?: string;
logStreamName?: string;
}
export interface IHeaderData {
clientContext?: string;
identity?: string;
invokedFunctionArn?: string;
awsRequestId?: string;
getRemainingTimeInMillis: () => number;
}
export declare type ErrorStringOrUndefined = Error | string | undefined;
export declare type ErrorStringOrUndefinedOrNull = ErrorStringOrUndefined | null;
/**
*
*/
export interface ICallbackContext {
callbackWaitsForEmptyEventLoop: boolean;
succeed: (result: unknown) => void;
fail: (err: ErrorStringOrUndefinedOrNull) => void;
done: (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void;
}
export declare type CallbackFunction = (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void;
export interface IBeforeExitListener {
invoke: () => void;
reset: () => () => void;
set: (listener: () => void) => () => void;
}
export interface IErrorCallbacks {
uncaughtException: (err: Error) => void;
unhandledRejection: (err: Error) => void;
}
export declare type HandlerFunction = (body: unknown, data: IEnvironmentData & IHeaderData, callback: CallbackFunction) => PromiseLike<unknown> | unknown;
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions lib/Common/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions lib/Common/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions lib/Errors/XRayError.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/**
* prepare an exception blob for sending to AWS X-Ray
* transform an Error, or Error-like, into an exception parseable by X-Ray's service.
* {
* "name": "CustomException",
* "message": "Something bad happend!",
* "stack": [
* "exports.handler (/var/function/node_modules/event_invoke.js:3:502)
* ]
* }
* =>
* {
* "working_directory": "/var/function",
* "exceptions": [
* {
* "type": "CustomException",
* "message": "Something bad happend!",
* "stack": [
* {
* "path": "/var/function/event_invoke.js",
* "line": 502,
* "label": "exports.throw_custom_exception"
* }
* ]
* }
* ],
* "paths": [
* "/var/function/event_invoke.js"
* ]
* }
*/
export declare const toFormatted: (err: unknown) => string;
//# sourceMappingURL=XRayError.d.ts.map
1 change: 1 addition & 0 deletions lib/Errors/XRayError.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 87 additions & 0 deletions lib/Errors/XRayError.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions lib/Errors/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Defines custom error types throwable by the runtime.
*/
export declare function isError(obj: any): obj is Error;
interface RuntimeErrorResponse {
errorType: string;
errorMessage: string;
trace: string[];
}
/**
* Attempt to convert an object into a response object.
* This method accounts for failures when serializing the error object.
*/
export declare function toRuntimeResponse(error: unknown): RuntimeErrorResponse;
/**
* Format an error with the expected properties.
* For compatability, the error string always starts with a tab.
*/
export declare const toFormatted: (error: unknown) => string;
export declare class ExtendedError extends Error {
code?: number;
custom?: string;
reason?: string;
promise?: Promise<any>;
constructor(reason?: string);
}
export declare class ImportModuleError extends ExtendedError {
}
export declare class HandlerNotFound extends ExtendedError {
}
export declare class MalformedHandlerName extends ExtendedError {
}
export declare class UserCodeSyntaxError extends ExtendedError {
}
export declare class UnhandledPromiseRejection extends ExtendedError {
constructor(reason?: string, promise?: Promise<any>);
}
export {};
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions lib/Errors/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a0a5e3f

Please sign in to comment.