@fncts/express 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ExitHandler.d.ts +2 -2
- package/ExpressApp.d.ts +1 -1
- package/RequestHandlerIO.d.ts +2 -2
- package/index.d.ts +2 -2
- package/package.json +2 -2
package/ExitHandler.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Cause } from "@fncts/base/data/Cause/definition";
|
2
2
|
import { URIO } from "@fncts/io/IO/definition";
|
3
3
|
import type { NextFunction, Request, Response } from "express";
|
4
|
-
export
|
5
|
-
export
|
4
|
+
export type ExitHandler<R> = (req: Request, res: Response, next: NextFunction) => (cause: Cause<never>) => URIO<R, any>;
|
5
|
+
export type ErasedExitHandler = ExitHandler<any>;
|
6
6
|
export declare function defaultExitHandler(_req: Request, _res: Response, _next: NextFunction): (cause: Cause<never>) => URIO<never, void>;
|
package/ExpressApp.d.ts
CHANGED
@@ -18,7 +18,7 @@ export interface ExpressApp {
|
|
18
18
|
export declare const ExpressAppTag: import("@fncts/base/data/Tag.js").Tag<ExpressApp>;
|
19
19
|
export declare const makeExpressApp: IO<Scope | ExpressAppConfig, never, ExpressApp>;
|
20
20
|
export declare const LiveExpressApp: import("@fncts/io/Layer.js").Layer<ExpressAppConfig, never, ExpressApp>;
|
21
|
-
export
|
21
|
+
export type ExpressEnv = ExpressAppConfig | ExpressApp;
|
22
22
|
export declare function LiveExpress(host: string, port: number): Layer<never, never, ExpressEnv>;
|
23
23
|
export declare function LiveExpress<R>(host: string, port: number, exitHandler: (req: Request, res: Response, next: NextFunction) => (cause: Cause<never>) => URIO<R, void>): Layer<R, never, ExpressEnv>;
|
24
24
|
export declare function expressRuntime<Handlers extends Array<RequestHandlerRouteIO>>(handlers: never extends Handlers ? Array<RequestHandlerRouteIO> : Handlers): IO<_R<{
|
package/RequestHandlerIO.d.ts
CHANGED
@@ -7,5 +7,5 @@ export interface ParsedQs {
|
|
7
7
|
export interface RequestHandlerIO<R, Route extends string = any, P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, Locals extends Record<string, any> = Record<string, any>> {
|
8
8
|
(req: Request<P, ResBody, ReqBody, ReqQuery, Locals>, res: Response<ResBody, Locals>, next: NextFunction): URIO<R, void>;
|
9
9
|
}
|
10
|
-
export
|
11
|
-
export
|
10
|
+
export type ErasedRequestHandlerIO<R> = RequestHandlerIO<R, any, any, any, any, any, any>;
|
11
|
+
export type RequestHandlerRouteIO<R = never, Route extends string = any> = RequestHandlerIO<R, Route, RouteParameters<Route>>;
|
package/index.d.ts
CHANGED
@@ -11,8 +11,8 @@ export * from "./ExpressApp.js";
|
|
11
11
|
export * from "./ExpressAppConfig.js";
|
12
12
|
export * from "./RequestHandlerIO.js";
|
13
13
|
export declare const methods: readonly ["all", "get", "post", "put", "delete", "patch", "options", "head", "checkout", "connect", "copy", "lock", "merge", "mkactivity", "mkcol", "move", "m-search", "notify", "propfind", "proppatch", "purge", "report", "search", "subscribe", "trace", "unlock", "unsubscribe"];
|
14
|
-
export
|
15
|
-
export
|
14
|
+
export type Methods = typeof methods[number];
|
15
|
+
export type PathParams = string | RegExp | Array<string | RegExp>;
|
16
16
|
export interface ParamsDictionary {
|
17
17
|
[key: string]: string;
|
18
18
|
}
|