@fncts/http 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) 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 -65
  5. package/_cjs/Body/definition.cjs.map +1 -1
  6. package/_cjs/Body.cjs +20 -28
  7. package/_cjs/BodyError.cjs +33 -38
  8. package/_cjs/BodyError.cjs.map +1 -1
  9. package/_cjs/Headers.cjs +70 -74
  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 -17
  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 -17
  24. package/_cjs/RequestError.cjs.map +1 -1
  25. package/_cjs/ResponseError.cjs +26 -25
  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 +29 -34
  30. package/_cjs/Route/definition.cjs.map +1 -1
  31. package/_cjs/Route/internal.cjs +33 -27
  32. package/_cjs/Route/internal.cjs.map +1 -1
  33. package/_cjs/Route.cjs +23 -28
  34. package/_cjs/RouteNotFound.cjs +16 -16
  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 -19
  39. package/_cjs/Router/definition.cjs.map +1 -1
  40. package/_cjs/Router/internal.cjs +75 -79
  41. package/_cjs/Router/internal.cjs.map +1 -1
  42. package/_cjs/Router.cjs +24 -28
  43. package/_cjs/Server.cjs +38 -41
  44. package/_cjs/Server.cjs.map +1 -1
  45. package/_cjs/ServerError.cjs +18 -19
  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 +21 -25
  50. package/_cjs/ServerRequest/definition.cjs.map +1 -1
  51. package/_cjs/ServerRequest/internal.cjs +77 -74
  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 -39
  57. package/_cjs/ServerResponse/definition.cjs.map +1 -1
  58. package/_cjs/ServerResponse.cjs +18 -28
  59. package/_cjs/Socket.cjs +213 -193
  60. package/_cjs/Socket.cjs.map +1 -1
  61. package/_cjs/UrlParams.cjs +23 -26
  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 -55
  68. package/_mjs/Body/definition.mjs.map +1 -1
  69. package/_mjs/Body.mjs +3 -4
  70. package/_mjs/BodyError.mjs +30 -30
  71. package/_mjs/BodyError.mjs.map +1 -1
  72. package/_mjs/Headers.mjs +61 -64
  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 -11
  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 -11
  87. package/_mjs/RequestError.mjs.map +1 -1
  88. package/_mjs/ResponseError.mjs +25 -19
  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 -24
  93. package/_mjs/Route/definition.mjs.map +1 -1
  94. package/_mjs/Route/internal.mjs +30 -19
  95. package/_mjs/Route/internal.mjs.map +1 -1
  96. package/_mjs/Route.mjs +3 -4
  97. package/_mjs/RouteNotFound.mjs +15 -10
  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 -12
  102. package/_mjs/Router/definition.mjs.map +1 -1
  103. package/_mjs/Router/internal.mjs +55 -63
  104. package/_mjs/Router/internal.mjs.map +1 -1
  105. package/_mjs/Router.mjs +3 -4
  106. package/_mjs/Server.mjs +28 -31
  107. package/_mjs/Server.mjs.map +1 -1
  108. package/_mjs/ServerError.mjs +14 -11
  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 -16
  113. package/_mjs/ServerRequest/definition.mjs.map +1 -1
  114. package/_mjs/ServerRequest/internal.mjs +65 -64
  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 -30
  120. package/_mjs/ServerResponse/definition.mjs.map +1 -1
  121. package/_mjs/ServerResponse.mjs +3 -4
  122. package/_mjs/Socket.mjs +152 -157
  123. package/_mjs/Socket.mjs.map +1 -1
  124. package/_mjs/UrlParams.mjs +22 -19
  125. package/_mjs/UrlParams.mjs.map +1 -1
  126. package/_mjs/global.mjs +0 -2
  127. package/_src/Headers.ts +1 -1
  128. package/_src/Socket.ts +1 -0
  129. package/_src/UrlParams.ts +1 -1
  130. package/package.json +10 -6
  131. package/_cjs/Body.cjs.map +0 -1
  132. package/_cjs/IncomingMessage.cjs.map +0 -1
  133. package/_cjs/QueryParams.cjs.map +0 -1
  134. package/_cjs/Route.cjs.map +0 -1
  135. package/_cjs/Router.cjs.map +0 -1
  136. package/_cjs/ServerRequest.cjs.map +0 -1
  137. package/_cjs/ServerResponse.cjs.map +0 -1
  138. package/_cjs/global.cjs.map +0 -1
  139. package/_mjs/Body.mjs.map +0 -1
  140. package/_mjs/IncomingMessage.mjs.map +0 -1
  141. package/_mjs/QueryParams.mjs.map +0 -1
  142. package/_mjs/Route.mjs.map +0 -1
  143. package/_mjs/Router.mjs.map +0 -1
  144. package/_mjs/ServerRequest.mjs.map +0 -1
  145. package/_mjs/ServerResponse.mjs.map +0 -1
  146. package/_mjs/global.mjs.map +0 -1
