@fncts/http 0.0.12 → 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.
Files changed (143) hide show
  1. package/LICENSE +26 -0
  2. package/_cjs/Body/api.cjs +62 -65
  3. package/_cjs/Body/api.cjs.map +1 -1
  4. package/_cjs/Body/definition.cjs +66 -69
  5. package/_cjs/Body/definition.cjs.map +1 -1
  6. package/_cjs/Body.cjs +20 -28
  7. package/_cjs/BodyError.cjs +33 -36
  8. package/_cjs/BodyError.cjs.map +1 -1
  9. package/_cjs/Headers.cjs +70 -73
  10. package/_cjs/Headers.cjs.map +1 -1
  11. package/_cjs/HttpApp.cjs +102 -94
  12. package/_cjs/HttpApp.cjs.map +1 -1
  13. package/_cjs/IncomingMessage/api.cjs +24 -23
  14. package/_cjs/IncomingMessage/api.cjs.map +1 -1
  15. package/_cjs/IncomingMessage/definition.cjs +12 -13
  16. package/_cjs/IncomingMessage/definition.cjs.map +1 -1
  17. package/_cjs/IncomingMessage.cjs +8 -28
  18. package/_cjs/Method.cjs +6 -7
  19. package/_cjs/Method.cjs.map +1 -1
  20. package/_cjs/Middleware.cjs +11 -12
  21. package/_cjs/Middleware.cjs.map +1 -1
  22. package/_cjs/QueryParams.cjs +0 -2
  23. package/_cjs/RequestError.cjs +17 -18
  24. package/_cjs/RequestError.cjs.map +1 -1
  25. package/_cjs/ResponseError.cjs +26 -27
  26. package/_cjs/ResponseError.cjs.map +1 -1
  27. package/_cjs/Route/api.cjs +87 -74
  28. package/_cjs/Route/api.cjs.map +1 -1
  29. package/_cjs/Route/definition.cjs +28 -26
  30. package/_cjs/Route/definition.cjs.map +1 -1
  31. package/_cjs/Route/internal.cjs +33 -34
  32. package/_cjs/Route/internal.cjs.map +1 -1
  33. package/_cjs/Route.cjs +23 -28
  34. package/_cjs/RouteNotFound.cjs +16 -17
  35. package/_cjs/RouteNotFound.cjs.map +1 -1
  36. package/_cjs/Router/api.cjs +127 -119
  37. package/_cjs/Router/api.cjs.map +1 -1
  38. package/_cjs/Router/definition.cjs +14 -14
  39. package/_cjs/Router/definition.cjs.map +1 -1
  40. package/_cjs/Router/internal.cjs +75 -82
  41. package/_cjs/Router/internal.cjs.map +1 -1
  42. package/_cjs/Router.cjs +24 -28
  43. package/_cjs/Server.cjs +38 -34
  44. package/_cjs/Server.cjs.map +1 -1
  45. package/_cjs/ServerError.cjs +18 -18
  46. package/_cjs/ServerError.cjs.map +1 -1
  47. package/_cjs/ServerRequest/api.cjs +9 -10
  48. package/_cjs/ServerRequest/api.cjs.map +1 -1
  49. package/_cjs/ServerRequest/definition.cjs +20 -19
  50. package/_cjs/ServerRequest/definition.cjs.map +1 -1
  51. package/_cjs/ServerRequest/internal.cjs +77 -80
  52. package/_cjs/ServerRequest/internal.cjs.map +1 -1
  53. package/_cjs/ServerRequest.cjs +7 -28
  54. package/_cjs/ServerResponse/api.cjs +108 -116
  55. package/_cjs/ServerResponse/api.cjs.map +1 -1
  56. package/_cjs/ServerResponse/definition.cjs +36 -41
  57. package/_cjs/ServerResponse/definition.cjs.map +1 -1
  58. package/_cjs/ServerResponse.cjs +18 -28
  59. package/_cjs/Socket.cjs +213 -192
  60. package/_cjs/Socket.cjs.map +1 -1
  61. package/_cjs/UrlParams.cjs +23 -27
  62. package/_cjs/UrlParams.cjs.map +1 -1
  63. package/_cjs/chunk.cjs +28 -0
  64. package/_cjs/global.cjs +0 -2
  65. package/_mjs/Body/api.mjs +54 -56
  66. package/_mjs/Body/api.mjs.map +1 -1
  67. package/_mjs/Body/definition.mjs +61 -59
  68. package/_mjs/Body/definition.mjs.map +1 -1
  69. package/_mjs/Body.mjs +3 -4
  70. package/_mjs/BodyError.mjs +30 -28
  71. package/_mjs/BodyError.mjs.map +1 -1
  72. package/_mjs/Headers.mjs +61 -63
  73. package/_mjs/Headers.mjs.map +1 -1
  74. package/_mjs/HttpApp.mjs +74 -79
  75. package/_mjs/HttpApp.mjs.map +1 -1
  76. package/_mjs/IncomingMessage/api.mjs +21 -17
  77. package/_mjs/IncomingMessage/api.mjs.map +1 -1
  78. package/_mjs/IncomingMessage/definition.mjs +11 -7
  79. package/_mjs/IncomingMessage/definition.mjs.map +1 -1
  80. package/_mjs/IncomingMessage.mjs +3 -4
  81. package/_mjs/Method.mjs +6 -2
  82. package/_mjs/Method.mjs.map +1 -1
  83. package/_mjs/Middleware.mjs +10 -6
  84. package/_mjs/Middleware.mjs.map +1 -1
  85. package/_mjs/QueryParams.mjs +0 -2
  86. package/_mjs/RequestError.mjs +16 -12
  87. package/_mjs/RequestError.mjs.map +1 -1
  88. package/_mjs/ResponseError.mjs +25 -21
  89. package/_mjs/ResponseError.mjs.map +1 -1
  90. package/_mjs/Route/api.mjs +68 -64
  91. package/_mjs/Route/api.mjs.map +1 -1
  92. package/_mjs/Route/definition.mjs +21 -17
  93. package/_mjs/Route/definition.mjs.map +1 -1
  94. package/_mjs/Route/internal.mjs +30 -26
  95. package/_mjs/Route/internal.mjs.map +1 -1
  96. package/_mjs/Route.mjs +3 -4
  97. package/_mjs/RouteNotFound.mjs +15 -11
  98. package/_mjs/RouteNotFound.mjs.map +1 -1
  99. package/_mjs/Router/api.mjs +105 -107
  100. package/_mjs/Router/api.mjs.map +1 -1
  101. package/_mjs/Router/definition.mjs +11 -7
  102. package/_mjs/Router/definition.mjs.map +1 -1
  103. package/_mjs/Router/internal.mjs +55 -66
  104. package/_mjs/Router/internal.mjs.map +1 -1
  105. package/_mjs/Router.mjs +3 -4
  106. package/_mjs/Server.mjs +28 -24
  107. package/_mjs/Server.mjs.map +1 -1
  108. package/_mjs/ServerError.mjs +14 -10
  109. package/_mjs/ServerError.mjs.map +1 -1
  110. package/_mjs/ServerRequest/api.mjs +8 -4
  111. package/_mjs/ServerRequest/api.mjs.map +1 -1
  112. package/_mjs/ServerRequest/definition.mjs +15 -11
  113. package/_mjs/ServerRequest/definition.mjs.map +1 -1
  114. package/_mjs/ServerRequest/internal.mjs +65 -70
  115. package/_mjs/ServerRequest/internal.mjs.map +1 -1
  116. package/_mjs/ServerRequest.mjs +3 -4
  117. package/_mjs/ServerResponse/api.mjs +97 -106
  118. package/_mjs/ServerResponse/api.mjs.map +1 -1
  119. package/_mjs/ServerResponse/definition.mjs +30 -32
  120. package/_mjs/ServerResponse/definition.mjs.map +1 -1
  121. package/_mjs/ServerResponse.mjs +3 -4
  122. package/_mjs/Socket.mjs +152 -156
  123. package/_mjs/Socket.mjs.map +1 -1
  124. package/_mjs/UrlParams.mjs +22 -20
  125. package/_mjs/UrlParams.mjs.map +1 -1
  126. package/_mjs/global.mjs +0 -2
  127. package/package.json +10 -6
  128. package/_cjs/Body.cjs.map +0 -1
  129. package/_cjs/IncomingMessage.cjs.map +0 -1
  130. package/_cjs/QueryParams.cjs.map +0 -1
  131. package/_cjs/Route.cjs.map +0 -1
  132. package/_cjs/Router.cjs.map +0 -1
  133. package/_cjs/ServerRequest.cjs.map +0 -1
  134. package/_cjs/ServerResponse.cjs.map +0 -1
  135. package/_cjs/global.cjs.map +0 -1
  136. package/_mjs/Body.mjs.map +0 -1
  137. package/_mjs/IncomingMessage.mjs.map +0 -1
  138. package/_mjs/QueryParams.mjs.map +0 -1
  139. package/_mjs/Route.mjs.map +0 -1
  140. package/_mjs/Router.mjs.map +0 -1
  141. package/_mjs/ServerRequest.mjs.map +0 -1
  142. package/_mjs/ServerResponse.mjs.map +0 -1
  143. package/_mjs/global.mjs.map +0 -1
