@fncts/http 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/Body/api.d.ts +63 -0
  2. package/Body/definition.d.ts +53 -0
  3. package/Body.d.ts +2 -0
  4. package/BodyError.d.ts +30 -0
  5. package/Headers.d.ts +42 -0
  6. package/HttpApp.d.ts +46 -0
  7. package/IncomingMessage/api.d.ts +19 -0
  8. package/IncomingMessage/definition.d.ts +21 -0
  9. package/IncomingMessage.d.ts +2 -0
  10. package/Method.d.ts +2 -0
  11. package/Middleware.d.ts +24 -0
  12. package/QueryParams.d.ts +7 -0
  13. package/RequestError.d.ts +10 -0
  14. package/ResponseError.d.ts +14 -0
  15. package/Route/api.d.ts +37 -0
  16. package/Route/definition.d.ts +35 -0
  17. package/Route/internal.d.ts +17 -0
  18. package/Route.d.ts +2 -0
  19. package/RouteNotFound.d.ts +8 -0
  20. package/Router/api.d.ts +96 -0
  21. package/Router/definition.d.ts +28 -0
  22. package/Router/internal.d.ts +26 -0
  23. package/Router.d.ts +2 -0
  24. package/Server.d.ts +53 -0
  25. package/ServerError.d.ts +9 -0
  26. package/ServerRequest/api.d.ts +6 -0
  27. package/ServerRequest/definition.d.ts +30 -0
  28. package/ServerRequest/internal.d.ts +33 -0
  29. package/ServerRequest.d.ts +2 -0
  30. package/ServerResponse/api.d.ts +69 -0
  31. package/ServerResponse/definition.d.ts +30 -0
  32. package/ServerResponse.d.ts +2 -0
  33. package/Socket.d.ts +107 -0
  34. package/UrlParams.d.ts +21 -0
  35. package/_cjs/Body/api.cjs +93 -0
  36. package/_cjs/Body/api.cjs.map +1 -0
  37. package/_cjs/Body/definition.cjs +71 -0
  38. package/_cjs/Body/definition.cjs.map +1 -0
  39. package/_cjs/Body.cjs +28 -0
  40. package/_cjs/Body.cjs.map +1 -0
  41. package/_cjs/BodyError.cjs +43 -0
  42. package/_cjs/BodyError.cjs.map +1 -0
  43. package/_cjs/Headers.cjs +87 -0
  44. package/_cjs/Headers.cjs.map +1 -0
  45. package/_cjs/HttpApp.cjs +109 -0
  46. package/_cjs/HttpApp.cjs.map +1 -0
  47. package/_cjs/IncomingMessage/api.cjs +35 -0
  48. package/_cjs/IncomingMessage/api.cjs.map +1 -0
  49. package/_cjs/IncomingMessage/definition.cjs +20 -0
  50. package/_cjs/IncomingMessage/definition.cjs.map +1 -0
  51. package/_cjs/IncomingMessage.cjs +28 -0
  52. package/_cjs/IncomingMessage.cjs.map +1 -0
  53. package/_cjs/Method.cjs +10 -0
  54. package/_cjs/Method.cjs.map +1 -0
  55. package/_cjs/Middleware.cjs +16 -0
  56. package/_cjs/Middleware.cjs.map +1 -0
  57. package/_cjs/QueryParams.cjs +6 -0
  58. package/_cjs/QueryParams.cjs.map +1 -0
  59. package/_cjs/RequestError.cjs +19 -0
  60. package/_cjs/RequestError.cjs.map +1 -0
  61. package/_cjs/ResponseError.cjs +27 -0
  62. package/_cjs/ResponseError.cjs.map +1 -0
  63. package/_cjs/Route/api.cjs +61 -0
  64. package/_cjs/Route/api.cjs.map +1 -0
  65. package/_cjs/Route/definition.cjs +35 -0
  66. package/_cjs/Route/definition.cjs.map +1 -0
  67. package/_cjs/Route/internal.cjs +31 -0
  68. package/_cjs/Route/internal.cjs.map +1 -0
  69. package/_cjs/Route.cjs +28 -0
  70. package/_cjs/Route.cjs.map +1 -0
  71. package/_cjs/RouteNotFound.cjs +18 -0
  72. package/_cjs/RouteNotFound.cjs.map +1 -0
  73. package/_cjs/Router/api.cjs +141 -0
  74. package/_cjs/Router/api.cjs.map +1 -0
  75. package/_cjs/Router/definition.cjs +22 -0
  76. package/_cjs/Router/definition.cjs.map +1 -0
  77. package/_cjs/Router/internal.cjs +85 -0
  78. package/_cjs/Router/internal.cjs.map +1 -0
  79. package/_cjs/Router.cjs +28 -0
  80. package/_cjs/Router.cjs.map +1 -0
  81. package/_cjs/Server.cjs +53 -0
  82. package/_cjs/Server.cjs.map +1 -0
  83. package/_cjs/ServerError.cjs +21 -0
  84. package/_cjs/ServerError.cjs.map +1 -0
  85. package/_cjs/ServerRequest/api.cjs +14 -0
  86. package/_cjs/ServerRequest/api.cjs.map +1 -0
  87. package/_cjs/ServerRequest/definition.cjs +29 -0
  88. package/_cjs/ServerRequest/definition.cjs.map +1 -0
  89. package/_cjs/ServerRequest/internal.cjs +77 -0
  90. package/_cjs/ServerRequest/internal.cjs.map +1 -0
  91. package/_cjs/ServerRequest.cjs +28 -0
  92. package/_cjs/ServerRequest.cjs.map +1 -0
  93. package/_cjs/ServerResponse/api.cjs +157 -0
  94. package/_cjs/ServerResponse/api.cjs.map +1 -0
  95. package/_cjs/ServerResponse/definition.cjs +44 -0
  96. package/_cjs/ServerResponse/definition.cjs.map +1 -0
  97. package/_cjs/ServerResponse.cjs +28 -0
  98. package/_cjs/ServerResponse.cjs.map +1 -0
  99. package/_cjs/Socket.cjs +221 -0
  100. package/_cjs/Socket.cjs.map +1 -0
  101. package/_cjs/UrlParams.cjs +34 -0
  102. package/_cjs/UrlParams.cjs.map +1 -0
  103. package/_cjs/global.cjs +6 -0
  104. package/_cjs/global.cjs.map +1 -0
  105. package/_mjs/Body/api.mjs +78 -0
  106. package/_mjs/Body/api.mjs.map +1 -0
  107. package/_mjs/Body/definition.mjs +58 -0
  108. package/_mjs/Body/definition.mjs.map +1 -0
  109. package/_mjs/Body.mjs +5 -0
  110. package/_mjs/Body.mjs.map +1 -0
  111. package/_mjs/BodyError.mjs +33 -0
  112. package/_mjs/BodyError.mjs.map +1 -0
  113. package/_mjs/Headers.mjs +75 -0
  114. package/_mjs/Headers.mjs.map +1 -0
  115. package/_mjs/HttpApp.mjs +96 -0
  116. package/_mjs/HttpApp.mjs.map +1 -0
  117. package/_mjs/IncomingMessage/api.mjs +25 -0
  118. package/_mjs/IncomingMessage/api.mjs.map +1 -0
  119. package/_mjs/IncomingMessage/definition.mjs +13 -0
  120. package/_mjs/IncomingMessage/definition.mjs.map +1 -0
  121. package/_mjs/IncomingMessage.mjs +5 -0
  122. package/_mjs/IncomingMessage.mjs.map +1 -0
  123. package/_mjs/Method.mjs +4 -0
  124. package/_mjs/Method.mjs.map +1 -0
  125. package/_mjs/Middleware.mjs +9 -0
  126. package/_mjs/Middleware.mjs.map +1 -0
  127. package/_mjs/QueryParams.mjs +2 -0
  128. package/_mjs/QueryParams.mjs.map +1 -0
  129. package/_mjs/RequestError.mjs +12 -0
  130. package/_mjs/RequestError.mjs.map +1 -0
  131. package/_mjs/ResponseError.mjs +20 -0
  132. package/_mjs/ResponseError.mjs.map +1 -0
  133. package/_mjs/Route/api.mjs +48 -0
  134. package/_mjs/Route/api.mjs.map +1 -0
  135. package/_mjs/Route/definition.mjs +25 -0
  136. package/_mjs/Route/definition.mjs.map +1 -0
  137. package/_mjs/Route/internal.mjs +21 -0
  138. package/_mjs/Route/internal.mjs.map +1 -0
  139. package/_mjs/Route.mjs +5 -0
  140. package/_mjs/Route.mjs.map +1 -0
  141. package/_mjs/RouteNotFound.mjs +11 -0
  142. package/_mjs/RouteNotFound.mjs.map +1 -0
  143. package/_mjs/Router/api.mjs +123 -0
  144. package/_mjs/Router/api.mjs.map +1 -0
  145. package/_mjs/Router/definition.mjs +15 -0
  146. package/_mjs/Router/definition.mjs.map +1 -0
  147. package/_mjs/Router/internal.mjs +76 -0
  148. package/_mjs/Router/internal.mjs.map +1 -0
  149. package/_mjs/Router.mjs +5 -0
  150. package/_mjs/Router.mjs.map +1 -0
  151. package/_mjs/Server.mjs +41 -0
  152. package/_mjs/Server.mjs.map +1 -0
  153. package/_mjs/ServerError.mjs +14 -0
  154. package/_mjs/ServerError.mjs.map +1 -0
  155. package/_mjs/ServerRequest/api.mjs +8 -0
  156. package/_mjs/ServerRequest/api.mjs.map +1 -0
  157. package/_mjs/ServerRequest/definition.mjs +20 -0
  158. package/_mjs/ServerRequest/definition.mjs.map +1 -0
  159. package/_mjs/ServerRequest/internal.mjs +68 -0
  160. package/_mjs/ServerRequest/internal.mjs.map +1 -0
  161. package/_mjs/ServerRequest.mjs +5 -0
  162. package/_mjs/ServerRequest.mjs.map +1 -0
  163. package/_mjs/ServerResponse/api.mjs +138 -0
  164. package/_mjs/ServerResponse/api.mjs.map +1 -0
  165. package/_mjs/ServerResponse/definition.mjs +34 -0
  166. package/_mjs/ServerResponse/definition.mjs.map +1 -0
  167. package/_mjs/ServerResponse.mjs +5 -0
  168. package/_mjs/ServerResponse.mjs.map +1 -0
  169. package/_mjs/Socket.mjs +202 -0
  170. package/_mjs/Socket.mjs.map +1 -0
  171. package/_mjs/UrlParams.mjs +25 -0
  172. package/_mjs/UrlParams.mjs.map +1 -0
  173. package/_mjs/global.mjs +2 -0
  174. package/_mjs/global.mjs.map +1 -0
  175. package/_src/Body/api.ts +106 -0
  176. package/_src/Body/definition.ts +74 -0
  177. package/_src/Body.ts +5 -0
  178. package/_src/BodyError.ts +38 -0
  179. package/_src/Headers.ts +84 -0
  180. package/_src/HttpApp.ts +129 -0
  181. package/_src/IncomingMessage/api.ts +25 -0
  182. package/_src/IncomingMessage/definition.ts +20 -0
  183. package/_src/IncomingMessage.ts +5 -0
  184. package/_src/Method.ts +5 -0
  185. package/_src/Middleware.ts +29 -0
  186. package/_src/QueryParams.ts +7 -0
  187. package/_src/RequestError.ts +13 -0
  188. package/_src/ResponseError.ts +25 -0
  189. package/_src/Route/api.ts +53 -0
  190. package/_src/Route/definition.ts +40 -0
  191. package/_src/Route/internal.ts +25 -0
  192. package/_src/Route.ts +5 -0
  193. package/_src/RouteNotFound.ts +14 -0
  194. package/_src/Router/api.ts +161 -0
  195. package/_src/Router/definition.ts +29 -0
  196. package/_src/Router/internal.ts +95 -0
  197. package/_src/Router.ts +5 -0
  198. package/_src/Server.ts +88 -0
  199. package/_src/ServerError.ts +14 -0
  200. package/_src/ServerRequest/api.ts +10 -0
  201. package/_src/ServerRequest/definition.ts +33 -0
  202. package/_src/ServerRequest/internal.ts +106 -0
  203. package/_src/ServerRequest.ts +5 -0
  204. package/_src/ServerResponse/api.ts +177 -0
  205. package/_src/ServerResponse/definition.ts +51 -0
  206. package/_src/ServerResponse.ts +5 -0
  207. package/_src/Socket.ts +294 -0
  208. package/_src/UrlParams.ts +28 -0
  209. package/_src/global.ts +2 -0
  210. package/global.d.ts +1 -0
  211. package/package.json +27 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RouteNotFoundTypeId = exports.RouteNotFound = void 0;