@@ -1,34 +1,34 @@
1
- var _a;
2
- import * as tsplus_module_1 from "@fncts/base/collection/immutable/HashMap/api";
3
- import * as tsplus_module_2 from "@fncts/base/util/predicates";
4
1
  import { Headers } from "../Headers.mjs";
5
- 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");
6
6
  /**
7
- * @tsplus type fncts.http.ServerResponse
8
- * @tsplus companion fncts.http.ServerResponseOps
9
- */
10
- export class ServerResponse {
11
- constructor(status, statusText, headers, body) {
12
- this.status = status;
13
- this.statusText = statusText;
14
- this.body = body;
15
- this[_a] = ServerResponseTypeId;
16
- if (body.contentType || body.contentLength) {
17
- const newHeaders = tsplus_module_1.beginMutation(headers.backing);
18
- if (body.contentType) {
19
- tsplus_module_1.set("content-type", body.contentType)(newHeaders);
20
- }
21
- if (body.contentLength) {
22
- tsplus_module_1.set("content-length", body.contentLength.toString())(newHeaders);
23
- }
24
- this.headers = new Headers(tsplus_module_1.endMutation(newHeaders));
25
- } else {
26
- this.headers = headers;
27
- }
28
- }
29
- }
30
- _a = ServerResponseTypeId;
31
- export function isServerResponse(u) {
32
- 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;
33
30
  }
31
+ //#endregion
32
+ export { ServerResponse, ServerResponseTypeId, isServerResponse };
33
+
34
34
  //# sourceMappingURL=definition.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.mjs","names":["Headers","ServerResponseTypeId","Symbol","for","ServerResponse","constructor","status","statusText","headers","body","_a","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;EAGzBC,YACWC,MAAc,EACdC,UAA8B,EACvCC,OAAgB,EACPC,IAAU;IAHV,KAAAH,MAAM,GAANA,MAAM;IACN,KAAAC,UAAU,GAAVA,UAAU;IAEV,KAAAE,IAAI,GAAJA,IAAI;IANN,KAAAC,EAAA,CAAsB,GAAyBT,oBAAoB;IAQ1E,IAAIQ,IAAI,CAACE,WAAW,IAAIF,IAAI,CAACG,aAAa,EAAE;MAC1C,MAAMC,UAAU,GAAAC,eAAA,CAAAC,aAAA,CAAGP,OAAO,CAACQ,OAAO,CAAc;MAChD,IAAIP,IAAI,CAACE,WAAW,EAAE;QACpBG,eAAA,CAAAG,GAAA,CAAe,cAAc,EAAER,IAAI,CAACE,WAAW,EAA/CE,UAAU,CAAsC;MAClD;MACA,IAAIJ,IAAI,CAACG,aAAa,EAAE;QACtBE,eAAA,CAAAG,GAAA,CAAe,gBAAgB,EAAER,IAAI,CAACG,aAAa,CAACM,QAAQ,EAAE,EAA9DL,UAAU,CAAqD;MACjE;MACA,IAAI,CAACL,OAAO,GAAG,IAAIR,OAAO,CAAAc,eAAA,CAAAK,WAAA,CAACN,UAAU,EAAa;IACpD,CAAC,MAAM;MACL,IAAI,CAACL,OAAO,GAAGA,OAAO;IACxB;EACF;;KApBUP,oBAAoB;AAoChC,OAAM,SAAUmB,gBAAgBA,CAACC,CAAU;EACzC,OAAOC,eAAA,CAAAC,QAAQ,CAACF,CAAC,CAAC,IAAIpB,oBAAoB,IAAIoB,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,5 +1,3 @@