@@ -1,88 +1,81 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RouterInternal = void 0;
7
- var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
8
- var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api"));
9
- var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/FiberRef/unsafe"));
10
- var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/http/ServerRequest/definition"));
11
- var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Environment/api"));
12
- var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/http/Route/definition"));
13
- var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/FiberRef/operations"));
14
- var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api"));
15
- var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
16
- var FindMyWay = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("find-my-way-ts"));
17
- var _internal = /*#__PURE__*/require("../Route/internal.cjs");
18
- var _RouteNotFound = /*#__PURE__*/require("../RouteNotFound.cjs");
19
- var _definition4 = /*#__PURE__*/require("./definition.cjs");
20
- 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_RouteNotFound = require("../RouteNotFound.cjs");
5
+ const require_Router_definition = require("./definition.cjs");
6
+ let _fncts_io_IO_api = require("@fncts/io/IO/api");
7
+ _fncts_io_IO_api = require_chunk.__toESM(_fncts_io_IO_api, 1);
8
+ let _fncts_base_data_Maybe_constructors = require("@fncts/base/data/Maybe/constructors");
9
+ _fncts_base_data_Maybe_constructors = require_chunk.__toESM(_fncts_base_data_Maybe_constructors, 1);
10
+ let _fncts_base_collection_immutable_Conc_api = require("@fncts/base/collection/immutable/Conc/api");
11
+ _fncts_base_collection_immutable_Conc_api = require_chunk.__toESM(_fncts_base_collection_immutable_Conc_api, 1);
12
+ let _fncts_io_FiberRef_unsafe = require("@fncts/io/FiberRef/unsafe");
13
+ _fncts_io_FiberRef_unsafe = require_chunk.__toESM(_fncts_io_FiberRef_unsafe, 1);
14
+ let _fncts_http_ServerRequest_definition = require("@fncts/http/ServerRequest/definition");
15
+ _fncts_http_ServerRequest_definition = require_chunk.__toESM(_fncts_http_ServerRequest_definition, 1);
16
+ let _fncts_base_data_Environment_api = require("@fncts/base/data/Environment/api");
17
+ _fncts_base_data_Environment_api = require_chunk.__toESM(_fncts_base_data_Environment_api, 1);
18
+ let _fncts_http_Route_definition = require("@fncts/http/Route/definition");
19
+ _fncts_http_Route_definition = require_chunk.__toESM(_fncts_http_Route_definition, 1);
20
+ let _fncts_io_FiberRef_operations = require("@fncts/io/FiberRef/operations");
21
+ _fncts_io_FiberRef_operations = require_chunk.__toESM(_fncts_io_FiberRef_operations, 1);
22
+ let _fncts_base_data_Maybe_definition = require("@fncts/base/data/Maybe/definition");
23
+ _fncts_base_data_Maybe_definition = require_chunk.__toESM(_fncts_base_data_Maybe_definition, 1);
24
+ let find_my_way_ts = require("find-my-way-ts");
25
+ find_my_way_ts = require_chunk.__toESM(find_my_way_ts, 1);
26
+ //#region build/esm/Router/internal.js
21
27
  const fileName_1 = "(@fncts/http) src/Router/internal.ts";
