@wxn0brp/falcon-frame 0.2.1 → 0.4.0
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/dist/body-utils.d.ts +6 -0
- package/dist/body-utils.js +66 -0
- package/dist/body.d.ts +3 -2
- package/dist/body.js +5 -49
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12 -2
- package/dist/plugin.d.ts +9 -0
- package/dist/plugin.js +9 -0
- package/dist/render.d.ts +2 -1
- package/dist/render.js +12 -1
- package/dist/req.js +20 -9
- package/dist/router.d.ts +3 -1
- package/dist/router.js +10 -2
- package/dist/sse.d.ts +13 -0
- package/dist/sse.js +37 -0
- package/dist/types.d.ts +5 -5
- package/dist/types.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import FalconFrame from "./index.js";
|
|
2
|
+
import type { FFRequest, ParseBodyFunction, RouteHandler, StandardBodyParserOptions } from "./types.js";
|
|
3
|
+
export declare function parseLimit(limit: string | number): number;
|
|
4
|
+
export declare function getContentType(req: FFRequest): string | undefined;
|
|
5
|
+
export declare function getRawBody(req: FFRequest, limit: number): Promise<string>;
|
|
6
|
+
export declare function getStandardBodyParser(type: string, parser: ParseBodyFunction, FF: FalconFrame, opts: StandardBodyParserOptions): RouteHandler;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export function parseLimit(limit) {
|
|
2
|
+
if (!limit)
|
|
3
|
+
return 0;
|
|
4
|
+
if (typeof limit === "number")
|
|
5
|
+
return limit;
|
|
6
|
+
if (typeof limit !== "string")
|
|
7
|
+
return 0;
|
|
8
|
+
limit = limit.toLowerCase().replace("b", "");
|
|
9
|
+
const match = limit.match(/^(\d+)([kmg])?$/i);
|
|
10
|
+
if (!match)
|
|
11
|
+
return 0;
|
|
12
|
+
const num = parseInt(match[1], 10);
|
|
13
|
+
const unit = match[2]?.toLowerCase();
|
|
14
|
+
switch (unit) {
|
|
15
|
+
case "k":
|
|
16
|
+
return num * 1024;
|
|
17
|
+
case "m":
|
|
18
|
+
return num * 1024 * 1024;
|
|
19
|
+
case "g":
|
|
20
|
+
return num * 1024 * 1024 * 1024;
|
|
21
|
+
default:
|
|
22
|
+
return num;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function getContentType(req) {
|
|
26
|
+
return req.headers["content-type"]?.split(";")[0].toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
export function getRawBody(req, limit) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
let body = "";
|
|
31
|
+
req.on("data", (chunk) => {
|
|
32
|
+
body += chunk.toString();
|
|
33
|
+
if (limit && body.length > limit) {
|
|
34
|
+
const error = new Error("Payload Too Large");
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
error.statusCode = 413;
|
|
37
|
+
req.destroy();
|
|
38
|
+
return reject(error);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
req.on("end", () => {
|
|
42
|
+
resolve(body);
|
|
43
|
+
});
|
|
44
|
+
req.on("error", (err) => {
|
|
45
|
+
reject(err);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export function getStandardBodyParser(type, parser, FF, opts) {
|
|
50
|
+
const limit = parseLimit(opts.limit || "100k");
|
|
51
|
+
return async (req, res, next) => {
|
|
52
|
+
if ((typeof req.body == "object" && Object.keys(req.body).length) || getContentType(req) !== type) {
|
|
53
|
+
return next();
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const body = await getRawBody(req, limit);
|
|
57
|
+
req.body = await parser(body, req, FF);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
req.body = {};
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
next();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
package/dist/body.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import FalconFrame from "./index.js";
|
|
2
|
-
import {
|
|
3
|
-
export declare function
|
|
2
|
+
import { RouteHandler, StandardBodyParserOptions } from "./types.js";
|
|
3
|
+
export declare function json(FF: FalconFrame, opts?: StandardBodyParserOptions): RouteHandler;
|
|
4
|
+
export declare function urlencoded(FF: FalconFrame, opts?: StandardBodyParserOptions): RouteHandler;
|
package/dist/body.js
CHANGED
|
@@ -1,52 +1,8 @@
|
|
|
1
1
|
import querystring from "querystring";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"application/
|
|
5
|
-
body: querystring.parse(body),
|
|
6
|
-
}),
|
|
7
|
-
};
|
|
8
|
-
export async function parseBody(req, body, FF) {
|
|
9
|
-
const funcs = Object.assign({}, parseBodyFunctions, FF.customParsers || {});
|
|
10
|
-
const limit = parseLimit(FF.opts.bodyLimit);
|
|
11
|
-
try {
|
|
12
|
-
if (limit && body.length > limit) {
|
|
13
|
-
await FF.logger.warn(`Body size exceeds limit of ${limit} bytes`);
|
|
14
|
-
return {};
|
|
15
|
-
}
|
|
16
|
-
const type = req.headers["content-type"] || "";
|
|
17
|
-
const func = funcs[type];
|
|
18
|
-
if (!func)
|
|
19
|
-
return {};
|
|
20
|
-
const data = await func(body, req, FF);
|
|
21
|
-
if (!data || typeof data !== "object")
|
|
22
|
-
return {};
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
await FF.logger.warn(`Error parsing body: ${e}`);
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
2
|
+
import { getStandardBodyParser } from "./body-utils.js";
|
|
3
|
+
export function json(FF, opts = {}) {
|
|
4
|
+
return getStandardBodyParser("application/json", (body) => JSON.parse(body), FF, opts);
|
|
29
5
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
return 0;
|
|
33
|
-
if (typeof limit === "number")
|
|
34
|
-
return limit;
|
|
35
|
-
if (typeof limit !== "string")
|
|
36
|
-
return 0;
|
|
37
|
-
const match = limit.match(/^(\d+)([kmg])?$/i);
|
|
38
|
-
if (!match)
|
|
39
|
-
return 0;
|
|
40
|
-
const num = parseInt(match[1], 10);
|
|
41
|
-
const unit = match[2]?.toLowerCase();
|
|
42
|
-
switch (unit) {
|
|
43
|
-
case "k":
|
|
44
|
-
return num * 1024;
|
|
45
|
-
case "m":
|
|
46
|
-
return num * 1024 * 1024;
|
|
47
|
-
case "g":
|
|
48
|
-
return num * 1024 * 1024 * 1024;
|
|
49
|
-
default:
|
|
50
|
-
return num;
|
|
51
|
-
}
|
|
6
|
+
export function urlencoded(FF, opts = {}) {
|
|
7
|
+
return getStandardBodyParser("application/x-www-form-urlencoded", (body) => querystring.parse(body), FF, opts);
|
|
52
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,19 +4,22 @@ import { PluginSystem } from "./plugin.js";
|
|
|
4
4
|
import { renderHTML } from "./render.js";
|
|
5
5
|
import { FFResponse } from "./res.js";
|
|
6
6
|
import { Router } from "./router.js";
|
|
7
|
-
import type { BeforeHandleRequest, FFRequest,
|
|
7
|
+
import type { BeforeHandleRequest, FFRequest, RouteHandler } from "./types.js";
|
|
8
8
|
export type EngineCallback = (path: string, options: any, callback: (e: any, rendered?: string) => void) => void;
|
|
9
9
|
export interface Opts {
|
|
10
10
|
loggerOpts?: LoggerOptions;
|
|
11
11
|
bodyLimit?: string;
|
|
12
|
+
disableJsonParser?: boolean;
|
|
13
|
+
disableUrlencodedParser?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare class FalconFrame<Vars extends Record<string, any> = any> extends Router {
|
|
14
16
|
logger: Logger;
|
|
15
|
-
|
|
17
|
+
bodyParsers: RouteHandler[];
|
|
16
18
|
vars: Vars;
|
|
17
19
|
opts: Opts;
|
|
18
20
|
engines: Record<string, EngineCallback>;
|
|
19
21
|
constructor(opts?: Partial<Opts>);
|
|
22
|
+
addBodyParser(parser: RouteHandler): this;
|
|
20
23
|
listen(port: number | string, callback?: (() => void) | boolean, beforeHandleRequest?: BeforeHandleRequest): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
21
24
|
getApp(beforeHandleRequest?: BeforeHandleRequest): (req: any, res: any) => Promise<void>;
|
|
22
25
|
engine(ext: string, callback: EngineCallback): this;
|
package/dist/index.js
CHANGED
|
@@ -6,22 +6,28 @@ import { renderHTML } from "./render.js";
|
|
|
6
6
|
import { handleRequest } from "./req.js";
|
|
7
7
|
import { FFResponse } from "./res.js";
|
|
8
8
|
import { Router } from "./router.js";
|
|
9
|
+
import { json, urlencoded } from "./body.js";
|
|
9
10
|
export class FalconFrame extends Router {
|
|
10
11
|
logger;
|
|
11
|
-
|
|
12
|
+
bodyParsers = [];
|
|
12
13
|
vars = {};
|
|
13
14
|
opts = {};
|
|
14
15
|
engines = {};
|
|
15
16
|
constructor(opts = {}) {
|
|
16
17
|
super();
|
|
18
|
+
const loggerOpts = opts?.loggerOpts || {};
|
|
17
19
|
this.logger = new Logger({
|
|
18
20
|
loggerName: "falcon-frame",
|
|
19
|
-
...
|
|
21
|
+
...loggerOpts,
|
|
20
22
|
});
|
|
21
23
|
this.opts = {
|
|
22
24
|
bodyLimit: "10m",
|
|
23
25
|
...opts,
|
|
24
26
|
};
|
|
27
|
+
if (!this.opts.disableJsonParser)
|
|
28
|
+
this.addBodyParser(json(this, { limit: this.opts.bodyLimit }));
|
|
29
|
+
if (!this.opts.disableUrlencodedParser)
|
|
30
|
+
this.addBodyParser(urlencoded(this, { limit: this.opts.bodyLimit }));
|
|
25
31
|
this.engine(".html", (path, options, callback) => {
|
|
26
32
|
try {
|
|
27
33
|
const content = renderHTML(path, options);
|
|
@@ -32,6 +38,10 @@ export class FalconFrame extends Router {
|
|
|
32
38
|
}
|
|
33
39
|
});
|
|
34
40
|
}
|
|
41
|
+
addBodyParser(parser) {
|
|
42
|
+
this.bodyParsers.push(parser);
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
35
45
|
listen(port, callback, beforeHandleRequest) {
|
|
36
46
|
const server = http.createServer(this.getApp(beforeHandleRequest));
|
|
37
47
|
if (typeof callback === "boolean") {
|
package/dist/plugin.d.ts
CHANGED
|
@@ -11,6 +11,15 @@ export interface PluginOptions {
|
|
|
11
11
|
after?: PluginId | PluginId[];
|
|
12
12
|
optional?: boolean;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* The `PluginSystem` class is deprecated and should not be used in new projects.
|
|
17
|
+
*
|
|
18
|
+
* ⚠️ Notes:
|
|
19
|
+
* - It may be refactored in the future, but any refactor will introduce breaking changes.
|
|
20
|
+
* - If your system currently relies on it and it works, you may continue using it.
|
|
21
|
+
* - If it does not work in your setup, it is recommended to skip it or wait for an update.
|
|
22
|
+
*/
|
|
14
23
|
export declare class PluginSystem {
|
|
15
24
|
private plugins;
|
|
16
25
|
private executionOrder;
|
package/dist/plugin.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated
|
|
3
|
+
* The `PluginSystem` class is deprecated and should not be used in new projects.
|
|
4
|
+
*
|
|
5
|
+
* ⚠️ Notes:
|
|
6
|
+
* - It may be refactored in the future, but any refactor will introduce breaking changes.
|
|
7
|
+
* - If your system currently relies on it and it works, you may continue using it.
|
|
8
|
+
* - If it does not work in your setup, it is recommended to skip it or wait for an update.
|
|
9
|
+
*/
|
|
1
10
|
export class PluginSystem {
|
|
2
11
|
plugins = [];
|
|
3
12
|
executionOrder = [];
|
package/dist/render.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import FalconFrame from "./index.js";
|
|
1
2
|
interface RenderData {
|
|
2
3
|
[key: string]: string;
|
|
3
4
|
}
|
|
4
|
-
export declare function renderHTML(templatePath: string, data: RenderData, renderedPaths?: string[]): string;
|
|
5
|
+
export declare function renderHTML(templatePath: string, data: RenderData, renderedPaths?: string[], FF?: FalconFrame): string;
|
|
5
6
|
export {};
|
package/dist/render.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
export function renderHTML(templatePath, data, renderedPaths = []) {
|
|
3
|
+
export function renderHTML(templatePath, data, renderedPaths = [], FF) {
|
|
4
4
|
try {
|
|
5
5
|
const realPath = path.resolve(templatePath);
|
|
6
6
|
if (renderedPaths.includes(realPath)) {
|
|
@@ -17,6 +17,17 @@ export function renderHTML(templatePath, data, renderedPaths = []) {
|
|
|
17
17
|
realPath,
|
|
18
18
|
]);
|
|
19
19
|
});
|
|
20
|
+
// Layout
|
|
21
|
+
if (FF && FF.vars["layout"]) {
|
|
22
|
+
const hasHtmlStructure = /<\s*html|<\s*body/i.test(template);
|
|
23
|
+
const forceLayout = /<!--\s*force-layout\s*-->/.test(template);
|
|
24
|
+
const forceNoLayout = /<!--\s*force-no-layout\s*-->/.test(template);
|
|
25
|
+
if (hasHtmlStructure && !forceLayout)
|
|
26
|
+
return template;
|
|
27
|
+
if (!hasHtmlStructure && forceNoLayout)
|
|
28
|
+
return template;
|
|
29
|
+
return renderHTML(FF.vars["layout"], { ...data, body: template }, [...renderedPaths, realPath]);
|
|
30
|
+
}
|
|
20
31
|
return template;
|
|
21
32
|
}
|
|
22
33
|
catch (error) {
|
package/dist/req.js
CHANGED
|
@@ -3,7 +3,6 @@ import { parseCookies } from "./helpers.js";
|
|
|
3
3
|
import { FFResponse } from "./res.js";
|
|
4
4
|
import { validate } from "./valid.js";
|
|
5
5
|
import { getMiddlewares, matchMiddleware } from "./middleware.js";
|
|
6
|
-
import { parseBody } from "./body.js";
|
|
7
6
|
export function handleRequest(req, res, FF) {
|
|
8
7
|
Object.setPrototypeOf(res, FFResponse.prototype);
|
|
9
8
|
res.FF = FF;
|
|
@@ -71,19 +70,31 @@ export function handleRequest(req, res, FF) {
|
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
}
|
|
73
|
+
const hasCustomParserEndpoint = matchedMiddlewares.some(middleware => middleware.customParser);
|
|
74
|
+
if (hasCustomParserEndpoint) {
|
|
75
|
+
logger.debug("Executing custom parser endpoint");
|
|
76
|
+
req.body = {};
|
|
77
|
+
next();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
74
80
|
if (req.method === "GET" ||
|
|
75
81
|
req.method === "HEAD" ||
|
|
76
82
|
req.method === "OPTIONS") {
|
|
83
|
+
logger.debug("Method does not require body. Executing middlewares");
|
|
77
84
|
req.body = {};
|
|
78
85
|
next();
|
|
79
86
|
return;
|
|
80
87
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
req.body = {};
|
|
89
|
+
let bodyParserIndex = 0;
|
|
90
|
+
function nextBodyParser() {
|
|
91
|
+
if (bodyParserIndex >= FF.bodyParsers.length) {
|
|
92
|
+
logger.debug("No more body parsers. Executing middlewares");
|
|
93
|
+
return next();
|
|
94
|
+
}
|
|
95
|
+
logger.debug(`Executing body parser ${bodyParserIndex} of ${FF.bodyParsers.length}`);
|
|
96
|
+
const bodyParser = FF.bodyParsers[bodyParserIndex++];
|
|
97
|
+
bodyParser(req, res, nextBodyParser);
|
|
98
|
+
}
|
|
99
|
+
nextBodyParser();
|
|
89
100
|
}
|
package/dist/router.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PluginSystem } from "./plugin.js";
|
|
2
2
|
import { Method, Middleware, RouteHandler, StaticServeOptions } from "./types.js";
|
|
3
|
+
import { SSEManager } from "./sse.js";
|
|
3
4
|
export type MiddlewareFn = RouteHandler | Router | PluginSystem;
|
|
4
5
|
export declare class Router {
|
|
5
6
|
middlewares: Middleware[];
|
|
@@ -11,5 +12,6 @@ export declare class Router {
|
|
|
11
12
|
delete(path: string, ...handlers: RouteHandler[]): this;
|
|
12
13
|
all(path: string, ...handlers: RouteHandler[]): this;
|
|
13
14
|
static(apiPath: string, dirPath?: string, opts?: StaticServeOptions): this;
|
|
14
|
-
sse(path: string, ...handlers: RouteHandler[]):
|
|
15
|
+
sse(path: string, ...handlers: RouteHandler[]): SSEManager;
|
|
16
|
+
customParser(path: string, handler: RouteHandler, method?: Method): this;
|
|
15
17
|
}
|
package/dist/router.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { handleStaticFiles } from "./helpers.js";
|
|
2
2
|
import { PluginSystem } from "./plugin.js";
|
|
3
|
+
import { SSEManager } from "./sse.js";
|
|
3
4
|
export class Router {
|
|
4
5
|
middlewares = [];
|
|
5
6
|
addRoute(method, path, ...handlers) {
|
|
@@ -59,8 +60,15 @@ export class Router {
|
|
|
59
60
|
return this;
|
|
60
61
|
}
|
|
61
62
|
sse(path, ...handlers) {
|
|
62
|
-
const
|
|
63
|
-
|
|
63
|
+
const lastHandler = handlers.pop() || (() => { });
|
|
64
|
+
const manager = new SSEManager();
|
|
65
|
+
handlers.push(manager.getMiddleware(lastHandler));
|
|
66
|
+
this.addRoute("get", path, ...handlers);
|
|
67
|
+
return manager;
|
|
68
|
+
}
|
|
69
|
+
customParser(path, handler, method = "post") {
|
|
70
|
+
const index = this.addRoute(method, path, handler);
|
|
71
|
+
this.middlewares[index - 1].customParser = true;
|
|
64
72
|
return this;
|
|
65
73
|
}
|
|
66
74
|
}
|
package/dist/sse.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FFRequest, RouteHandler } from "./types.js";
|
|
2
|
+
import { FFResponse } from "./res.js";
|
|
3
|
+
export declare class SSEManager {
|
|
4
|
+
private clients;
|
|
5
|
+
getMiddleware(lastHandler?: RouteHandler): RouteHandler;
|
|
6
|
+
getClients(): Map<string, {
|
|
7
|
+
req: FFRequest;
|
|
8
|
+
res: FFResponse;
|
|
9
|
+
}>;
|
|
10
|
+
sendAll(data: any): void;
|
|
11
|
+
sendTo(id: string, data: any): void;
|
|
12
|
+
disconnect(id: string): void;
|
|
13
|
+
}
|
package/dist/sse.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { randomUUID } from "crypto";
|
|
2
|
+
export class SSEManager {
|
|
3
|
+
clients = new Map();
|
|
4
|
+
getMiddleware(lastHandler) {
|
|
5
|
+
return (req, res, next) => {
|
|
6
|
+
res.sseInit();
|
|
7
|
+
const id = randomUUID();
|
|
8
|
+
this.clients.set(id, { req, res });
|
|
9
|
+
req.on("close", () => {
|
|
10
|
+
this.clients.delete(id);
|
|
11
|
+
});
|
|
12
|
+
req.sseId = id;
|
|
13
|
+
lastHandler?.(req, res, next);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
getClients() {
|
|
17
|
+
return this.clients;
|
|
18
|
+
}
|
|
19
|
+
sendAll(data) {
|
|
20
|
+
for (const { res } of this.clients.values()) {
|
|
21
|
+
res.sseSend(data);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
sendTo(id, data) {
|
|
25
|
+
const client = this.clients.get(id);
|
|
26
|
+
if (client) {
|
|
27
|
+
client.res.sseSend(data);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
disconnect(id) {
|
|
31
|
+
const client = this.clients.get(id);
|
|
32
|
+
if (client) {
|
|
33
|
+
client.res.end();
|
|
34
|
+
this.clients.delete(id);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,11 +15,10 @@ export interface Query {
|
|
|
15
15
|
export interface Body {
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export type ParseBodyFunction = (body: string, req: FFRequest, FF: FalconFrame) => Promise<Record<string, any>>;
|
|
19
|
+
export interface StandardBodyParserOptions {
|
|
20
|
+
limit?: string | number;
|
|
21
21
|
}
|
|
22
|
-
export type ParseBodyFunction = (body: string, req: FFRequest, FF: FalconFrame) => Promise<ParseBody>;
|
|
23
22
|
export declare class FFRequest extends http.IncomingMessage {
|
|
24
23
|
path: string;
|
|
25
24
|
query: Query;
|
|
@@ -28,6 +27,7 @@ export declare class FFRequest extends http.IncomingMessage {
|
|
|
28
27
|
body: Body;
|
|
29
28
|
valid: (schema: ValidationSchema) => ValidationResult;
|
|
30
29
|
middleware: Middleware;
|
|
30
|
+
sseId?: string;
|
|
31
31
|
}
|
|
32
32
|
export interface Middleware {
|
|
33
33
|
path: string;
|
|
@@ -35,7 +35,7 @@ export interface Middleware {
|
|
|
35
35
|
middleware: RouteHandler;
|
|
36
36
|
use?: true;
|
|
37
37
|
router?: Middleware[];
|
|
38
|
-
|
|
38
|
+
customParser?: true;
|
|
39
39
|
}
|
|
40
40
|
export interface CookieOptions {
|
|
41
41
|
maxAge?: number;
|
package/dist/types.js
CHANGED