1
- var _a, _b, _c, _d;
2
- const fileName_1 = "(@fncts/http) src/Socket.ts";
3
1
  import * as tsplus_module_1 from "@fncts/base/data/Tag/constructors";
4
2
  import * as tsplus_module_2 from "@fncts/base/util/predicates";
5
3
  import * as tsplus_module_3 from "@fncts/io/Channel/api";
@@ -24,179 +22,176 @@ import * as tsplus_module_21 from "@fncts/io/Future/api";
24
22
  import * as tsplus_module_22 from "@fncts/io/IO/api/environment";
25
23
  import * as tsplus_module_23 from "@fncts/io/IO/api/scoped";
26
24
  import * as tsplus_module_24 from "@fncts/io/Layer/api";
27
- export const toChannel = toChannel_1;
28
- export const makeWebSocket = makeWebSocket_1;
29
- export const fromWebSocket = fromWebSocket_1;
30
- import { WebSocket as IsoWs } from "isows";
31
- 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");
32
32
  /**
33
- * @tsplus type fncts.http.Socket
34
- * @tsplus companion fncts.http.SocketOps
35
- */
36
- export class Socket {
37
- constructor() {
38
- this[_a] = SocketTypeId;
39
- }
40
- }
41
- _a = SocketTypeId;
33
+ * @tsplus type fncts.http.Socket
34
+ * @tsplus companion fncts.http.SocketOps
35
+ */
36
+ var Socket = class {
37
+ [SocketTypeId] = SocketTypeId;
38
+ };
42
39
  /**
43
- * @tsplus static fncts.http.SocketOps Tag
44
- */
45
- const SocketTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
46
- export const SocketTag = SocketTag_1;
47
- export const SocketGenericErrorTypeId = /*#__PURE__*/Symbol.for("fncts.http.Socket.SocketGenericError");
48
- export class SocketGenericError extends Error {
49
- constructor(reason, error) {
50
- super();
51
- this.reason = reason;
52
- this.error = error;
53
- this[_b] = SocketGenericErrorTypeId;
54
- }
55
- }
56
- _b = SocketGenericErrorTypeId;
57
- export const SocketCloseErrorTypeId = /*#__PURE__*/Symbol.for("fncts.http.Socket.SocketCloseError");
58
- export class SocketCloseError extends Error {
59
- constructor(reason, code, closeReason, error) {
60
- super();
61
- this.reason = reason;
62
- this.code = code;
63
- this.closeReason = closeReason;
64
- this.error = error;
65
- this[_c] = SocketCloseErrorTypeId;
66
- }
67
- static isClean(isClean) {
68
- return u => {
69
- return isSocketCloseError(u) && isClean(u.code);
70
- };
71
- }
72
- }
73
- _c = SocketCloseErrorTypeId;
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
- constructor(code = 1000, reason) {
80
- this.code = code;
81
- this.reason = reason;
82
- this[_d] = CloseEventTypeId;
83
- }
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;
84
77
  }
85
- _d = CloseEventTypeId;
86
- export function isCloseEvent(u) {
87
- 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;
88
90
  }