22
- class RouterInternal extends _definition4.Router {
23
- routes;
24
- mounts;
25
- httpApp;
26
- constructor(routes, mounts) {
27
- super();
28
- this.routes = routes;
29
- this.mounts = mounts;
30
- this.httpApp = toHttpApp(this);
31
- }
32
- get toIO() {
33
- return this.httpApp;
34
- }
35
- }
36
- exports.RouterInternal = RouterInternal;
28
+ var RouterInternal = class extends require_Router_definition.Router {
29
+ routes;
30
+ mounts;
31
+ httpApp;
32
+ constructor(routes, mounts) {
33
+ super();
34
+ this.routes = routes;
35
+ this.mounts = mounts;
36
+ this.httpApp = toHttpApp(this);
37
+ }
38
+ get toIO() {
39
+ return this.httpApp;
40
+ }
41
+ };
37
42
  function toHttpApp(self) {
38
- const router = FindMyWay.make();
39
- const mounts = tsplus_module_2.map(({
40
- prefix,
41
- httpApp,
42
- options
43
- }) => [prefix, new _internal.RouteContextImpl(new _internal.RouteImpl("*", options?.inclduePrefix ? `${prefix}/*` : "/*", httpApp, options?.inclduePrefix ? tsplus_module_1.nothing(fileName_1 + ":43:45") : tsplus_module_1.just(prefix, fileName_1 + ":43:54")), {}, {}), options])(self.mounts);
44
- const mountsLen = mounts.length;
45
- tsplus_module_2.forEach(route => {
46
- if (route.method === "*") {
47
- router.all(route.path, route);
48
- } else {
49
- router.on(route.method, route.path, route);
50
- }
51
- })(self.routes);
52
- return tsplus_module_8.withFiberRuntime(fiber => {
53
- let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);
54
- const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);
55
- if (mountsLen > 0) {
56
- for (let i = 0; i < mountsLen; i++) {
57
- const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);
58
- if (request.url.startsWith(path)) {
59
- context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);
60
- if (options?.inclduePrefix !== true) {
61
- context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);
62
- }
63
- return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":70:53")(routeContext.route.handler);
64
- }
65
- }
66
- }
67
- let result = router.find(request.method, request.url);
68
- if (result === undefined && request.method === "HEAD") {
69
- result = router.find("GET", request.url);
70
- }
71
- if (result === undefined) {
72
- return tsplus_module_8.failNow(new _RouteNotFound.RouteNotFound(request), fileName_1 + ":80:24");
73
- }
74
- const route = result.handler;
75
- if (tsplus_module_9.isJust(route.prefix)) {
76
- context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);
77
- }
78
- context = tsplus_module_5.add(new _internal.RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);
79
- return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":87:47")(route.handler);
80
- }, fileName_1 + ":59:29");
43
+ const router = find_my_way_ts.make();
44
+ const mounts = _fncts_base_collection_immutable_Conc_api.map(({ prefix, httpApp, options }) => [
45
+ prefix,
46
+ new require_Route_internal.RouteContextImpl(new require_Route_internal.RouteImpl("*", options?.inclduePrefix ? `${prefix}/*` : "/*", httpApp, options?.inclduePrefix ? _fncts_base_data_Maybe_constructors.nothing(fileName_1 + ":43:45") : _fncts_base_data_Maybe_constructors.just(prefix, fileName_1 + ":43:54")), {}, {}),
47
+ options
48
+ ])(self.mounts);
49
+ const mountsLen = mounts.length;
50
+ _fncts_base_collection_immutable_Conc_api.forEach((route) => {
51
+ if (route.method === "*") router.all(route.path, route);
52
+ else router.on(route.method, route.path, route);
53
+ })(self.routes);
54
+ return _fncts_io_IO_api.withFiberRuntime((fiber) => {
55
+ let context = fiber.getFiberRef(_fncts_io_FiberRef_unsafe.currentEnvironment);
56
+ const request = _fncts_base_data_Environment_api.unsafeGet(_fncts_http_ServerRequest_definition.ServerRequestTag)(context);
57
+ if (mountsLen > 0) for (let i = 0; i < mountsLen; i++) {
58
+ const [path, routeContext, options] = _fncts_base_collection_immutable_Conc_api.unsafeGet(i)(mounts);
59
+ if (request.url.startsWith(path)) {
60
+ context = _fncts_base_data_Environment_api.add(routeContext, _fncts_http_Route_definition.RouteContextTag)(context);
61
+ if (options?.inclduePrefix !== true) context = _fncts_base_data_Environment_api.add(sliceRequestUrl(request, path), _fncts_http_ServerRequest_definition.ServerRequestTag)(context);
62
+ return _fncts_io_FiberRef_operations.locally(_fncts_io_FiberRef_unsafe.currentEnvironment, context, fileName_1 + ":70:53")(routeContext.route.handler);
63
+ }
64
+ }
65
+ let result = router.find(request.method, request.url);
66
+ if (result === void 0 && request.method === "HEAD") result = router.find("GET", request.url);
67
+ if (result === void 0) return _fncts_io_IO_api.failNow(new require_RouteNotFound.RouteNotFound(request), fileName_1 + ":80:24");
68
+ const route = result.handler;
69
+ if (_fncts_base_data_Maybe_definition.isJust(route.prefix)) context = _fncts_base_data_Environment_api.add(sliceRequestUrl(request, route.prefix.value), _fncts_http_ServerRequest_definition.ServerRequestTag)(context);
70
+ context = _fncts_base_data_Environment_api.add(new require_Route_internal.RouteContextImpl(route, result.params, result.searchParams), _fncts_http_Route_definition.RouteContextTag)(context);
71
+ return _fncts_io_FiberRef_operations.locally(_fncts_io_FiberRef_unsafe.currentEnvironment, context, fileName_1 + ":87:47")(route.handler);
72
+ }, fileName_1 + ":59:29");
81
73
  }
