@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,138 +1,136 @@
1
- const fileName_1 = "(@fncts/http) src/Router/api.ts";
2
- import * as tsplus_module_1 from "@fncts/base/collection/immutable/Conc/api/empty";
3
- import * as tsplus_module_2 from "@fncts/base/collection/immutable/Conc/api";
1
+ import { RouteImpl } from "../Route/internal.mjs";
2
+ import { RouterInternal } from "./internal.mjs";
3
+ import * as tsplus_module_6 from "@fncts/io/IO/api";
4
4
  import * as tsplus_module_3 from "@fncts/base/collection/immutable/Conc/constructors";
5
5
  import * as tsplus_module_4 from "@fncts/base/data/Maybe/constructors";
6
- import * as tsplus_module_5 from "@fncts/base/data/Maybe/api";
7
- import * as tsplus_module_6 from "@fncts/io/IO/api";
8
6
  import * as tsplus_module_7 from "@fncts/io/IO/api/environment";
9
- export const use = use_1;
10
- export const from = from_1;
11
- export const concat = concat_1;
12
- export const prefixAll = prefixAll_1;
13
- import { RouteImpl } from "../Route/internal.mjs";
14
- import { RouterInternal } from "./internal.mjs";
15
- /**
16
- * @tsplus static fncts.http.RouterOps empty
17
- */
18
- export const empty = /*#__PURE__*/new RouterInternal(/*#__PURE__*/tsplus_module_1.empty(), /*#__PURE__*/tsplus_module_1.empty());
19
- export function route(method) {
20
- return (path, handler) => self => new RouterInternal(tsplus_module_2.append(new RouteImpl(method, path, handler))(self.routes), self.mounts);
7
+ import * as tsplus_module_1 from "@fncts/base/collection/immutable/Conc/api/empty";
8
+ import * as tsplus_module_2 from "@fncts/base/collection/immutable/Conc/api";
9
+ import * as tsplus_module_5 from "@fncts/base/data/Maybe/api";
10
+ //#region build/esm/Router/api.js
11
+ const fileName_1 = "(@fncts/http) src/Router/api.ts";
12
+ const use = use_1;
13
+ const from = from_1;
14
+ const concat = concat_1;
15
+ const prefixAll = prefixAll_1;
16
+ /**
17
+ * @tsplus static fncts.http.RouterOps empty
18
+ */
19
+ const empty = new RouterInternal(tsplus_module_1.empty(), tsplus_module_1.empty());
20
+ function route(method) {
21
+ return (path, handler) => (self) => new RouterInternal(tsplus_module_2.append(new RouteImpl(method, path, handler))(self.routes), self.mounts);
21
22
  }
22
23
  /**
23
- * @tsplus pipeable fncts.http.Router get
24
- * @tsplus static fncts.http.RouterOps get
25
- */
26
- export const get = /*#__PURE__*/route("GET");
27
- /**
28
- * @tsplus pipeable fncts.http.Router post
29
- * @tsplus static fncts.http.RouterOps post
30
- */
31
- export const post = /*#__PURE__*/route("POST");
32
- /**
33
- * @tsplus pipeable fncts.http.Router put
34
- * @tsplus static fncts.http.RouterOps put
35
- */
36
- export const put = /*#__PURE__*/route("PUT");
37
- /**
38
- * @tsplus pipeable fncts.http.Router patch
39
- * @tsplus static fncts.http.RouterOps patch
40
- */
41
- export const patch = /*#__PURE__*/route("PATCH");
42
- /**
43
- * @tsplus pipeable fncts.http.Router del
44
- * @tsplus static fncts.http.RouterOps del
45
- */
46
- export const del = /*#__PURE__*/route("DELETE");
47
- /**
48
- * @tsplus pipeable fncts.http.Router head
49
- * @tsplus static fncts.http.RouterOps head
50
- */
51
- export const head = /*#__PURE__*/route("HEAD");
52
- /**
53
- * @tsplus pipeable fncts.http.Router options
54
- * @tsplus static fncts.http.RouterOps options
55
- */
56
- export const options = /*#__PURE__*/route("OPTIONS");
57
- /**
58
- * @tsplus pipeable fncts.http.Router use
59
- * @tsplus static fncts.http.RouterOps use
60
- */
24
+ * @tsplus pipeable fncts.http.Router get
25
+ * @tsplus static fncts.http.RouterOps get
26
+ */
27
+ const get = route("GET");
28
+ /**
29
+ * @tsplus pipeable fncts.http.Router post
30
+ * @tsplus static fncts.http.RouterOps post
31
+ */
32
+ const post = route("POST");
33
+ /**
34
+ * @tsplus pipeable fncts.http.Router put
35
+ * @tsplus static fncts.http.RouterOps put
36
+ */
37
+ const put = route("PUT");
38
+ /**
39
+ * @tsplus pipeable fncts.http.Router patch
40
+ * @tsplus static fncts.http.RouterOps patch
41
+ */
42
+ const patch = route("PATCH");
43
+ /**
44
+ * @tsplus pipeable fncts.http.Router del
45
+ * @tsplus static fncts.http.RouterOps del
46
+ */
47
+ const del = route("DELETE");
48
+ /**
49
+ * @tsplus pipeable fncts.http.Router head
50
+ * @tsplus static fncts.http.RouterOps head
51
+ */
52
+ const head = route("HEAD");
53
+ /**
54
+ * @tsplus pipeable fncts.http.Router options
55
+ * @tsplus static fncts.http.RouterOps options
56
+ */
57
+ const options = route("OPTIONS");
58
+ /**
59
+ * @tsplus pipeable fncts.http.Router use
60
+ * @tsplus static fncts.http.RouterOps use
61
+ */
61
62
  function use_1(f, __tsplusTrace) {
62
- 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(({
63
- prefix,
64
- httpApp
65
- }) => ({
66
- prefix,
67
- httpApp: f(httpApp)
68
- }))(self.mounts));
63
+ return (self) => new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path, f(route.handler), route.prefix))(self.routes), tsplus_module_2.map(({ prefix, httpApp }) => ({
64
+ prefix,
65
+ httpApp: f(httpApp)
66
+ }))(self.mounts));
69
67
  }
