-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathTypes.ts
More file actions
43 lines (40 loc) · 1 KB
/
Types.ts
File metadata and controls
43 lines (40 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* @since 1.0.0
*/
import type { Context } from "aws-lambda";
import { type Layer } from "effect";
import type * as Effect from "effect/Effect";
/**
* AWS Lambda native handler type.
*
* @since 1.0.0
* @category model
*/
export type Handler<TEvent = unknown, TResult = any> = (
event: TEvent,
context: Context,
) => Promise<TResult>;
/**
* Effectful AWS Lambda handler type.
*
* @since 1.0.0
* @category model
*/
export type EffectHandler<T, R, E = never, A = void> = (
event: T,
context: Context,
) => Effect.Effect<A, E, R>;
/**
* Combined object of an EffectHandler and a global layer.
*
* @param {EffectHandler<T, R, E1, A>} handler - The effectful handler function.
* @param {Layer.Layer<R, E2>} layer - The global layer to provide to the handler.
*
* @since 1.0.0
* @category model
*/
export type EffectHandlerWithLayer<T, R, E1 = never, E2 = never, A = void> = {
readonly handler: EffectHandler<T, R, E1, A>;
readonly layer: Layer.Layer<R, E2>;
readonly memoMap?: Layer.MemoMap;
};