82
74
  function sliceRequestUrl(request, prefix) {
83
- const prefixLen = prefix.length;
84
- return request.modify({
85
- url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen)
86
- });
75
+ const prefixLen = prefix.length;
76
+ return request.modify({ url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen) });
87
77
  }
78
+ //#endregion
79
+ exports.RouterInternal = RouterInternal;
80
+
88
81
  //# sourceMappingURL=internal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.cjs","names":["FindMyWay","_interopRequireWildcard","require","_internal","_RouteNotFound","_definition4","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RouterInternal","Router","routes","mounts","httpApp","constructor","toHttpApp","toIO","exports","self","router","make","tsplus_module_2","map","prefix","options","RouteContextImpl","RouteImpl","inclduePrefix","tsplus_module_1","nothing","fileName_1","just","mountsLen","length","forEach","route","method","all","path","on","tsplus_module_8","withFiberRuntime","fiber","context","getFiberRef","tsplus_module_3","currentEnvironment","request","tsplus_module_5","unsafeGet","tsplus_module_4","ServerRequestTag","routeContext","url","startsWith","add","tsplus_module_6","RouteContextTag","sliceRequestUrl","tsplus_module_7","locally","handler","result","find","undefined","failNow","RouteNotFound","tsplus_module_9","isJust","value","params","searchParams","prefixLen","modify","slice"],"sources":["../../_src/Router/internal.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,gBAAAC,uBAAA,cAAAC,OAAA;AAGA,IAAAC,SAAA,gBAAAD,OAAA;AACA,IAAAE,cAAA,gBAAAF,OAAA;AAEA,IAAAG,YAAA,gBAAAH,OAAA;AAAyC,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM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G,GAAG,GAAGzB,OAAO,CAACM,GAAG,CAACqB,KAAK,CAACF,SAAS;EAAC,CAAE,CAAC;AACtG","ignoreList":[]}
1
+ {"version":3,"file":"internal.cjs","names":["Router","FindMyWay","tsplus_module_2","RouteContextImpl","RouteImpl","tsplus_module_1","tsplus_module_8","tsplus_module_3","tsplus_module_5","tsplus_module_4","tsplus_module_6","tsplus_module_7","RouteNotFound","tsplus_module_9"],"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,cAAoCA,0BAAAA,OAAO;CACvC;CACA;CACA;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,QAAQJ,0BAAgB,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,QAAOD,iBAAgB,QAAQ,IAAIM,sBAAAA,cAAc,QAAQ,EAAE,aAAa,SAAS;EAErF,MAAM,QAAQ,OAAO;AACrB,MAAIC,kCAAgB,OAAO,MAAM,OAAO,CACpC,WAAUL,iCAAgB,IAAI,gBAAgB,SAAS,MAAM,OAAO,MAAM,EAAEC,qCAAgB,iBAAiB,CAAC,QAAQ;AAE1H,YAAUD,iCAAgB,IAAI,IAAIL,uBAAAA,iBAAiB,OAAO,OAAO,QAAQ,OAAO,aAAa,EAAEO,6BAAgB,gBAAgB,CAAC,QAAQ;AACxI,SAAOC,8BAAgB,QAAQJ,0BAAgB,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/_cjs/Router.cjs CHANGED
@@ -1,28 +1,24 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _api = /*#__PURE__*/require("./Router/api.cjs");
7
- Object.keys(_api).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _api[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _api[key];
14
- }
15
- });
16
- });
17
- var _definition = /*#__PURE__*/require("./Router/definition.cjs");
18
- Object.keys(_definition).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _definition[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _definition[key];
25
- }
26
- });
27
- });
28
- //# sourceMappingURL=Router.cjs.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_Router_definition = require("./Router/definition.cjs");
3
+ const require_Router_api = require("./Router/api.cjs");
4
+ exports.Router = require_Router_definition.Router;
5
+ exports.RouterTypeId = require_Router_definition.RouterTypeId;
6
+ exports.append = require_Router_api.append;
7
+ exports.catchAll = require_Router_api.catchAll;
8
+ exports.catchAllCause = require_Router_api.catchAllCause;
9
+ exports.concat = require_Router_api.concat;
10
+ exports.del = require_Router_api.del;
11
+ exports.empty = require_Router_api.empty;
12
+ exports.from = require_Router_api.from;
13
+ exports.get = require_Router_api.get;
14
+ exports.head = require_Router_api.head;
15
+ exports.mount = require_Router_api.mount;
16
+ exports.options = require_Router_api.options;
17
+ exports.patch = require_Router_api.patch;
18
+ exports.post = require_Router_api.post;
19
+ exports.prefixAll = require_Router_api.prefixAll;
20
+ exports.provideService = require_Router_api.provideService;
21
+ exports.put = require_Router_api.put;
22
+ exports.route = require_Router_api.route;
23
+ exports.routes = require_Router_api.routes;
24
+ exports.use = require_Router_api.use;
package/_cjs/Server.cjs CHANGED
@@ -1,45 +1,49 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ServerTypeId = exports.ServerTag = exports.Server = void 0;
7
- exports.make = make;
8
- exports.serve = serve;
9
- exports.serveIO = serveIO;
10
- var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Tag/constructors"));
11
- var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/environment"));
12
- var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api"));
13
- var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Layer/api"));
14
- 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
+ let _fncts_base_data_Tag_constructors = require("@fncts/base/data/Tag/constructors");
4
+ _fncts_base_data_Tag_constructors = require_chunk.__toESM(_fncts_base_data_Tag_constructors, 1);
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_io_IO_api_environment = require("@fncts/io/IO/api/environment");
8
+ _fncts_io_IO_api_environment = require_chunk.__toESM(_fncts_io_IO_api_environment, 1);
9
+ let _fncts_io_Layer_api = require("@fncts/io/Layer/api");
10
+ _fncts_io_Layer_api = require_chunk.__toESM(_fncts_io_Layer_api, 1);
11
+ //#region build/esm/Server.js
15
12
  const fileName_1 = "(@fncts/http) src/Server.ts";
16
- const ServerTypeId = exports.ServerTypeId = /*#__PURE__*/Symbol.for("fncts.http.Server");
13
+ const ServerTypeId = Symbol.for("fncts.http.Server");
17
14
  /**
18
- * @tsplus type fncts.http.Server
19
- * @tsplus companion fncts.http.ServerOps
20
- */
21
- class Server {
22
- [ServerTypeId] = ServerTypeId;
23
- }
15
+ * @tsplus type fncts.http.Server
16
+ * @tsplus companion fncts.http.ServerOps
17
+ */
18
+ var Server = class {
19
+ [ServerTypeId] = ServerTypeId;
20
+ };
24
21
  /**
25
- * @tsplus static fncts.http.ServerOps Tag
26
- */
27
- exports.Server = Server;
28
- const ServerTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
29
- const ServerTag = exports.ServerTag = ServerTag_1;
22
+ * @tsplus static fncts.http.ServerOps Tag
23
+ */
24
+ const ServerTag_1 = _fncts_base_data_Tag_constructors.makeTag();
25
+ const ServerTag = ServerTag_1;
30
26
  /**
31
- * @tsplus static fncts.http.ServerOps __call
32
- */
27
+ * @tsplus static fncts.http.ServerOps __call
28
+ */
33
29
  function make(options) {
34
- return new class extends Server {
35
- serve = options.serve;
36
- address = options.address;
37
- }();
30
+ return new class extends Server {
31
+ serve = options.serve;
32
+ address = options.address;
33
+ }();
38
34
  }