89
91
  /**
90
- * @tsplus fluent fncts.http.Socket toChannel
91
- */
92
+ * @tsplus fluent fncts.http.Socket toChannel
93
+ */
92
94
  function toChannel_1(self) {
93
- return tsplus_module_3.unwrap(() => tsplus_module_8.flatMap(writeScope => tsplus_module_8.flatMap(write => tsplus_module_8.flatMap(exitQueue => {
94
- const input = {
95
- awaitRead: tsplus_module_8.unit,
96
- emit(chunk) {
97
- 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"));
98
- },
99
- error(error) {
100
- 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));
101
- },
102
- done() {
103
- return writeScope.close(() => tsplus_module_10.unit);
104
- }
105
- };
106
- return tsplus_module_8.map(() => {
107
- 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")));
108
- return tsplus_module_3.embedInput(input)(loop);
109
- }, 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"));
110
- }, 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));
111
113
  }
112
114
  /**
113
- * @tsplus fluent fncts.http.Socket toChannelWith
114
- */
115
- export function toChannelWith(self) {
116
- return toChannel_1(self);
115
+ * @tsplus fluent fncts.http.Socket toChannelWith
116
+ */
117
+ function toChannelWith(self) {
118
+ return toChannel_1(self);
117
119
  }
118
120
  /**
119
- * @tsplus static fncts.http.WebSocketOps Tag
120
- */
121
- const WebSocketTag_1 = /*#__PURE__*/tsplus_module_1.makeTag();
122
- 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;
123
125
  /**
124
- * @tsplus static fncts.http.SocketOps makeWebSocket
125
- * @tsplus static fncts.http.WebSocketOps __call
126
- */
126
+ * @tsplus static fncts.http.SocketOps makeWebSocket
127
+ * @tsplus static fncts.http.WebSocketOps __call
128
+ */
127
129
  function makeWebSocket_1(url, options) {
128
- return fromWebSocket_1(tsplus_module_15.acquireRelease(() => tsplus_module_8.succeed(() => {
129
- if ("WebSocket" in globalThis) {
130
- return new globalThis.WebSocket(url);
131
- }
132
- return new IsoWs(url);
133
- }, 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);
134
134
  }
135
135
  /**
136
- * @tsplus static fncts.http.SocketOps fromWebSocket
137
- */
136
+ * @tsplus static fncts.http.SocketOps fromWebSocket
137
+ */
138
138
  function fromWebSocket_1(acquire, options) {
139
- return (() => {
140
- const closeCodeIsError = options?.closeCodeIsError ?? (code => code !== 1000 && 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, undefined), 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 + ":249:10")(tsplus_module_8.catchJust(tsplus_module_16.partial(miss => error => SocketCloseError.isClean(code => !closeCodeIsError(code))(error) ? tsplus_module_8.unit : miss()), fileName_1 + ":250: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)) {
157
- return tsplus_module_8.fail(() => {
158
- ws.close(chunk.code, chunk.reason);
159
- return new SocketCloseError("Close", chunk.code, chunk.reason, chunk);
160
- }, fileName_1 + ":238:31");
161
- } else {
162
- return tsplus_module_8.tryCatch(() => ws.send(chunk), error => new SocketGenericError("Write", error), fileName_1 + ":243:35");
163
- }
164
- }, fileName_1 + ":236:31")(tsplus_module_6.take(sendQueue, fileName_1 + ":236:22")), fileName_1 + ":245:15"))(fiberSet)), fileName_1 + ":232:10")(tsplus_module_8.succeed(() => open = true, fileName_1 + ":232:13")), fileName_1 + ":213:10")(tsplus_module_8.defer(() => {
165
- if (ws.readyState !== 1) {
166
- 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 => {
167
- ws.onopen = () => {
168
- resume(tsplus_module_8.unit);
169
- };
170
- })));
171
- }
172
- return tsplus_module_8.unit;
173
- }, fileName_1 + ":214:19"));
174
- }, 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());
175
- }, fileName_1 + ":186:27")(acquire), fileName_1 + ":257:9"), fileName_1 + ":257:16");
176
- const write = chunk => tsplus_module_6.offer(chunk, fileName_1 + ":259:70")(sendQueue);
177
- const writer = tsplus_module_8.succeed(() => write, fileName_1 + ":261:22");
178
- return new class extends Socket {
179
- constructor() {
180
- super(...arguments);
181
- this.writer = writer;
182
- this.run = run;
183
- }
184
- }();
185
- }, fileName_1 + ":183:31")(tsplus_module_13.makeUnbounded(fileName_1 + ":183:51"));
186
- })();
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
+ })();
187
179
  }
