@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/_cjs/Route.cjs
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return _definition[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=Route.cjs.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Route_definition = require("./Route/definition.cjs");
|
|
3
|
+
const require_Route_api = require("./Route/api.cjs");
|
|
4
|
+
exports.Route = require_Route_definition.Route;
|
|
5
|
+
exports.RouteContext = require_Route_definition.RouteContext;
|
|
6
|
+
exports.RouteContextTag = require_Route_definition.RouteContextTag;
|
|
7
|
+
exports.RouteContextTypeId = require_Route_definition.RouteContextTypeId;
|
|
8
|
+
exports.RouteTypeId = require_Route_definition.RouteTypeId;
|
|
9
|
+
exports.all = require_Route_api.all;
|
|
10
|
+
exports.del = require_Route_api.del;
|
|
11
|
+
exports.get = require_Route_api.get;
|
|
12
|
+
exports.head = require_Route_api.head;
|
|
13
|
+
exports.make = require_Route_api.make;
|
|
14
|
+
exports.options = require_Route_api.options;
|
|
15
|
+
exports.params = require_Route_api.params;
|
|
16
|
+
exports.patch = require_Route_api.patch;
|
|
17
|
+
exports.post = require_Route_api.post;
|
|
18
|
+
exports.put = require_Route_api.put;
|
|
19
|
+
exports.route = require_Route_api.route;
|
|
20
|
+
exports.schemaParams = require_Route_api.schemaParams;
|
|
21
|
+
exports.schemaPathParams = require_Route_api.schemaPathParams;
|
|
22
|
+
exports.schemaSearchParams = require_Route_api.schemaSearchParams;
|
|
23
|
+
exports.searchParams = require_Route_api.searchParams;
|
package/_cjs/RouteNotFound.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region build/esm/RouteNotFound.js
|
|
3
|
+
const RouteNotFoundTypeId = Symbol.for("fncts.http.RouteNotFound");
|
|
4
|
+
var RouteNotFound = class extends Error {
|
|
5
|
+
request;
|
|
6
|
+
constructor(request) {
|
|
7
|
+
super();
|
|
8
|
+
this.request = request;
|
|
9
|
+
}
|
|
10
|
+
get message() {
|
|
11
|
+
return `${this.request.method} ${this.request.url} not found`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
17
15
|
exports.RouteNotFound = RouteNotFound;
|
|
16
|
+
exports.RouteNotFoundTypeId = RouteNotFoundTypeId;
|
|
17
|
+
|
|
18
18
|
//# sourceMappingURL=RouteNotFound.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteNotFound.cjs","names":["
|
|
1
|
+
{"version":3,"file":"RouteNotFound.cjs","names":[],"sources":["../esm/RouteNotFound.js"],"sourcesContent":["export const RouteNotFoundTypeId = Symbol.for(\"fncts.http.RouteNotFound\");\nexport class RouteNotFound extends Error {\n request;\n constructor(request) {\n super();\n this.request = request;\n }\n get message() {\n return `${this.request.method} ${this.request.url} not found`;\n }\n}\n//# sourceMappingURL=RouteNotFound.js.map"],"mappings":";;AAAA,MAAa,sBAAsB,OAAO,IAAI,2BAA2B;AACzE,IAAa,gBAAb,cAAmC,MAAM;CACrC;CACA,YAAY,SAAS;AACjB,SAAO;AACP,OAAK,UAAU;;CAEnB,IAAI,UAAU;AACV,SAAO,GAAG,KAAK,QAAQ,OAAO,GAAG,KAAK,QAAQ,IAAI"}
|
package/_cjs/Router/api.cjs
CHANGED
|
@@ -1,155 +1,163 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
|
|
21
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/api"));
|
|
22
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api"));
|
|
23
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/environment"));
|
|
24
|
-
var _internal = /*#__PURE__*/require("../Route/internal.cjs");
|
|
25
|
-
var _internal2 = /*#__PURE__*/require("./internal.cjs");
|
|
26
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("../chunk.cjs");
|
|
3
|
+
const require_Route_internal = require("../Route/internal.cjs");
|
|
4
|
+
const require_Router_internal = require("./internal.cjs");
|
|
5
|
+
let _fncts_io_IO_api = require("@fncts/io/IO/api");
|
|
6
|
+
_fncts_io_IO_api = require_chunk.__toESM(_fncts_io_IO_api, 1);
|
|
7
|
+
let _fncts_base_collection_immutable_Conc_constructors = require("@fncts/base/collection/immutable/Conc/constructors");
|
|
8
|
+
_fncts_base_collection_immutable_Conc_constructors = require_chunk.__toESM(_fncts_base_collection_immutable_Conc_constructors, 1);
|
|
9
|
+
let _fncts_base_data_Maybe_constructors = require("@fncts/base/data/Maybe/constructors");
|
|
10
|
+
_fncts_base_data_Maybe_constructors = require_chunk.__toESM(_fncts_base_data_Maybe_constructors, 1);
|
|
11
|
+
let _fncts_io_IO_api_environment = require("@fncts/io/IO/api/environment");
|
|
12
|
+
_fncts_io_IO_api_environment = require_chunk.__toESM(_fncts_io_IO_api_environment, 1);
|
|
13
|
+
let _fncts_base_collection_immutable_Conc_api_empty = require("@fncts/base/collection/immutable/Conc/api/empty");
|
|
14
|
+
_fncts_base_collection_immutable_Conc_api_empty = require_chunk.__toESM(_fncts_base_collection_immutable_Conc_api_empty, 1);
|
|
15
|
+
let _fncts_base_collection_immutable_Conc_api = require("@fncts/base/collection/immutable/Conc/api");
|
|
16
|
+
_fncts_base_collection_immutable_Conc_api = require_chunk.__toESM(_fncts_base_collection_immutable_Conc_api, 1);
|
|
17
|
+
let _fncts_base_data_Maybe_api = require("@fncts/base/data/Maybe/api");
|
|
18
|
+
_fncts_base_data_Maybe_api = require_chunk.__toESM(_fncts_base_data_Maybe_api, 1);
|
|
19
|
+
//#region build/esm/Router/api.js
|
|
27
20
|
const fileName_1 = "(@fncts/http) src/Router/api.ts";
|
|
28
|
-
const use =
|
|
29
|
-
const from =
|
|
30
|
-
const concat =
|
|
31
|
-
const prefixAll =
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const empty =
|
|
21
|
+
const use = use_1;
|
|
22
|
+
const from = from_1;
|
|
23
|
+
const concat = concat_1;
|
|
24
|
+
const prefixAll = prefixAll_1;
|
|
25
|
+
/**
|
|
26
|
+
* @tsplus static fncts.http.RouterOps empty
|
|
27
|
+
*/
|
|
28
|
+
const empty = new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_api_empty.empty(), _fncts_base_collection_immutable_Conc_api_empty.empty());
|
|
36
29
|
function route(method) {
|
|
37
|
-
|
|
30
|
+
return (path, handler) => (self) => new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_api.append(new require_Route_internal.RouteImpl(method, path, handler))(self.routes), self.mounts);
|
|
38
31
|
}
|
|
39
32
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const get =
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const post =
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const put =
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const patch =
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const del =
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const head =
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const options =
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
33
|
+
* @tsplus pipeable fncts.http.Router get
|
|
34
|
+
* @tsplus static fncts.http.RouterOps get
|
|
35
|
+
*/
|
|
36
|
+
const get = route("GET");
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus pipeable fncts.http.Router post
|
|
39
|
+
* @tsplus static fncts.http.RouterOps post
|
|
40
|
+
*/
|
|
41
|
+
const post = route("POST");
|
|
42
|
+
/**
|
|
43
|
+
* @tsplus pipeable fncts.http.Router put
|
|
44
|
+
* @tsplus static fncts.http.RouterOps put
|
|
45
|
+
*/
|
|
46
|
+
const put = route("PUT");
|
|
47
|
+
/**
|
|
48
|
+
* @tsplus pipeable fncts.http.Router patch
|
|
49
|
+
* @tsplus static fncts.http.RouterOps patch
|
|
50
|
+
*/
|
|
51
|
+
const patch = route("PATCH");
|
|
52
|
+
/**
|
|
53
|
+
* @tsplus pipeable fncts.http.Router del
|
|
54
|
+
* @tsplus static fncts.http.RouterOps del
|
|
55
|
+
*/
|
|
56
|
+
const del = route("DELETE");
|
|
57
|
+
/**
|
|
58
|
+
* @tsplus pipeable fncts.http.Router head
|
|
59
|
+
* @tsplus static fncts.http.RouterOps head
|
|
60
|
+
*/
|
|
61
|
+
const head = route("HEAD");
|
|
62
|
+
/**
|
|
63
|
+
* @tsplus pipeable fncts.http.Router options
|
|
64
|
+
* @tsplus static fncts.http.RouterOps options
|
|
65
|
+
*/
|
|
66
|
+
const options = route("OPTIONS");
|
|
67
|
+
/**
|
|
68
|
+
* @tsplus pipeable fncts.http.Router use
|
|
69
|
+
* @tsplus static fncts.http.RouterOps use
|
|
70
|
+
*/
|
|
78
71
|
function use_1(f, __tsplusTrace) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
prefix,
|
|
84
|
-
httpApp: f(httpApp)
|
|
85
|
-
}))(self.mounts));
|
|
72
|
+
return (self) => new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_api.map((route) => new require_Route_internal.RouteImpl(route.method, route.path, f(route.handler), route.prefix))(self.routes), _fncts_base_collection_immutable_Conc_api.map(({ prefix, httpApp }) => ({
|
|
73
|
+
prefix,
|
|
74
|
+
httpApp: f(httpApp)
|
|
75
|
+
}))(self.mounts));
|
|
86
76
|
}
|
|
87
77
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
* @tsplus static fncts.http.RouterOps from
|
|
79
|
+
*/
|
|
90
80
|
function from_1(routes) {
|
|
91
|
-
|
|
81
|
+
return new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_constructors.from(routes), _fncts_base_collection_immutable_Conc_api_empty.empty());
|
|
92
82
|
}
|
|
93
83
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
* @tsplus static fncts.http.RouterOps routes
|
|
85
|
+
*/
|
|
96
86
|
function routes(...routes) {
|
|
97
|
-
|
|
87
|
+
return from_1(routes);
|
|
98
88
|
}
|
|
99
89
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
* @tsplus pipeable fncts.http.Router append
|
|
91
|
+
*/
|
|
102
92
|
function append(route) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
return (self) => {
|
|
94
|
+
return new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_api.append(route)(self.routes), self.mounts);
|
|
95
|
+
};
|
|
106
96
|
}
|
|
107
97
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
* @tsplus pipeable fncts.http.Router concat
|
|
99
|
+
*/
|
|
110
100
|
function concat_1(that) {
|
|
111
|
-
|
|
101
|
+
return (self) => new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_api.concat(that.routes)(self.routes), self.mounts);
|
|
112
102
|
}
|
|
113
103
|
function removeTrailingSlash(path) {
|
|
114
|
-
|
|
104
|
+
return path.endsWith("/") ? path.slice(0, -1) : path;
|
|
115
105
|
}
|
|
116
106
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
107
|
+
* @tsplus pipeable fncts.http.Router prefixAll
|
|
108
|
+
*/
|
|
119
109
|
function prefixAll_1(prefix) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
httpApp
|
|
128
|
-
}))(self.mounts));
|
|
129
|
-
};
|
|
110
|
+
return (self) => {
|
|
111
|
+
prefix = removeTrailingSlash(prefix);
|
|
112
|
+
return new require_Router_internal.RouterInternal(_fncts_base_collection_immutable_Conc_api.map((route) => new require_Route_internal.RouteImpl(route.method, route.path === "/" ? prefix : prefix + route.path, route.handler, _fncts_base_data_Maybe_api.orElse(() => _fncts_base_data_Maybe_constructors.just(prefix, fileName_1 + ":150:60"))(_fncts_base_data_Maybe_api.map((_) => prefix + _)(route.prefix))))(self.routes), _fncts_base_collection_immutable_Conc_api.map(({ prefix: path, httpApp }) => ({
|
|
113
|
+
prefix: path === "/" ? prefix : prefix + path,
|
|
114
|
+
httpApp
|
|
115
|
+
}))(self.mounts));
|
|
116
|
+
};
|
|
130
117
|
}
|
|
131
118
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
119
|
+
* @tsplus pipeable fncts.http.Router mount
|
|
120
|
+
*/
|
|
134
121
|
function mount(path, that) {
|
|
135
|
-
|
|
122
|
+
return (self) => concat_1(prefixAll_1(path)(that))(self);
|
|
136
123
|
}
|
|
137
124
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
125
|
+
* @tsplus pipeable fncts.http.Router catchAll
|
|
126
|
+
*/
|
|
140
127
|
function catchAll(f, __tsplusTrace) {
|
|
141
|
-
|
|
128
|
+
return (self) => use_1((handler) => _fncts_io_IO_api.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);
|
|
142
129
|
}
|
|
143
130
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
* @tsplus pipeable fncts.http.Router catchAllCause
|
|
132
|
+
*/
|
|
146
133
|
function catchAllCause(f, __tsplusTrace) {
|
|
147
|
-
|
|
134
|
+
return (self) => use_1((handler) => _fncts_io_IO_api.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);
|
|
148
135
|
}
|
|
149
136
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
137
|
+
* @tsplus pipeable fncts.http.Router provideService
|
|
138
|
+
*/
|
|
152
139
|
function provideService(service, tag, __tsplusTrace) {
|
|
153
|
-
|
|
140
|
+
return (self) => use_1((handler) => _fncts_io_IO_api_environment.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);
|
|
154
141
|
}
|
|
142
|
+
//#endregion
|
|
143
|
+
exports.append = append;
|
|
144
|
+
exports.catchAll = catchAll;
|
|
145
|
+
exports.catchAllCause = catchAllCause;
|
|
146
|
+
exports.concat = concat;
|
|
147
|
+
exports.del = del;
|
|
148
|
+
exports.empty = empty;
|
|
149
|
+
exports.from = from;
|
|
150
|
+
exports.get = get;
|
|
151
|
+
exports.head = head;
|
|
152
|
+
exports.mount = mount;
|
|
153
|
+
exports.options = options;
|
|
154
|
+
exports.patch = patch;
|
|
155
|
+
exports.post = post;
|
|
156
|
+
exports.prefixAll = prefixAll;
|
|
157
|
+
exports.provideService = provideService;
|
|
158
|
+
exports.put = put;
|
|
159
|
+
exports.route = route;
|
|
160
|
+
exports.routes = routes;
|
|
161
|
+
exports.use = use;
|
|
162
|
+
|
|
155
163
|
//# sourceMappingURL=api.cjs.map
|
package/_cjs/Router/api.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","names":["
|
|
1
|
+
{"version":3,"file":"api.cjs","names":["RouterInternal","tsplus_module_1","tsplus_module_2","RouteImpl","tsplus_module_3","tsplus_module_5","tsplus_module_4","tsplus_module_6","tsplus_module_7"],"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":"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"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.RouterTypeId = exports.Router = void 0;
|
|
7
|
-
var _IO = /*#__PURE__*/require("@fncts/io/IO");
|
|
8
|
-
var _a;
|
|
9
|
-
const RouterTypeId = exports.RouterTypeId = /*#__PURE__*/Symbol.for("fncts.http.Router");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../chunk.cjs");
|
|
3
|
+
let _fncts_io_IO = require("@fncts/io/IO");
|
|
4
|
+
//#region build/esm/Router/definition.js
|
|
5
|
+
const RouterTypeId = Symbol.for("fncts.http.Router");
|
|
10
6
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
7
|
+
* @tsplus type fncts.http.Router
|
|
8
|
+
* @tsplus companion fncts.http.RouterOps
|
|
9
|
+
*/
|
|
10
|
+
var Router = class extends _fncts_io_IO.External {
|
|
11
|
+
[RouterTypeId] = RouterTypeId;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
20
14
|
exports.Router = Router;
|
|
21
|
-
|
|
15
|
+
exports.RouterTypeId = RouterTypeId;
|
|
16
|
+
|
|
22
17
|
//# sourceMappingURL=definition.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.cjs","names":["
|
|
1
|
+
{"version":3,"file":"definition.cjs","names":["External"],"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,cAA4BA,aAAAA,SAAS;CACjC,CAAC,gBAAgB"}
|