39
35
  function serve(middleware) {
40
- 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");
36
+ return (httpApp) => _fncts_io_Layer_api.scopedDiscard(() => _fncts_io_IO_api.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + ":69:55")(_fncts_io_IO_api_environment.service(ServerTag_1, fileName_1 + ":69:35")), fileName_1 + ":69:24");
41
37
  }
42
38
  function serveIO(middleware) {
43
- 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"));
39
+ return (httpApp) => _fncts_io_IO_api.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + ":87:53")(_fncts_io_IO_api_environment.service(ServerTag_1, fileName_1 + ":87:33"));
44
40
  }
41
+ //#endregion
42
+ exports.Server = Server;
43
+ exports.ServerTag = ServerTag;
44
+ exports.ServerTypeId = ServerTypeId;
45
+ exports.make = make;
46
+ exports.serve = serve;
47
+ exports.serveIO = serveIO;
48
+
45
49
  //# sourceMappingURL=Server.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Server.cjs","names":["ServerTypeId","exports","Symbol","for","Server","ServerTag_1","tsplus_module_1","makeTag","ServerTag","make","options","serve","address","middleware","httpApp","tsplus_module_4","scopedDiscard","tsplus_module_3","flatMap","server","fileName_1","tsplus_module_2","service","serveIO"],"sources":["../_src/Server.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAIO,MAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAG3D;;;;AAIM,MAAgBC,MAAM;EACjB,CAACJ,YAAY,IAAkBA,YAAY;;AAStD;;;AAAAC,OAAA,CAAAG,MAAA,GAAAA,MAAA;AAGO,MAAMC,WAAA,gBAAYC,eAAA,CAAAC,OAAA,EAAa;MAAzBC,SAAS,GAAAP,OAAA,CAAAO,SAAA,GAAAH,WAAA;AAetB;;;AAGM,SAAUI,IAAIA,CAACC,OAGpB;EACC,OAAO,IAAK,cAAcN,MAAM;IAC9BO,KAAK,GAAGD,OAAO,CAACC,KAAK;IACrBC,OAAO,GAAGF,OAAO,CAACE,OAAO;GAC1B,CAAC,CAAE;AACN;AAcM,SAAUD,KAAKA,CACnBE,UAA0C;EAE1C,OAAQC,OAAO,IACbC,eAAA,CAAAC,aAAA,OAAoBC,eAAA,CAAAC,OAAA,CAAgCC,MAAM,IAAKA,MAAM,CAACR,KAAK,CAACG,OAAO,EAAED,UAAW,CAAC,EAAAO,UAAA,aAA7EC,eAAA,CAAAC,OAAA,CAAAjB,WAAA,EAAAe,UAAA,YAAsB,CAAwD,EAAAA,UAAA,YAAQ;AAC9G;AAcM,SAAUG,OAAOA,CACrBV,UAA0C;EAE1C,OAAQC,OAAO,IAAKG,eAAA,CAAAC,OAAA,CAAgCC,MAAM,IAAKA,MAAM,CAACR,KAAK,CAACG,OAAO,EAAED,UAAW,CAAC,EAAAO,UAAA,aAA7EC,eAAA,CAAAC,OAAA,CAAAjB,WAAA,EAAAe,UAAA,YAAsB,CAA+D;AAC3G","ignoreList":[]}