70
68
  /**
71
- * @tsplus static fncts.http.RouterOps from
72
- */
69
+ * @tsplus static fncts.http.RouterOps from
70
+ */
73
71
  function from_1(routes) {
74
- return new RouterInternal(tsplus_module_3.from(routes), tsplus_module_1.empty());
72
+ return new RouterInternal(tsplus_module_3.from(routes), tsplus_module_1.empty());
75
73
  }
76
74
  /**
77
- * @tsplus static fncts.http.RouterOps routes
78
- */
79
- export function routes(...routes) {
80
- return from_1(routes);
75
+ * @tsplus static fncts.http.RouterOps routes
76
+ */
77
+ function routes(...routes) {
78
+ return from_1(routes);
81
79
  }
82
80
  /**
83
- * @tsplus pipeable fncts.http.Router append
84
- */
85
- export function append(route) {
86
- return self => {
87
- return new RouterInternal(tsplus_module_2.append(route)(self.routes), self.mounts);
88
- };
81
+ * @tsplus pipeable fncts.http.Router append
82
+ */
83
+ function append(route) {
84
+ return (self) => {
85
+ return new RouterInternal(tsplus_module_2.append(route)(self.routes), self.mounts);
86
+ };
89
87
  }
90
88
  /**
91
- * @tsplus pipeable fncts.http.Router concat
92
- */
89
+ * @tsplus pipeable fncts.http.Router concat
90
+ */
93
91
  function concat_1(that) {
94
- return self => new RouterInternal(tsplus_module_2.concat(that.routes)(self.routes), self.mounts);
92
+ return (self) => new RouterInternal(tsplus_module_2.concat(that.routes)(self.routes), self.mounts);
95
93
  }
96
94
  function removeTrailingSlash(path) {
97
- return path.endsWith("/") ? path.slice(0, -1) : path;
95
+ return path.endsWith("/") ? path.slice(0, -1) : path;
98
96
  }
99
97
  /**
100
- * @tsplus pipeable fncts.http.Router prefixAll
101
- */
98
+ * @tsplus pipeable fncts.http.Router prefixAll
99
+ */
102
100
  function prefixAll_1(prefix) {
103
- return self => {
104
- prefix = removeTrailingSlash(prefix);
105
- 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(({
106
- prefix: path,
107
- httpApp
108
- }) => ({
109
- prefix: path === "/" ? prefix : prefix + path,
110
- httpApp
111
- }))(self.mounts));
112
- };
101
+ return (self) => {
102
+ prefix = removeTrailingSlash(prefix);
103
+ return new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path === "/" ? prefix : prefix + route.path, route.handler, tsplus_module_5.orElse(() => tsplus_module_4.just(prefix, fileName_1 + ":150:60"))(tsplus_module_5.map((_) => prefix + _)(route.prefix))))(self.routes), tsplus_module_2.map(({ prefix: path, httpApp }) => ({
104
+ prefix: path === "/" ? prefix : prefix + path,
105
+ httpApp
106
+ }))(self.mounts));
107
+ };
113
108
  }
