@fncts/http 0.0.11 → 0.0.13
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/_cjs/Body/api.cjs +62 -65
- package/_cjs/Body/api.cjs.map +1 -1
- package/_cjs/Body/definition.cjs +66 -65
- package/_cjs/Body/definition.cjs.map +1 -1
- package/_cjs/Body.cjs +20 -28
- package/_cjs/BodyError.cjs +33 -38
- package/_cjs/BodyError.cjs.map +1 -1
- package/_cjs/Headers.cjs +70 -74
- package/_cjs/Headers.cjs.map +1 -1
- package/_cjs/HttpApp.cjs +102 -94
- package/_cjs/HttpApp.cjs.map +1 -1
- package/_cjs/IncomingMessage/api.cjs +24 -23
- package/_cjs/IncomingMessage/api.cjs.map +1 -1
- package/_cjs/IncomingMessage/definition.cjs +12 -17
- package/_cjs/IncomingMessage/definition.cjs.map +1 -1
- package/_cjs/IncomingMessage.cjs +8 -28
- package/_cjs/Method.cjs +6 -7
- package/_cjs/Method.cjs.map +1 -1
- package/_cjs/Middleware.cjs +11 -12
- package/_cjs/Middleware.cjs.map +1 -1
- package/_cjs/QueryParams.cjs +0 -2
- package/_cjs/RequestError.cjs +17 -17
- package/_cjs/RequestError.cjs.map +1 -1
- package/_cjs/ResponseError.cjs +26 -25
- package/_cjs/ResponseError.cjs.map +1 -1
- package/_cjs/Route/api.cjs +87 -74
- package/_cjs/Route/api.cjs.map +1 -1
- package/_cjs/Route/definition.cjs +29 -34
- package/_cjs/Route/definition.cjs.map +1 -1
- package/_cjs/Route/internal.cjs +33 -27
- package/_cjs/Route/internal.cjs.map +1 -1
- package/_cjs/Route.cjs +23 -28
- package/_cjs/RouteNotFound.cjs +16 -16
- package/_cjs/RouteNotFound.cjs.map +1 -1
- package/_cjs/Router/api.cjs +127 -119
- package/_cjs/Router/api.cjs.map +1 -1
- package/_cjs/Router/definition.cjs +14 -19
- package/_cjs/Router/definition.cjs.map +1 -1
- package/_cjs/Router/internal.cjs +75 -79
- package/_cjs/Router/internal.cjs.map +1 -1
- package/_cjs/Router.cjs +24 -28
- package/_cjs/Server.cjs +38 -41
- package/_cjs/Server.cjs.map +1 -1
- package/_cjs/ServerError.cjs +18 -19
- package/_cjs/ServerError.cjs.map +1 -1
- package/_cjs/ServerRequest/api.cjs +9 -10
- package/_cjs/ServerRequest/api.cjs.map +1 -1
- package/_cjs/ServerRequest/definition.cjs +21 -25
- package/_cjs/ServerRequest/definition.cjs.map +1 -1
- package/_cjs/ServerRequest/internal.cjs +77 -74
- package/_cjs/ServerRequest/internal.cjs.map +1 -1
- package/_cjs/ServerRequest.cjs +7 -28
- package/_cjs/ServerResponse/api.cjs +108 -116
- package/_cjs/ServerResponse/api.cjs.map +1 -1
- package/_cjs/ServerResponse/definition.cjs +36 -39
- package/_cjs/ServerResponse/definition.cjs.map +1 -1
- package/_cjs/ServerResponse.cjs +18 -28
- package/_cjs/Socket.cjs +213 -193
- package/_cjs/Socket.cjs.map +1 -1
- package/_cjs/UrlParams.cjs +23 -26
- package/_cjs/UrlParams.cjs.map +1 -1
- package/_cjs/chunk.cjs +28 -0
- package/_cjs/global.cjs +0 -2
- package/_mjs/Body/api.mjs +54 -56
- package/_mjs/Body/api.mjs.map +1 -1
- package/_mjs/Body/definition.mjs +61 -55
- package/_mjs/Body/definition.mjs.map +1 -1
- package/_mjs/Body.mjs +3 -4
- package/_mjs/BodyError.mjs +30 -30
- package/_mjs/BodyError.mjs.map +1 -1
- package/_mjs/Headers.mjs +61 -64
- package/_mjs/Headers.mjs.map +1 -1
- package/_mjs/HttpApp.mjs +74 -79
- package/_mjs/HttpApp.mjs.map +1 -1
- package/_mjs/IncomingMessage/api.mjs +21 -17
- package/_mjs/IncomingMessage/api.mjs.map +1 -1
- package/_mjs/IncomingMessage/definition.mjs +11 -11
- package/_mjs/IncomingMessage/definition.mjs.map +1 -1
- package/_mjs/IncomingMessage.mjs +3 -4
- package/_mjs/Method.mjs +6 -2
- package/_mjs/Method.mjs.map +1 -1
- package/_mjs/Middleware.mjs +10 -6
- package/_mjs/Middleware.mjs.map +1 -1
- package/_mjs/QueryParams.mjs +0 -2
- package/_mjs/RequestError.mjs +16 -11
- package/_mjs/RequestError.mjs.map +1 -1
- package/_mjs/ResponseError.mjs +25 -19
- package/_mjs/ResponseError.mjs.map +1 -1
- package/_mjs/Route/api.mjs +68 -64
- package/_mjs/Route/api.mjs.map +1 -1
- package/_mjs/Route/definition.mjs +21 -24
- package/_mjs/Route/definition.mjs.map +1 -1
- package/_mjs/Route/internal.mjs +30 -19
- package/_mjs/Route/internal.mjs.map +1 -1
- package/_mjs/Route.mjs +3 -4
- package/_mjs/RouteNotFound.mjs +15 -10
- package/_mjs/RouteNotFound.mjs.map +1 -1
- package/_mjs/Router/api.mjs +105 -107
- package/_mjs/Router/api.mjs.map +1 -1
- package/_mjs/Router/definition.mjs +11 -12
- package/_mjs/Router/definition.mjs.map +1 -1
- package/_mjs/Router/internal.mjs +55 -63
- package/_mjs/Router/internal.mjs.map +1 -1
- package/_mjs/Router.mjs +3 -4
- package/_mjs/Server.mjs +28 -31
- package/_mjs/Server.mjs.map +1 -1
- package/_mjs/ServerError.mjs +14 -11
- package/_mjs/ServerError.mjs.map +1 -1
- package/_mjs/ServerRequest/api.mjs +8 -4
- package/_mjs/ServerRequest/api.mjs.map +1 -1
- package/_mjs/ServerRequest/definition.mjs +15 -16
- package/_mjs/ServerRequest/definition.mjs.map +1 -1
- package/_mjs/ServerRequest/internal.mjs +65 -64
- package/_mjs/ServerRequest/internal.mjs.map +1 -1
- package/_mjs/ServerRequest.mjs +3 -4
- package/_mjs/ServerResponse/api.mjs +97 -106
- package/_mjs/ServerResponse/api.mjs.map +1 -1
- package/_mjs/ServerResponse/definition.mjs +30 -30
- package/_mjs/ServerResponse/definition.mjs.map +1 -1
- package/_mjs/ServerResponse.mjs +3 -4
- package/_mjs/Socket.mjs +152 -157
- package/_mjs/Socket.mjs.map +1 -1
- package/_mjs/UrlParams.mjs +22 -19
- package/_mjs/UrlParams.mjs.map +1 -1
- package/_mjs/global.mjs +0 -2
- package/_src/Headers.ts +1 -1
- package/_src/Socket.ts +1 -0
- package/_src/UrlParams.ts +1 -1
- package/package.json +10 -6
- package/_cjs/Body.cjs.map +0 -1
- package/_cjs/IncomingMessage.cjs.map +0 -1
- package/_cjs/QueryParams.cjs.map +0 -1
- package/_cjs/Route.cjs.map +0 -1
- package/_cjs/Router.cjs.map +0 -1
- package/_cjs/ServerRequest.cjs.map +0 -1
- package/_cjs/ServerResponse.cjs.map +0 -1
- package/_cjs/global.cjs.map +0 -1
- package/_mjs/Body.mjs.map +0 -1
- package/_mjs/IncomingMessage.mjs.map +0 -1
- package/_mjs/QueryParams.mjs.map +0 -1
- package/_mjs/Route.mjs.map +0 -1
- package/_mjs/Router.mjs.map +0 -1
- package/_mjs/ServerRequest.mjs.map +0 -1
- package/_mjs/ServerResponse.mjs.map +0 -1
- package/_mjs/global.mjs.map +0 -1
package/_mjs/Router/api.mjs
CHANGED
|
@@ -1,138 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
1
|
+
import { RouteImpl } from "../Route/internal.mjs";
|
|
2
|
+
import { RouterInternal } from "./internal.mjs";
|
|
3
|
+
import * as tsplus_module_6 from "@fncts/io/IO/api";
|
|
4
4
|
import * as tsplus_module_3 from "@fncts/base/collection/immutable/Conc/constructors";
|
|
5
5
|
import * as tsplus_module_4 from "@fncts/base/data/Maybe/constructors";
|
|
6
|
-
import * as tsplus_module_5 from "@fncts/base/data/Maybe/api";
|
|
7
|
-
import * as tsplus_module_6 from "@fncts/io/IO/api";
|
|
8
6
|
import * as tsplus_module_7 from "@fncts/io/IO/api/environment";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
import * as tsplus_module_1 from "@fncts/base/collection/immutable/Conc/api/empty";
|
|
8
|
+
import * as tsplus_module_2 from "@fncts/base/collection/immutable/Conc/api";
|
|
9
|
+
import * as tsplus_module_5 from "@fncts/base/data/Maybe/api";
|
|
10
|
+
//#region build/esm/Router/api.js
|
|
11
|
+
const fileName_1 = "(@fncts/http) src/Router/api.ts";
|
|
12
|
+
const use = use_1;
|
|
13
|
+
const from = from_1;
|
|
14
|
+
const concat = concat_1;
|
|
15
|
+
const prefixAll = prefixAll_1;
|
|
16
|
+
/**
|
|
17
|
+
* @tsplus static fncts.http.RouterOps empty
|
|
18
|
+
*/
|
|
19
|
+
const empty = new RouterInternal(tsplus_module_1.empty(), tsplus_module_1.empty());
|
|
20
|
+
function route(method) {
|
|
21
|
+
return (path, handler) => (self) => new RouterInternal(tsplus_module_2.append(new RouteImpl(method, path, handler))(self.routes), self.mounts);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
24
|
+
* @tsplus pipeable fncts.http.Router get
|
|
25
|
+
* @tsplus static fncts.http.RouterOps get
|
|
26
|
+
*/
|
|
27
|
+
const get = route("GET");
|
|
28
|
+
/**
|
|
29
|
+
* @tsplus pipeable fncts.http.Router post
|
|
30
|
+
* @tsplus static fncts.http.RouterOps post
|
|
31
|
+
*/
|
|
32
|
+
const post = route("POST");
|
|
33
|
+
/**
|
|
34
|
+
* @tsplus pipeable fncts.http.Router put
|
|
35
|
+
* @tsplus static fncts.http.RouterOps put
|
|
36
|
+
*/
|
|
37
|
+
const put = route("PUT");
|
|
38
|
+
/**
|
|
39
|
+
* @tsplus pipeable fncts.http.Router patch
|
|
40
|
+
* @tsplus static fncts.http.RouterOps patch
|
|
41
|
+
*/
|
|
42
|
+
const patch = route("PATCH");
|
|
43
|
+
/**
|
|
44
|
+
* @tsplus pipeable fncts.http.Router del
|
|
45
|
+
* @tsplus static fncts.http.RouterOps del
|
|
46
|
+
*/
|
|
47
|
+
const del = route("DELETE");
|
|
48
|
+
/**
|
|
49
|
+
* @tsplus pipeable fncts.http.Router head
|
|
50
|
+
* @tsplus static fncts.http.RouterOps head
|
|
51
|
+
*/
|
|
52
|
+
const head = route("HEAD");
|
|
53
|
+
/**
|
|
54
|
+
* @tsplus pipeable fncts.http.Router options
|
|
55
|
+
* @tsplus static fncts.http.RouterOps options
|
|
56
|
+
*/
|
|
57
|
+
const options = route("OPTIONS");
|
|
58
|
+
/**
|
|
59
|
+
* @tsplus pipeable fncts.http.Router use
|
|
60
|
+
* @tsplus static fncts.http.RouterOps use
|
|
61
|
+
*/
|
|
61
62
|
function use_1(f, __tsplusTrace) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
prefix,
|
|
67
|
-
httpApp: f(httpApp)
|
|
68
|
-
}))(self.mounts));
|
|
63
|
+
return (self) => new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path, f(route.handler), route.prefix))(self.routes), tsplus_module_2.map(({ prefix, httpApp }) => ({
|
|
64
|
+
prefix,
|
|
65
|
+
httpApp: f(httpApp)
|
|
66
|
+
}))(self.mounts));
|
|
69
67
|
}
|
|
70
68
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
* @tsplus static fncts.http.RouterOps from
|
|
70
|
+
*/
|
|
73
71
|
function from_1(routes) {
|
|
74
|
-
|
|
72
|
+
return new RouterInternal(tsplus_module_3.from(routes), tsplus_module_1.empty());
|
|
75
73
|
}
|
|
76
74
|
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
* @tsplus static fncts.http.RouterOps routes
|
|
76
|
+
*/
|
|
77
|
+
function routes(...routes) {
|
|
78
|
+
return from_1(routes);
|
|
81
79
|
}
|
|
82
80
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
* @tsplus pipeable fncts.http.Router append
|
|
82
|
+
*/
|
|
83
|
+
function append(route) {
|
|
84
|
+
return (self) => {
|
|
85
|
+
return new RouterInternal(tsplus_module_2.append(route)(self.routes), self.mounts);
|
|
86
|
+
};
|
|
89
87
|
}
|
|
90
88
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
* @tsplus pipeable fncts.http.Router concat
|
|
90
|
+
*/
|
|
93
91
|
function concat_1(that) {
|
|
94
|
-
|
|
92
|
+
return (self) => new RouterInternal(tsplus_module_2.concat(that.routes)(self.routes), self.mounts);
|
|
95
93
|
}
|
|
96
94
|
function removeTrailingSlash(path) {
|
|
97
|
-
|
|
95
|
+
return path.endsWith("/") ? path.slice(0, -1) : path;
|
|
98
96
|
}
|
|
99
97
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
* @tsplus pipeable fncts.http.Router prefixAll
|
|
99
|
+
*/
|
|
102
100
|
function prefixAll_1(prefix) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
httpApp
|
|
111
|
-
}))(self.mounts));
|
|
112
|
-
};
|
|
101
|
+
return (self) => {
|
|
102
|
+
prefix = removeTrailingSlash(prefix);
|
|
103
|
+
return new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path === "/" ? prefix : prefix + route.path, route.handler, tsplus_module_5.orElse(() => tsplus_module_4.just(prefix, fileName_1 + ":150:60"))(tsplus_module_5.map((_) => prefix + _)(route.prefix))))(self.routes), tsplus_module_2.map(({ prefix: path, httpApp }) => ({
|
|
104
|
+
prefix: path === "/" ? prefix : prefix + path,
|
|
105
|
+
httpApp
|
|
106
|
+
}))(self.mounts));
|
|
107
|
+
};
|
|
113
108
|
}
|
|
114
109
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
* @tsplus pipeable fncts.http.Router mount
|
|
111
|
+
*/
|
|
112
|
+
function mount(path, that) {
|
|
113
|
+
return (self) => concat_1(prefixAll_1(path)(that))(self);
|
|
119
114
|
}
|
|
120
115
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
* @tsplus pipeable fncts.http.Router catchAll
|
|
117
|
+
*/
|
|
118
|
+
function catchAll(f, __tsplusTrace) {
|
|
119
|
+
return (self) => use_1((handler) => tsplus_module_6.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);
|
|
125
120
|
}
|
|
126
121
|
/**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
* @tsplus pipeable fncts.http.Router catchAllCause
|
|
123
|
+
*/
|
|
124
|
+
function catchAllCause(f, __tsplusTrace) {
|
|
125
|
+
return (self) => use_1((handler) => tsplus_module_6.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);
|
|
131
126
|
}
|
|
132
127
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
* @tsplus pipeable fncts.http.Router provideService
|
|
129
|
+
*/
|
|
130
|
+
function provideService(service, tag, __tsplusTrace) {
|
|
131
|
+
return (self) => use_1((handler) => tsplus_module_7.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);
|
|
137
132
|
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { append, catchAll, catchAllCause, concat, del, empty, from, get, head, mount, options, patch, post, prefixAll, provideService, put, route, routes, use };
|
|
135
|
+
|
|
138
136
|
//# sourceMappingURL=api.mjs.map
|
package/_mjs/Router/api.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","names":["
|
|
1
|
+
{"version":3,"file":"api.mjs","names":[],"sources":["../../esm/Router/api.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Router/api.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/collection/immutable/Conc/api/empty\";\nimport * as tsplus_module_2 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_4 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/api\";\nimport * as tsplus_module_6 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_7 from \"@fncts/io/IO/api/environment\";\nexport const use = use_1;\nexport const from = from_1;\nexport const concat = concat_1;\nexport const prefixAll = prefixAll_1;\nimport { RouteImpl } from \"../Route/internal.js\";\nimport { RouterInternal } from \"./internal.js\";\n/**\n * @tsplus static fncts.http.RouterOps empty\n */\nexport const empty = new RouterInternal(tsplus_module_1.empty(), tsplus_module_1.empty());\nexport function route(method) {\n return (path, handler) => (self) => new RouterInternal(tsplus_module_2.append(new RouteImpl(method, path, handler))(self.routes), self.mounts);\n}\n/**\n * @tsplus pipeable fncts.http.Router get\n * @tsplus static fncts.http.RouterOps get\n */\nexport const get = route(\"GET\");\n/**\n * @tsplus pipeable fncts.http.Router post\n * @tsplus static fncts.http.RouterOps post\n */\nexport const post = route(\"POST\");\n/**\n * @tsplus pipeable fncts.http.Router put\n * @tsplus static fncts.http.RouterOps put\n */\nexport const put = route(\"PUT\");\n/**\n * @tsplus pipeable fncts.http.Router patch\n * @tsplus static fncts.http.RouterOps patch\n */\nexport const patch = route(\"PATCH\");\n/**\n * @tsplus pipeable fncts.http.Router del\n * @tsplus static fncts.http.RouterOps del\n */\nexport const del = route(\"DELETE\");\n/**\n * @tsplus pipeable fncts.http.Router head\n * @tsplus static fncts.http.RouterOps head\n */\nexport const head = route(\"HEAD\");\n/**\n * @tsplus pipeable fncts.http.Router options\n * @tsplus static fncts.http.RouterOps options\n */\nexport const options = route(\"OPTIONS\");\n/**\n * @tsplus pipeable fncts.http.Router use\n * @tsplus static fncts.http.RouterOps use\n */\nfunction use_1(f, __tsplusTrace) {\n return (self) => new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path, f(route.handler), route.prefix))(self.routes), tsplus_module_2.map(({ prefix, httpApp }) => ({ prefix, httpApp: f(httpApp) }))(self.mounts));\n}\n/**\n * @tsplus static fncts.http.RouterOps from\n */\nfunction from_1(routes) {\n return new RouterInternal(tsplus_module_3.from(routes), tsplus_module_1.empty());\n}\n/**\n * @tsplus static fncts.http.RouterOps routes\n */\nexport function routes(...routes) {\n return from_1(routes);\n}\n/**\n * @tsplus pipeable fncts.http.Router append\n */\nexport function append(route) {\n return (self) => {\n return new RouterInternal(tsplus_module_2.append(route)(self.routes), self.mounts);\n };\n}\n/**\n * @tsplus pipeable fncts.http.Router concat\n */\nfunction concat_1(that) {\n return (self) => new RouterInternal(tsplus_module_2.concat(that.routes)(self.routes), self.mounts);\n}\nfunction removeTrailingSlash(path) {\n return (path.endsWith(\"/\") ? path.slice(0, -1) : path);\n}\n/**\n * @tsplus pipeable fncts.http.Router prefixAll\n */\nfunction prefixAll_1(prefix) {\n return (self) => {\n prefix = removeTrailingSlash(prefix);\n return new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path === \"/\" ? prefix : (prefix + route.path), route.handler, tsplus_module_5.orElse(() => tsplus_module_4.just(prefix, fileName_1 + \":150:60\"))(tsplus_module_5.map((_) => prefix + _)(route.prefix))))(self.routes), tsplus_module_2.map(({ prefix: path, httpApp }) => ({ prefix: path === \"/\" ? prefix : prefix + path, httpApp }))(self.mounts));\n };\n}\n/**\n * @tsplus pipeable fncts.http.Router mount\n */\nexport function mount(path, that) {\n return (self) => concat_1(prefixAll_1(path)(that))(self);\n}\n/**\n * @tsplus pipeable fncts.http.Router catchAll\n */\nexport function catchAll(f, __tsplusTrace) {\n return (self) => use_1((handler) => tsplus_module_6.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);\n}\n/**\n * @tsplus pipeable fncts.http.Router catchAllCause\n */\nexport function catchAllCause(f, __tsplusTrace) {\n return (self) => use_1((handler) => tsplus_module_6.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);\n}\n/**\n * @tsplus pipeable fncts.http.Router provideService\n */\nexport function provideService(service, tag, __tsplusTrace) {\n return (self) => use_1((handler) => tsplus_module_7.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);\n}\n//# sourceMappingURL=api.js.map"],"mappings":";;;;;;;;;;AAAA,MAAM,aAAa;AAQnB,MAAa,MAAM;AACnB,MAAa,OAAO;AACpB,MAAa,SAAS;AACtB,MAAa,YAAY;;;;AAMzB,MAAa,QAAQ,IAAI,eAAe,gBAAgB,OAAO,EAAE,gBAAgB,OAAO,CAAC;AACzF,SAAgB,MAAM,QAAQ;AAC1B,SAAQ,MAAM,aAAa,SAAS,IAAI,eAAe,gBAAgB,OAAO,IAAI,UAAU,QAAQ,MAAM,QAAQ,CAAC,CAAC,KAAK,OAAO,EAAE,KAAK,OAAO;;;;;;AAMlJ,MAAa,MAAM,MAAM,MAAM;;;;;AAK/B,MAAa,OAAO,MAAM,OAAO;;;;;AAKjC,MAAa,MAAM,MAAM,MAAM;;;;;AAK/B,MAAa,QAAQ,MAAM,QAAQ;;;;;AAKnC,MAAa,MAAM,MAAM,SAAS;;;;;AAKlC,MAAa,OAAO,MAAM,OAAO;;;;;AAKjC,MAAa,UAAU,MAAM,UAAU;;;;;AAKvC,SAAS,MAAM,GAAG,eAAe;AAC7B,SAAQ,SAAS,IAAI,eAAe,gBAAgB,KAAK,UAAU,IAAI,UAAU,MAAM,QAAQ,MAAM,MAAM,EAAE,MAAM,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,KAAK,OAAO,EAAE,gBAAgB,KAAK,EAAE,QAAQ,eAAe;EAAE;EAAQ,SAAS,EAAE,QAAQ;EAAE,EAAE,CAAC,KAAK,OAAO,CAAC;;;;;AAK3P,SAAS,OAAO,QAAQ;AACpB,QAAO,IAAI,eAAe,gBAAgB,KAAK,OAAO,EAAE,gBAAgB,OAAO,CAAC;;;;;AAKpF,SAAgB,OAAO,GAAG,QAAQ;AAC9B,QAAO,OAAO,OAAO;;;;;AAKzB,SAAgB,OAAO,OAAO;AAC1B,SAAQ,SAAS;AACb,SAAO,IAAI,eAAe,gBAAgB,OAAO,MAAM,CAAC,KAAK,OAAO,EAAE,KAAK,OAAO;;;;;;AAM1F,SAAS,SAAS,MAAM;AACpB,SAAQ,SAAS,IAAI,eAAe,gBAAgB,OAAO,KAAK,OAAO,CAAC,KAAK,OAAO,EAAE,KAAK,OAAO;;AAEtG,SAAS,oBAAoB,MAAM;AAC/B,QAAQ,KAAK,SAAS,IAAI,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG;;;;;AAKrD,SAAS,YAAY,QAAQ;AACzB,SAAQ,SAAS;AACb,WAAS,oBAAoB,OAAO;AACpC,SAAO,IAAI,eAAe,gBAAgB,KAAK,UAAU,IAAI,UAAU,MAAM,QAAQ,MAAM,SAAS,MAAM,SAAU,SAAS,MAAM,MAAO,MAAM,SAAS,gBAAgB,aAAa,gBAAgB,KAAK,QAAQ,aAAa,UAAU,CAAC,CAAC,gBAAgB,KAAK,MAAM,SAAS,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,gBAAgB,KAAK,EAAE,QAAQ,MAAM,eAAe;GAAE,QAAQ,SAAS,MAAM,SAAS,SAAS;GAAM;GAAS,EAAE,CAAC,KAAK,OAAO,CAAC;;;;;;AAMxb,SAAgB,MAAM,MAAM,MAAM;AAC9B,SAAQ,SAAS,SAAS,YAAY,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK;;;;;AAK5D,SAAgB,SAAS,GAAG,eAAe;AACvC,SAAQ,SAAS,OAAO,YAAY,gBAAgB,SAAS,GAAG,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK;;;;;AAKjH,SAAgB,cAAc,GAAG,eAAe;AAC5C,SAAQ,SAAS,OAAO,YAAY,gBAAgB,cAAc,GAAG,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK;;;;;AAKtH,SAAgB,eAAe,SAAS,KAAK,eAAe;AACxD,SAAQ,SAAS,OAAO,YAAY,gBAAgB,mBAAmB,SAAS,KAAK,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { External } from "@fncts/io/IO";
|
|
3
|
-
|
|
2
|
+
//#region build/esm/Router/definition.js
|
|
3
|
+
const RouterTypeId = Symbol.for("fncts.http.Router");
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_a = RouterTypeId;
|
|
5
|
+
* @tsplus type fncts.http.Router
|
|
6
|
+
* @tsplus companion fncts.http.RouterOps
|
|
7
|
+
*/
|
|
8
|
+
var Router = class extends External {
|
|
9
|
+
[RouterTypeId] = RouterTypeId;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Router, RouterTypeId };
|
|
13
|
+
|
|
15
14
|
//# sourceMappingURL=definition.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.mjs","names":[
|
|
1
|
+
{"version":3,"file":"definition.mjs","names":[],"sources":["../../esm/Router/definition.js"],"sourcesContent":["import { External } from \"@fncts/io/IO\";\nexport const RouterTypeId = Symbol.for(\"fncts.http.Router\");\n/**\n * @tsplus type fncts.http.Router\n * @tsplus companion fncts.http.RouterOps\n */\nexport class Router extends External {\n [RouterTypeId] = RouterTypeId;\n}\n//# sourceMappingURL=definition.js.map"],"mappings":";;AACA,MAAa,eAAe,OAAO,IAAI,oBAAoB;;;;;AAK3D,IAAa,SAAb,cAA4B,SAAS;CACjC,CAAC,gBAAgB"}
|
package/_mjs/Router/internal.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { RouteContextImpl, RouteImpl } from "../Route/internal.mjs";
|
|
2
|
+
import { RouteNotFound } from "../RouteNotFound.mjs";
|
|
3
|
+
import { Router } from "./definition.mjs";
|
|
4
|
+
import * as tsplus_module_8 from "@fncts/io/IO/api";
|
|
2
5
|
import * as tsplus_module_1 from "@fncts/base/data/Maybe/constructors";
|
|
3
6
|
import * as tsplus_module_2 from "@fncts/base/collection/immutable/Conc/api";
|
|
4
7
|
import * as tsplus_module_3 from "@fncts/io/FiberRef/unsafe";
|
|
@@ -6,72 +9,61 @@ import * as tsplus_module_4 from "@fncts/http/ServerRequest/definition";
|
|
|
6
9
|
import * as tsplus_module_5 from "@fncts/base/data/Environment/api";
|
|
7
10
|
import * as tsplus_module_6 from "@fncts/http/Route/definition";
|
|
8
11
|
import * as tsplus_module_7 from "@fncts/io/FiberRef/operations";
|
|
9
|
-
import * as tsplus_module_8 from "@fncts/io/IO/api";
|
|
10
12
|
import * as tsplus_module_9 from "@fncts/base/data/Maybe/definition";
|
|
11
13
|
import * as FindMyWay from "find-my-way-ts";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
//#region build/esm/Router/internal.js
|
|
15
|
+
const fileName_1 = "(@fncts/http) src/Router/internal.ts";
|
|
16
|
+
var RouterInternal = class extends Router {
|
|
17
|
+
routes;
|
|
18
|
+
mounts;
|
|
19
|
+
httpApp;
|
|
20
|
+
constructor(routes, mounts) {
|
|
21
|
+
super();
|
|
22
|
+
this.routes = routes;
|
|
23
|
+
this.mounts = mounts;
|
|
24
|
+
this.httpApp = toHttpApp(this);
|
|
25
|
+
}
|
|
26
|
+
get toIO() {
|
|
27
|
+
return this.httpApp;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
26
30
|
function toHttpApp(self) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (result === undefined && request.method === "HEAD") {
|
|
58
|
-
result = router.find("GET", request.url);
|
|
59
|
-
}
|
|
60
|
-
if (result === undefined) {
|
|
61
|
-
return tsplus_module_8.failNow(new RouteNotFound(request), fileName_1 + ":80:24");
|
|
62
|
-
}
|
|
63
|
-
const route = result.handler;
|
|
64
|
-
if (tsplus_module_9.isJust(route.prefix)) {
|
|
65
|
-
context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);
|
|
66
|
-
}
|
|
67
|
-
context = tsplus_module_5.add(new RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);
|
|
68
|
-
return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":87:47")(route.handler);
|
|
69
|
-
}, fileName_1 + ":59:29");
|
|
31
|
+
const router = FindMyWay.make();
|
|
32
|
+
const mounts = tsplus_module_2.map(({ prefix, httpApp, options }) => [
|
|
33
|
+
prefix,
|
|
34
|
+
new RouteContextImpl(new RouteImpl("*", options?.inclduePrefix ? `${prefix}/*` : "/*", httpApp, options?.inclduePrefix ? tsplus_module_1.nothing(fileName_1 + ":43:45") : tsplus_module_1.just(prefix, fileName_1 + ":43:54")), {}, {}),
|
|
35
|
+
options
|
|
36
|
+
])(self.mounts);
|
|
37
|
+
const mountsLen = mounts.length;
|
|
38
|
+
tsplus_module_2.forEach((route) => {
|
|
39
|
+
if (route.method === "*") router.all(route.path, route);
|
|
40
|
+
else router.on(route.method, route.path, route);
|
|
41
|
+
})(self.routes);
|
|
42
|
+
return tsplus_module_8.withFiberRuntime((fiber) => {
|
|
43
|
+
let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);
|
|
44
|
+
const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);
|
|
45
|
+
if (mountsLen > 0) for (let i = 0; i < mountsLen; i++) {
|
|
46
|
+
const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);
|
|
47
|
+
if (request.url.startsWith(path)) {
|
|
48
|
+
context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);
|
|
49
|
+
if (options?.inclduePrefix !== true) context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);
|
|
50
|
+
return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":70:53")(routeContext.route.handler);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
let result = router.find(request.method, request.url);
|
|
54
|
+
if (result === void 0 && request.method === "HEAD") result = router.find("GET", request.url);
|
|
55
|
+
if (result === void 0) return tsplus_module_8.failNow(new RouteNotFound(request), fileName_1 + ":80:24");
|
|
56
|
+
const route = result.handler;
|
|
57
|
+
if (tsplus_module_9.isJust(route.prefix)) context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);
|
|
58
|
+
context = tsplus_module_5.add(new RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);
|
|
59
|
+
return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":87:47")(route.handler);
|
|
60
|
+
}, fileName_1 + ":59:29");
|
|
70
61
|
}
|
|
71
62
|
function sliceRequestUrl(request, prefix) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen)
|
|
75
|
-
});
|
|
63
|
+
const prefixLen = prefix.length;
|
|
64
|
+
return request.modify({ url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen) });
|
|
76
65
|
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { RouterInternal };
|
|
68
|
+
|
|
77
69
|
//# sourceMappingURL=internal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.mjs","names":["
|
|
1
|
+
{"version":3,"file":"internal.mjs","names":[],"sources":["../../esm/Router/internal.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Router/internal.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_2 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_3 from \"@fncts/io/FiberRef/unsafe\";\nimport * as tsplus_module_4 from \"@fncts/http/ServerRequest/definition\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Environment/api\";\nimport * as tsplus_module_6 from \"@fncts/http/Route/definition\";\nimport * as tsplus_module_7 from \"@fncts/io/FiberRef/operations\";\nimport * as tsplus_module_8 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_9 from \"@fncts/base/data/Maybe/definition\";\nimport * as FindMyWay from \"find-my-way-ts\";\nimport { RouteContextImpl, RouteImpl } from \"../Route/internal.js\";\nimport { RouteNotFound } from \"../RouteNotFound.js\";\nimport { Router } from \"./definition.js\";\nexport class RouterInternal extends Router {\n routes;\n mounts;\n httpApp;\n constructor(routes, mounts) {\n super();\n this.routes = routes;\n this.mounts = mounts;\n this.httpApp = toHttpApp(this);\n }\n get toIO() {\n return this.httpApp;\n }\n}\nfunction toHttpApp(self) {\n const router = FindMyWay.make();\n const mounts = tsplus_module_2.map(({ prefix, httpApp, options }) => [\n prefix,\n new RouteContextImpl(new RouteImpl(\"*\", options?.inclduePrefix ? `${prefix}/*` : \"/*\", httpApp, options?.inclduePrefix ? tsplus_module_1.nothing(fileName_1 + \":43:45\") : tsplus_module_1.just(prefix, fileName_1 + \":43:54\")), {}, {}),\n options,\n ])(self.mounts);\n const mountsLen = mounts.length;\n tsplus_module_2.forEach((route) => {\n if (route.method === \"*\") {\n router.all(route.path, route);\n }\n else {\n router.on(route.method, route.path, route);\n }\n })(self.routes);\n return tsplus_module_8.withFiberRuntime((fiber) => {\n let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);\n const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);\n if (mountsLen > 0) {\n for (let i = 0; i < mountsLen; i++) {\n const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);\n if (request.url.startsWith(path)) {\n context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);\n if (options?.inclduePrefix !== true) {\n context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);\n }\n return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + \":70:53\")(routeContext.route.handler);\n }\n }\n }\n let result = router.find(request.method, request.url);\n if (result === undefined && request.method === \"HEAD\") {\n result = router.find(\"GET\", request.url);\n }\n if (result === undefined) {\n return tsplus_module_8.failNow(new RouteNotFound(request), fileName_1 + \":80:24\");\n }\n const route = result.handler;\n if (tsplus_module_9.isJust(route.prefix)) {\n context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);\n }\n context = tsplus_module_5.add(new RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);\n return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + \":87:47\")(route.handler);\n }, fileName_1 + \":59:29\");\n}\nfunction sliceRequestUrl(request, prefix) {\n const prefixLen = prefix.length;\n return request.modify({ url: request.url.length <= prefixLen ? \"/\" : request.url.slice(prefixLen) });\n}\n//# sourceMappingURL=internal.js.map"],"mappings":";;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAcnB,IAAa,iBAAb,cAAoC,OAAO;CACvC;CACA;CACA;CACA,YAAY,QAAQ,QAAQ;AACxB,SAAO;AACP,OAAK,SAAS;AACd,OAAK,SAAS;AACd,OAAK,UAAU,UAAU,KAAK;;CAElC,IAAI,OAAO;AACP,SAAO,KAAK;;;AAGpB,SAAS,UAAU,MAAM;CACrB,MAAM,SAAS,UAAU,MAAM;CAC/B,MAAM,SAAS,gBAAgB,KAAK,EAAE,QAAQ,SAAS,cAAc;EACjE;EACA,IAAI,iBAAiB,IAAI,UAAU,KAAK,SAAS,gBAAgB,GAAG,OAAO,MAAM,MAAM,SAAS,SAAS,gBAAgB,gBAAgB,QAAQ,aAAa,SAAS,GAAG,gBAAgB,KAAK,QAAQ,aAAa,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;EACvO;EACH,CAAC,CAAC,KAAK,OAAO;CACf,MAAM,YAAY,OAAO;AACzB,iBAAgB,SAAS,UAAU;AAC/B,MAAI,MAAM,WAAW,IACjB,QAAO,IAAI,MAAM,MAAM,MAAM;MAG7B,QAAO,GAAG,MAAM,QAAQ,MAAM,MAAM,MAAM;GAEhD,CAAC,KAAK,OAAO;AACf,QAAO,gBAAgB,kBAAkB,UAAU;EAC/C,IAAI,UAAU,MAAM,YAAY,gBAAgB,mBAAmB;EACnE,MAAM,UAAU,gBAAgB,UAAU,gBAAgB,iBAAiB,CAAC,QAAQ;AACpF,MAAI,YAAY,EACZ,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,KAAK;GAChC,MAAM,CAAC,MAAM,cAAc,WAAW,gBAAgB,UAAU,EAAE,CAAC,OAAO;AAC1E,OAAI,QAAQ,IAAI,WAAW,KAAK,EAAE;AAC9B,cAAU,gBAAgB,IAAI,cAAc,gBAAgB,gBAAgB,CAAC,QAAQ;AACrF,QAAI,SAAS,kBAAkB,KAC3B,WAAU,gBAAgB,IAAI,gBAAgB,SAAS,KAAK,EAAE,gBAAgB,iBAAiB,CAAC,QAAQ;AAE5G,WAAO,gBAAgB,QAAQ,gBAAgB,oBAAoB,SAAS,aAAa,SAAS,CAAC,aAAa,MAAM,QAAQ;;;EAI1I,IAAI,SAAS,OAAO,KAAK,QAAQ,QAAQ,QAAQ,IAAI;AACrD,MAAI,WAAW,KAAA,KAAa,QAAQ,WAAW,OAC3C,UAAS,OAAO,KAAK,OAAO,QAAQ,IAAI;AAE5C,MAAI,WAAW,KAAA,EACX,QAAO,gBAAgB,QAAQ,IAAI,cAAc,QAAQ,EAAE,aAAa,SAAS;EAErF,MAAM,QAAQ,OAAO;AACrB,MAAI,gBAAgB,OAAO,MAAM,OAAO,CACpC,WAAU,gBAAgB,IAAI,gBAAgB,SAAS,MAAM,OAAO,MAAM,EAAE,gBAAgB,iBAAiB,CAAC,QAAQ;AAE1H,YAAU,gBAAgB,IAAI,IAAI,iBAAiB,OAAO,OAAO,QAAQ,OAAO,aAAa,EAAE,gBAAgB,gBAAgB,CAAC,QAAQ;AACxI,SAAO,gBAAgB,QAAQ,gBAAgB,oBAAoB,SAAS,aAAa,SAAS,CAAC,MAAM,QAAQ;IAClH,aAAa,SAAS;;AAE7B,SAAS,gBAAgB,SAAS,QAAQ;CACtC,MAAM,YAAY,OAAO;AACzB,QAAO,QAAQ,OAAO,EAAE,KAAK,QAAQ,IAAI,UAAU,YAAY,MAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,CAAC"}
|
package/_mjs/Router.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
//# sourceMappingURL=Router.mjs.map
|
|
1
|
+
import { Router, RouterTypeId } from "./Router/definition.mjs";
|
|
2
|
+
import { append, catchAll, catchAllCause, concat, del, empty, from, get, head, mount, options, patch, post, prefixAll, provideService, put, route, routes, use } from "./Router/api.mjs";
|
|
3
|
+
export { Router, RouterTypeId, append, catchAll, catchAllCause, concat, del, empty, from, get, head, mount, options, patch, post, prefixAll, provideService, put, route, routes, use };
|
package/_mjs/Server.mjs
CHANGED
|
@@ -1,41 +1,38 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
const fileName_1 = "(@fncts/http) src/Server.ts";
|
|
3
1
|
import * as tsplus_module_1 from "@fncts/base/data/Tag/constructors";
|
|
4
|
-
import * as tsplus_module_2 from "@fncts/io/IO/api/environment";
|
|
5
2
|
import * as tsplus_module_3 from "@fncts/io/IO/api";
|
|
3
|
+
import * as tsplus_module_2 from "@fncts/io/IO/api/environment";
|
|
6
4
|
import * as tsplus_module_4 from "@fncts/io/Layer/api";
|
|
7
|
-
|
|
5
|
+
//#region build/esm/Server.js
|
|
6
|
+
const fileName_1 = "(@fncts/http) src/Server.ts";
|
|
7
|
+
const ServerTypeId = Symbol.for("fncts.http.Server");
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
_a = ServerTypeId;
|
|
9
|
+
* @tsplus type fncts.http.Server
|
|
10
|
+
* @tsplus companion fncts.http.ServerOps
|
|
11
|
+
*/
|
|
12
|
+
var Server = class {
|
|
13
|
+
[ServerTypeId] = ServerTypeId;
|
|
14
|
+
};
|
|
18
15
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const ServerTag_1 =
|
|
22
|
-
|
|
16
|
+
* @tsplus static fncts.http.ServerOps Tag
|
|
17
|
+
*/
|
|
18
|
+
const ServerTag_1 = tsplus_module_1.makeTag();
|
|
19
|
+
const ServerTag = ServerTag_1;
|
|
23
20
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.address = options.address;
|
|
32
|
-
}
|
|
33
|
-
}();
|
|
21
|
+
* @tsplus static fncts.http.ServerOps __call
|
|
22
|
+
*/
|
|
23
|
+
function make(options) {
|
|
24
|
+
return new class extends Server {
|
|
25
|
+
serve = options.serve;
|
|
26
|
+
address = options.address;
|
|
27
|
+
}();
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
function serve(middleware) {
|
|
30
|
+
return (httpApp) => tsplus_module_4.scopedDiscard(() => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + ":69:55")(tsplus_module_2.service(ServerTag_1, fileName_1 + ":69:35")), fileName_1 + ":69:24");
|
|
37
31
|
}
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
function serveIO(middleware) {
|
|
33
|
+
return (httpApp) => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + ":87:53")(tsplus_module_2.service(ServerTag_1, fileName_1 + ":87:33"));
|
|
40
34
|
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Server, ServerTag, ServerTypeId, make, serve, serveIO };
|
|
37
|
+
|
|
41
38
|
//# sourceMappingURL=Server.mjs.map
|
package/_mjs/Server.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.mjs","names":["
|
|
1
|
+
{"version":3,"file":"Server.mjs","names":[],"sources":["../esm/Server.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Server.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Tag/constructors\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api/environment\";\nimport * as tsplus_module_3 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_4 from \"@fncts/io/Layer/api\";\nexport const ServerTypeId = Symbol.for(\"fncts.http.Server\");\n/**\n * @tsplus type fncts.http.Server\n * @tsplus companion fncts.http.ServerOps\n */\nexport class Server {\n [ServerTypeId] = ServerTypeId;\n}\n/**\n * @tsplus static fncts.http.ServerOps Tag\n */\nconst ServerTag_1 = tsplus_module_1.makeTag();\nexport const ServerTag = ServerTag_1;\n/**\n * @tsplus static fncts.http.ServerOps __call\n */\nexport function make(options) {\n return new (class extends Server {\n serve = options.serve;\n address = options.address;\n })();\n}\nexport function serve(middleware) {\n return (httpApp) => tsplus_module_4.scopedDiscard(() => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + \":69:55\")(tsplus_module_2.service(ServerTag_1, fileName_1 + \":69:35\")), fileName_1 + \":69:24\");\n}\nexport function serveIO(middleware) {\n return (httpApp) => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + \":87:53\")(tsplus_module_2.service(ServerTag_1, fileName_1 + \":87:33\"));\n}\n//# sourceMappingURL=Server.js.map"],"mappings":";;;;;AAAA,MAAM,aAAa;AAKnB,MAAa,eAAe,OAAO,IAAI,oBAAoB;;;;;AAK3D,IAAa,SAAb,MAAoB;CAChB,CAAC,gBAAgB;;;;;AAKrB,MAAM,cAAc,gBAAgB,SAAS;AAC7C,MAAa,YAAY;;;;AAIzB,SAAgB,KAAK,SAAS;AAC1B,QAAO,IAAK,cAAc,OAAO;EAC7B,QAAQ,QAAQ;EAChB,UAAU,QAAQ;IAClB;;AAER,SAAgB,MAAM,YAAY;AAC9B,SAAQ,YAAY,gBAAgB,oBAAoB,gBAAgB,SAAS,WAAW,OAAO,MAAM,SAAS,WAAW,EAAE,aAAa,SAAS,CAAC,gBAAgB,QAAQ,aAAa,aAAa,SAAS,CAAC,EAAE,aAAa,SAAS;;AAE9O,SAAgB,QAAQ,YAAY;AAChC,SAAQ,YAAY,gBAAgB,SAAS,WAAW,OAAO,MAAM,SAAS,WAAW,EAAE,aAAa,SAAS,CAAC,gBAAgB,QAAQ,aAAa,aAAa,SAAS,CAAC"}
|