1
+ {"version":3,"file":"Server.cjs","names":["tsplus_module_1","tsplus_module_4","tsplus_module_3","tsplus_module_2"],"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,cAAcA,kCAAgB,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,YAAYC,oBAAgB,oBAAoBC,iBAAgB,SAAS,WAAW,OAAO,MAAM,SAAS,WAAW,EAAE,aAAa,SAAS,CAACC,6BAAgB,QAAQ,aAAa,aAAa,SAAS,CAAC,EAAE,aAAa,SAAS;;AAE9O,SAAgB,QAAQ,YAAY;AAChC,SAAQ,YAAYD,iBAAgB,SAAS,WAAW,OAAO,MAAM,SAAS,WAAW,EAAE,aAAa,SAAS,CAACC,6BAAgB,QAAQ,aAAa,aAAa,SAAS,CAAC"}
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clientAbortFiberId = exports.ServeErrorTypeId = exports.ServeError = void 0;
7
- var _FiberId = /*#__PURE__*/require("@fncts/base/data/FiberId");
8
- var _Global = /*#__PURE__*/require("@fncts/base/data/Global");
9
- const clientAbortFiberId = exports.clientAbortFiberId = /*#__PURE__*/(0, _Global.globalValue)("fncts.http.ServerError.clientAbortFiberId", () => new _FiberId.Runtime(-499, 0));
10
- const ServeErrorTypeId = exports.ServeErrorTypeId = /*#__PURE__*/Symbol.for("fncts.http.ServeError");
11
- class ServeError extends Error {
12
- error;
13
- [ServeErrorTypeId] = ServeErrorTypeId;
14
- constructor(error) {
15
- super();
16
- this.error = error;
17
- }
18
- }
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./chunk.cjs");
3
+ let _fncts_base_data_FiberId = require("@fncts/base/data/FiberId");
4
+ //#region build/esm/ServerError.js
5
+ const clientAbortFiberId = (0, require("@fncts/base/data/Global").globalValue)("fncts.http.ServerError.clientAbortFiberId", () => new _fncts_base_data_FiberId.Runtime(-499, 0));
6
+ const ServeErrorTypeId = Symbol.for("fncts.http.ServeError");
7
+ var ServeError = class extends Error {
8
+ error;
9
+ [ServeErrorTypeId] = ServeErrorTypeId;
10
+ constructor(error) {
11
+ super();
12
+ this.error = error;
13
+ }
14
+ };
15
+ //#endregion
19
16
  exports.ServeError = ServeError;
17
+ exports.ServeErrorTypeId = ServeErrorTypeId;
18
+ exports.clientAbortFiberId = clientAbortFiberId;
19
+
20
20
  //# sourceMappingURL=ServerError.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServerError.cjs","names":["_FiberId","require","_Global","clientAbortFiberId","exports","globalValue","Runtime","ServeErrorTypeId","Symbol","for","ServeError","Error","error","constructor"],"sources":["../_src/ServerError.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,QAAA,gBAAAC,OAAA;AACA,IAAAC,OAAA,gBAAAD,OAAA;AAEO,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,gBAAG,IAAAE,mBAAW,EAAC,2CAA2C,EAAE,MAAM,IAAIC,gBAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAE/G,MAAMC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,gBAAGC,MAAM,CAACC,GAAG,CAAC,uBAAuB,CAAC;AAG7D,MAAOC,UAAW,SAAQC,KAAK;EAEdC,KAAA;EADZ,CAACL,gBAAgB,IAAsBA,gBAAgB;EAChEM,YAAqBD,KAAe;IAClC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;EAE1B;;AACDR,OAAA,CAAAM,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"ServerError.cjs","names":["Runtime"],"sources":["../esm/ServerError.js"],"sourcesContent":["import { Runtime } from \"@fncts/base/data/FiberId\";\nimport { globalValue } from \"@fncts/base/data/Global\";\nexport const clientAbortFiberId = globalValue(\"fncts.http.ServerError.clientAbortFiberId\", () => new Runtime(-499, 0));\nexport const ServeErrorTypeId = Symbol.for(\"fncts.http.ServeError\");\nexport class ServeError extends Error {\n error;\n [ServeErrorTypeId] = ServeErrorTypeId;\n constructor(error) {\n super();\n this.error = error;\n }\n}\n//# sourceMappingURL=ServerError.js.map"],"mappings":";;;;AAEA,MAAa,sBAAA,qCAAA,CAAA,aAAiC,mDAAmD,IAAIA,yBAAAA,QAAQ,MAAM,EAAE,CAAC;AACtH,MAAa,mBAAmB,OAAO,IAAI,wBAAwB;AACnE,IAAa,aAAb,cAAgC,MAAM;CAClC;CACA,CAAC,oBAAoB;CACrB,YAAY,OAAO;AACf,SAAO;AACP,OAAK,QAAQ"}
@@ -1,14 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fromWeb = fromWeb;
7
- var _internal = /*#__PURE__*/require("./internal.cjs");
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_ServerRequest_internal = require("./internal.cjs");
3
+ //#region build/esm/ServerRequest/api.js
8
4
  /**
9
- * @tsplus static fncts.http.ServerRequestOps fromWeb
10
- */
5
+ * @tsplus static fncts.http.ServerRequestOps fromWeb
6
+ */
11
7
  function fromWeb(request) {
12
- return new _internal.ServerRequestImpl(request, request.url);
8
+ return new require_ServerRequest_internal.ServerRequestImpl(request, request.url);
13
9
  }
10
+ //#endregion
11
+ exports.fromWeb = fromWeb;
12
+
14
13
  //# sourceMappingURL=api.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.cjs","names":["_internal","require","fromWeb","request","ServerRequestImpl","url"],"sources":["../../_src/ServerRequest/api.ts"],"sourcesContent":[null],"mappings":";;;;;;AAEA,IAAAA,SAAA,gBAAAC,OAAA;AAEA;;;AAGM,SAAUC,OAAOA,CAACC,OAA2B;EACjD,OAAO,IAAIC,2BAAiB,CAACD,OAAO,EAAEA,OAAO,CAACE,GAAG,CAAC;AACpD","ignoreList":[]}
1
+ {"version":3,"file":"api.cjs","names":["ServerRequestImpl"],"sources":["../../esm/ServerRequest/api.js"],"sourcesContent":["import { ServerRequestImpl } from \"./internal.js\";\n/**\n * @tsplus static fncts.http.ServerRequestOps fromWeb\n */\nexport function fromWeb(request) {\n return new ServerRequestImpl(request, request.url);\n}\n//# sourceMappingURL=api.js.map"],"mappings":";;;;;;AAIA,SAAgB,QAAQ,SAAS;AAC7B,QAAO,IAAIA,+BAAAA,kBAAkB,SAAS,QAAQ,IAAI"}
@@ -1,23 +1,24 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ServerRequestTypeId = exports.ServerRequestTag = exports.ServerRequest = void 0;
7
- var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Tag/constructors"));
8
- var _definition = /*#__PURE__*/require("../IncomingMessage/definition.cjs");
9
- 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); }
10
- const ServerRequestTypeId = exports.ServerRequestTypeId = /*#__PURE__*/Symbol.for("fncts.http.ServerRequest");
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chunk = require("../chunk.cjs");
3
+ const require_IncomingMessage_definition = require("../IncomingMessage/definition.cjs");
4
+ let _fncts_base_data_Tag_constructors = require("@fncts/base/data/Tag/constructors");
5
+ _fncts_base_data_Tag_constructors = require_chunk.__toESM(_fncts_base_data_Tag_constructors, 1);
6
+ //#region build/esm/ServerRequest/definition.js
7
+ const ServerRequestTypeId = Symbol.for("fncts.http.ServerRequest");
11
8
  /**
12
- * @tsplus type fncts.http.ServerRequest
13
- * @tsplus companion fncts.http.ServerRequestOps
14
- */
15
- class ServerRequest extends _definition.IncomingMessage {
16
- [ServerRequestTypeId] = ServerRequestTypeId;
17
- }
9
+ * @tsplus type fncts.http.ServerRequest
10
+ * @tsplus companion fncts.http.ServerRequestOps
11
+ */
12
+ var ServerRequest = class extends require_IncomingMessage_definition.IncomingMessage {
13
+ [ServerRequestTypeId] = ServerRequestTypeId;
14
+ };
18
15
  /**
19
- * @tsplus static fncts.http.ServerRequestOps Tag
20
- */
16
+ * @tsplus static fncts.http.ServerRequestOps Tag
17
+ */
18
+ const ServerRequestTag = _fncts_base_data_Tag_constructors.makeTag();
19
+ //#endregion
21
20
  exports.ServerRequest = ServerRequest;
22
- const ServerRequestTag = exports.ServerRequestTag = /*#__PURE__*/tsplus_module_1.makeTag();
21
+ exports.ServerRequestTag = ServerRequestTag;
22
+ exports.ServerRequestTypeId = ServerRequestTypeId;
23
+
23
24
  //# sourceMappingURL=definition.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.cjs","names":["_definition","require","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ServerRequestTypeId","exports","Symbol","for","ServerRequest","IncomingMessage","ServerRequestTag","tsplus_module_1","makeTag"],"sources":["../../_src/ServerRequest/definition.ts"],"sourcesContent":[null],"mappings":";;;;;;;AAKA,IAAAA,WAAA,gBAAAC,OAAA;AAAmE,SAAAC,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAE5D,MAAMkB,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,0BAA0B,CAAC;AAGzE;;;;AAIM,MAAgBC,aAAc,SAAQC,2BAA6B;EAC9D,CAACL,mBAAmB,IAAyBA,mBAAmB;;AAc3E;;;AAAAC,OAAA,CAAAG,aAAA,GAAAA,aAAA;AAGO,MAAME,gBAAgB,GAAAL,OAAA,CAAAK,gBAAA,gBAAGC,eAAA,CAAAC,OAAA,EAAoB","ignoreList":[]}
1
+ {"version":3,"file":"definition.cjs","names":["IncomingMessage","tsplus_module_1"],"sources":["../../esm/ServerRequest/definition.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/base/data/Tag/constructors\";\nimport { IncomingMessage } from \"../IncomingMessage/definition.js\";\nexport const ServerRequestTypeId = Symbol.for(\"fncts.http.ServerRequest\");\n/**\n * @tsplus type fncts.http.ServerRequest\n * @tsplus companion fncts.http.ServerRequestOps\n */\nexport class ServerRequest extends IncomingMessage {\n [ServerRequestTypeId] = ServerRequestTypeId;\n}\n/**\n * @tsplus static fncts.http.ServerRequestOps Tag\n */\nexport const ServerRequestTag = tsplus_module_1.makeTag();\n//# sourceMappingURL=definition.js.map"],"mappings":";;;;;;AAEA,MAAa,sBAAsB,OAAO,IAAI,2BAA2B;;;;;AAKzE,IAAa,gBAAb,cAAmCA,mCAAAA,gBAAgB;CAC/C,CAAC,uBAAuB;;;;;AAK5B,MAAa,mBAAmBC,kCAAgB,SAAS"}