7
+ const RouteNotFoundTypeId = exports.RouteNotFoundTypeId = /*#__PURE__*/Symbol.for("fncts.http.RouteNotFound");
8
+ class RouteNotFound extends Error {
9
+ constructor(request) {
10
+ super();
11
+ this.request = request;
12
+ }
13
+ get message() {
14
+ return `${this.request.method} ${this.request.url} not found`;
15
+ }
16
+ }
17
+ exports.RouteNotFound = RouteNotFound;
18
+ //# sourceMappingURL=RouteNotFound.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteNotFound.cjs","names":["RouteNotFoundTypeId","exports","Symbol","for","RouteNotFound","Error","constructor","request","message","method","url"],"sources":["../_src/RouteNotFound.ts"],"sourcesContent":[null],"mappings":";;;;;;AAEO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,0BAA0B,CAAC;AAGnE,MAAOC,aAAc,SAAQC,KAAK;EACtCC,YAAqBC,OAAsB;IACzC,KAAK,EAAE;IADY,KAAAA,OAAO,GAAPA,OAAO;EAE5B;EAEA,IAAIC,OAAOA,CAAA;IACT,OAAO,GAAG,IAAI,CAACD,OAAO,CAACE,MAAM,IAAI,IAAI,CAACF,OAAO,CAACG,GAAG,YAAY;EAC/D;;AACDT,OAAA,CAAAG,aAAA,GAAAA,aAAA"}
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.catchAll = catchAll;
7
+ exports.catchAllCause = catchAllCause;
8
+ exports.empty = exports.del = exports.concat = void 0;
9
+ exports.from = from;
10
+ exports.head = exports.get = void 0;
11
+ exports.mount = mount;
12
+ exports.prefixAll = exports.post = exports.patch = exports.options = void 0;
13
+ exports.provideService = provideService;
14
+ exports.put = void 0;
15
+ exports.route = route;
16
+ exports.use = void 0;
17
+ var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/empty"));
18
+ var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api"));
19
+ var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
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 _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
+ const fileName_1 = "(@fncts/http) src/Router/api.ts";
29
+ const use = exports.use = use_1;
30
+ const concat = exports.concat = concat_1;
31
+ const prefixAll = exports.prefixAll = prefixAll_1;
32
+ /**
33
+ * @tsplus static fncts.http.RouterOps empty
34
+ */
35
+ const empty = exports.empty = /*#__PURE__*/new _internal2.RouterInternal( /*#__PURE__*/tsplus_module_1.empty(), /*#__PURE__*/tsplus_module_1.empty());
36
+ function route(method) {
37
+ return (path, handler) => self => new _internal2.RouterInternal(tsplus_module_2.append(new _internal.RouteImpl(method, path, handler))(self.routes), self.mounts);
38
+ }
39
+ /**
40
+ * @tsplus pipeable fncts.http.Router get
41
+ * @tsplus static fncts.http.RouterOps get
42
+ */
43
+ const get = exports.get = /*#__PURE__*/route("GET");
44
+ /**
45
+ * @tsplus pipeable fncts.http.Router post
46
+ * @tsplus static fncts.http.RouterOps post
47
+ */
48
+ const post = exports.post = /*#__PURE__*/route("POST");
49
+ /**
50
+ * @tsplus pipeable fncts.http.Router put
51
+ * @tsplus static fncts.http.RouterOps put
52
+ */
53
+ const put = exports.put = /*#__PURE__*/route("PUT");
54
+ /**
55
+ * @tsplus pipeable fncts.http.Router patch
56
+ * @tsplus static fncts.http.RouterOps patch
57
+ */
58
+ const patch = exports.patch = /*#__PURE__*/route("PATCH");
59
+ /**
60
+ * @tsplus pipeable fncts.http.Router del
61
+ * @tsplus static fncts.http.RouterOps del
62
+ */
63
+ const del = exports.del = /*#__PURE__*/route("DELETE");
64
+ /**
65
+ * @tsplus pipeable fncts.http.Router head
66
+ * @tsplus static fncts.http.RouterOps head
67
+ */
68
+ const head = exports.head = /*#__PURE__*/route("HEAD");
69
+ /**
70
+ * @tsplus pipeable fncts.http.Router options
71
+ * @tsplus static fncts.http.RouterOps options
72
+ */
73
+ const options = exports.options = /*#__PURE__*/route("OPTIONS");
74
+ /**
75
+ * @tsplus pipeable fncts.http.Router use
76
+ * @tsplus static fncts.http.RouterOps use
77
+ */
78
+ function use_1(f, __tsplusTrace) {
79
+ return self => new _internal2.RouterInternal(tsplus_module_2.map(route => new _internal.RouteImpl(route.method, route.path, f(route.handler), route.prefix))(self.routes), tsplus_module_2.map(({
80
+ prefix,
81
+ httpApp
82
+ }) => ({
83
+ prefix,
84
+ httpApp: f(httpApp)
85
+ }))(self.mounts));
86
+ }
87
+ /**
88
+ * @tsplus static fncts.http.RouterOps from
89
+ */
90
+ function from(routes) {
91
+ return new _internal2.RouterInternal(tsplus_module_3.from(routes), tsplus_module_1.empty());
92
+ }
93
+ /**
94
+ * @tsplus pipeable fncts.http.Router concat
95
+ */
96
+ function concat_1(that) {
97
+ return self => new _internal2.RouterInternal(tsplus_module_2.concat(that.routes)(self.routes), self.mounts);
98
+ }
99
+ function removeTrailingSlash(path) {
100
+ return path.endsWith("/") ? path.slice(0, -1) : path;
101
+ }
102
+ /**
103
+ * @tsplus pipeable fncts.http.Router prefixAll
104
+ */
105
+ function prefixAll_1(prefix) {
106
+ return self => {
107
+ prefix = removeTrailingSlash(prefix);
108
+ return new _internal2.RouterInternal(tsplus_module_2.map(route => new _internal.RouteImpl(route.method, route.path === "/" ? prefix : prefix + route.path, route.handler, tsplus_module_5.orElse(() => tsplus_module_4.just(prefix, fileName_1 + ":124:60"))(tsplus_module_5.map(_ => prefix + _)(route.prefix))))(self.routes), tsplus_module_2.map(({
109
+ prefix: path,
110
+ httpApp
111
+ }) => ({
112
+ prefix: path === "/" ? prefix : prefix + path,
113
+ httpApp
114
+ }))(self.mounts));
115
+ };
116
+ }
117
+ /**
118
+ * @tsplus pipeable fncts.http.Router mount
119
+ */
120
+ function mount(path, that) {
121
+ return self => concat_1(prefixAll_1(path)(that))(self);
122
+ }
123
+ /**
124
+ * @tsplus pipeable fncts.http.Router catchAll
125
+ */
126
+ function catchAll(f, __tsplusTrace) {
127
+ return self => use_1(handler => tsplus_module_6.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);
128
+ }
129
+ /**
130
+ * @tsplus pipeable fncts.http.Router catchAllCause
131
+ */
132
+ function catchAllCause(f, __tsplusTrace) {
133
+ return self => use_1(handler => tsplus_module_6.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);
134
+ }
135
+ /**
136
+ * @tsplus pipeable fncts.http.Router provideService
137
+ */
138
+ function provideService(service, tag, __tsplusTrace) {
139
+ return self => use_1(handler => tsplus_module_7.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);
140
+ }
141
+ //# sourceMappingURL=api.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.cjs","names":["_internal","require","_internal2","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","use","exports","use_1","concat","concat_1","prefixAll","prefixAll_1","empty","RouterInternal","tsplus_module_1","route","method","path","handler","self","tsplus_module_2","append","RouteImpl","routes","mounts","post","put","patch","del","head","options","f","__tsplusTrace","map","prefix","httpApp","from","tsplus_module_3","that","removeTrailingSlash","endsWith","slice","tsplus_module_5","orElse","tsplus_module_4","just","fileName_1","_","mount","catchAll","tsplus_module_6","catchAllCause","provideService","service","tag","tsplus_module_7","provideSomeService"],"sources":["../../_src/Router/api.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,SAAA,gBAAAC,OAAA;AACA,IAAAC,UAAA,gBAAAD,OAAA;AAA+C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAA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TypeId = 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");
10
+ /**
11
+ * @tsplus type fncts.http.Router
12
+ * @tsplus companion fncts.http.RouterOps
13
+ */
14
+ class Router extends _IO.External {
15
+ constructor() {
16
+ super(...arguments);
17
+ this[_a] = RouterTypeId;
18
+ }
19
+ }
20
+ exports.Router = Router;
21
+ _a = RouterTypeId;
22
+ //# sourceMappingURL=definition.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.cjs","names":["_IO","require","RouterTypeId","exports","Symbol","for","Router","External","constructor","_a"],"sources":["../../_src/Router/definition.ts"],"sourcesContent":[null],"mappings":";;;;;;AAMA,IAAAA,GAAA,gBAAAC,OAAA;;AAEO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAG3D;;;;AAIM,MAAgBC,MACpB,SAAQC,YAAqE;EAD/EC,YAAA;;IAIW,KAAAC,EAAA,CAAc,GAAiBP,YAAY;EAKtD;;AAACC,OAAA,CAAAG,MAAA,GAAAA,MAAA;KALWJ,YAAY"}
@@ -0,0 +1,85 @@
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 _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ const fileName_1 = "(@fncts/http) src/Router/internal.ts";
23
+ class RouterInternal extends _definition4.Router {
24
+ constructor(routes, mounts) {
25
+ super();
26
+ this.routes = routes;
27
+ this.mounts = mounts;
28
+ this.httpApp = toHttpApp(this);
29
+ }
30
+ get toIO() {
31
+ return this.httpApp;
32
+ }
33
+ }
34
+ exports.RouterInternal = RouterInternal;
35
+ function toHttpApp(self) {
36
+ const router = FindMyWay.make();
37
+ const mounts = tsplus_module_2.map(({
38
+ prefix,
39
+ httpApp,
40
+ options
41
+ }) => [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);
42
+ const mountsLen = mounts.length;
43
+ tsplus_module_2.forEach(route => {
44
+ if (route.method === "*") {
45
+ router.all(route.path, route);
46
+ } else {
47
+ router.on(route.method, route.path, route);
48
+ }
49
+ })(self.routes);
50
+ return tsplus_module_8.withFiberRuntime(fiber => {
51
+ let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);
52
+ const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);
53
+ if (mountsLen > 0) {
54
+ for (let i = 0; i < mountsLen; i++) {
55
+ const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);
56
+ if (request.url.startsWith(path)) {
57
+ context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);
58
+ if (options?.inclduePrefix !== true) {
59
+ context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);
60
+ }
61
+ return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":70:53")(routeContext.route.handler);
62
+ }
63
+ }
64
+ }
65
+ let result = router.find(request.method, request.url);
66
+ if (result === undefined && request.method === "HEAD") {
67
+ result = router.find("GET", request.url);
68
+ }
69
+ if (result === undefined) {
70
+ return tsplus_module_8.failNow(new _RouteNotFound.RouteNotFound(request), fileName_1 + ":80:24");
71
+ }
72
+ const route = result.handler;
73
+ if (tsplus_module_9.isJust(route.prefix)) {
74
+ context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);
75
+ }
76
+ return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":86:47")(route.handler);
77
+ }, fileName_1 + ":59:29");
78
+ }
79
+ function sliceRequestUrl(request, prefix) {
80
+ const prefixLen = prefix.length;
81
+ return request.modify({
82
+ url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen)
83
+ });
84
+ }
85
+ //# sourceMappingURL=internal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.cjs","names":["FindMyWay","_interopRequireWildcard","require","_internal","_RouteNotFound","_definition4","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","RouterInternal","Router","constructor","routes","mounts","httpApp","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","prefixLen","modify","slice"],"sources":["../../_src/Router/internal.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,gBAAAC,uBAAA,eAAAC,OAAA;AAGA,IAAAC,SAAA,gBAAAD,OAAA;AACA,IAAAE,cAAA,gBAAAF,OAAA;AAEA,IAAAG,YAAA,gBAAAH,OAAA;AAAyC,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,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,eAAA,CAAAO,GAAA,CAAYG,eAAe,CAACX,OAAO,EAAEZ,KAAK,CAACZ,MAAM,CAAC8C,KAAK,CAAC,EAAAnB,eAAA,CAAAC,gBAAA,EAAxDR,OAAO,CAAqE;IACxF;IACA,OAAOgB,eAAA,CAAAC,OAAA,CAAAf,eAAA,CAAAC,kBAAA,EAAoCH,OAAO,EAAAb,UAAA,YAAC,CACjDK,KAAK,CAAC0B,OAA2D,CAClE;EACH,CAAC,EAAA/B,UAAA,YAAC;AACJ;AAEA,SAAS4B,eAAeA,CAACX,OAAsB,EAAExB,MAAc;EAC7D,MAAM+C,SAAS,GAAG/C,MAAM,CAACU,MAAM;EAC/B,OAAOc,OAAO,CAACwB,MAAM,CAAC;IAAElB,GAAG,EAAEN,OAAO,CAACM,GAAG,CAACpB,MAAM,IAAIqC,SAAS,GAAG,GAAG,GAAGvB,OAAO,CAACM,GAAG,CAACmB,KAAK,CAACF,SAAS;EAAC,CAAE,CAAC;AACtG"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _definition = /*#__PURE__*/require("./Router/definition.cjs");
7
+ Object.keys(_definition).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _definition[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _definition[key];
14
+ }
15
+ });
16
+ });
17
+ var _api = /*#__PURE__*/require("./Router/api.cjs");
18
+ Object.keys(_api).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _api[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _api[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=Router.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Router.cjs","names":["_definition","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_api"],"sources":["../_src/Router.ts"],"sourcesContent":[null],"mappings":";;;;;AAEA,IAAAA,WAAA,gBAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,IAAA,gBAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,IAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,IAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,IAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,53 @@
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 _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ var _a;
17
+ const fileName_1 = "(@fncts/http) src/Server.ts";
18
+ const ServerTypeId = exports.ServerTypeId = /*#__PURE__*/Symbol.for("fncts.http.Server");
19
+ /**
20
+ * @tsplus type fncts.http.Server
21
+ * @tsplus companion fncts.http.ServerOps
22
+ */
23
+ class Server {
24
+ constructor() {
25
+ this[_a] = ServerTypeId;
26
+ }
27
+ }
28
+ exports.Server = Server;
29
+ _a = ServerTypeId;
30
+ /**
31
+ * @tsplus static fncts.http.ServerOps Tag
32
+ */
33
+ const ServerTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
34
+ const ServerTag = exports.ServerTag = ServerTag_1;
35
+ /**
36
+ * @tsplus static fncts.http.ServerOps __call
37
+ */
38
+ function make(options) {
39
+ return new class extends Server {
40
+ constructor() {
41
+ super(...arguments);
42
+ this.serve = options.serve;
43
+ this.address = options.address;
44
+ }
45
+ }();
46
+ }
47
+ function serve(middleware) {
48
+ 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");
49
+ }
50
+ function serveIO(middleware) {
51
+ 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"));
52
+ }
53
+ //# sourceMappingURL=Server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Server.cjs","names":["ServerTypeId","exports","Symbol","for","Server","constructor","_a","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;EAA5BC,YAAA;IACW,KAAAC,EAAA,CAAc,GAAiBN,YAAY;EAOtD;;AAACC,OAAA,CAAAG,MAAA,GAAAA,MAAA;KAPWJ,YAAY;AASxB;;;AAGO,MAAMO,WAAA,gBAAYC,eAAA,CAAAC,OAAA,EAAa;MAAzBC,SAAS,GAAAT,OAAA,CAAAS,SAAA,GAAAH,WAAA;AAetB;;;AAGM,SAAUI,IAAIA,CAACC,OAGpB;EACC,OAAO,IAAK,cAAcR,MAAM;IAApBC,YAAA;;MACV,KAAAQ,KAAK,GAAGD,OAAO,CAACC,KAAK;MACrB,KAAAC,OAAO,GAAGF,OAAO,CAACE,OAAO;IAC3B;GAAC,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"}
@@ -0,0 +1,21 @@
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
+ var _a;
10
+ const clientAbortFiberId = exports.clientAbortFiberId = /*#__PURE__*/(0, _Global.globalValue)("fncts.http.ServerError.clientAbortFiberId", () => new _FiberId.Runtime(-499, 0));
11
+ const ServeErrorTypeId = exports.ServeErrorTypeId = /*#__PURE__*/Symbol.for("fncts.http.ServeError");
12
+ class ServeError extends Error {
13
+ constructor(error) {
14
+ super();
15
+ this.error = error;
16
+ this[_a] = ServeErrorTypeId;
17
+ }
18
+ }
19
+ exports.ServeError = ServeError;
20
+ _a = ServeErrorTypeId;
21
+ //# sourceMappingURL=ServerError.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerError.cjs","names":["_FiberId","require","_Global","clientAbortFiberId","exports","globalValue","Runtime","ServeErrorTypeId","Symbol","for","ServeError","Error","constructor","error","_a"],"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;EAEnCC,YAAqBC,KAAe;IAClC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,EAAA,CAAkB,GAAqBP,gBAAgB;EAGhE;;AACDH,OAAA,CAAAM,UAAA,GAAAA,UAAA;KAJWH,gBAAgB"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fromWeb = fromWeb;
7
+ var _internal = /*#__PURE__*/require("./internal.cjs");
8
+ /**
9
+ * @tsplus static fncts.http.ServerRequestOps fromWeb
10
+ */
11
+ function fromWeb(request) {
12
+ return new _internal.ServerRequestImpl(request, request.url);
13
+ }
14
+ //# sourceMappingURL=api.cjs.map
@@ -0,0 +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"}
@@ -0,0 +1,29 @@
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 _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ var _a;
12
+ const ServerRequestTypeId = exports.ServerRequestTypeId = /*#__PURE__*/Symbol.for("fncts.http.ServerRequest");
13
+ /**
14
+ * @tsplus type fncts.http.ServerRequest
15
+ * @tsplus companion fncts.http.ServerRequestOps
16
+ */
17
+ class ServerRequest extends _definition.IncomingMessage {
18
+ constructor() {
19
+ super(...arguments);
20
+ this[_a] = ServerRequestTypeId;
21
+ }
22
+ }
23
+ exports.ServerRequest = ServerRequest;
24
+ _a = ServerRequestTypeId;
25
+ /**
26
+ * @tsplus static fncts.http.ServerRequestOps Tag
27
+ */
28
+ const ServerRequestTag = exports.ServerRequestTag = /*#__PURE__*/tsplus_module_1.makeTag();
29
+ //# sourceMappingURL=definition.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.cjs","names":["_definition","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ServerRequestTypeId","exports","Symbol","for","ServerRequest","IncomingMessage","constructor","_a","ServerRequestTag","tsplus_module_1","makeTag"],"sources":["../../_src/ServerRequest/definition.ts"],"sourcesContent":[null],"mappings":";;;;;;;AAKA,IAAAA,WAAA,gBAAAC,OAAA;AAAmE,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OA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AAA,CAAAG,aAAA,GAAAA,aAAA;KAZWJ,mBAAmB;AAc/B;;;AAGO,MAAMQ,gBAAgB,GAAAP,OAAA,CAAAO,gBAAA,gBAAGC,eAAA,CAAAC,OAAA,EAAoB"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ServerRequestImpl = 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/http/Headers"));
9
+ var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
10
+ var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/memoize"));
11
+ var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/runtime"));
12
+ var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/api"));
13
+ var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/http/UrlParams"));
14
+ var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/api"));
15
+ var _RequestError = /*#__PURE__*/require("../RequestError.cjs");
16
+ var _UrlParams2 = /*#__PURE__*/require("../UrlParams.cjs");
17
+ var _definition = /*#__PURE__*/require("./definition.cjs");
18
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
+ const fileName_1 = "(@fncts/http) src/ServerRequest/internal.ts";
21
+ class ServerRequestImpl extends _definition.ServerRequest {
22
+ constructor(source, url, headersOverride, remoteAddressOverride) {
23
+ super();
24
+ this.source = source;
25
+ this.url = url;
26
+ this.headersOverride = headersOverride;
27
+ this.remoteAddressOverride = remoteAddressOverride;
28
+ }
29
+ get method() {
30
+ return this.source.method.toUpperCase();
31
+ }
32
+ get originalUrl() {
33
+ return this.source.url;
34
+ }
35
+ get remoteAddress() {
36
+ return tsplus_module_1.fromNullable(this.remoteAddressOverride);
37
+ }
38
+ get headers() {
39
+ this.headersOverride ?? (this.headersOverride = tsplus_module_2.fromHeaders(this.source.headers));
40
+ return this.headersOverride;
41
+ }
42
+ get text() {
43
+ if (this.textIO) {
44
+ return this.textIO;
45
+ }
46
+ this.textIO = tsplus_module_6.getOrThrow(tsplus_module_5.unsafeRun(tsplus_module_4.memoize(tsplus_module_3.fromPromiseCatch(() => this.source.text(), error => new _RequestError.RequestError(this, "Decode", error), fileName_1 + ":42:38"), fileName_1 + ":45:6")));
47
+ return this.textIO;
48
+ }
49
+ get json() {
50
+ return tsplus_module_3.flatMap(text => tsplus_module_3.tryCatch(() => JSON.parse(text), error => new _RequestError.RequestError(this, "Decode", error), fileName_1 + ":52:18"), fileName_1 + ":51:29")(this.text);
51
+ }
52
+ get urlParamsBody() {
53
+ return tsplus_module_3.flatMap(text => tsplus_module_3.tryCatch(() => tsplus_module_7.make(new URLSearchParams(text)), error => new _RequestError.RequestError(this, "Decode", error), fileName_1 + ":61:18"), fileName_1 + ":60:29")(this.text);
54
+ }
55
+ get arrayBuffer() {
56
+ if (this.arrayBufferIO) {
57
+ return this.arrayBufferIO;
58
+ }
59
+ this.arrayBufferIO = tsplus_module_6.getOrThrow(tsplus_module_5.unsafeRun(tsplus_module_4.memoize(tsplus_module_3.fromPromiseCatch(() => this.source.arrayBuffer(), error => new _RequestError.RequestError(this, "Decode", error), fileName_1 + ":74:45"), fileName_1 + ":77:6")));
60
+ return this.arrayBufferIO;
61
+ }
62
+ get stream() {
63
+ if (this.source.body) {
64
+ return tsplus_module_8.fromReadableStream(() => this.source.body, error => new _RequestError.RequestError(this, "Decode", error));
65
+ } else {
66
+ return tsplus_module_8.failNow(new _RequestError.RequestError(this, "Decode", "cannot create stream from empty body"), fileName_1 + ":86:28");
67
+ }
68
+ }
69
+ modify(options) {
70
+ return new ServerRequestImpl(this.source, options.url ?? this.url, options.headers ?? this.headers, options.remoteAddress ?? this.remoteAddressOverride);
71
+ }
72
+ get upgrade() {
73
+ return tsplus_module_3.failNow(new _RequestError.RequestError(this, "Decode", "Not an upgradeable ServerRequest"), fileName_1 + ":104:22");
74
+ }
75
+ }
76
+ exports.ServerRequestImpl = ServerRequestImpl;
77
+ //# sourceMappingURL=internal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.cjs","names":["_RequestError","require","_UrlParams2","_definition","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ServerRequestImpl","ServerRequest","constructor","source","url","headersOverride","remoteAddressOverride","method","toUpperCase","originalUrl","remoteAddress","tsplus_module_1","fromNullable","headers","tsplus_module_2","fromHeaders","text","textIO","tsplus_module_6","getOrThrow","tsplus_module_5","unsafeRun","tsplus_module_4","memoize","tsplus_module_3","fromPromiseCatch","error","RequestError","fileName_1","json","flatMap","tryCatch","JSON","parse","urlParamsBody","tsplus_module_7","make","URLSearchParams","arrayBuffer","arrayBufferIO","stream","body","tsplus_module_8","fromReadableStream","failNow","modify","options","upgrade","exports"],"sources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B,eAAA,CAAAE,OAAA,CAAe,IAAIjB,0BAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,sCAAsC,CAAC,EAAAC,UAAA,YAAC;IACjG;EACF;EAEAiB,MAAMA,CAACC,OAIN;IACC,OAAO,IAAI9C,iBAAiB,CAC1B,IAAI,CAACG,MAAM,EACX2C,OAAO,CAAC1C,GAAG,IAAI,IAAI,CAACA,GAAG,EACvB0C,OAAO,CAACjC,OAAO,IAAI,IAAI,CAACA,OAAO,EAC/BiC,OAAO,CAACpC,aAAa,IAAI,IAAI,CAACJ,qBAAqB,CACpD;EACH;EAEA,IAAIyC,OAAOA,CAAA;IACT,OAAOvB,eAAA,CAAAoB,OAAA,CAAW,IAAIjB,0BAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,kCAAkC,CAAC,EAAAC,UAAA,aAAC;EACzF;;AACDoB,OAAA,CAAAhD,iBAAA,GAAAA,iBAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _definition = /*#__PURE__*/require("./ServerRequest/definition.cjs");
7
+ Object.keys(_definition).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _definition[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _definition[key];
14
+ }
15
+ });
16
+ });
17
+ var _api = /*#__PURE__*/require("./ServerRequest/api.cjs");
18
+ Object.keys(_api).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _api[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _api[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=ServerRequest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerRequest.cjs","names":["_definition","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_api"],"sources":["../_src/ServerRequest.ts"],"sourcesContent":[null],"mappings":";;;;;AAEA,IAAAA,WAAA,gBAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,IAAA,gBAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,IAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,IAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,IAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}