@fncts/express 0.0.43 → 0.0.45
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/LICENSE +26 -0
- package/RequestHandlerIO.d.ts +2 -4
- package/_cjs/ExitHandler.cjs +16 -16
- package/_cjs/ExitHandler.cjs.map +1 -1
- package/_cjs/ExpressApp.cjs +65 -61
- package/_cjs/ExpressApp.cjs.map +1 -1
- package/_cjs/ExpressAppConfig.cjs +19 -17
- package/_cjs/ExpressAppConfig.cjs.map +1 -1
- package/_cjs/RequestHandlerIO.cjs +0 -2
- package/_cjs/chunk.cjs +28 -0
- package/_cjs/errors.cjs +18 -18
- package/_cjs/errors.cjs.map +1 -1
- package/_cjs/global.cjs +0 -2
- package/_cjs/index.cjs +119 -146
- package/_cjs/index.cjs.map +1 -1
- package/_mjs/ExitHandler.mjs +11 -9
- package/_mjs/ExitHandler.mjs.map +1 -1
- package/_mjs/ExpressApp.mjs +44 -44
- package/_mjs/ExpressApp.mjs.map +1 -1
- package/_mjs/ExpressAppConfig.mjs +13 -9
- package/_mjs/ExpressAppConfig.mjs.map +1 -1
- package/_mjs/RequestHandlerIO.mjs +0 -2
- package/_mjs/errors.mjs +18 -12
- package/_mjs/errors.mjs.map +1 -1
- package/_mjs/global.mjs +0 -2
- package/_mjs/index.mjs +77 -50
- package/_mjs/index.mjs.map +1 -1
- package/_src/RequestHandlerIO.ts +2 -5
- package/package.json +6 -2
- package/_cjs/RequestHandlerIO.cjs.map +0 -1
- package/_cjs/global.cjs.map +0 -1
- package/_mjs/RequestHandlerIO.mjs.map +0 -1
- package/_mjs/global.mjs.map +0 -1
package/_mjs/index.mjs
CHANGED
|
@@ -1,56 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
import { NodeServerCloseError, NodeServerListenError } from "./errors.mjs";
|
|
2
|
+
import { defaultExitHandler } from "./ExitHandler.mjs";
|
|
3
|
+
import { ExpressAppConfigTag, LiveExpressAppConfig } from "./ExpressAppConfig.mjs";
|
|
4
|
+
import { ExpressAppTag, LiveExpress, LiveExpressApp, expressRuntime, makeExpressApp } from "./ExpressApp.mjs";
|
|
5
|
+
import "./RequestHandlerIO.mjs";
|
|
2
6
|
import * as tsplus_module_1 from "@fncts/io/IO/api";
|
|
3
7
|
import * as tsplus_module_2 from "@fncts/io/IO/api/environment";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
//#region build/esm/index.js
|
|
9
|
+
const fileName_1 = "(@fncts/express) src/index.ts";
|
|
10
|
+
const methods = [
|
|
11
|
+
"all",
|
|
12
|
+
"get",
|
|
13
|
+
"post",
|
|
14
|
+
"put",
|
|
15
|
+
"delete",
|
|
16
|
+
"patch",
|
|
17
|
+
"options",
|
|
18
|
+
"head",
|
|
19
|
+
"checkout",
|
|
20
|
+
"connect",
|
|
21
|
+
"copy",
|
|
22
|
+
"lock",
|
|
23
|
+
"merge",
|
|
24
|
+
"mkactivity",
|
|
25
|
+
"mkcol",
|
|
26
|
+
"move",
|
|
27
|
+
"m-search",
|
|
28
|
+
"notify",
|
|
29
|
+
"propfind",
|
|
30
|
+
"proppatch",
|
|
31
|
+
"purge",
|
|
32
|
+
"report",
|
|
33
|
+
"search",
|
|
34
|
+
"subscribe",
|
|
35
|
+
"trace",
|
|
36
|
+
"unlock",
|
|
37
|
+
"unsubscribe"
|
|
38
|
+
];
|
|
39
|
+
function match(method) {
|
|
40
|
+
return function(path, ...handlers) {
|
|
41
|
+
return tsplus_module_1.flatMap((expressHandlers) => tsplus_module_2.serviceWithIO((service) => tsplus_module_1.succeed(() => service.app[method](path, ...expressHandlers), fileName_1 + ":71:44"), ExpressAppTag, fileName_1 + ":70:23"), fileName_1 + ":69:84")(expressRuntime(handlers));
|
|
42
|
+
};
|
|
15
43
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return tsplus_module_1.flatMap(expressHandlers => tsplus_module_1.succeed(() => service.app.use(args[0], ...expressHandlers), fileName_1 + ":109:19"), fileName_1 + ":108:91")(expressRuntime(args.slice(1) ?? []));
|
|
22
|
-
}
|
|
23
|
-
}, ExpressAppTag, fileName_1 + ":102:26"), fileName_1 + ":112:20");
|
|
44
|
+
function use(...args) {
|
|
45
|
+
return tsplus_module_1.asUnit(tsplus_module_2.serviceWithIO((service) => {
|
|
46
|
+
if (typeof args[0] === "function") return tsplus_module_1.flatMap((expressHandlers) => tsplus_module_1.succeed(() => service.app.use(...expressHandlers), fileName_1 + ":105:19"), fileName_1 + ":104:74")(expressRuntime(args));
|
|
47
|
+
else return tsplus_module_1.flatMap((expressHandlers) => tsplus_module_1.succeed(() => service.app.use(args[0], ...expressHandlers), fileName_1 + ":109:19"), fileName_1 + ":108:91")(expressRuntime(args.slice(1) ?? []));
|
|
48
|
+
}, ExpressAppTag, fileName_1 + ":102:26"), fileName_1 + ":112:20");
|
|
24
49
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const delete_ =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (req, res, next) => tsplus_module_1.succeed(() => _(req, res, next), fileName_1 + ":150:40");
|
|
50
|
+
const all = match("all");
|
|
51
|
+
const get = match("get");
|
|
52
|
+
const post = match("post");
|
|
53
|
+
const put = match("put");
|
|
54
|
+
const delete_ = match("delete");
|
|
55
|
+
const patch = match("patch");
|
|
56
|
+
const options = match("options");
|
|
57
|
+
const head = match("head");
|
|
58
|
+
const checkout = match("checkout");
|
|
59
|
+
const connect = match("connect");
|
|
60
|
+
const copy = match("copy");
|
|
61
|
+
const lock = match("lock");
|
|
62
|
+
const merge = match("merge");
|
|
63
|
+
const mkactivity = match("mkactivity");
|
|
64
|
+
const mkcol = match("mkcol");
|
|
65
|
+
const move = match("move");
|
|
66
|
+
const mSearch = match("m-search");
|
|
67
|
+
const notify = match("notify");
|
|
68
|
+
const propfind = match("propfind");
|
|
69
|
+
const proppatch = match("proppatch");
|
|
70
|
+
const purge = match("purge");
|
|
71
|
+
const report = match("report");
|
|
72
|
+
const search = match("search");
|
|
73
|
+
const subscribe = match("subscribe");
|
|
74
|
+
const trace = match("trace");
|
|
75
|
+
const unlock = match("unlock");
|
|
76
|
+
const unsubscribe = match("unsubscribe");
|
|
77
|
+
function classic(_) {
|
|
78
|
+
return (req, res, next) => tsplus_module_1.succeed(() => _(req, res, next), fileName_1 + ":150:40");
|
|
55
79
|
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { ExpressAppConfigTag, ExpressAppTag, LiveExpress, LiveExpressApp, LiveExpressAppConfig, NodeServerCloseError, NodeServerListenError, all, checkout, classic, connect, copy, defaultExitHandler, delete_ as delete, expressRuntime, get, head, lock, mSearch, makeExpressApp, match, merge, methods, mkactivity, mkcol, move, notify, options, patch, post, propfind, proppatch, purge, put, report, search, subscribe, trace, unlock, unsubscribe, use };
|
|
82
|
+
|
|
56
83
|
//# sourceMappingURL=index.mjs.map
|
package/_mjs/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../esm/index.js"],"sourcesContent":["const fileName_1 = \"(@fncts/express) src/index.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api/environment\";\nimport { ExpressAppTag, expressRuntime } from \"./ExpressApp.js\";\nexport * from \"./errors.js\";\nexport * from \"./ExitHandler.js\";\nexport * from \"./ExpressApp.js\";\nexport * from \"./ExpressAppConfig.js\";\nexport * from \"./RequestHandlerIO.js\";\nexport const methods = [\n \"all\",\n \"get\",\n \"post\",\n \"put\",\n \"delete\",\n \"patch\",\n \"options\",\n \"head\",\n \"checkout\",\n \"connect\",\n \"copy\",\n \"lock\",\n \"merge\",\n \"mkactivity\",\n \"mkcol\",\n \"move\",\n \"m-search\",\n \"notify\",\n \"propfind\",\n \"proppatch\",\n \"purge\",\n \"report\",\n \"search\",\n \"subscribe\",\n \"trace\",\n \"unlock\",\n \"unsubscribe\",\n];\nexport function match(method) {\n return function (path, ...handlers) {\n return tsplus_module_1.flatMap((expressHandlers) => tsplus_module_2.serviceWithIO((service) => tsplus_module_1.succeed(() => service.app[method](path, ...expressHandlers), fileName_1 + \":71:44\"), ExpressAppTag, fileName_1 + \":70:23\"), fileName_1 + \":69:84\")(expressRuntime(handlers));\n };\n}\nexport function use(...args) {\n return tsplus_module_1.asUnit(tsplus_module_2.serviceWithIO((service) => {\n if (typeof args[0] === \"function\") {\n return tsplus_module_1.flatMap((expressHandlers) => tsplus_module_1.succeed(() => service.app.use(...expressHandlers), fileName_1 + \":105:19\"), fileName_1 + \":104:74\")(expressRuntime(args));\n }\n else {\n return tsplus_module_1.flatMap((expressHandlers) => tsplus_module_1.succeed(() => service.app.use(args[0], ...expressHandlers), fileName_1 + \":109:19\"), fileName_1 + \":108:91\")(expressRuntime(args.slice(1) ?? []));\n }\n }, ExpressAppTag, fileName_1 + \":102:26\"), fileName_1 + \":112:20\");\n}\nexport const all = match(\"all\");\nexport const get = match(\"get\");\nexport const post = match(\"post\");\nexport const put = match(\"put\");\nconst delete_ = match(\"delete\");\nexport { delete_ as delete };\nexport const patch = match(\"patch\");\nexport const options = match(\"options\");\nexport const head = match(\"head\");\nexport const checkout = match(\"checkout\");\nexport const connect = match(\"connect\");\nexport const copy = match(\"copy\");\nexport const lock = match(\"lock\");\nexport const merge = match(\"merge\");\nexport const mkactivity = match(\"mkactivity\");\nexport const mkcol = match(\"mkcol\");\nexport const move = match(\"move\");\nexport const mSearch = match(\"m-search\");\nexport const notify = match(\"notify\");\nexport const propfind = match(\"propfind\");\nexport const proppatch = match(\"proppatch\");\nexport const purge = match(\"purge\");\nexport const report = match(\"report\");\nexport const search = match(\"search\");\nexport const subscribe = match(\"subscribe\");\nexport const trace = match(\"trace\");\nexport const unlock = match(\"unlock\");\nexport const unsubscribe = match(\"unsubscribe\");\nexport function classic(_) {\n return (req, res, next) => tsplus_module_1.succeed(() => _(req, res, next), fileName_1 + \":150:40\");\n}\n//# sourceMappingURL=index.js.map"],"mappings":";;;;;;;;AAAA,MAAM,aAAa;AASnB,MAAa,UAAU;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACH;AACD,SAAgB,MAAM,QAAQ;AAC1B,QAAO,SAAU,MAAM,GAAG,UAAU;AAChC,SAAO,gBAAgB,SAAS,oBAAoB,gBAAgB,eAAe,YAAY,gBAAgB,cAAc,QAAQ,IAAI,QAAQ,MAAM,GAAG,gBAAgB,EAAE,aAAa,SAAS,EAAE,eAAe,aAAa,SAAS,EAAE,aAAa,SAAS,CAAC,eAAe,SAAS,CAAC;;;AAGnS,SAAgB,IAAI,GAAG,MAAM;AACzB,QAAO,gBAAgB,OAAO,gBAAgB,eAAe,YAAY;AACrE,MAAI,OAAO,KAAK,OAAO,WACnB,QAAO,gBAAgB,SAAS,oBAAoB,gBAAgB,cAAc,QAAQ,IAAI,IAAI,GAAG,gBAAgB,EAAE,aAAa,UAAU,EAAE,aAAa,UAAU,CAAC,eAAe,KAAK,CAAC;MAG7L,QAAO,gBAAgB,SAAS,oBAAoB,gBAAgB,cAAc,QAAQ,IAAI,IAAI,KAAK,IAAI,GAAG,gBAAgB,EAAE,aAAa,UAAU,EAAE,aAAa,UAAU,CAAC,eAAe,KAAK,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1N,eAAe,aAAa,UAAU,EAAE,aAAa,UAAU;;AAEtE,MAAa,MAAM,MAAM,MAAM;AAC/B,MAAa,MAAM,MAAM,MAAM;AAC/B,MAAa,OAAO,MAAM,OAAO;AACjC,MAAa,MAAM,MAAM,MAAM;AAC/B,MAAM,UAAU,MAAM,SAAS;AAE/B,MAAa,QAAQ,MAAM,QAAQ;AACnC,MAAa,UAAU,MAAM,UAAU;AACvC,MAAa,OAAO,MAAM,OAAO;AACjC,MAAa,WAAW,MAAM,WAAW;AACzC,MAAa,UAAU,MAAM,UAAU;AACvC,MAAa,OAAO,MAAM,OAAO;AACjC,MAAa,OAAO,MAAM,OAAO;AACjC,MAAa,QAAQ,MAAM,QAAQ;AACnC,MAAa,aAAa,MAAM,aAAa;AAC7C,MAAa,QAAQ,MAAM,QAAQ;AACnC,MAAa,OAAO,MAAM,OAAO;AACjC,MAAa,UAAU,MAAM,WAAW;AACxC,MAAa,SAAS,MAAM,SAAS;AACrC,MAAa,WAAW,MAAM,WAAW;AACzC,MAAa,YAAY,MAAM,YAAY;AAC3C,MAAa,QAAQ,MAAM,QAAQ;AACnC,MAAa,SAAS,MAAM,SAAS;AACrC,MAAa,SAAS,MAAM,SAAS;AACrC,MAAa,YAAY,MAAM,YAAY;AAC3C,MAAa,QAAQ,MAAM,QAAQ;AACnC,MAAa,SAAS,MAAM,SAAS;AACrC,MAAa,cAAc,MAAM,cAAc;AAC/C,SAAgB,QAAQ,GAAG;AACvB,SAAQ,KAAK,KAAK,SAAS,gBAAgB,cAAc,EAAE,KAAK,KAAK,KAAK,EAAE,aAAa,UAAU"}
|
package/_src/RequestHandlerIO.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { NextFunction, Request, Response } from "express";
|
|
2
2
|
import type { RouteParameters } from "express-serve-static-core";
|
|
3
|
-
|
|
4
|
-
export interface ParsedQs {
|
|
5
|
-
[key: string]: undefined | string | string[] | ParsedQs | ParsedQs[];
|
|
6
|
-
}
|
|
3
|
+
import type qs from "qs";
|
|
7
4
|
|
|
8
5
|
export interface RequestHandlerIO<
|
|
9
6
|
R,
|
|
@@ -11,7 +8,7 @@ export interface RequestHandlerIO<
|
|
|
11
8
|
P = RouteParameters<Route>,
|
|
12
9
|
ResBody = any,
|
|
13
10
|
ReqBody = any,
|
|
14
|
-
ReqQuery = ParsedQs,
|
|
11
|
+
ReqQuery = qs.ParsedQs,
|
|
15
12
|
Locals extends Record<string, any> = Record<string, any>,
|
|
16
13
|
> {
|
|
17
14
|
(
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fncts/express",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/0x706b/fncts"
|
|
7
|
+
},
|
|
4
8
|
"dependencies": {
|
|
5
|
-
"@fncts/io": "0.0.
|
|
9
|
+
"@fncts/io": "0.0.52"
|
|
6
10
|
},
|
|
7
11
|
"peerDependencies": {
|
|
8
12
|
"express": "^4.18.1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestHandlerIO.cjs","names":[],"sources":["../_src/RequestHandlerIO.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
|
package/_cjs/global.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global.cjs","names":[],"sources":["../_src/global.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestHandlerIO.mjs","names":[],"sources":["../_src/RequestHandlerIO.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
|
package/_mjs/global.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global.mjs","names":[],"sources":["../_src/global.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
|