114
109
  /**
115
- * @tsplus pipeable fncts.http.Router mount
116
- */
117
- export function mount(path, that) {
118
- return self => concat_1(prefixAll_1(path)(that))(self);
110
+ * @tsplus pipeable fncts.http.Router mount
111
+ */
112
+ function mount(path, that) {
113
+ return (self) => concat_1(prefixAll_1(path)(that))(self);
119
114
  }
120
115
  /**
121
- * @tsplus pipeable fncts.http.Router catchAll
122
- */
123
- export function catchAll(f, __tsplusTrace) {
124
- return self => use_1(handler => tsplus_module_6.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);
116
+ * @tsplus pipeable fncts.http.Router catchAll
117
+ */
118
+ function catchAll(f, __tsplusTrace) {
119
+ return (self) => use_1((handler) => tsplus_module_6.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);
125
120
  }
126
121
  /**
127
- * @tsplus pipeable fncts.http.Router catchAllCause
128
- */
129
- export function catchAllCause(f, __tsplusTrace) {
130
- return self => use_1(handler => tsplus_module_6.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);
122
+ * @tsplus pipeable fncts.http.Router catchAllCause
123
+ */
124
+ function catchAllCause(f, __tsplusTrace) {
125
+ return (self) => use_1((handler) => tsplus_module_6.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);
131
126
  }
132
127
  /**
133
- * @tsplus pipeable fncts.http.Router provideService
134
- */
135
- export function provideService(service, tag, __tsplusTrace) {
136
- return self => use_1(handler => tsplus_module_7.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);
128
+ * @tsplus pipeable fncts.http.Router provideService
129
+ */
130
+ function provideService(service, tag, __tsplusTrace) {
131
+ return (self) => use_1((handler) => tsplus_module_7.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);
137
132
  }
133
+ //#endregion
134
+ export { append, catchAll, catchAllCause, concat, del, empty, from, get, head, mount, options, patch, post, prefixAll, provideService, put, route, routes, use };
135
+
138
136
  //# sourceMappingURL=api.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.mjs","names":["use","use_1","from","from_1","concat","concat_1","prefixAll","prefixAll_1","RouteImpl","RouterInternal","empty","tsplus_module_1","route","method","path","handler","self","tsplus_module_2","append","routes","mounts","get","post","put","patch","del","head","options","f","__tsplusTrace","map","prefix","httpApp","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":";;;;;;;;aAmFgBA,GAAG,GAAAC,KAAA;aAWHC,IAAI,GAAAC,MAAA;aAiCJC,MAAM,GAAAC,QAAA;aAYNC,SAAS,GAAAC,WAAA;AAvIzB,SAASC,SAAS,QAAQ,uBAAsB;AAI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,CAAC,EAFmCC,aAAA,EAE1Dd,OAAO,CAAiB,EAFkCc,aAAA,EAEhFb,IAAI,CAA2C;AACnD;AAEA;;;AAGA,OAAM,SAAUgC,cAAcA,CAAIC,OAAU,EAAEC,GAAW,EAAErB,aAAsB;EAC/E,OAAcb,IAAkB,IAC9Bf,KAAA,CAAUc,OAAO,IAAKoC,eAAA,CAAAC,kBAAA,CAA2BH,OAAO,EAAEC,GAAG,EAFNrB,aAAA,EAEjCd,OAAO,CAAiC,EAFPc,aAAA,EAEvDb,IAAI,CAA2D;AACnE","ignoreList":[]}
1
+ {"version":3,"file":"api.mjs","names":[],"sources":["../../esm/Router/api.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Router/api.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/collection/immutable/Conc/api/empty\";\nimport * as tsplus_module_2 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_4 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/api\";\nimport * as tsplus_module_6 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_7 from \"@fncts/io/IO/api/environment\";\nexport const use = use_1;\nexport const from = from_1;\nexport const concat = concat_1;\nexport const prefixAll = prefixAll_1;\nimport { RouteImpl } from \"../Route/internal.js\";\nimport { RouterInternal } from \"./internal.js\";\n/**\n * @tsplus static fncts.http.RouterOps empty\n */\nexport const empty = new RouterInternal(tsplus_module_1.empty(), tsplus_module_1.empty());\nexport function route(method) {\n return (path, handler) => (self) => new RouterInternal(tsplus_module_2.append(new RouteImpl(method, path, handler))(self.routes), self.mounts);\n}\n/**\n * @tsplus pipeable fncts.http.Router get\n * @tsplus static fncts.http.RouterOps get\n */\nexport const get = route(\"GET\");\n/**\n * @tsplus pipeable fncts.http.Router post\n * @tsplus static fncts.http.RouterOps post\n */\nexport const post = route(\"POST\");\n/**\n * @tsplus pipeable fncts.http.Router put\n * @tsplus static fncts.http.RouterOps put\n */\nexport const put = route(\"PUT\");\n/**\n * @tsplus pipeable fncts.http.Router patch\n * @tsplus static fncts.http.RouterOps patch\n */\nexport const patch = route(\"PATCH\");\n/**\n * @tsplus pipeable fncts.http.Router del\n * @tsplus static fncts.http.RouterOps del\n */\nexport const del = route(\"DELETE\");\n/**\n * @tsplus pipeable fncts.http.Router head\n * @tsplus static fncts.http.RouterOps head\n */\nexport const head = route(\"HEAD\");\n/**\n * @tsplus pipeable fncts.http.Router options\n * @tsplus static fncts.http.RouterOps options\n */\nexport const options = route(\"OPTIONS\");\n/**\n * @tsplus pipeable fncts.http.Router use\n * @tsplus static fncts.http.RouterOps use\n */\nfunction use_1(f, __tsplusTrace) {\n return (self) => new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path, f(route.handler), route.prefix))(self.routes), tsplus_module_2.map(({ prefix, httpApp }) => ({ prefix, httpApp: f(httpApp) }))(self.mounts));\n}\n/**\n * @tsplus static fncts.http.RouterOps from\n */\nfunction from_1(routes) {\n return new RouterInternal(tsplus_module_3.from(routes), tsplus_module_1.empty());\n}\n/**\n * @tsplus static fncts.http.RouterOps routes\n */\nexport function routes(...routes) {\n return from_1(routes);\n}\n/**\n * @tsplus pipeable fncts.http.Router append\n */\nexport function append(route) {\n return (self) => {\n return new RouterInternal(tsplus_module_2.append(route)(self.routes), self.mounts);\n };\n}\n/**\n * @tsplus pipeable fncts.http.Router concat\n */\nfunction concat_1(that) {\n return (self) => new RouterInternal(tsplus_module_2.concat(that.routes)(self.routes), self.mounts);\n}\nfunction removeTrailingSlash(path) {\n return (path.endsWith(\"/\") ? path.slice(0, -1) : path);\n}\n/**\n * @tsplus pipeable fncts.http.Router prefixAll\n */\nfunction prefixAll_1(prefix) {\n return (self) => {\n prefix = removeTrailingSlash(prefix);\n return new RouterInternal(tsplus_module_2.map((route) => new RouteImpl(route.method, route.path === \"/\" ? prefix : (prefix + route.path), route.handler, tsplus_module_5.orElse(() => tsplus_module_4.just(prefix, fileName_1 + \":150:60\"))(tsplus_module_5.map((_) => prefix + _)(route.prefix))))(self.routes), tsplus_module_2.map(({ prefix: path, httpApp }) => ({ prefix: path === \"/\" ? prefix : prefix + path, httpApp }))(self.mounts));\n };\n}\n/**\n * @tsplus pipeable fncts.http.Router mount\n */\nexport function mount(path, that) {\n return (self) => concat_1(prefixAll_1(path)(that))(self);\n}\n/**\n * @tsplus pipeable fncts.http.Router catchAll\n */\nexport function catchAll(f, __tsplusTrace) {\n return (self) => use_1((handler) => tsplus_module_6.catchAll(f, __tsplusTrace)(handler), __tsplusTrace)(self);\n}\n/**\n * @tsplus pipeable fncts.http.Router catchAllCause\n */\nexport function catchAllCause(f, __tsplusTrace) {\n return (self) => use_1((handler) => tsplus_module_6.catchAllCause(f, __tsplusTrace)(handler), __tsplusTrace)(self);\n}\n/**\n * @tsplus pipeable fncts.http.Router provideService\n */\nexport function provideService(service, tag, __tsplusTrace) {\n return (self) => use_1((handler) => tsplus_module_7.provideSomeService(service, tag, __tsplusTrace)(handler), __tsplusTrace)(self);\n}\n//# sourceMappingURL=api.js.map"],"mappings":";;;;;;;;;;AAAA,MAAM,aAAa;AAQnB,MAAa,MAAM;AACnB,MAAa,OAAO;AACpB,MAAa,SAAS;AACtB,MAAa,YAAY;;;;AAMzB,MAAa,QAAQ,IAAI,eAAe,gBAAgB,OAAO,EAAE,gBAAgB,OAAO,CAAC;AACzF,SAAgB,MAAM,QAAQ;AAC1B,SAAQ,MAAM,aAAa,SAAS,IAAI,eAAe,gBAAgB,OAAO,IAAI,UAAU,QAAQ,MAAM,QAAQ,CAAC,CAAC,KAAK,OAAO,EAAE,KAAK,OAAO;;;;;;AAMlJ,MAAa,MAAM,MAAM,MAAM;;;;;AAK/B,MAAa,OAAO,MAAM,OAAO;;;;;AAKjC,MAAa,MAAM,MAAM,MAAM;;;;;AAK/B,MAAa,QAAQ,MAAM,QAAQ;;;;;AAKnC,MAAa,MAAM,MAAM,S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,OAAO,EAAE,gBAAgB,KAAK,EAAE,QAAQ,MAAM,eAAe;GAAE,QAAQ,SAAS,MAAM,SAAS,SAAS;GAAM;GAAS,EAAE,CAAC,KAAK,OAAO,CAAC;;;;;;AAMxb,SAAgB,MAAM,MAAM,MAAM;AAC9B,SAAQ,SAAS,SAAS,YAAY,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK;;;;;AAK5D,SAAgB,SAAS,GAAG,eAAe;AACvC,SAAQ,SAAS,OAAO,YAAY,gBAAgB,SAAS,GAAG,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK;;;;;AAKjH,SAAgB,cAAc,GAAG,eAAe;AAC5C,SAAQ,SAAS,OAAO,YAAY,gBAAgB,cAAc,GAAG,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK;;;;;AAKtH,SAAgB,eAAe,SAAS,KAAK,eAAe;AACxD,SAAQ,SAAS,OAAO,YAAY,gBAAgB,mBAAmB,SAAS,KAAK,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK"}
@@ -1,10 +1,14 @@
1
1
  import { External } from "@fncts/io/IO";
2
- export const RouterTypeId = /*#__PURE__*/Symbol.for("fncts.http.Router");
2
+ //#region build/esm/Router/definition.js
3
+ const RouterTypeId = Symbol.for("fncts.http.Router");
3
4
  /**
4
- * @tsplus type fncts.http.Router
5
- * @tsplus companion fncts.http.RouterOps
6
- */
7
- export class Router extends External {
8
- [RouterTypeId] = RouterTypeId;
9
- }
5
+ * @tsplus type fncts.http.Router
6
+ * @tsplus companion fncts.http.RouterOps
7
+ */
8
+ var Router = class extends External {
9
+ [RouterTypeId] = RouterTypeId;
10
+ };
11
+ //#endregion
12
+ export { Router, RouterTypeId };
13
+
10
14
  //# sourceMappingURL=definition.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.mjs","names":["External","RouterTypeId","Symbol","for","Router"],"sources":["../../_src/Router/definition.ts"],"sourcesContent":[null],"mappings":"AAMA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,YAAY,gBAAGC,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAG3D;;;;AAIA,OAAM,MAAgBC,MACpB,SAAQJ,QAAqE;EAGpE,CAACC,YAAY,IAAkBA,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"definition.mjs","names":[],"sources":["../../esm/Router/definition.js"],"sourcesContent":["import { External } from \"@fncts/io/IO\";\nexport const RouterTypeId = Symbol.for(\"fncts.http.Router\");\n/**\n * @tsplus type fncts.http.Router\n * @tsplus companion fncts.http.RouterOps\n */\nexport class Router extends External {\n [RouterTypeId] = RouterTypeId;\n}\n//# sourceMappingURL=definition.js.map"],"mappings":";;AACA,MAAa,eAAe,OAAO,IAAI,oBAAoB;;;;;AAK3D,IAAa,SAAb,cAA4B,SAAS;CACjC,CAAC,gBAAgB"}
@@ -1,4 +1,7 @@
1
- const fileName_1 = "(@fncts/http) src/Router/internal.ts";
1
+ import { RouteContextImpl, RouteImpl } from "../Route/internal.mjs";
2
+ import { RouteNotFound } from "../RouteNotFound.mjs";
3
+ import { Router } from "./definition.mjs";
4
+ import * as tsplus_module_8 from "@fncts/io/IO/api";
2
5
  import * as tsplus_module_1 from "@fncts/base/data/Maybe/constructors";
3
6
  import * as tsplus_module_2 from "@fncts/base/collection/immutable/Conc/api";
4
7
  import * as tsplus_module_3 from "@fncts/io/FiberRef/unsafe";
@@ -6,75 +9,61 @@ import * as tsplus_module_4 from "@fncts/http/ServerRequest/definition";
6
9
  import * as tsplus_module_5 from "@fncts/base/data/Environment/api";
7
10
  import * as tsplus_module_6 from "@fncts/http/Route/definition";
8
11
  import * as tsplus_module_7 from "@fncts/io/FiberRef/operations";
9
- import * as tsplus_module_8 from "@fncts/io/IO/api";
10
12
  import * as tsplus_module_9 from "@fncts/base/data/Maybe/definition";
11
13
  import * as FindMyWay from "find-my-way-ts";
12
- import { RouteContextImpl, RouteImpl } from "../Route/internal.mjs";
13
- import { RouteNotFound } from "../RouteNotFound.mjs";
14
- import { Router } from "./definition.mjs";
15
- export class RouterInternal extends Router {
16
- routes;
17
- mounts;
18
- httpApp;
19
- constructor(routes, mounts) {
20
- super();
21
- this.routes = routes;
22
- this.mounts = mounts;
23
- this.httpApp = toHttpApp(this);
24
- }
25
- get toIO() {
26
- return this.httpApp;
27
- }
28
- }
14
+ //#region build/esm/Router/internal.js
15
+ const fileName_1 = "(@fncts/http) src/Router/internal.ts";
16
+ var RouterInternal = class extends Router {
17
+ routes;
18
+ mounts;
19
+ httpApp;
20
+ constructor(routes, mounts) {
21
+ super();
22
+ this.routes = routes;
23
+ this.mounts = mounts;
24
+ this.httpApp = toHttpApp(this);
25
+ }
26
+ get toIO() {
27
+ return this.httpApp;
28
+ }
29
+ };
29
30
  function toHttpApp(self) {
30
- const router = FindMyWay.make();
31
- const mounts = tsplus_module_2.map(({
32
- prefix,
33
- httpApp,
34
- options
35
- }) => [prefix, 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")), {}, {}), options])(self.mounts);
36
- const mountsLen = mounts.length;
37
- tsplus_module_2.forEach(route => {
38
- if (route.method === "*") {
39
- router.all(route.path, route);
40
- } else {
41
- router.on(route.method, route.path, route);
42
- }
43
- })(self.routes);
44
- return tsplus_module_8.withFiberRuntime(fiber => {
45
- let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);
46
- const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);
47
- if (mountsLen > 0) {
48
- for (let i = 0; i < mountsLen; i++) {
49
- const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);
50
- if (request.url.startsWith(path)) {
51
- context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);
52
- if (options?.inclduePrefix !== true) {
53
- context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);
54
- }
55
- return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":70:53")(routeContext.route.handler);
56
- }
57
- }
58
- }
59
- let result = router.find(request.method, request.url);
60
- if (result === undefined && request.method === "HEAD") {
61
- result = router.find("GET", request.url);
62
- }
63
- if (result === undefined) {
64
- return tsplus_module_8.failNow(new RouteNotFound(request), fileName_1 + ":80:24");
65
- }
66
- const route = result.handler;
67
- if (tsplus_module_9.isJust(route.prefix)) {
68
- context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);
69
- }
70
- context = tsplus_module_5.add(new RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);
71
- return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":87:47")(route.handler);
72
- }, fileName_1 + ":59:29");
31
+ const router = FindMyWay.make();
32
+ const mounts = tsplus_module_2.map(({ prefix, httpApp, options }) => [
33
+ prefix,
34
+ new RouteContextImpl(new RouteImpl("*", options?.inclduePrefix ? `${prefix}/*` : "/*", httpApp, options?.inclduePrefix ? tsplus_module_1.nothing(fileName_1 + ":43:45") : tsplus_module_1.just(prefix, fileName_1 + ":43:54")), {}, {}),
35
+ options
36
+ ])(self.mounts);
37
+ const mountsLen = mounts.length;
38
+ tsplus_module_2.forEach((route) => {
39
+ if (route.method === "*") router.all(route.path, route);
40
+ else router.on(route.method, route.path, route);
41
+ })(self.routes);
42
+ return tsplus_module_8.withFiberRuntime((fiber) => {
43
+ let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);
44
+ const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);
45
+ if (mountsLen > 0) for (let i = 0; i < mountsLen; i++) {
46
+ const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);
47
+ if (request.url.startsWith(path)) {
48
+ context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);
49
+ if (options?.inclduePrefix !== true) context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);
50
+ return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":70:53")(routeContext.route.handler);
51
+ }
52
+ }
53
+ let result = router.find(request.method, request.url);
54
+ if (result === void 0 && request.method === "HEAD") result = router.find("GET", request.url);
55
+ if (result === void 0) return tsplus_module_8.failNow(new RouteNotFound(request), fileName_1 + ":80:24");
56
+ const route = result.handler;
57
+ if (tsplus_module_9.isJust(route.prefix)) context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);
58
+ context = tsplus_module_5.add(new RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);
59
+ return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + ":87:47")(route.handler);
60
+ }, fileName_1 + ":59:29");
73
61
  }
74
62
  function sliceRequestUrl(request, prefix) {
75
- const prefixLen = prefix.length;
76
- return request.modify({
77
- url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen)
78
- });
63
+ const prefixLen = prefix.length;
64
+ return request.modify({ url: request.url.length <= prefixLen ? "/" : request.url.slice(prefixLen) });
79
65
  }
66
+ //#endregion
67
+ export { RouterInternal };
68
+
80
69
  //# sourceMappingURL=internal.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.mjs","names":["FindMyWay","RouteContextImpl","RouteImpl","RouteNotFound","Router","RouterInternal","routes","mounts","httpApp","constructor","toHttpApp","toIO","self","router","make","tsplus_module_2","map","prefix","options","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","i","routeContext","url","startsWith","add","tsplus_module_6","RouteContextTag","sliceRequestUrl","tsplus_module_7","locally","handler","result","find","undefined","failNow","tsplus_module_9","isJust","value","params","searchParams","prefixLen","modify","slice"],"sources":["../../_src/Router/internal.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;AAIA,OAAO,KAAKA,SAAS,MAAM,gBAAgB;AAG3C,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,uBAAsB;AAClE,SAASC,aAAa,QAAQ,sBAAqB;AAEnD,SAASC,MAAM,QAAQ,kBAAiB;AAExC,OAAM,MAAOC,cAAqB,SAAQD,MAAY;EAIzCE,MAAA;EACAC,MAAA;EAJFC,OAAO;EAEhBC,YACWH,MAAyB,EACzBC,MAER;IAED,KAAK,EAAE;IALE,KAAAD,MAAM,GAANA,MAAM;IACN,KAAAC,MAAM,GAANA,MAAM;IAKf,IAAI,CAACC,OAAO,GAAGE,SAAS,CAAC,IAAI,CAAQ;EACvC;EAEA,IAAIC,IAAIA,CAAA;IACN,OAAO,IAAI,CAACH,OAAO;EACrB;;AAGF,SAASE,SAASA,CAAOE,IAAkB;EACzC,MAAMC,MAAM,GAAGb,SAAS,CAACc,IAAI,EAAe;EAE5C,MAAMP,MAAM,GAAGQ,eAAA,CAAAC,GAAA,CACb,CAAC;IAAEC,MAAM;IAAET,OAAO;IAAEU;EAAO,CAAE,KAC3B,CACED,MAAM,EACN,IAAIhB,gBAAgB,CAClB,IAAIC,SAAS,CACX,GAAG,EACHgB,OAAO,EAAEC,aAAa,GAAI,GAAGF,MAAM,IAAkB,GAAG,IAAI,EAC5DT,OAAO,EACPU,OAAO,EAAEC,aAAa,GAAGC,eAAA,CAAAC,OAAA,CAAAC,UAAA,YAAS,GAAGF,eAAA,CAAAG,IAAA,CAAKN,MAAM,EAAAK,UAAA,YAAC,CAClD,EACD,EAAE,EACF,EAAE,CACa,EACjBJ,OAAO,CACC,EAfCN,IAAI,CAACL,MAAM,CAgBzB;EACD,MAAMiB,SAAS,GAAGjB,MAAM,CAACkB,MAAM;EAC/BV,eAAA,CAAAW,OAAA,CAAqBC,KAAK,IAAI;IAC5B,IAAI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AM,CAAC;IAAEnB,GAAG,EAAEP,OAAO,CAACO,GAAG,CAACrB,MAAM,IAAIuC,SAAS,GAAG,GAAG,GAAGzB,OAAO,CAACO,GAAG,CAACoB,KAAK,CAACF,SAAS;EAAC,CAAE,CAAC;AACtG","ignoreList":[]}
1
+ {"version":3,"file":"internal.mjs","names":[],"sources":["../../esm/Router/internal.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Router/internal.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_2 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_3 from \"@fncts/io/FiberRef/unsafe\";\nimport * as tsplus_module_4 from \"@fncts/http/ServerRequest/definition\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Environment/api\";\nimport * as tsplus_module_6 from \"@fncts/http/Route/definition\";\nimport * as tsplus_module_7 from \"@fncts/io/FiberRef/operations\";\nimport * as tsplus_module_8 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_9 from \"@fncts/base/data/Maybe/definition\";\nimport * as FindMyWay from \"find-my-way-ts\";\nimport { RouteContextImpl, RouteImpl } from \"../Route/internal.js\";\nimport { RouteNotFound } from \"../RouteNotFound.js\";\nimport { Router } from \"./definition.js\";\nexport class RouterInternal extends Router {\n routes;\n mounts;\n httpApp;\n constructor(routes, mounts) {\n super();\n this.routes = routes;\n this.mounts = mounts;\n this.httpApp = toHttpApp(this);\n }\n get toIO() {\n return this.httpApp;\n }\n}\nfunction toHttpApp(self) {\n const router = FindMyWay.make();\n const mounts = tsplus_module_2.map(({ prefix, httpApp, options }) => [\n prefix,\n new RouteContextImpl(new RouteImpl(\"*\", options?.inclduePrefix ? `${prefix}/*` : \"/*\", httpApp, options?.inclduePrefix ? tsplus_module_1.nothing(fileName_1 + \":43:45\") : tsplus_module_1.just(prefix, fileName_1 + \":43:54\")), {}, {}),\n options,\n ])(self.mounts);\n const mountsLen = mounts.length;\n tsplus_module_2.forEach((route) => {\n if (route.method === \"*\") {\n router.all(route.path, route);\n }\n else {\n router.on(route.method, route.path, route);\n }\n })(self.routes);\n return tsplus_module_8.withFiberRuntime((fiber) => {\n let context = fiber.getFiberRef(tsplus_module_3.currentEnvironment);\n const request = tsplus_module_5.unsafeGet(tsplus_module_4.ServerRequestTag)(context);\n if (mountsLen > 0) {\n for (let i = 0; i < mountsLen; i++) {\n const [path, routeContext, options] = tsplus_module_2.unsafeGet(i)(mounts);\n if (request.url.startsWith(path)) {\n context = tsplus_module_5.add(routeContext, tsplus_module_6.RouteContextTag)(context);\n if (options?.inclduePrefix !== true) {\n context = tsplus_module_5.add(sliceRequestUrl(request, path), tsplus_module_4.ServerRequestTag)(context);\n }\n return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + \":70:53\")(routeContext.route.handler);\n }\n }\n }\n let result = router.find(request.method, request.url);\n if (result === undefined && request.method === \"HEAD\") {\n result = router.find(\"GET\", request.url);\n }\n if (result === undefined) {\n return tsplus_module_8.failNow(new RouteNotFound(request), fileName_1 + \":80:24\");\n }\n const route = result.handler;\n if (tsplus_module_9.isJust(route.prefix)) {\n context = tsplus_module_5.add(sliceRequestUrl(request, route.prefix.value), tsplus_module_4.ServerRequestTag)(context);\n }\n context = tsplus_module_5.add(new RouteContextImpl(route, result.params, result.searchParams), tsplus_module_6.RouteContextTag)(context);\n return tsplus_module_7.locally(tsplus_module_3.currentEnvironment, context, fileName_1 + \":87:47\")(route.handler);\n }, fileName_1 + \":59:29\");\n}\nfunction sliceRequestUrl(request, prefix) {\n const prefixLen = prefix.length;\n return request.modify({ url: request.url.length <= prefixLen ? \"/\" : request.url.slice(prefixLen) });\n}\n//# sourceMappingURL=internal.js.map"],"mappings":";;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAcnB,IAAa,iBAAb,cAAoC,OAAO;CACvC;CACA;CACA;CACA,YAAY,QAAQ,QAAQ;AACxB,SAAO;AACP,OAAK,SAAS;AACd,OAAK,SAAS;AACd,OAAK,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,QAAQ,IAAI;AACrD,MAAI,WAAW,KAAA,KAAa,QAAQ,WAAW,OAC3C,UAAS,OAAO,KAAK,OAAO,QAAQ,IAAI;AAE5C,MAAI,WAAW,KAAA,EACX,QAAO,gBAAgB,QAAQ,IAAI,cAAc,QAAQ,EAAE,aAAa,SAAS;EAErF,MAAM,QAAQ,OAAO;AACrB,MAAI,gBAAgB,OAAO,MAAM,OAAO,CACpC,WAAU,gBAAgB,IAAI,gBAAgB,SAAS,MAAM,OAAO,MAAM,EAAE,gBAAgB,iBAAiB,CAAC,QAAQ;AAE1H,YAAU,gBAAgB,IAAI,IAAI,iBAAiB,OAAO,OAAO,QAAQ,OAAO,aAAa,EAAE,gBAAgB,gBAAgB,CAAC,QAAQ;AACxI,SAAO,gBAAgB,QAAQ,gBAAgB,oBAAoB,SAAS,aAAa,SAAS,CAAC,MAAM,QAAQ;IAClH,aAAa,SAAS;;AAE7B,SAAS,gBAAgB,SAAS,QAAQ;CACtC,MAAM,YAAY,OAAO;AACzB,QAAO,QAAQ,OAAO,EAAE,KAAK,QAAQ,IAAI,UAAU,YAAY,MAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,CAAC"}
package/_mjs/Router.mjs CHANGED
@@ -1,4 +1,3 @@
1
- // codegen:start { preset: barrel, include: ./Router/*.ts, exclude: Router/*(*internal).ts }
2
- export * from "./Router/api.mjs";
3
- export * from "./Router/definition.mjs";
4
- //# sourceMappingURL=Router.mjs.map
1
+ import { Router, RouterTypeId } from "./Router/definition.mjs";
2
+ import { append, catchAll, catchAllCause, concat, del, empty, from, get, head, mount, options, patch, post, prefixAll, provideService, put, route, routes, use } from "./Router/api.mjs";
3
+ export { Router, RouterTypeId, append, catchAll, catchAllCause, concat, del, empty, from, get, head, mount, options, patch, post, prefixAll, provideService, put, route, routes, use };
package/_mjs/Server.mjs CHANGED
@@ -1,34 +1,38 @@
1
- const fileName_1 = "(@fncts/http) src/Server.ts";
2
1
  import * as tsplus_module_1 from "@fncts/base/data/Tag/constructors";
3
- import * as tsplus_module_2 from "@fncts/io/IO/api/environment";
4
2
  import * as tsplus_module_3 from "@fncts/io/IO/api";
3
+ import * as tsplus_module_2 from "@fncts/io/IO/api/environment";
5
4
  import * as tsplus_module_4 from "@fncts/io/Layer/api";
6
- export const ServerTypeId = /*#__PURE__*/Symbol.for("fncts.http.Server");
5
+ //#region build/esm/Server.js
6
+ const fileName_1 = "(@fncts/http) src/Server.ts";
7
+ const ServerTypeId = Symbol.for("fncts.http.Server");
7
8
  /**
8
- * @tsplus type fncts.http.Server
9
- * @tsplus companion fncts.http.ServerOps
10
- */
11
- export class Server {
12
- [ServerTypeId] = ServerTypeId;
13
- }
9
+ * @tsplus type fncts.http.Server
10
+ * @tsplus companion fncts.http.ServerOps
11
+ */
12
+ var Server = class {
13
+ [ServerTypeId] = ServerTypeId;
14
+ };
14
15
  /**
15
- * @tsplus static fncts.http.ServerOps Tag
16
- */
17
- const ServerTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
18
- export const ServerTag = ServerTag_1;
16
+ * @tsplus static fncts.http.ServerOps Tag
17
+ */
18
+ const ServerTag_1 = tsplus_module_1.makeTag();
19
+ const ServerTag = ServerTag_1;
19
20
  /**
20
- * @tsplus static fncts.http.ServerOps __call
21
- */
22
- export function make(options) {
23
- return new class extends Server {
24
- serve = options.serve;
25
- address = options.address;
26
- }();
21
+ * @tsplus static fncts.http.ServerOps __call
22
+ */
23
+ function make(options) {
24
+ return new class extends Server {
25
+ serve = options.serve;
26
+ address = options.address;
27
+ }();
27
28
  }
28
- export function serve(middleware) {
29
- 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");
29
+ function serve(middleware) {
30
+ return (httpApp) => tsplus_module_4.scopedDiscard(() => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + ":69:55")(tsplus_module_2.service(ServerTag_1, fileName_1 + ":69:35")), fileName_1 + ":69:24");
30
31
  }
31
- export function serveIO(middleware) {
32
- 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"));
32
+ function serveIO(middleware) {
33
+ return (httpApp) => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + ":87:53")(tsplus_module_2.service(ServerTag_1, fileName_1 + ":87:33"));
33
34
  }
35
+ //#endregion
36
+ export { Server, ServerTag, ServerTypeId, make, serve, serveIO };
37
+
34
38
  //# sourceMappingURL=Server.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Server.mjs","names":["ServerTypeId","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":";;;;;AAIA,OAAO,MAAMA,YAAY,gBAAGC,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAG3D;;;;AAIA,OAAM,MAAgBC,MAAM;EACjB,CAACH,YAAY,IAAkBA,YAAY;;AAStD;;;AAGO,MAAMI,WAAA,gBAAYC,eAAA,CAAAC,OAAA,EAAa;aAAzBC,SAAS,GAAAH,WAAA;AAetB;;;AAGA,OAAM,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;AAcA,OAAM,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;AAcA,OAAM,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.mjs","names":[],"sources":["../esm/Server.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Server.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Tag/constructors\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api/environment\";\nimport * as tsplus_module_3 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_4 from \"@fncts/io/Layer/api\";\nexport const ServerTypeId = Symbol.for(\"fncts.http.Server\");\n/**\n * @tsplus type fncts.http.Server\n * @tsplus companion fncts.http.ServerOps\n */\nexport class Server {\n [ServerTypeId] = ServerTypeId;\n}\n/**\n * @tsplus static fncts.http.ServerOps Tag\n */\nconst ServerTag_1 = tsplus_module_1.makeTag();\nexport const ServerTag = ServerTag_1;\n/**\n * @tsplus static fncts.http.ServerOps __call\n */\nexport function make(options) {\n return new (class extends Server {\n serve = options.serve;\n address = options.address;\n })();\n}\nexport function serve(middleware) {\n return (httpApp) => tsplus_module_4.scopedDiscard(() => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + \":69:55\")(tsplus_module_2.service(ServerTag_1, fileName_1 + \":69:35\")), fileName_1 + \":69:24\");\n}\nexport function serveIO(middleware) {\n return (httpApp) => tsplus_module_3.flatMap((server) => server.serve(httpApp, middleware), fileName_1 + \":87:53\")(tsplus_module_2.service(ServerTag_1, fileName_1 + \":87:33\"));\n}\n//# sourceMappingURL=Server.js.map"],"mappings":";;;;;AAAA,MAAM,aAAa;AAKnB,MAAa,eAAe,OAAO,IAAI,oBAAoB;;;;;AAK3D,IAAa,SAAb,MAAoB;CAChB,CAAC,gBAAgB;;;;;AAKrB,MAAM,cAAc,gBAAgB,SAAS;AAC7C,MAAa,YAAY;;;;AAIzB,SAAgB,KAAK,SAAS;AAC1B,QAAO,IAAK,cAAc,OAAO;EAC7B,QAAQ,QAAQ;EAChB,UAAU,QAAQ;IAClB;;AAER,SAAgB,MAAM,YAAY;AAC9B,SAAQ,YAAY,gBAAgB,oBAAoB,gBAAgB,SAAS,WAAW,OAAO,MAAM,SAAS,WAAW,EAAE,aAAa,SAAS,CAAC,gBAAgB,QAAQ,aAAa,aAAa,SAAS,CAAC,EAAE,aAAa,SAAS;;AAE9O,SAAgB,QAAQ,YAAY;AAChC,SAAQ,YAAY,gBAAgB,SAAS,WAAW,OAAO,MAAM,SAAS,WAAW,EAAE,aAAa,SAAS,CAAC,gBAAgB,QAAQ,aAAa,aAAa,SAAS,CAAC"}