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

fix(types): add missing config params (#486) #488

Merged
merged 1 commit into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/configure.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RequestListener } from "http";
import { Handler } from "aws-lambda";
import Logger from "./logger";
import Framework from "./frameworks";

type EventSources = "AWS_SNS" | "AWS_DYNAMODB";

Expand All @@ -18,12 +19,23 @@ interface BinarySettings {
isBinary?: Function | boolean;
contentTypes?: string[];
}

interface LogSettings {
level: string;
}

interface ConfigureParams {
app: RequestListener;
logSettings?: LogSettings;
log?: Logger;
framework?: Framework;
binaryMimeTypes?: string[];
binarySettings?: BinarySettings;
resolutionMode?: string;
eventSourceName?: string;
eventSource?: EventSource; // TODO:
eventSourceRoutes?: { [key in EventSources]?: string };
respondWithErrors?: boolean;
}

interface BinarySettings {
Expand All @@ -37,7 +49,9 @@ interface ConfigureResult<TEvent = any, TResult = any> {
proxy: (proxyParams: ProxyParams) => Promise<Object>;
}

declare function configure<TEvent = any, TResult = any>(configureParams: ConfigureParams): Handler<TEvent, TResult> & ConfigureResult<TEvent, TResult>;
declare function configure<TEvent = any, TResult = any>(
configureParams: ConfigureParams
): Handler<TEvent, TResult> & ConfigureResult<TEvent, TResult>;

// declare function proxy(proxyParams: ProxyParams): Promise<any>

Expand Down
5 changes: 5 additions & 0 deletions src/frameworks/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface Framework {
sendRequest: (handler: { request: any; response: any }) => void;
}

export default Framework;