Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building on macos #4

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified deps/aws-lambda-cpp-0.2.6.tar.gz
Binary file not shown.
22 changes: 22 additions & 0 deletions deps/patches/aws-lambda-cpp-macos-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/include/backward.h b/include/backward.h
index e065783..9e369a6 100644
--- a/include/backward.h
+++ b/include/backward.h
@@ -43,7 +43,7 @@

// You can define one of the following (or leave it to the auto-detection):
//
-# define BACKWARD_SYSTEM_LINUX
+// #define BACKWARD_SYSTEM_LINUX
// - specialization for linux
//
// #define BACKWARD_SYSTEM_DARWIN
@@ -3057,7 +3057,7 @@ public:
if (st.size() == 0) {
return;
}
- _symbols.reset(backtrace_symbols(st.begin(), st.size()));
+ _symbols.reset(backtrace_symbols(st.begin(), (int)st.size()));
}

ResolvedTrace resolve(ResolvedTrace trace)
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