Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@middy/core

Package Overview
Dependencies
Maintainers
10
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/core - npm Package Compare versions

Comparing version 1.0.0-alpha.44 to 1.0.0-alpha.45

74

index.d.ts

@@ -1,46 +0,56 @@

import { Callback, Context, Handler, ProxyResult } from 'aws-lambda'
import {
Callback,
Context,
Handler
} from 'aws-lambda'
type AsyncHandler = (
event: any,
context: Context
) => Promise<ProxyResult | object>
declare type EventType<T> =
T extends (event: infer EventArgType, context: Context, callback: Callback<any>) => void ? EventArgType :
T extends (event: infer EventArgType, context: Context) => Promise<any> ? EventArgType :
never;
declare var middy: {
(handler: Handler | AsyncHandler): middy.IMiddy
}
declare type HandlerReturnType<T> =
T extends (event: any, context: Context) => Promise<infer RetType> ? RetType :
T extends (event: any, context: Context, callback: Callback<infer RetType>) => void ? RetType :
never;
declare type AsyncHandler<C extends Context> =
((event: any, context: C, callback: Callback<any>) => void) |
((event: any, context: C) => Promise<any>);
declare const middy: <H extends AsyncHandler<C>, C extends Context = Context>(handler: H) => middy.Middy<
EventType<H>,
HandlerReturnType<H>
>
declare namespace middy {
interface IMiddy extends Handler {
use: IMiddyUseFunction
before: IMiddyMiddlewareFunction
after: IMiddyMiddlewareFunction
onError: IMiddyMiddlewareFunction
interface Middy<T, R, C extends Context = Context> extends Handler<T, R> {
use: <M extends MiddlewareObject<T, R, C>>(middleware: M) => Middy<T, R, C>;
before: (callbackFn: MiddlewareFunction<T, R, C>) => Middy<T, R, C>;
after: (callbackFn: MiddlewareFunction<T, R, C>) => Middy<T, R, C>;
onError: (callbackFn: MiddlewareFunction<T, R, C>) => Middy<T, R, C>;
}
type IMiddyUseFunction = (
middlewares?: IMiddyMiddlewareObject | IMiddyMiddlewareObject[]
) => IMiddy
type Middleware<C extends any, T = any, R = any> = (config?: C) => MiddlewareObject<T, R>;
interface IMiddyMiddlewareObject {
before?: IMiddyMiddlewareFunction
after?: IMiddyMiddlewareFunction
onError?: IMiddyMiddlewareFunction
interface MiddlewareObject<T, R, C extends Context = Context> {
before?: MiddlewareFunction<T, R, C>;
after?: MiddlewareFunction<T, R, C>;
onError?: MiddlewareFunction<T, R, C>;
}
type IMiddyMiddlewareFunction = (
handler: IHandlerLambda,
next: IMiddyNextFunction
) => void | Promise<any>
type MiddlewareFunction<T, R, C extends Context = Context> = (handler: HandlerLambda<T, R, C>, next: NextFunction) => void | Promise<any>;
type IMiddyNextFunction = (error?: any) => void
type NextFunction = (error?: any) => void;
interface IHandlerLambda<T = any, V = object> {
event: T
context: Context
response: V
error: Error
callback: Callback
interface HandlerLambda<T = any, V = any, C extends Context = Context> {
event: T;
context: C;
response: V;
error: Error;
callback: Callback<V>;
}
}
export default middy
export default middy;
export as namespace middy;
{
"name": "@middy/core",
"version": "1.0.0-alpha.44",
"version": "1.0.0-alpha.45",
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (core package)",

@@ -45,3 +45,3 @@ "engines": {

},
"gitHead": "e96e46b686064792b0652abe9d8a07029a63e8ad"
"gitHead": "df9c23728ea5dd29689fdea48473a29e41d5ee92"
}

@@ -5,3 +5,4 @@ {

"lib": ["es2015"],
"target": "es2015"
"target": "es2015",
"esModuleInterop": true
},

@@ -8,0 +9,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc