@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,36 +1,34 @@
1
- import * as tsplus_module_1 from "@fncts/base/collection/immutable/HashMap/api";
2
- import * as tsplus_module_2 from "@fncts/base/util/predicates";
3
1
  import { Headers } from "../Headers.mjs";
4
- export const ServerResponseTypeId = /*#__PURE__*/Symbol.for("fncts.http.ServerResponse");
2
+ import * as tsplus_module_2 from "@fncts/base/util/predicates";
3
+ import * as tsplus_module_1 from "@fncts/base/collection/immutable/HashMap/api";
4
+ //#region build/esm/ServerResponse/definition.js
5
+ const ServerResponseTypeId = Symbol.for("fncts.http.ServerResponse");
5
6
  /**
6
- * @tsplus type fncts.http.ServerResponse
7
- * @tsplus companion fncts.http.ServerResponseOps
8
- */
9
- export class ServerResponse {
10
- status;
11
- statusText;
12
- body;
13
- [ServerResponseTypeId] = ServerResponseTypeId;
14
- headers;
15
- constructor(status, statusText, headers, body) {
16
- this.status = status;
17
- this.statusText = statusText;
18
- this.body = body;
19
- if (body.contentType || body.contentLength) {
20
- const newHeaders = tsplus_module_1.beginMutation(headers.backing);
21
- if (body.contentType) {
22
- tsplus_module_1.set("content-type", body.contentType)(newHeaders);
23
- }
24
- if (body.contentLength) {
25
- tsplus_module_1.set("content-length", body.contentLength.toString())(newHeaders);
26
- }
27
- this.headers = new Headers(tsplus_module_1.endMutation(newHeaders));
28
- } else {
29
- this.headers = headers;
30
- }
31
- }
32
- }
33
- export function isServerResponse(u) {
34
- return tsplus_module_2.isObject(u) && ServerResponseTypeId in u;
7
+ * @tsplus type fncts.http.ServerResponse
8
+ * @tsplus companion fncts.http.ServerResponseOps
9
+ */
10
+ var ServerResponse = class {
11
+ status;
12
+ statusText;
13
+ body;
14
+ [ServerResponseTypeId] = ServerResponseTypeId;
15
+ headers;
16
+ constructor(status, statusText, headers, body) {
17
+ this.status = status;
18
+ this.statusText = statusText;
19
+ this.body = body;
20
+ if (body.contentType || body.contentLength) {
21
+ const newHeaders = tsplus_module_1.beginMutation(headers.backing);
22
+ if (body.contentType) tsplus_module_1.set("content-type", body.contentType)(newHeaders);
23
+ if (body.contentLength) tsplus_module_1.set("content-length", body.contentLength.toString())(newHeaders);
24
+ this.headers = new Headers(tsplus_module_1.endMutation(newHeaders));
25
+ } else this.headers = headers;
26
+ }
27
+ };
28
+ function isServerResponse(u) {
29
+ return tsplus_module_2.isObject(u) && ServerResponseTypeId in u;
35
30
  }
31
+ //#endregion
32
+ export { ServerResponse, ServerResponseTypeId, isServerResponse };
33
+
36
34
  //# sourceMappingURL=definition.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.mjs","names":["Headers","ServerResponseTypeId","Symbol","for","ServerResponse","status","statusText","body","headers","constructor","contentType","contentLength","newHeaders","tsplus_module_1","beginMutation","backing","set","toString","endMutation","isServerResponse","u","tsplus_module_2","isObject"],"sources":["../../_src/ServerResponse/definition.ts"],"sourcesContent":[null],"mappings":";;AAEA,SAASA,OAAO,QAAQ,gBAAe;AAEvC,OAAO,MAAMC,oBAAoB,gBAAGC,MAAM,CAACC,GAAG,CAAC,2BAA2B,CAAC;AAG3E;;;;AAIA,OAAM,MAAOC,cAAc;EAIdC,MAAA;EACAC,UAAA;EAEAC,IAAA;EANF,CAACN,oBAAoB,IAA0BA,oBAAoB;EACnEO,OAAO;EAChBC,YACWJ,MAAc,EACdC,UAA8B,EACvCE,OAAgB,EACPD,IAAU;IAHV,KAAAF,MAAM,GAANA,MAAM;IACN,KAAAC,UAAU,GAAVA,UAAU;IAEV,KAAAC,IAAI,GAAJA,IAAI;IAEb,IAAIA,IAAI,CAACG,WAAW,IAAIH,IAAI,CAACI,aAAa,EAAE;MAC1C,MAAMC,UAAU,GAAAC,eAAA,CAAAC,aAAA,CAAGN,OAAO,CAACO,OAAO,CAAc;MAChD,IAAIR,IAAI,CAACG,WAAW,EAAE;QACpBG,eAAA,CAAAG,GAAA,CAAe,cAAc,EAAET,IAAI,CAACG,WAAW,EAA/CE,UAAU,CAAsC;MAClD;MACA,IAAIL,IAAI,CAACI,aAAa,EAAE;QACtBE,eAAA,CAAAG,GAAA,CAAe,gBAAgB,EAAET,IAAI,CAACI,aAAa,CAACM,QAAQ,EAAE,EAA9DL,UAAU,CAAqD;MACjE;MACA,IAAI,CAACJ,OAAO,GAAG,IAAIR,OAAO,CAAAa,eAAA,CAAAK,WAAA,CAACN,UAAU,EAAa;IACpD,CAAC,MAAM;MACL,IAAI,CAACJ,OAAO,GAAGA,OAAO;IACxB;EACF;;AAgBF,OAAM,SAAUW,gBAAgBA,CAACC,CAAU;EACzC,OAAOC,eAAA,CAAAC,QAAQ,CAACF,CAAC,CAAC,IAAInB,oBAAoB,IAAImB,CAAC;AACjD","ignoreList":[]}
1
+ {"version":3,"file":"definition.mjs","names":[],"sources":["../../esm/ServerResponse/definition.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/base/collection/immutable/HashMap/api\";\nimport * as tsplus_module_2 from \"@fncts/base/util/predicates\";\nimport { Headers } from \"../Headers.js\";\nexport const ServerResponseTypeId = Symbol.for(\"fncts.http.ServerResponse\");\n/**\n * @tsplus type fncts.http.ServerResponse\n * @tsplus companion fncts.http.ServerResponseOps\n */\nexport class ServerResponse {\n status;\n statusText;\n body;\n [ServerResponseTypeId] = ServerResponseTypeId;\n headers;\n constructor(status, statusText, headers, body) {\n this.status = status;\n this.statusText = statusText;\n this.body = body;\n if (body.contentType || body.contentLength) {\n const newHeaders = tsplus_module_1.beginMutation(headers.backing);\n if (body.contentType) {\n tsplus_module_1.set(\"content-type\", body.contentType)(newHeaders);\n }\n if (body.contentLength) {\n tsplus_module_1.set(\"content-length\", body.contentLength.toString())(newHeaders);\n }\n this.headers = new Headers(tsplus_module_1.endMutation(newHeaders));\n }\n else {\n this.headers = headers;\n }\n }\n}\nexport function isServerResponse(u) {\n return tsplus_module_2.isObject(u) && ServerResponseTypeId in u;\n}\n//# sourceMappingURL=definition.js.map"],"mappings":";;;;AAGA,MAAa,uBAAuB,OAAO,IAAI,4BAA4B;;;;;AAK3E,IAAa,iBAAb,MAA4B;CACxB;CACA;CACA;CACA,CAAC,wBAAwB;CACzB;CACA,YAAY,QAAQ,YAAY,SAAS,MAAM;AAC3C,OAAK,SAAS;AACd,OAAK,aAAa;AAClB,OAAK,OAAO;AACZ,MAAI,KAAK,eAAe,KAAK,eAAe;GACxC,MAAM,aAAa,gBAAgB,cAAc,QAAQ,QAAQ;AACjE,OAAI,KAAK,YACL,iBAAgB,IAAI,gBAAgB,KAAK,YAAY,CAAC,WAAW;AAErE,OAAI,KAAK,cACL,iBAAgB,IAAI,kBAAkB,KAAK,cAAc,UAAU,CAAC,CAAC,WAAW;AAEpF,QAAK,UAAU,IAAI,QAAQ,gBAAgB,YAAY,WAAW,CAAC;QAGnE,MAAK,UAAU;;;AAI3B,SAAgB,iBAAiB,GAAG;AAChC,QAAO,gBAAgB,SAAS,EAAE,IAAI,wBAAwB"}
@@ -1,4 +1,3 @@
1
- // codegen:start { preset: barrel, include: ./ServerResponse/*.ts }
2
- export * from "./ServerResponse/api.mjs";
3
- export * from "./ServerResponse/definition.mjs";
4
- //# sourceMappingURL=ServerResponse.mjs.map
1
+ import { ServerResponse, ServerResponseTypeId, isServerResponse } from "./ServerResponse/definition.mjs";
2
+ import { empty, json, schemaJson, setBody, setHeader, setHeaders, setStatus, stream, text, toWeb, uint8Array, urlParams } from "./ServerResponse/api.mjs";
3
+ export { ServerResponse, ServerResponseTypeId, empty, isServerResponse, json, schemaJson, setBody, setHeader, setHeaders, setStatus, stream, text, toWeb, uint8Array, urlParams };
package/_mjs/Socket.mjs CHANGED
@@ -1,4 +1,3 @@
1
- const fileName_1 = "(@fncts/http) src/Socket.ts";
2
1
  import * as tsplus_module_1 from "@fncts/base/data/Tag/constructors";
3
2
  import * as tsplus_module_2 from "@fncts/base/util/predicates";
4
3
  import * as tsplus_module_3 from "@fncts/io/Channel/api";
@@ -23,179 +22,176 @@ import * as tsplus_module_21 from "@fncts/io/Future/api";
23
22
  import * as tsplus_module_22 from "@fncts/io/IO/api/environment";
24
23
  import * as tsplus_module_23 from "@fncts/io/IO/api/scoped";
25
24
  import * as tsplus_module_24 from "@fncts/io/Layer/api";
26
- export const toChannel = toChannel_1;
27
- export const makeWebSocket = makeWebSocket_1;
28
- export const fromWebSocket = fromWebSocket_1;
29
- import { WebSocket as IsoWs } from "isows";
30
- export const SocketTypeId = /*#__PURE__*/Symbol.for("fncts.http.Socket");
25
+ import { WebSocket } from "isows";
26
+ //#region build/esm/Socket.js
27
+ const fileName_1 = "(@fncts/http) src/Socket.ts";
28
+ const toChannel = toChannel_1;
29
+ const makeWebSocket = makeWebSocket_1;
30
+ const fromWebSocket = fromWebSocket_1;
31
+ const SocketTypeId = Symbol.for("fncts.http.Socket");
31
32
  /**
32
- * @tsplus type fncts.http.Socket
33
- * @tsplus companion fncts.http.SocketOps
34
- */
35
- export class Socket {
36
- [SocketTypeId] = SocketTypeId;
37
- }
33
+ * @tsplus type fncts.http.Socket
34
+ * @tsplus companion fncts.http.SocketOps
35
+ */
36
+ var Socket = class {
37
+ [SocketTypeId] = SocketTypeId;
38
+ };
38
39
  /**
39
- * @tsplus static fncts.http.SocketOps Tag
40
- */
41
- const SocketTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
42
- export const SocketTag = SocketTag_1;
43
- export const SocketGenericErrorTypeId = /*#__PURE__*/Symbol.for("fncts.http.Socket.SocketGenericError");
44
- export class SocketGenericError extends Error {
45
- reason;
46
- error;
47
- [SocketGenericErrorTypeId] = SocketGenericErrorTypeId;
48
- constructor(reason, error) {
49
- super();
50
- this.reason = reason;
51
- this.error = error;
52
- }
53
- }
54
- export const SocketCloseErrorTypeId = /*#__PURE__*/Symbol.for("fncts.http.Socket.SocketCloseError");
55
- export class SocketCloseError extends Error {
56
- reason;
57
- code;
58
- closeReason;
59
- error;
60
- [SocketCloseErrorTypeId] = SocketCloseErrorTypeId;
61
- constructor(reason, code, closeReason, error) {
62
- super();
63
- this.reason = reason;
64
- this.code = code;
65
- this.closeReason = closeReason;
66
- this.error = error;
67
- }
68
- static isClean(isClean) {
69
- return u => {
70
- return isSocketCloseError(u) && isClean(u.code);
71
- };
72
- }
73
- }
74
- export function isSocketCloseError(u) {
75
- return tsplus_module_2.isObject(u) && SocketCloseErrorTypeId in u;
76
- }
77
- export const CloseEventTypeId = /*#__PURE__*/Symbol.for("fncts.http.Socket.CloseEvent");
78
- export class CloseEvent {
79
- code;
80
- reason;
81
- [CloseEventTypeId] = CloseEventTypeId;
82
- constructor(code = 1000, reason) {
83
- this.code = code;
84
- this.reason = reason;
85
- }
40
+ * @tsplus static fncts.http.SocketOps Tag
41
+ */
42
+ const SocketTag_1 = tsplus_module_1.makeTag();
43
+ const SocketTag = SocketTag_1;
44
+ const SocketGenericErrorTypeId = Symbol.for("fncts.http.Socket.SocketGenericError");
45
+ var SocketGenericError = class extends Error {
46
+ reason;
47
+ error;
48
+ [SocketGenericErrorTypeId] = SocketGenericErrorTypeId;
49
+ constructor(reason, error) {
50
+ super();
51
+ this.reason = reason;
52
+ this.error = error;
53
+ }
54
+ };
55
+ const SocketCloseErrorTypeId = Symbol.for("fncts.http.Socket.SocketCloseError");
56
+ var SocketCloseError = class extends Error {
57
+ reason;
58
+ code;
59
+ closeReason;
60
+ error;
61
+ [SocketCloseErrorTypeId] = SocketCloseErrorTypeId;
62
+ constructor(reason, code, closeReason, error) {
63
+ super();
64
+ this.reason = reason;
65
+ this.code = code;
66
+ this.closeReason = closeReason;
67
+ this.error = error;
68
+ }
69
+ static isClean(isClean) {
70
+ return (u) => {
71
+ return isSocketCloseError(u) && isClean(u.code);
72
+ };
73
+ }
74
+ };
75
+ function isSocketCloseError(u) {
76
+ return tsplus_module_2.isObject(u) && SocketCloseErrorTypeId in u;
86
77
  }
87
- export function isCloseEvent(u) {
88
- return tsplus_module_2.isObject(u) && CloseEventTypeId in u;
78
+ const CloseEventTypeId = Symbol.for("fncts.http.Socket.CloseEvent");
79
+ var CloseEvent = class {
80
+ code;
81
+ reason;
82
+ [CloseEventTypeId] = CloseEventTypeId;
83
+ constructor(code = 1e3, reason) {
84
+ this.code = code;
85
+ this.reason = reason;
86
+ }
87
+ };
88
+ function isCloseEvent(u) {
89
+ return tsplus_module_2.isObject(u) && CloseEventTypeId in u;
89
90
  }
90
91
  /**
91
- * @tsplus fluent fncts.http.Socket toChannel
92
- */
92
+ * @tsplus fluent fncts.http.Socket toChannel
93
+ */
93
94
  function toChannel_1(self) {
94
- return tsplus_module_3.unwrap(() => tsplus_module_8.flatMap(writeScope => tsplus_module_8.flatMap(write => tsplus_module_8.flatMap(exitQueue => {
95
- const input = {
96
- awaitRead: tsplus_module_8.unit,
97
- emit(chunk) {
98
- return tsplus_module_8.catchAllCause(cause => tsplus_module_6.offer(tsplus_module_10.failCause(cause, fileName_1 + ":94:105"), fileName_1 + ":94:90")(exitQueue), fileName_1 + ":94:63")(tsplus_module_8.foreachDiscard(chunk, write, fileName_1 + ":94:35"));
99
- },
100
- error(error) {
101
- return tsplus_module_8.zipRight(tsplus_module_6.offer(tsplus_module_10.failCause(error, fileName_1 + ":97:78"), fileName_1 + ":97:63")(exitQueue), fileName_1 + ":97:47")(writeScope.close(() => tsplus_module_10.unit));
102
- },
103
- done() {
104
- return writeScope.close(() => tsplus_module_10.unit);
105
- }
106
- };
107
- return tsplus_module_8.map(() => {
108
- const loop = tsplus_module_4.flatMap(exit => tsplus_module_5.match(cause => cause._tag === "Empty" /* CauseTag.Empty */ ? tsplus_module_3.unit : tsplus_module_4.failCause(() => cause), chunk => tsplus_module_4.zipRight(loop)(tsplus_module_3.write(() => chunk)))(exit))(tsplus_module_3.fromIO(() => tsplus_module_6.take(exitQueue, fileName_1 + ":112:18")));
109
- return tsplus_module_3.embedInput(input)(loop);
110
- }, fileName_1 + ":104:8")(tsplus_module_12.interruptible(tsplus_module_11.fork(tsplus_module_8.tap(exit => tsplus_module_6.offer(exit, fileName_1 + ":108:48")(exitQueue), fileName_1 + ":108:22")(tsplus_module_8.result(tsplus_module_8.zipRight(tsplus_module_8.failCauseNow(tsplus_module_7.empty(), fileName_1 + ":107:36"), fileName_1 + ":107:20")(self.run(data => tsplus_module_6.offer(tsplus_module_10.succeed(tsplus_module_9.single(data), fileName_1 + ":106:54"), fileName_1 + ":106:41")(exitQueue))), fileName_1 + ":107:70")), fileName_1 + ":108:55"), fileName_1 + ":108:60"));
111
- }, fileName_1 + ":89:27")(tsplus_module_13.makeUnbounded(fileName_1 + ":89:47")), fileName_1 + ":88:27")(tsplus_module_14.extend(() => self.writer, fileName_1 + ":88:45")(writeScope)), fileName_1 + ":87:27")(tsplus_module_14.make));
95
+ return tsplus_module_3.unwrap(() => tsplus_module_8.flatMap((writeScope) => tsplus_module_8.flatMap((write) => tsplus_module_8.flatMap((exitQueue) => {
96
+ const input = {
97
+ awaitRead: tsplus_module_8.unit,
98
+ emit(chunk) {
99
+ return tsplus_module_8.catchAllCause((cause) => tsplus_module_6.offer(tsplus_module_10.failCause(cause, fileName_1 + ":94:105"), fileName_1 + ":94:90")(exitQueue), fileName_1 + ":94:63")(tsplus_module_8.foreachDiscard(chunk, write, fileName_1 + ":94:35"));
100
+ },
101
+ error(error) {
102
+ return tsplus_module_8.zipRight(tsplus_module_6.offer(tsplus_module_10.failCause(error, fileName_1 + ":97:78"), fileName_1 + ":97:63")(exitQueue), fileName_1 + ":97:47")(writeScope.close(() => tsplus_module_10.unit));
103
+ },
104
+ done() {
105
+ return writeScope.close(() => tsplus_module_10.unit);
106
+ }
107
+ };
108
+ return tsplus_module_8.map(() => {
109
+ const loop = tsplus_module_4.flatMap((exit) => tsplus_module_5.match((cause) => cause._tag === "Empty" ? tsplus_module_3.unit : tsplus_module_4.failCause(() => cause), (chunk) => tsplus_module_4.zipRight(loop)(tsplus_module_3.write(() => chunk)))(exit))(tsplus_module_3.fromIO(() => tsplus_module_6.take(exitQueue, fileName_1 + ":112:18")));
110
+ return tsplus_module_3.embedInput(input)(loop);
111
+ }, fileName_1 + ":104:8")(tsplus_module_12.interruptible(tsplus_module_11.fork(tsplus_module_8.tap((exit) => tsplus_module_6.offer(exit, fileName_1 + ":108:48")(exitQueue), fileName_1 + ":108:22")(tsplus_module_8.result(tsplus_module_8.zipRight(tsplus_module_8.failCauseNow(tsplus_module_7.empty(), fileName_1 + ":107:36"), fileName_1 + ":107:20")(self.run((data) => tsplus_module_6.offer(tsplus_module_10.succeed(tsplus_module_9.single(data), fileName_1 + ":106:54"), fileName_1 + ":106:41")(exitQueue))), fileName_1 + ":107:70")), fileName_1 + ":108:55"), fileName_1 + ":108:60"));
112
+ }, fileName_1 + ":89:27")(tsplus_module_13.makeUnbounded(fileName_1 + ":89:47")), fileName_1 + ":88:27")(tsplus_module_14.extend(() => self.writer, fileName_1 + ":88:45")(writeScope)), fileName_1 + ":87:27")(tsplus_module_14.make));
112
113
  }
113
114
  /**
114
- * @tsplus fluent fncts.http.Socket toChannelWith
115
- */
116
- export function toChannelWith(self) {
117
- return toChannel_1(self);
115
+ * @tsplus fluent fncts.http.Socket toChannelWith
116
+ */
117
+ function toChannelWith(self) {
118
+ return toChannel_1(self);
118
119
  }
119
120
  /**
120
- * @tsplus static fncts.http.WebSocketOps Tag
121
- */
122
- const WebSocketTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
123
- export const WebSocketTag = WebSocketTag_1;
121
+ * @tsplus static fncts.http.WebSocketOps Tag
122
+ */
123
+ const WebSocketTag_1 = tsplus_module_1.makeTag();
124
+ const WebSocketTag = WebSocketTag_1;
124
125
  /**
125
- * @tsplus static fncts.http.SocketOps makeWebSocket
126
- * @tsplus static fncts.http.WebSocketOps __call
127
- */
126
+ * @tsplus static fncts.http.SocketOps makeWebSocket
127
+ * @tsplus static fncts.http.WebSocketOps __call
128
+ */
128
129
  function makeWebSocket_1(url, options) {
129
- return fromWebSocket_1(tsplus_module_15.acquireRelease(() => tsplus_module_8.succeed(() => {
130
- if ("WebSocket" in globalThis) {
131
- return new globalThis.WebSocket(url);
132
- }
133
- return new IsoWs(url);
134
- }, fileName_1 + ":159:9"), ws => tsplus_module_8.succeed(() => ws.close(), fileName_1 + ":165:17"), fileName_1 + ":158:22"), options);
130
+ return fromWebSocket_1(tsplus_module_15.acquireRelease(() => tsplus_module_8.succeed(() => {
131
+ if ("WebSocket" in globalThis) return new globalThis.WebSocket(url);
132
+ return new WebSocket(url);
133
+ }, fileName_1 + ":159:9"), (ws) => tsplus_module_8.succeed(() => ws.close(), fileName_1 + ":165:17"), fileName_1 + ":158:22"), options);
135
134
  }
136
135
  /**
137
- * @tsplus static fncts.http.SocketOps fromWebSocket
138
- */
136
+ * @tsplus static fncts.http.SocketOps fromWebSocket
137
+ */
139
138
  function fromWebSocket_1(acquire, options) {
140
- return (() => {
141
- const closeCodeIsError = options?.closeCodeIsError ?? (code => code !== 1000 && code !== 1006);
142
- return tsplus_module_8.map(sendQueue => {
143
- const run = handler => tsplus_module_12.interruptible(tsplus_module_23.scoped(tsplus_module_8.flatMap(ws => {
144
- const encoder = new TextEncoder();
145
- return tsplus_module_8.flatMap(fiberSet => tsplus_module_8.flatMap(run => {
146
- let open = false;
147
- ws.onmessage = event => {
148
- run(handler(event.data instanceof Uint8Array ? event.data : typeof event.data === "string" ? encoder.encode(event.data) : new Uint8Array(event.data)));
149
- };
150
- ws.onclose = event => {
151
- tsplus_module_21.unsafeDone(tsplus_module_8.fail(() => new SocketCloseError("Close", event.code, event.reason, undefined), fileName_1 + ":206:45"), fileName_1 + ":206:37")(fiberSet.future);
152
- };
153
- ws.onerror = error => {
154
- tsplus_module_21.unsafeDone(tsplus_module_8.fail(() => new SocketGenericError(open ? "Read" : "Open", error), fileName_1 + ":210:45"), fileName_1 + ":210:37")(fiberSet.future);
155
- };
156
- return tsplus_module_8.flatMap(() => tsplus_module_8.flatMap(() => tsplus_module_8.flatMap(() => tsplus_module_8.map(() => void 0, fileName_1 + ":250:10")(tsplus_module_8.catchJust(tsplus_module_16.partial(miss => error => SocketCloseError.isClean(code => !closeCodeIsError(code))(error) ? tsplus_module_8.unit : miss()), fileName_1 + ":251:34")(tsplus_module_17.join(fiberSet))), fileName_1 + ":234:10")(tsplus_module_17.run(tsplus_module_8.forever(tsplus_module_8.tap(chunk => {
157
- if (isCloseEvent(chunk)) {
158
- return tsplus_module_8.fail(() => {
159
- ws.close(chunk.code, chunk.reason);
160
- return new SocketCloseError("Close", chunk.code, chunk.reason, chunk);
161
- }, fileName_1 + ":238:31");
162
- } else {
163
- // @ts-expect-error -- tsplus-6.0.0
164
- return tsplus_module_8.tryCatch(() => ws.send(chunk), error => new SocketGenericError("Write", error), fileName_1 + ":244:35");
165
- }
166
- }, fileName_1 + ":236:31")(tsplus_module_6.take(sendQueue, fileName_1 + ":236:22")), fileName_1 + ":246:15"))(fiberSet)), fileName_1 + ":232:10")(tsplus_module_8.succeed(() => open = true, fileName_1 + ":232:13")), fileName_1 + ":213:10")(tsplus_module_8.defer(() => {
167
- if (ws.readyState !== 1) {
168
- return tsplus_module_20.raceFirst(tsplus_module_17.join(fiberSet), fileName_1 + ":225:27")(tsplus_module_19.timeoutFail(() => options?.openTimeout ?? tsplus_module_18.seconds(10), () => new SocketGenericError("OpenTimeout", 'timeout waiting for "open"'))(tsplus_module_8.async(resume => {
169
- ws.onopen = () => {
170
- resume(tsplus_module_8.unit);
171
- };
172
- })));
173
- }
174
- return tsplus_module_8.unit;
175
- }, fileName_1 + ":214:19"));
176
- }, fileName_1 + ":189:27")(tsplus_module_22.provideSomeService(ws, WebSocketTag_1, fileName_1 + ":190:73")(tsplus_module_17.runtime()(fiberSet))), fileName_1 + ":188:27")(tsplus_module_17.make());
177
- }, fileName_1 + ":186:27")(acquire), fileName_1 + ":258:9"), fileName_1 + ":258:16");
178
- const write = chunk => tsplus_module_6.offer(chunk, fileName_1 + ":260:70")(sendQueue);
179
- const writer = tsplus_module_8.succeed(() => write, fileName_1 + ":262:22");
180
- return new class extends Socket {
181
- writer = writer;
182
- run = run;
183
- }();
184
- }, fileName_1 + ":183:31")(tsplus_module_13.makeUnbounded(fileName_1 + ":183:51"));
185
- })();
139
+ return (() => {
140
+ const closeCodeIsError = options?.closeCodeIsError ?? ((code) => code !== 1e3 && code !== 1006);
141
+ return tsplus_module_8.map((sendQueue) => {
142
+ const run = (handler) => tsplus_module_12.interruptible(tsplus_module_23.scoped(tsplus_module_8.flatMap((ws) => {
143
+ const encoder = new TextEncoder();
144
+ return tsplus_module_8.flatMap((fiberSet) => tsplus_module_8.flatMap((run) => {
145
+ let open = false;
146
+ ws.onmessage = (event) => {
147
+ run(handler(event.data instanceof Uint8Array ? event.data : typeof event.data === "string" ? encoder.encode(event.data) : new Uint8Array(event.data)));
148
+ };
149
+ ws.onclose = (event) => {
150
+ tsplus_module_21.unsafeDone(tsplus_module_8.fail(() => new SocketCloseError("Close", event.code, event.reason, void 0), fileName_1 + ":206:45"), fileName_1 + ":206:37")(fiberSet.future);
151
+ };
152
+ ws.onerror = (error) => {
153
+ tsplus_module_21.unsafeDone(tsplus_module_8.fail(() => new SocketGenericError(open ? "Read" : "Open", error), fileName_1 + ":210:45"), fileName_1 + ":210:37")(fiberSet.future);
154
+ };
155
+ return tsplus_module_8.flatMap(() => tsplus_module_8.flatMap(() => tsplus_module_8.flatMap(() => tsplus_module_8.map(() => void 0, fileName_1 + ":250:10")(tsplus_module_8.catchJust(tsplus_module_16.partial((miss) => (error) => SocketCloseError.isClean((code) => !closeCodeIsError(code))(error) ? tsplus_module_8.unit : miss()), fileName_1 + ":251:34")(tsplus_module_17.join(fiberSet))), fileName_1 + ":234:10")(tsplus_module_17.run(tsplus_module_8.forever(tsplus_module_8.tap((chunk) => {
156
+ if (isCloseEvent(chunk)) return tsplus_module_8.fail(() => {
157
+ ws.close(chunk.code, chunk.reason);
158
+ return new SocketCloseError("Close", chunk.code, chunk.reason, chunk);
159
+ }, fileName_1 + ":238:31");
160
+ else return tsplus_module_8.tryCatch(() => ws.send(chunk), (error) => new SocketGenericError("Write", error), fileName_1 + ":244:35");
161
+ }, fileName_1 + ":236:31")(tsplus_module_6.take(sendQueue, fileName_1 + ":236:22")), fileName_1 + ":246:15"))(fiberSet)), fileName_1 + ":232:10")(tsplus_module_8.succeed(() => open = true, fileName_1 + ":232:13")), fileName_1 + ":213:10")(tsplus_module_8.defer(() => {
162
+ if (ws.readyState !== 1) return tsplus_module_20.raceFirst(tsplus_module_17.join(fiberSet), fileName_1 + ":225:27")(tsplus_module_19.timeoutFail(() => options?.openTimeout ?? tsplus_module_18.seconds(10), () => new SocketGenericError("OpenTimeout", "timeout waiting for \"open\""))(tsplus_module_8.async((resume) => {
163
+ ws.onopen = () => {
164
+ resume(tsplus_module_8.unit);
165
+ };
166
+ })));
167
+ return tsplus_module_8.unit;
168
+ }, fileName_1 + ":214:19"));
169
+ }, fileName_1 + ":189:27")(tsplus_module_22.provideSomeService(ws, WebSocketTag_1, fileName_1 + ":190:73")(tsplus_module_17.runtime()(fiberSet))), fileName_1 + ":188:27")(tsplus_module_17.make());
170
+ }, fileName_1 + ":186:27")(acquire), fileName_1 + ":258:9"), fileName_1 + ":258:16");
171
+ const write = (chunk) => tsplus_module_6.offer(chunk, fileName_1 + ":260:70")(sendQueue);
172
+ const writer = tsplus_module_8.succeed(() => write, fileName_1 + ":262:22");
173
+ return new class extends Socket {
174
+ writer = writer;
175
+ run = run;
176
+ }();
177
+ }, fileName_1 + ":183:31")(tsplus_module_13.makeUnbounded(fileName_1 + ":183:51"));
178
+ })();
186
179
  }
187
180
  /**
188
- * @tsplus static fncts.http.SocketOps makeWebSocketChannel
189
- * @tsplus static fncts.http.WebSocketOps makeChannel
190
- */
191
- export function makeWebSocketChannel(url, options) {
192
- return tsplus_module_3.unwrap(() => tsplus_module_8.map(socket => toChannel_1(socket), fileName_1 + ":281:56")(makeWebSocket_1(url, options)));
181
+ * @tsplus static fncts.http.SocketOps makeWebSocketChannel
182
+ * @tsplus static fncts.http.WebSocketOps makeChannel
183
+ */
184
+ function makeWebSocketChannel(url, options) {
185
+ return tsplus_module_3.unwrap(() => tsplus_module_8.map((socket) => toChannel_1(socket), fileName_1 + ":281:56")(makeWebSocket_1(url, options)));
193
186
  }
194
187
  /**
195
- * @tsplus static fncts.http.SocketOps liveWebSocket
196
- * @tsplus static fncts.http.WebSocketOps live
197
- */
198
- export function live(url, options) {
199
- return tsplus_module_24.scoped(() => makeWebSocket_1(url, options), SocketTag_1, fileName_1 + ":294:22");
188
+ * @tsplus static fncts.http.SocketOps liveWebSocket
189
+ * @tsplus static fncts.http.WebSocketOps live
190
+ */
191
+ function live(url, options) {
192
+ return tsplus_module_24.scoped(() => makeWebSocket_1(url, options), SocketTag_1, fileName_1 + ":294:22");
200
193
  }
194
+ //#endregion
195
+ export { CloseEvent, CloseEventTypeId, Socket, SocketCloseError, SocketCloseErrorTypeId, SocketGenericError, SocketGenericErrorTypeId, SocketTag, SocketTypeId, WebSocketTag, fromWebSocket, isCloseEvent, isSocketCloseError, live, makeWebSocket, makeWebSocketChannel, toChannel, toChannelWith };
196
+
201
197
  //# sourceMappingURL=Socket.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Socket.mjs","names":["toChannel","toChannel_1","makeWebSocket","makeWebSocket_1","fromWebSocket","fromWebSocket_1","WebSocket","IsoWs","SocketTypeId","Symbol","for","Socket","SocketTag_1","tsplus_module_1","makeTag","SocketTag","SocketGenericErrorTypeId","SocketGenericError","Error","reason","error","constructor","SocketCloseErrorTypeId","SocketCloseError","code","closeReason","isClean","u","isSocketCloseError","tsplus_module_2","isObject","CloseEventTypeId","CloseEvent","isCloseEvent","self","tsplus_module_3","unwrap","tsplus_module_8","flatMap","writeScope","write","exitQueue","input","awaitRead","unit","emit","chunk","catchAllCause","cause","tsplus_module_6","offer","tsplus_module_10","failCause","fileName_1","foreachDiscard","zipRight","close","done","loop","tsplus_module_4","exit","tsplus_module_5","match","_tag","fromIO","take","embedInput","tap","result","failCauseNow","tsplus_module_7","empty","run","data","succeed","tsplus_module_9","single","tsplus_module_13","makeUnbounded","tsplus_module_14","extend","writer","make","toChannelWith","WebSocketTag_1","WebSocketTag","url","options","tsplus_module_15","acquireRelease","globalThis","ws","acquire","closeCodeIsError","sendQueue","handler","tsplus_module_12","interruptible","tsplus_module_23","scoped","encoder","TextEncoder","fiberSet","open","onmessage","event","Uint8Array","encode","onclose","tsplus_module_21","unsafeDone","fail","undefined","future","onerror","catchJust","tsplus_module_16","partial","miss","tsplus_module_17","join","forever","tryCatch","send","defer","readyState","tsplus_module_20","raceFirst","tsplus_module_19","timeoutFail","openTimeout","tsplus_module_18","seconds","async","resume","onopen","tsplus_module_22","provideSomeService","runtime","makeWebSocketChannel","map","socket","live","tsplus_module_24"],"sources":["../_src/Socket.ts"],"sourcesContent":[null],"mappings":";;;;;;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C;AAC5F;AAEA;;;;AAIA,OAAM,SAAUuD,IAAIA,CAClBxD,GAAW,EACXC,OAEC;EAED,OAAOwD,gBAAA,CAAA5C,MAAA,OAAahG,eAAA,CAAUmF,GAAG,EAAEC,OAAO,CAAC,EAAA3E,WAAA,EAAAyC,UAAA,aAAa;AAC1D","ignoreList":[]}
1
+ {"version":3,"file":"Socket.mjs","names":["IsoWs"],"sources":["../esm/Socket.js"],"sourcesContent":["const fileName_1 = \"(@fncts/http) src/Socket.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Tag/constructors\";\nimport * as tsplus_module_2 from \"@fncts/base/util/predicates\";\nimport * as tsplus_module_3 from \"@fncts/io/Channel/api\";\nimport * as tsplus_module_4 from \"@fncts/io/Channel/core-api\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Exit/api\";\nimport * as tsplus_module_6 from \"@fncts/io/Queue/api/operations\";\nimport * as tsplus_module_7 from \"@fncts/base/data/Cause/api\";\nimport * as tsplus_module_8 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_9 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_10 from \"@fncts/base/data/Exit/constructors\";\nimport * as tsplus_module_11 from \"@fncts/io/IO/api/fork\";\nimport * as tsplus_module_12 from \"@fncts/io/IO/api/interrupt\";\nimport * as tsplus_module_13 from \"@fncts/io/Queue/constructors\";\nimport * as tsplus_module_14 from \"@fncts/io/Scope/api\";\nimport * as tsplus_module_15 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_16 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_17 from \"@fncts/io/FiberSet\";\nimport * as tsplus_module_18 from \"@fncts/base/data/Duration/api\";\nimport * as tsplus_module_19 from \"@fncts/io/IO/api/timeout\";\nimport * as tsplus_module_20 from \"@fncts/io/IO/api/raceFirst\";\nimport * as tsplus_module_21 from \"@fncts/io/Future/api\";\nimport * as tsplus_module_22 from \"@fncts/io/IO/api/environment\";\nimport * as tsplus_module_23 from \"@fncts/io/IO/api/scoped\";\nimport * as tsplus_module_24 from \"@fncts/io/Layer/api\";\nexport const toChannel = toChannel_1;\nexport const makeWebSocket = makeWebSocket_1;\nexport const fromWebSocket = fromWebSocket_1;\nimport { WebSocket as IsoWs } from \"isows\";\nexport const SocketTypeId = Symbol.for(\"fncts.http.Socket\");\n/**\n * @tsplus type fncts.http.Socket\n * @tsplus companion fncts.http.SocketOps\n */\nexport class Socket {\n [SocketTypeId] = SocketTypeId;\n}\n/**\n * @tsplus static fncts.http.SocketOps Tag\n */\nconst SocketTag_1 = tsplus_module_1.makeTag();\nexport const SocketTag = SocketTag_1;\nexport const SocketGenericErrorTypeId = Symbol.for(\"fncts.http.Socket.SocketGenericError\");\nexport class SocketGenericError extends Error {\n reason;\n error;\n [SocketGenericErrorTypeId] = SocketGenericErrorTypeId;\n constructor(reason, error) {\n super();\n this.reason = reason;\n this.error = error;\n }\n}\nexport const SocketCloseErrorTypeId = Symbol.for(\"fncts.http.Socket.SocketCloseError\");\nexport class SocketCloseError extends Error {\n reason;\n code;\n closeReason;\n error;\n [SocketCloseErrorTypeId] = SocketCloseErrorTypeId;\n constructor(reason, code, closeReason, error) {\n super();\n this.reason = reason;\n this.code = code;\n this.closeReason = closeReason;\n this.error = error;\n }\n static isClean(isClean) {\n return (u) => {\n return isSocketCloseError(u) && isClean(u.code);\n };\n }\n}\nexport function isSocketCloseError(u) {\n return tsplus_module_2.isObject(u) && SocketCloseErrorTypeId in u;\n}\nexport const CloseEventTypeId = Symbol.for(\"fncts.http.Socket.CloseEvent\");\nexport class CloseEvent {\n code;\n reason;\n [CloseEventTypeId] = CloseEventTypeId;\n constructor(code = 1000, reason) {\n this.code = code;\n this.reason = reason;\n }\n}\nexport function isCloseEvent(u) {\n return tsplus_module_2.isObject(u) && CloseEventTypeId in u;\n}\n/**\n * @tsplus fluent fncts.http.Socket toChannel\n */\nfunction toChannel_1(self) {\n return tsplus_module_3.unwrap(() => tsplus_module_8.flatMap(writeScope => tsplus_module_8.flatMap(write => tsplus_module_8.flatMap(exitQueue => {\n const input = {\n awaitRead: tsplus_module_8.unit,\n emit(chunk) {\n return tsplus_module_8.catchAllCause((cause) => tsplus_module_6.offer(tsplus_module_10.failCause(cause, fileName_1 + \":94:105\"), fileName_1 + \":94:90\")(exitQueue), fileName_1 + \":94:63\")(tsplus_module_8.foreachDiscard(chunk, write, fileName_1 + \":94:35\"));\n },\n error(error) {\n return tsplus_module_8.zipRight(tsplus_module_6.offer(tsplus_module_10.failCause(error, fileName_1 + \":97:78\"), fileName_1 + \":97:63\")(exitQueue), fileName_1 + \":97:47\")(writeScope.close(() => tsplus_module_10.unit));\n },\n done() {\n return writeScope.close(() => tsplus_module_10.unit);\n },\n };\n return tsplus_module_8.map(() => {\n const loop = tsplus_module_4.flatMap((exit) => tsplus_module_5.match((cause) => (cause._tag === \"Empty\" /* CauseTag.Empty */ ? tsplus_module_3.unit : tsplus_module_4.failCause(() => cause)), (chunk) => tsplus_module_4.zipRight(loop)(tsplus_module_3.write(() => chunk)))(exit))(tsplus_module_3.fromIO(() => tsplus_module_6.take(exitQueue, fileName_1 + \":112:18\")));\n return tsplus_module_3.embedInput(input)(loop);\n }, fileName_1 + \":104:8\")(tsplus_module_12.interruptible(tsplus_module_11.fork(tsplus_module_8.tap((exit) => tsplus_module_6.offer(exit, fileName_1 + \":108:48\")(exitQueue), fileName_1 + \":108:22\")(tsplus_module_8.result(tsplus_module_8.zipRight(tsplus_module_8.failCauseNow(tsplus_module_7.empty(), fileName_1 + \":107:36\"), fileName_1 + \":107:20\")(self\n .run((data) => tsplus_module_6.offer(tsplus_module_10.succeed(tsplus_module_9.single(data), fileName_1 + \":106:54\"), fileName_1 + \":106:41\")(exitQueue))), fileName_1 + \":107:70\")), fileName_1 + \":108:55\"), fileName_1 + \":108:60\"));\n }, fileName_1 + \":89:27\")(tsplus_module_13.makeUnbounded(fileName_1 + \":89:47\")), fileName_1 + \":88:27\")(tsplus_module_14.extend(() => self.writer, fileName_1 + \":88:45\")(writeScope)), fileName_1 + \":87:27\")(tsplus_module_14.make));\n}\n/**\n * @tsplus fluent fncts.http.Socket toChannelWith\n */\nexport function toChannelWith(self) {\n return toChannel_1(self);\n}\n/**\n * @tsplus static fncts.http.WebSocketOps Tag\n */\nconst WebSocketTag_1 = tsplus_module_1.makeTag();\nexport const WebSocketTag = WebSocketTag_1;\n/**\n * @tsplus static fncts.http.SocketOps makeWebSocket\n * @tsplus static fncts.http.WebSocketOps __call\n */\nfunction makeWebSocket_1(url, options) {\n return fromWebSocket_1(tsplus_module_15.acquireRelease(() => tsplus_module_8.succeed(() => {\n if (\"WebSocket\" in globalThis) {\n return new globalThis.WebSocket(url);\n }\n return new IsoWs(url);\n }, fileName_1 + \":159:9\"), (ws) => tsplus_module_8.succeed(() => ws.close(), fileName_1 + \":165:17\"), fileName_1 + \":158:22\"), options);\n}\n/**\n * @tsplus static fncts.http.SocketOps fromWebSocket\n */\nfunction fromWebSocket_1(acquire, options) {\n return (() => {\n const closeCodeIsError = options?.closeCodeIsError ?? ((code) => code !== 1000 && code !== 1006);\n return tsplus_module_8.map(sendQueue => {\n const run = (handler) => tsplus_module_12.interruptible(tsplus_module_23.scoped(tsplus_module_8.flatMap(ws => {\n const encoder = new TextEncoder();\n return tsplus_module_8.flatMap(fiberSet => tsplus_module_8.flatMap(run => {\n let open = false;\n ws.onmessage = (event) => {\n run(handler(event.data instanceof Uint8Array\n ? event.data\n : typeof event.data === \"string\"\n ? encoder.encode(event.data)\n : new Uint8Array(event.data)));\n };\n ws.onclose = (event) => {\n tsplus_module_21.unsafeDone(tsplus_module_8.fail(() => new SocketCloseError(\"Close\", event.code, event.reason, undefined), fileName_1 + \":206:45\"), fileName_1 + \":206:37\")(fiberSet.future);\n };\n ws.onerror = (error) => {\n tsplus_module_21.unsafeDone(tsplus_module_8.fail(() => new SocketGenericError(open ? \"Read\" : \"Open\", error), fileName_1 + \":210:45\"), fileName_1 + \":210:37\")(fiberSet.future);\n };\n return tsplus_module_8.flatMap(() => tsplus_module_8.flatMap(() => tsplus_module_8.flatMap(() => tsplus_module_8.map(() => void 0, fileName_1 + \":250:10\")(tsplus_module_8.catchJust(tsplus_module_16.partial((miss) => (error) => SocketCloseError.isClean((code) => !closeCodeIsError(code))(error) ? tsplus_module_8.unit : miss()), fileName_1 + \":251:34\")(tsplus_module_17.join(fiberSet))), fileName_1 + \":234:10\")(tsplus_module_17.run(tsplus_module_8.forever(tsplus_module_8.tap((chunk) => {\n if (isCloseEvent(chunk)) {\n return tsplus_module_8.fail(() => {\n ws.close(chunk.code, chunk.reason);\n return new SocketCloseError(\"Close\", chunk.code, chunk.reason, chunk);\n }, fileName_1 + \":238:31\");\n }\n else {\n // @ts-expect-error -- tsplus-6.0.0\n return tsplus_module_8.tryCatch(() => ws.send(chunk), (error) => new SocketGenericError(\"Write\", error), fileName_1 + \":244:35\");\n }\n }, fileName_1 + \":236:31\")(tsplus_module_6.take(sendQueue, fileName_1 + \":236:22\")), fileName_1 + \":246:15\"))(fiberSet)), fileName_1 + \":232:10\")(tsplus_module_8.succeed(() => (open = true), fileName_1 + \":232:13\")), fileName_1 + \":213:10\")(tsplus_module_8.defer(() => {\n if (ws.readyState !== 1) {\n return tsplus_module_20.raceFirst(tsplus_module_17.join(fiberSet), fileName_1 + \":225:27\")(tsplus_module_19.timeoutFail(() => options?.openTimeout ?? tsplus_module_18.seconds(10), () => new SocketGenericError(\"OpenTimeout\", 'timeout waiting for \"open\"'))(tsplus_module_8.async((resume) => {\n ws.onopen = () => {\n resume(tsplus_module_8.unit);\n };\n })));\n }\n return tsplus_module_8.unit;\n }, fileName_1 + \":214:19\"));\n }, fileName_1 + \":189:27\")(tsplus_module_22.provideSomeService(ws, WebSocketTag_1, fileName_1 + \":190:73\")(tsplus_module_17.runtime()(fiberSet))), fileName_1 + \":188:27\")(tsplus_module_17.make());\n }, fileName_1 + \":186:27\")(acquire), fileName_1 + \":258:9\"), fileName_1 + \":258:16\");\n const write = (chunk) => tsplus_module_6.offer(chunk, fileName_1 + \":260:70\")(sendQueue);\n const writer = tsplus_module_8.succeed(() => write, fileName_1 + \":262:22\");\n return new (class extends Socket {\n writer = writer;\n run = run;\n })();\n }, fileName_1 + \":183:31\")(tsplus_module_13.makeUnbounded(fileName_1 + \":183:51\"));\n })();\n}\n/**\n * @tsplus static fncts.http.SocketOps makeWebSocketChannel\n * @tsplus static fncts.http.WebSocketOps makeChannel\n */\nexport function makeWebSocketChannel(url, options) {\n return tsplus_module_3.unwrap(() => tsplus_module_8.map((socket) => toChannel_1(socket), fileName_1 + \":281:56\")(makeWebSocket_1(url, options)));\n}\n/**\n * @tsplus static fncts.http.SocketOps liveWebSocket\n * @tsplus static fncts.http.WebSocketOps live\n */\nexport function live(url, options) {\n return tsplus_module_24.scoped(() => makeWebSocket_1(url, options), SocketTag_1, fileName_1 + \":294:22\");\n}\n//# sourceMappingURL=Socket.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAyBnB,MAAa,YAAY;AACzB,MAAa,gBAAgB;AAC7B,MAAa,gBAAgB;AAE7B,MAAa,eAAe,OAAO,IAAI,oBAAoB;;;;;AAK3D,IAAa,SAAb,MAAoB;CAChB,CAAC,gBAAgB;;;;;AAKrB,MAAM,cAAc,gBAAgB,SAAS;AAC7C,MAAa,YAAY;AACzB,MAAa,2BAA2B,OAAO,IAAI,uCAAuC;AAC1F,IAAa,qBAAb,cAAwC,MAAM;CAC1C;CACA;CACA,CAAC,4BAA4B;CAC7B,YAAY,QAAQ,OAAO;AACvB,SAAO;AACP,OAAK,SAAS;AACd,OAAK,QAAQ;;;AAGrB,MAAa,yBAAyB,OAAO,IAAI,qCAAqC;AACtF,IAAa,mBAAb,cAAsC,MAAM;CACxC;CACA;CACA;CACA;CACA,CAAC,0BAA0B;CAC3B,YAAY,QAAQ,MAAM,aAAa,OAAO;AAC1C,SAAO;AACP,OAAK,SAAS;AACd,OAAK,OAAO;AACZ,OAAK,cA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,gBAAgB,KAAK,WAAW,YAAY,OAAO,EAAE,aAAa,UAAU,CAAC,gBAAgB,KAAK,QAAQ,CAAC,CAAC;;;;;;AAMpJ,SAAgB,KAAK,KAAK,SAAS;AAC/B,QAAO,iBAAiB,aAAa,gBAAgB,KAAK,QAAQ,EAAE,aAAa,aAAa,UAAU"}
@@ -1,26 +1,28 @@
1
+ //#region build/esm/UrlParams.js
1
2
  /**
2
- * @tsplus type fncts.http.UrlParams
3
- * @tsplus type fncts.http.UrlParamsOps
4
- */
5
- export class UrlParams {
6
- backing;
7
- constructor(backing) {
8
- this.backing = backing;
9
- }
10
- }
3
+ * @tsplus type fncts.http.UrlParams
4
+ * @tsplus type fncts.http.UrlParamsOps
5
+ */
6
+ var UrlParams = class {
7
+ backing;
8
+ constructor(backing) {
9
+ this.backing = backing;
10
+ }
11
+ };
11
12
  /**
12
- * @tsplus static fncts.http.UrlParamsOps __call
13
- */
14
- export function make(input) {
15
- if (Symbol.iterator in input) {
16
- return new UrlParams(Array.from(input));
17
- }
18
- return new UrlParams(Array.from(Object.entries(input)));
13
+ * @tsplus static fncts.http.UrlParamsOps __call
14
+ */
15
+ function make(input) {
16
+ if (Symbol.iterator in input) return new UrlParams(Array.from(input));
17
+ return new UrlParams(Array.from(Object.entries(input)));
19
18
  }
20
19
  /**
21
- * @tsplus fluent fncts.http.UrlParams toString
22
- */
23
- export function toString(self) {
24
- return new URLSearchParams(self.backing).toString();
20
+ * @tsplus fluent fncts.http.UrlParams toString
21
+ */
22
+ function toString(self) {
23
+ return new URLSearchParams(self.backing).toString();
25
24
  }
25
+ //#endregion
26
+ export { UrlParams, make, toString };
27
+
26
28
  //# sourceMappingURL=UrlParams.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"UrlParams.mjs","names":["UrlParams","backing","constructor","make","input","Symbol","iterator","Array","from","Object","entries","toString","self","URLSearchParams"],"sources":["../_src/UrlParams.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAIA,OAAM,MAAOA,SAAS;EACCC,OAAA;EAArBC,YAAqBD,OAAiD;IAAjD,KAAAA,OAAO,GAAPA,OAAO;EAA6C;;AAO3E;;;AAGA,OAAM,SAAUE,IAAIA,CAACC,KAAsB;EACzC,IAAIC,MAAM,CAACC,QAAQ,IAAIF,KAAK,EAAE;IAC5B,OAAO,IAAIJ,SAAS,CAACO,KAAK,CAACC,IAAI,CAACJ,KAAK,CAAC,CAAC;EACzC;EACA,OAAO,IAAIJ,SAAS,CAACO,KAAK,CAACC,IAAI,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,CAAC,CAAC,CAAC;AACzD;AAEA;;;AAGA,OAAM,SAAUO,QAAQA,CAACC,IAAe;EACtC,OAAO,IAAIC,eAAe,CAACD,IAAI,CAACX,OAAkC,CAAC,CAACU,QAAQ,EAAE;AAChF","ignoreList":[]}
1
+ {"version":3,"file":"UrlParams.mjs","names":[],"sources":["../esm/UrlParams.js"],"sourcesContent":["/**\n * @tsplus type fncts.http.UrlParams\n * @tsplus type fncts.http.UrlParamsOps\n */\nexport class UrlParams {\n backing;\n constructor(backing) {\n this.backing = backing;\n }\n}\n/**\n * @tsplus static fncts.http.UrlParamsOps __call\n */\nexport function make(input) {\n if (Symbol.iterator in input) {\n return new UrlParams(Array.from(input));\n }\n return new UrlParams(Array.from(Object.entries(input)));\n}\n/**\n * @tsplus fluent fncts.http.UrlParams toString\n */\nexport function toString(self) {\n return new URLSearchParams(self.backing).toString();\n}\n//# sourceMappingURL=UrlParams.js.map"],"mappings":";;;;;AAIA,IAAa,YAAb,MAAuB;CACnB;CACA,YAAY,SAAS;AACjB,OAAK,UAAU;;;;;;AAMvB,SAAgB,KAAK,OAAO;AACxB,KAAI,OAAO,YAAY,MACnB,QAAO,IAAI,UAAU,MAAM,KAAK,MAAM,CAAC;AAE3C,QAAO,IAAI,UAAU,MAAM,KAAK,OAAO,QAAQ,MAAM,CAAC,CAAC;;;;;AAK3D,SAAgB,SAAS,MAAM;AAC3B,QAAO,IAAI,gBAAgB,KAAK,QAAQ,CAAC,UAAU"}
package/_mjs/global.mjs CHANGED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=global.mjs.map
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@fncts/http",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/0x706b/fncts"
7
+ },
4
8
  "dependencies": {
5
- "@fncts/base": "0.0.43",
6
- "@fncts/io": "0.0.51",
7
- "@fncts/schema": "0.0.24",
8
- "@fncts/typelevel": "0.0.24",
9
9
  "find-my-way": "^9.3.0",
10
10
  "find-my-way-ts": "^0.1.5",
11
11
  "isows": "^1.0.7",
12
- "uuid": "^14.0.0"
12
+ "uuid": "^14.0.0",
13
+ "@fncts/typelevel": "0.0.25",
14
+ "@fncts/base": "0.0.44",
15
+ "@fncts/schema": "0.0.25",
16
+ "@fncts/io": "0.0.52"
13
17
  },
14
18
  "exports": {
15
19
  "./*": {
package/_cjs/Body.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Body.cjs","names":["_api","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_definition"],"sources":["../_src/Body.ts"],"sourcesContent":[null],"mappings":";;;;;AACA,IAAAA,IAAA,gBAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,WAAA,gBAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IncomingMessage.cjs","names":["_api","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_definition"],"sources":["../_src/IncomingMessage.ts"],"sourcesContent":[null],"mappings":";;;;;AACA,IAAAA,IAAA,gBAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,WAAA,gBAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryParams.cjs","names":[],"sources":["../_src/QueryParams.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Route.cjs","names":["_api","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_definition"],"sources":["../_src/Route.ts"],"sourcesContent":[null],"mappings":";;;;;AACA,IAAAA,IAAA,gBAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,WAAA,gBAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}