Skip to content

Commit

Permalink
fix(types): add missing config params (#486) (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethWussmann committed Jan 23, 2022
1 parent 5c1e0a5 commit 093af02
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/configure.d.ts
@@ -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
@@ -0,0 +1,5 @@
interface Framework {
sendRequest: (handler: { request: any; response: any }) => void;
}

export default Framework;

0 comments on commit 093af02

Please sign in to comment.