188
180
  /**
189
- * @tsplus static fncts.http.SocketOps makeWebSocketChannel
190
- * @tsplus static fncts.http.WebSocketOps makeChannel
191
- */
192
- export function makeWebSocketChannel(url, options) {
193
- return tsplus_module_3.unwrap(() => tsplus_module_8.map(socket => toChannel_1(socket), fileName_1 + ":280: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)));
194
186
  }
195
187
  /**
196
- * @tsplus static fncts.http.SocketOps liveWebSocket
197
- * @tsplus static fncts.http.WebSocketOps live
198
- */
199
- export function live(url, options) {
200
- return tsplus_module_24.scoped(() => makeWebSocket_1(url, options), SocketTag_1, fileName_1 + ":293: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");
201
193
  }
194
+ //#endregion
195
+ export { CloseEvent, CloseEventTypeId, Socket, SocketCloseError, SocketCloseErrorTypeId, SocketGenericError, SocketGenericErrorTypeId, SocketTag, SocketTypeId, WebSocketTag, fromWebSocket, isCloseEvent, isSocketCloseError, live, makeWebSocket, makeWebSocketChannel, toChannel, toChannelWith };
196
+
202
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","constructor","_a","SocketTag_1","tsplus_module_1","makeTag","SocketTag","SocketGenericErrorTypeId","SocketGenericError","Error","reason","error","_b","SocketCloseErrorTypeId","SocketCloseError","code","closeReason","_c","isClean","u","isSocketCloseError","tsplus_module_2","isObject","CloseEventTypeId","CloseEvent","_d","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":";;;;;;;;;;;;;;;;;;;;;;;;;;aAiFgBA,SAAS,GAAAC,WAAA;aAoETC,aAAa,GAAAC,eAAA;aAwBbC,aAAa,GAAAC,eAAA;AA1K7B,SAASC,SAAS,IAAIC,KAAK,QAAQ,OAAO;AAE1C,OAAO,MAAMC,YAAY,gBAAGC,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAG3D;;;;AAIA,OAAM,MAAgBC,MAAM;EAA5BC,YAAA;IACW,KAAAC,EAAA,CAAc,GAAiBL,YAAY;EAGtD;;KAHYA,YAAY;AAKxB;;;AAGO,MAAMM,WAAA,gBAAYC,eAAA,CAAAC,OAAA,EAAa;aAAzBC,SAAS,GAAAH,WAAA;AAEtB,OAAO,MAAMI,wBAAwB,gBAAGT,MAAM,CAACC,GAAG,CAAC,sCAAsC,CAAC;AAG1F,OAAM,MAAOS,kBAAmB,SAAQC,KAAK;EAE3CR,YACWS,MAAiD,EACjDC,KAAc;IAEvB,KAAK,EAAE;IAHE,KAAAD,MAAM,GAANA,MAAM;IACN,KAAAC,KAAK,GAALA,KAAK;IAHP,KAAAC,EAAA,CAA0B,GAA6BL,wBAAwB;EAMxF;;KANUA,wBAAwB;AASpC,OAAO,MAAMM,sBAAsB,gBAAGf,MAAM,CAACC,GAAG,CAAC,oCAAoC,CAAC;AAGtF,OAAM,MAAOe,gBAAiB,SAAQL,KAAK;EAEzCR,YACWS,MAAe,EACfK,IAAY,EACZC,WAA+B,EAC/BL,KAAc;IAEvB,KAAK,EAAE;IALE,KAAAD,MAAM,GAANA,MAAM;IACN,KAAAK,IAAI,GAAJA,IAAI;IACJ,KAAAC,WAAW,GAAXA,WAAW;IACX,KAAAL,KAAK,GAALA,KAAK;IALP,KAAAM,EAAA,CAAwB,GAA2BJ,sBAAsB;EAQlF;EAEA,OAAOK,OAAOA,CAACA,OAAkC;IAC/C,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AAA,CAAiCC,MAAM,IAAKhJ,WAAA,CAAAgJ,MAAM,CAAgB,EAAAxF,UAAA,cAAlEtD,eAAA,CAAcuF,GAAG,EAAEC,OAAO,CAAC,CAAwC,CAAC;AAC5F;AAEA;;;;AAIA,OAAM,SAAUuD,IAAIA,CAClBxD,GAAW,EACXC,OAEC;EAED,OAAOwD,gBAAA,CAAA5C,MAAA,OAAapG,eAAA,CAAUuF,GAAG,EAAEC,OAAO,CAAC,EAAA7E,WAAA,EAAA2C,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;C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MACN;KACL,aAAa,UAAU,CAAC,iBAAiB,cAAc,aAAa,UAAU,CAAC;KAClF;;;;;;AAMR,SAAgB,qBAAqB,KAAK,SAAS;AAC/C,QAAO,gBAAgB,aAAa,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,25 +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
- constructor(backing) {
7
- this.backing = backing;
8
- }
9
- }
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
+ };
10
12
  /**
11
- * @tsplus static fncts.http.UrlParamsOps __call
12
- */
13
- export function make(input) {
14
- if (Symbol.iterator in input) {
15
- return new UrlParams(Array.from(input));
16
- }
17
- 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)));
18
18
  }
19
19
  /**
20
- * @tsplus fluent fncts.http.UrlParams toString
21
- */
22
- export function toString(self) {
23
- 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();
24
24
  }
25
+ //#endregion
26
+ export { UrlParams, make, toString };
27
+
25
28
  //# sourceMappingURL=UrlParams.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"UrlParams.mjs","names":["UrlParams","constructor","backing","make","input","Symbol","iterator","Array","from","Object","entries","toString","self","URLSearchParams"],"sources":["../_src/UrlParams.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAIA,OAAM,MAAOA,SAAS;EACpBC,YAAqBC,OAAiD;IAAjD,KAAAA,OAAO,GAAPA,OAAO;EAA6C;;AAO3E;;;AAGA,OAAM,SAAUC,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,CAACV,OAAkC,CAAC,CAACS,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/_src/Headers.ts CHANGED
@@ -45,7 +45,7 @@ export class Headers {
45
45
  }
46
46
  }
47
47
 
48
- export declare module Headers {
48
+ export declare namespace Headers {
49
49
  export type Input = Readonly<Record<string, string>> | Iterable<readonly [string, string]>;
50
50
  }
51
51
 
package/_src/Socket.ts CHANGED
@@ -240,6 +240,7 @@ export function fromWebSocket(
240
240
  return new SocketCloseError("Close", chunk.code, chunk.reason, chunk);
241
241
  });
242
242
  } else {
243
+ // @ts-expect-error -- tsplus-6.0.0
243
244
  return IO.tryCatch(ws.send(chunk), (error) => new SocketGenericError("Write", error));
244
245
  }
245
246
  }).forever,
package/_src/UrlParams.ts CHANGED
@@ -6,7 +6,7 @@ export class UrlParams {
6
6
  constructor(readonly backing: ReadonlyArray<readonly [string, string]>) {}
7
7
  }
8
8
 
9
- export declare module UrlParams {
9
+ export declare namespace UrlParams {
10
10
  export type Input = Readonly<Record<string, string>> | Iterable<readonly [string, string]> | URLSearchParams;
11
11
  }
12
12