@litert/televoke 0.4.6 → 1.0.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. package/CHANGES.md +6 -0
  2. package/README.md +13 -8
  3. package/lib/client/Client.decl.d.ts +47 -0
  4. package/lib/client/Client.decl.d.ts.map +1 -0
  5. package/lib/client/Client.decl.js +18 -0
  6. package/lib/client/Client.decl.js.map +1 -0
  7. package/lib/client/JsonApiClient.impl.d.ts +28 -0
  8. package/lib/client/JsonApiClient.impl.d.ts.map +1 -0
  9. package/lib/client/JsonApiClient.impl.js +169 -0
  10. package/lib/client/JsonApiClient.impl.js.map +1 -0
  11. package/lib/client/LegacyHttpClient.impl.d.ts +62 -0
  12. package/lib/client/LegacyHttpClient.impl.d.ts.map +1 -0
  13. package/lib/client/LegacyHttpClient.impl.js +163 -0
  14. package/lib/client/LegacyHttpClient.impl.js.map +1 -0
  15. package/lib/client/index.d.ts +19 -0
  16. package/lib/client/index.d.ts.map +1 -0
  17. package/lib/client/index.js +35 -0
  18. package/lib/client/index.js.map +1 -0
  19. package/lib/index.d.ts +18 -20
  20. package/lib/index.d.ts.map +1 -1
  21. package/lib/index.js +19 -20
  22. package/lib/index.js.map +1 -1
  23. package/lib/server/LegacyServerChannel.impl.d.ts +38 -0
  24. package/lib/server/LegacyServerChannel.impl.d.ts.map +1 -0
  25. package/lib/server/LegacyServerChannel.impl.js +51 -0
  26. package/lib/server/LegacyServerChannel.impl.js.map +1 -0
  27. package/lib/server/Server.decl.d.ts +81 -0
  28. package/lib/server/Server.decl.d.ts.map +1 -0
  29. package/lib/server/Server.decl.js +18 -0
  30. package/lib/server/Server.decl.js.map +1 -0
  31. package/lib/server/Server.impl.d.ts +33 -0
  32. package/lib/server/Server.impl.d.ts.map +1 -0
  33. package/lib/server/Server.impl.js +58 -0
  34. package/lib/server/Server.impl.js.map +1 -0
  35. package/lib/server/ServerChannel.d.ts +20 -0
  36. package/lib/server/ServerChannel.d.ts.map +1 -0
  37. package/lib/server/ServerChannel.js +23 -0
  38. package/lib/server/ServerChannel.js.map +1 -0
  39. package/lib/server/SimpleJsonApiRouter.d.ts +28 -0
  40. package/lib/server/SimpleJsonApiRouter.d.ts.map +1 -0
  41. package/lib/server/SimpleJsonApiRouter.js +92 -0
  42. package/lib/server/SimpleJsonApiRouter.js.map +1 -0
  43. package/lib/server/index.d.ts +19 -0
  44. package/lib/server/index.d.ts.map +1 -0
  45. package/lib/server/index.js +35 -0
  46. package/lib/server/index.js.map +1 -0
  47. package/lib/shared/BinaryStream.d.ts +32 -0
  48. package/lib/shared/BinaryStream.d.ts.map +1 -0
  49. package/lib/shared/BinaryStream.js +93 -0
  50. package/lib/shared/BinaryStream.js.map +1 -0
  51. package/lib/shared/BinaryStreamManager.d.ts +52 -0
  52. package/lib/shared/BinaryStreamManager.d.ts.map +1 -0
  53. package/lib/shared/BinaryStreamManager.js +105 -0
  54. package/lib/shared/BinaryStreamManager.js.map +1 -0
  55. package/lib/shared/Channel.impl.d.ts +79 -0
  56. package/lib/shared/Channel.impl.d.ts.map +1 -0
  57. package/lib/shared/Channel.impl.js +433 -0
  58. package/lib/shared/Channel.impl.js.map +1 -0
  59. package/lib/shared/Constants.d.ts +32 -0
  60. package/lib/shared/Constants.d.ts.map +1 -0
  61. package/lib/shared/Constants.js +35 -0
  62. package/lib/shared/Constants.js.map +1 -0
  63. package/lib/shared/Encodings/index.d.ts +18 -0
  64. package/lib/shared/Encodings/index.d.ts.map +1 -0
  65. package/lib/shared/Encodings/index.js +21 -0
  66. package/lib/shared/Encodings/index.js.map +1 -0
  67. package/lib/shared/Encodings/v1/EncoderV1.d.ts +22 -0
  68. package/lib/shared/Encodings/v1/EncoderV1.d.ts.map +1 -0
  69. package/lib/shared/Encodings/v1/EncoderV1.js +47 -0
  70. package/lib/shared/Encodings/v1/EncoderV1.js.map +1 -0
  71. package/lib/shared/Encodings/v1/Protocol.v1.decls.d.ts +78 -0
  72. package/lib/shared/Encodings/v1/Protocol.v1.decls.d.ts.map +1 -0
  73. package/lib/shared/Encodings/v1/Protocol.v1.decls.js +53 -0
  74. package/lib/shared/Encodings/v1/Protocol.v1.decls.js.map +1 -0
  75. package/lib/shared/Encodings/v1/index.d.ts +18 -0
  76. package/lib/shared/Encodings/v1/index.d.ts.map +1 -0
  77. package/lib/shared/Encodings/v1/index.js +34 -0
  78. package/lib/shared/Encodings/v1/index.js.map +1 -0
  79. package/lib/shared/Encodings/v2/Constants.v2.d.ts +29 -0
  80. package/lib/shared/Encodings/v2/Constants.v2.d.ts.map +1 -0
  81. package/lib/shared/Encodings/v2/Constants.v2.js +34 -0
  82. package/lib/shared/Encodings/v2/Constants.v2.js.map +1 -0
  83. package/lib/shared/Encodings/v2/DecoderV2.d.ts +27 -0
  84. package/lib/shared/Encodings/v2/DecoderV2.d.ts.map +1 -0
  85. package/lib/shared/Encodings/v2/DecoderV2.js +279 -0
  86. package/lib/shared/Encodings/v2/DecoderV2.js.map +1 -0
  87. package/lib/shared/Encodings/v2/EncoderV2.d.ts +21 -0
  88. package/lib/shared/Encodings/v2/EncoderV2.d.ts.map +1 -0
  89. package/lib/shared/Encodings/v2/EncoderV2.js +176 -0
  90. package/lib/shared/Encodings/v2/EncoderV2.js.map +1 -0
  91. package/lib/shared/Encodings/v2/Encoding.v2.decl.d.ts +95 -0
  92. package/lib/shared/Encodings/v2/Encoding.v2.decl.d.ts.map +1 -0
  93. package/lib/shared/Encodings/v2/Encoding.v2.decl.js +18 -0
  94. package/lib/shared/Encodings/v2/Encoding.v2.decl.js.map +1 -0
  95. package/lib/shared/Encodings/v2/index.d.ts +20 -0
  96. package/lib/shared/Encodings/v2/index.d.ts.map +1 -0
  97. package/lib/shared/Encodings/v2/index.js +35 -0
  98. package/lib/shared/Encodings/v2/index.js.map +1 -0
  99. package/lib/shared/Errors.d.ts +60 -0
  100. package/lib/shared/Errors.d.ts.map +1 -0
  101. package/lib/shared/Errors.js +75 -0
  102. package/lib/shared/Errors.js.map +1 -0
  103. package/lib/shared/Shared.decl.d.ts +296 -0
  104. package/lib/shared/Shared.decl.d.ts.map +1 -0
  105. package/lib/shared/Shared.decl.js +18 -0
  106. package/lib/shared/Shared.decl.js.map +1 -0
  107. package/lib/shared/Utils.d.ts +25 -0
  108. package/lib/shared/Utils.d.ts.map +1 -0
  109. package/lib/shared/Utils.js +46 -0
  110. package/lib/shared/Utils.js.map +1 -0
  111. package/lib/shared/index.d.ts +23 -0
  112. package/lib/shared/index.d.ts.map +1 -0
  113. package/lib/shared/index.js +39 -0
  114. package/lib/shared/index.js.map +1 -0
  115. package/lib/transporters/Transporter.decl.d.ts +90 -0
  116. package/lib/transporters/Transporter.decl.d.ts.map +1 -0
  117. package/lib/transporters/Transporter.decl.js +18 -0
  118. package/lib/transporters/Transporter.decl.js.map +1 -0
  119. package/lib/transporters/http-listener/AbstractHttpListener.d.ts +32 -0
  120. package/lib/transporters/http-listener/AbstractHttpListener.d.ts.map +1 -0
  121. package/lib/transporters/http-listener/AbstractHttpListener.js +46 -0
  122. package/lib/transporters/http-listener/AbstractHttpListener.js.map +1 -0
  123. package/lib/transporters/http-listener/Http.Decl.d.ts +95 -0
  124. package/lib/transporters/http-listener/Http.Decl.d.ts.map +1 -0
  125. package/lib/transporters/http-listener/Http.Decl.js +52 -0
  126. package/lib/transporters/http-listener/Http.Decl.js.map +1 -0
  127. package/lib/transporters/http-listener/HttpListener.d.ts +18 -0
  128. package/lib/transporters/http-listener/HttpListener.d.ts.map +1 -0
  129. package/lib/transporters/http-listener/HttpListener.js +73 -0
  130. package/lib/transporters/http-listener/HttpListener.js.map +1 -0
  131. package/lib/transporters/http-listener/HttpUnixSocketListener.d.ts +18 -0
  132. package/lib/transporters/http-listener/HttpUnixSocketListener.d.ts.map +1 -0
  133. package/lib/transporters/http-listener/HttpUnixSocketListener.js +72 -0
  134. package/lib/transporters/http-listener/HttpUnixSocketListener.js.map +1 -0
  135. package/lib/transporters/http-listener/HttpsListener.d.ts +18 -0
  136. package/lib/transporters/http-listener/HttpsListener.d.ts.map +1 -0
  137. package/lib/transporters/http-listener/HttpsListener.js +73 -0
  138. package/lib/transporters/http-listener/HttpsListener.js.map +1 -0
  139. package/lib/transporters/http-listener/index.d.ts +20 -0
  140. package/lib/transporters/http-listener/index.d.ts.map +1 -0
  141. package/lib/transporters/http-listener/index.js +36 -0
  142. package/lib/transporters/http-listener/index.js.map +1 -0
  143. package/lib/transporters/index.d.ts +17 -0
  144. package/lib/transporters/index.d.ts.map +1 -0
  145. package/lib/transporters/index.js +18 -0
  146. package/lib/transporters/index.js.map +1 -0
  147. package/lib/transporters/legacy-http/LegacyHttp.Server.d.ts +24 -0
  148. package/lib/transporters/legacy-http/LegacyHttp.Server.d.ts.map +1 -0
  149. package/lib/transporters/legacy-http/LegacyHttp.Server.js +167 -0
  150. package/lib/transporters/legacy-http/LegacyHttp.Server.js.map +1 -0
  151. package/lib/transporters/legacy-http/LegacyHttp.Transporter.d.ts +28 -0
  152. package/lib/transporters/legacy-http/LegacyHttp.Transporter.d.ts.map +1 -0
  153. package/lib/transporters/legacy-http/LegacyHttp.Transporter.js +55 -0
  154. package/lib/transporters/legacy-http/LegacyHttp.Transporter.js.map +1 -0
  155. package/lib/transporters/legacy-http/index.d.ts +18 -0
  156. package/lib/transporters/legacy-http/index.d.ts.map +1 -0
  157. package/lib/transporters/legacy-http/index.js +34 -0
  158. package/lib/transporters/legacy-http/index.js.map +1 -0
  159. package/lib/transporters/lwdfx/LwDFX.Tcp.Client.d.ts +19 -0
  160. package/lib/transporters/lwdfx/LwDFX.Tcp.Client.d.ts.map +1 -0
  161. package/lib/transporters/lwdfx/LwDFX.Tcp.Client.js +33 -0
  162. package/lib/transporters/lwdfx/LwDFX.Tcp.Client.js.map +1 -0
  163. package/lib/transporters/lwdfx/LwDFX.Tcp.Server.d.ts +21 -0
  164. package/lib/transporters/lwdfx/LwDFX.Tcp.Server.d.ts.map +1 -0
  165. package/lib/transporters/lwdfx/LwDFX.Tcp.Server.js +64 -0
  166. package/lib/transporters/lwdfx/LwDFX.Tcp.Server.js.map +1 -0
  167. package/lib/transporters/lwdfx/LwDFX.Tls.Client.d.ts +19 -0
  168. package/lib/transporters/lwdfx/LwDFX.Tls.Client.d.ts.map +1 -0
  169. package/lib/transporters/lwdfx/LwDFX.Tls.Client.js +33 -0
  170. package/lib/transporters/lwdfx/LwDFX.Tls.Client.js.map +1 -0
  171. package/lib/transporters/lwdfx/LwDFX.Tls.Server.d.ts +21 -0
  172. package/lib/transporters/lwdfx/LwDFX.Tls.Server.d.ts.map +1 -0
  173. package/lib/transporters/lwdfx/LwDFX.Tls.Server.js +64 -0
  174. package/lib/transporters/lwdfx/LwDFX.Tls.Server.js.map +1 -0
  175. package/lib/transporters/lwdfx/LwDFX.Transporter.d.ts +34 -0
  176. package/lib/transporters/lwdfx/LwDFX.Transporter.d.ts.map +1 -0
  177. package/lib/transporters/lwdfx/LwDFX.Transporter.js +78 -0
  178. package/lib/transporters/lwdfx/LwDFX.Transporter.js.map +1 -0
  179. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.d.ts +19 -0
  180. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.d.ts.map +1 -0
  181. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.js +33 -0
  182. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.js.map +1 -0
  183. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.d.ts +21 -0
  184. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.d.ts.map +1 -0
  185. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.js +64 -0
  186. package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.js.map +1 -0
  187. package/lib/transporters/lwdfx/LwDFX.decl.d.ts +18 -0
  188. package/lib/transporters/lwdfx/LwDFX.decl.d.ts.map +1 -0
  189. package/lib/transporters/lwdfx/LwDFX.decl.js +18 -0
  190. package/lib/transporters/lwdfx/LwDFX.decl.js.map +1 -0
  191. package/lib/transporters/lwdfx/index.d.ts +23 -0
  192. package/lib/transporters/lwdfx/index.d.ts.map +1 -0
  193. package/lib/transporters/lwdfx/index.js +39 -0
  194. package/lib/transporters/lwdfx/index.js.map +1 -0
  195. package/lib/transporters/memory/Memory.Impl.d.ts +43 -0
  196. package/lib/transporters/memory/Memory.Impl.d.ts.map +1 -0
  197. package/lib/transporters/memory/Memory.Impl.js +227 -0
  198. package/lib/transporters/memory/Memory.Impl.js.map +1 -0
  199. package/lib/transporters/memory/index.d.ts +17 -0
  200. package/lib/transporters/memory/index.d.ts.map +1 -0
  201. package/lib/transporters/memory/index.js +33 -0
  202. package/lib/transporters/memory/index.js.map +1 -0
  203. package/lib/transporters/websocket/WebSocket.Client.d.ts +20 -0
  204. package/lib/transporters/websocket/WebSocket.Client.d.ts.map +1 -0
  205. package/lib/transporters/websocket/WebSocket.Client.js +68 -0
  206. package/lib/transporters/websocket/WebSocket.Client.js.map +1 -0
  207. package/lib/transporters/websocket/WebSocket.Server.d.ts +25 -0
  208. package/lib/transporters/websocket/WebSocket.Server.d.ts.map +1 -0
  209. package/lib/transporters/websocket/WebSocket.Server.js +87 -0
  210. package/lib/transporters/websocket/WebSocket.Server.js.map +1 -0
  211. package/lib/transporters/websocket/WebSocket.Transporter.d.ts +34 -0
  212. package/lib/transporters/websocket/WebSocket.Transporter.d.ts.map +1 -0
  213. package/lib/transporters/websocket/WebSocket.Transporter.js +106 -0
  214. package/lib/transporters/websocket/WebSocket.Transporter.js.map +1 -0
  215. package/lib/transporters/websocket/WebSocket.decl.d.ts +19 -0
  216. package/lib/transporters/websocket/WebSocket.decl.d.ts.map +1 -0
  217. package/lib/transporters/websocket/WebSocket.decl.js +22 -0
  218. package/lib/transporters/websocket/WebSocket.decl.js.map +1 -0
  219. package/lib/transporters/websocket/index.d.ts +19 -0
  220. package/lib/transporters/websocket/index.d.ts.map +1 -0
  221. package/lib/transporters/websocket/index.js +35 -0
  222. package/lib/transporters/websocket/index.js.map +1 -0
  223. package/package.json +12 -12
  224. package/src/lib/client/Client.decl.ts +61 -0
  225. package/src/lib/client/JsonApiClient.impl.ts +258 -0
  226. package/src/lib/client/LegacyHttpClient.impl.ts +278 -0
  227. package/src/lib/client/index.ts +19 -0
  228. package/src/lib/index.ts +18 -20
  229. package/src/lib/server/LegacyServerChannel.impl.ts +71 -0
  230. package/src/lib/server/Server.decl.ts +109 -0
  231. package/src/lib/server/Server.impl.ts +90 -0
  232. package/src/lib/server/ServerChannel.ts +20 -0
  233. package/src/lib/server/SimpleJsonApiRouter.ts +135 -0
  234. package/src/lib/server/index.ts +19 -0
  235. package/src/lib/shared/BinaryStream.ts +131 -0
  236. package/src/lib/shared/BinaryStreamManager.ts +142 -0
  237. package/src/lib/shared/Channel.impl.ts +641 -0
  238. package/src/lib/shared/Constants.ts +35 -0
  239. package/src/lib/shared/Encodings/index.ts +18 -0
  240. package/src/lib/shared/Encodings/v1/EncoderV1.ts +66 -0
  241. package/src/lib/shared/Encodings/v1/Protocol.v1.decls.ts +96 -0
  242. package/src/lib/shared/Encodings/v1/index.ts +18 -0
  243. package/src/lib/shared/Encodings/v2/Constants.v2.ts +31 -0
  244. package/src/lib/shared/Encodings/v2/DecoderV2.ts +404 -0
  245. package/src/lib/shared/Encodings/v2/EncoderV2.ts +283 -0
  246. package/src/lib/shared/Encodings/v2/Encoding.v2.decl.ts +133 -0
  247. package/src/lib/shared/Encodings/v2/index.ts +20 -0
  248. package/src/lib/shared/Errors.ts +94 -0
  249. package/src/lib/shared/Shared.decl.ts +347 -0
  250. package/src/lib/shared/Utils.ts +51 -0
  251. package/src/lib/shared/index.ts +23 -0
  252. package/src/lib/transporters/Transporter.decl.ts +117 -0
  253. package/src/lib/transporters/http-listener/AbstractHttpListener.ts +57 -0
  254. package/src/lib/transporters/http-listener/Http.Decl.ts +141 -0
  255. package/src/lib/transporters/http-listener/HttpListener.ts +102 -0
  256. package/src/lib/transporters/http-listener/HttpUnixSocketListener.ts +97 -0
  257. package/src/lib/transporters/http-listener/HttpsListener.ts +102 -0
  258. package/src/lib/transporters/http-listener/index.ts +20 -0
  259. package/src/lib/transporters/index.ts +17 -0
  260. package/src/lib/transporters/legacy-http/LegacyHttp.Server.ts +262 -0
  261. package/src/lib/transporters/legacy-http/LegacyHttp.Transporter.ts +66 -0
  262. package/src/lib/transporters/legacy-http/index.ts +18 -0
  263. package/src/lib/transporters/lwdfx/LwDFX.Tcp.Client.ts +34 -0
  264. package/src/lib/transporters/lwdfx/LwDFX.Tcp.Server.ts +94 -0
  265. package/src/lib/transporters/lwdfx/LwDFX.Tls.Client.ts +34 -0
  266. package/src/lib/transporters/lwdfx/LwDFX.Tls.Server.ts +94 -0
  267. package/src/lib/transporters/lwdfx/LwDFX.Transporter.ts +100 -0
  268. package/src/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.ts +34 -0
  269. package/src/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.ts +94 -0
  270. package/src/lib/transporters/lwdfx/LwDFX.decl.ts +19 -0
  271. package/src/lib/transporters/lwdfx/index.ts +23 -0
  272. package/src/lib/transporters/memory/Memory.Impl.ts +363 -0
  273. package/src/lib/transporters/memory/index.ts +17 -0
  274. package/src/lib/transporters/websocket/WebSocket.Client.ts +76 -0
  275. package/src/lib/transporters/websocket/WebSocket.Server.ts +118 -0
  276. package/src/lib/transporters/websocket/WebSocket.Transporter.ts +132 -0
  277. package/src/lib/transporters/websocket/WebSocket.decl.ts +21 -0
  278. package/src/lib/transporters/websocket/index.ts +19 -0
  279. package/lib/Client/BuiltInRIDGenerator.d.ts +0 -4
  280. package/lib/Client/BuiltInRIDGenerator.d.ts.map +0 -1
  281. package/lib/Client/BuiltInRIDGenerator.js +0 -18
  282. package/lib/Client/BuiltInRIDGenerator.js.map +0 -1
  283. package/lib/Client/Common.d.ts +0 -47
  284. package/lib/Client/Common.d.ts.map +0 -1
  285. package/lib/Client/Common.js +0 -18
  286. package/lib/Client/Common.js.map +0 -1
  287. package/lib/Client/Errors.d.ts +0 -26
  288. package/lib/Client/Errors.d.ts.map +0 -1
  289. package/lib/Client/Errors.js +0 -80
  290. package/lib/Client/Errors.js.map +0 -1
  291. package/lib/Client/HttpClient.d.ts +0 -37
  292. package/lib/Client/HttpClient.d.ts.map +0 -1
  293. package/lib/Client/HttpClient.js +0 -148
  294. package/lib/Client/HttpClient.js.map +0 -1
  295. package/lib/Client/HttpsClient.d.ts +0 -40
  296. package/lib/Client/HttpsClient.d.ts.map +0 -1
  297. package/lib/Client/HttpsClient.js +0 -144
  298. package/lib/Client/HttpsClient.js.map +0 -1
  299. package/lib/Client/TCPClient.d.ts +0 -34
  300. package/lib/Client/TCPClient.d.ts.map +0 -1
  301. package/lib/Client/TCPClient.js +0 -271
  302. package/lib/Client/TCPClient.js.map +0 -1
  303. package/lib/Client/TLSClient.d.ts +0 -34
  304. package/lib/Client/TLSClient.d.ts.map +0 -1
  305. package/lib/Client/TLSClient.js +0 -265
  306. package/lib/Client/TLSClient.js.map +0 -1
  307. package/lib/Client/index.d.ts +0 -23
  308. package/lib/Client/index.d.ts.map +0 -1
  309. package/lib/Client/index.js +0 -39
  310. package/lib/Client/index.js.map +0 -1
  311. package/lib/Common/API.d.ts +0 -19
  312. package/lib/Common/API.d.ts.map +0 -1
  313. package/lib/Common/API.js +0 -18
  314. package/lib/Common/API.js.map +0 -1
  315. package/lib/Common/Encoding.d.ts +0 -32
  316. package/lib/Common/Encoding.d.ts.map +0 -1
  317. package/lib/Common/Encoding.js +0 -20
  318. package/lib/Common/Encoding.js.map +0 -1
  319. package/lib/Common/Request.d.ts +0 -23
  320. package/lib/Common/Request.d.ts.map +0 -1
  321. package/lib/Common/Request.js +0 -18
  322. package/lib/Common/Request.js.map +0 -1
  323. package/lib/Common/Response.d.ts +0 -60
  324. package/lib/Common/Response.d.ts.map +0 -1
  325. package/lib/Common/Response.js +0 -42
  326. package/lib/Common/Response.js.map +0 -1
  327. package/lib/Common/index.d.ts +0 -20
  328. package/lib/Common/index.d.ts.map +0 -1
  329. package/lib/Common/index.js +0 -36
  330. package/lib/Common/index.js.map +0 -1
  331. package/lib/Encoder/Decoder.d.ts +0 -18
  332. package/lib/Encoder/Decoder.d.ts.map +0 -1
  333. package/lib/Encoder/Decoder.js +0 -136
  334. package/lib/Encoder/Decoder.js.map +0 -1
  335. package/lib/Encoder/Encoder.d.ts +0 -18
  336. package/lib/Encoder/Encoder.d.ts.map +0 -1
  337. package/lib/Encoder/Encoder.js +0 -35
  338. package/lib/Encoder/Encoder.js.map +0 -1
  339. package/lib/Encoder/Errors.d.ts +0 -17
  340. package/lib/Encoder/Errors.d.ts.map +0 -1
  341. package/lib/Encoder/Errors.js +0 -26
  342. package/lib/Encoder/Errors.js.map +0 -1
  343. package/lib/Errors.d.ts +0 -20
  344. package/lib/Errors.d.ts.map +0 -1
  345. package/lib/Errors.js +0 -40
  346. package/lib/Errors.js.map +0 -1
  347. package/lib/Server/Common/Gateway.d.ts +0 -26
  348. package/lib/Server/Common/Gateway.d.ts.map +0 -1
  349. package/lib/Server/Common/Gateway.js +0 -18
  350. package/lib/Server/Common/Gateway.js.map +0 -1
  351. package/lib/Server/Common/Request.d.ts +0 -21
  352. package/lib/Server/Common/Request.d.ts.map +0 -1
  353. package/lib/Server/Common/Request.js +0 -18
  354. package/lib/Server/Common/Request.js.map +0 -1
  355. package/lib/Server/Common/Router.d.ts +0 -41
  356. package/lib/Server/Common/Router.d.ts.map +0 -1
  357. package/lib/Server/Common/Router.js +0 -18
  358. package/lib/Server/Common/Router.js.map +0 -1
  359. package/lib/Server/Common/Server.d.ts +0 -57
  360. package/lib/Server/Common/Server.d.ts.map +0 -1
  361. package/lib/Server/Common/Server.js +0 -18
  362. package/lib/Server/Common/Server.js.map +0 -1
  363. package/lib/Server/Common/index.d.ts +0 -20
  364. package/lib/Server/Common/index.d.ts.map +0 -1
  365. package/lib/Server/Common/index.js +0 -36
  366. package/lib/Server/Common/index.js.map +0 -1
  367. package/lib/Server/Errors.d.ts +0 -25
  368. package/lib/Server/Errors.d.ts.map +0 -1
  369. package/lib/Server/Errors.js +0 -74
  370. package/lib/Server/Errors.js.map +0 -1
  371. package/lib/Server/Gateways/Http.d.ts +0 -18
  372. package/lib/Server/Gateways/Http.d.ts.map +0 -1
  373. package/lib/Server/Gateways/Http.js +0 -144
  374. package/lib/Server/Gateways/Http.js.map +0 -1
  375. package/lib/Server/Gateways/TCP.d.ts +0 -23
  376. package/lib/Server/Gateways/TCP.d.ts.map +0 -1
  377. package/lib/Server/Gateways/TCP.js +0 -146
  378. package/lib/Server/Gateways/TCP.js.map +0 -1
  379. package/lib/Server/Server.d.ts +0 -18
  380. package/lib/Server/Server.d.ts.map +0 -1
  381. package/lib/Server/Server.js +0 -200
  382. package/lib/Server/Server.js.map +0 -1
  383. package/lib/Server/SimpleRouter.d.ts +0 -41
  384. package/lib/Server/SimpleRouter.d.ts.map +0 -1
  385. package/lib/Server/SimpleRouter.js +0 -54
  386. package/lib/Server/SimpleRouter.js.map +0 -1
  387. package/lib/Server/index.d.ts +0 -22
  388. package/lib/Server/index.d.ts.map +0 -1
  389. package/lib/Server/index.js +0 -38
  390. package/lib/Server/index.js.map +0 -1
  391. package/src/lib/Client/BuiltInRIDGenerator.ts +0 -21
  392. package/src/lib/Client/Common.ts +0 -63
  393. package/src/lib/Client/Errors.ts +0 -87
  394. package/src/lib/Client/HttpClient.ts +0 -232
  395. package/src/lib/Client/HttpsClient.ts +0 -238
  396. package/src/lib/Client/TCPClient.ts +0 -420
  397. package/src/lib/Client/TLSClient.ts +0 -422
  398. package/src/lib/Client/index.ts +0 -23
  399. package/src/lib/Common/API.ts +0 -20
  400. package/src/lib/Common/Encoding.ts +0 -42
  401. package/src/lib/Common/Request.ts +0 -28
  402. package/src/lib/Common/Response.ts +0 -67
  403. package/src/lib/Common/index.ts +0 -20
  404. package/src/lib/Encoder/Decoder.ts +0 -206
  405. package/src/lib/Encoder/Encoder.ts +0 -41
  406. package/src/lib/Encoder/Errors.ts +0 -24
  407. package/src/lib/Errors.ts +0 -40
  408. package/src/lib/Server/Common/Gateway.ts +0 -37
  409. package/src/lib/Server/Common/Request.ts +0 -24
  410. package/src/lib/Server/Common/Router.ts +0 -52
  411. package/src/lib/Server/Common/Server.ts +0 -68
  412. package/src/lib/Server/Common/index.ts +0 -20
  413. package/src/lib/Server/Errors.ts +0 -80
  414. package/src/lib/Server/Gateways/Http.ts +0 -203
  415. package/src/lib/Server/Gateways/TCP.ts +0 -221
  416. package/src/lib/Server/Server.ts +0 -268
  417. package/src/lib/Server/SimpleRouter.ts +0 -95
  418. package/src/lib/Server/index.ts +0 -22
@@ -0,0 +1,347 @@
1
+ /**
2
+ * Copyright 2023 Angus.Fenying <fenying@litert.org>
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { Readable } from 'node:stream';
18
+
19
+ export type IFn<TArgs extends any[], TRet> = (...args: TArgs) => TRet;
20
+
21
+ export type IVoidFn<TArgs extends any[]> = IFn<TArgs, void>;
22
+
23
+ // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/consistent-type-definitions
24
+ export type IObject = {};
25
+
26
+ export type IfIsFn<T, TTrue = T, TFalse = never> = T extends IFn<any[], any> ? TTrue : TFalse;
27
+
28
+ export type IfIsOfFn<T, TFn extends IFn<any[], any>, TTrue = T, TFalse = never> = T extends TFn ? TTrue : TFalse;
29
+
30
+ export interface IEventListener<T extends IDefaultEvents> {
31
+
32
+ /**
33
+ * Register a listener for the given event.
34
+ *
35
+ * > Alias for `addListener()`.
36
+ *
37
+ * @param event The event name.
38
+ * @param listener The listener function.
39
+ */
40
+ on<TKey extends keyof T>(event: TKey, listener: IfIsOfFn<T[TKey], IVoidFn<any[]>>): this;
41
+
42
+ /**
43
+ * Register a listener for the given event.
44
+ *
45
+ * > Alias for `addListener()`.
46
+ *
47
+ * @param event The event name.
48
+ * @param listener The listener function.
49
+ */
50
+ on(event: string | symbol, listener: IVoidFn<any[]>): this;
51
+
52
+ /**
53
+ * Register a one-time listener for the given event.
54
+ *
55
+ * > The listener is invoked only the next time the event is fired, after which it is removed.
56
+ *
57
+ * @param event The event name.
58
+ * @param listener The listener function.
59
+ */
60
+ once<TKey extends keyof T>(event: TKey, listener: IfIsOfFn<T[TKey], IVoidFn<any[]>>): this;
61
+
62
+ /**
63
+ * Register a one-time listener for the given event.
64
+ *
65
+ * > The listener is invoked only the next time the event is fired, after which it is removed.
66
+ *
67
+ * @param event The event name.
68
+ * @param listener The listener function.
69
+ */
70
+ once(event: string | symbol, listener: IVoidFn<any[]>): this;
71
+
72
+ /**
73
+ * Register a listener for the given event.
74
+ *
75
+ * > Alias for `on()`.
76
+ *
77
+ * @param event The event name.
78
+ * @param listener The listener function.
79
+ */
80
+ addListener<TKey extends keyof T>(event: TKey, listener: IfIsOfFn<T[TKey], IVoidFn<any[]>>): this;
81
+
82
+ /**
83
+ * Register a listener for the given event.
84
+ *
85
+ * > Alias for `on()`.
86
+ *
87
+ * @param event The event name.
88
+ * @param listener The listener function.
89
+ */
90
+ addListener(event: string | symbol, listener: IVoidFn<any[]>): this;
91
+
92
+ /**
93
+ * Remove the given listener for the given event.
94
+ *
95
+ * > Alias for `off()`.
96
+ *
97
+ * @param event The event name.
98
+ * @param listener The listener function.
99
+ */
100
+ removeListener<TKey extends keyof T>(event: TKey, listener: IVoidFn<any[]>): this;
101
+
102
+ /**
103
+ * Remove the given listener for the given event.
104
+ *
105
+ * > Alias for `off()`.
106
+ *
107
+ * @param event The event name.
108
+ * @param listener The listener function.
109
+ */
110
+ removeListener(event: string | symbol, listener: IVoidFn<any[]>): this;
111
+
112
+ /**
113
+ * Remove the given listener for the given event.
114
+ *
115
+ * > Alias for `removeListener()`.
116
+ *
117
+ * @param event The event name.
118
+ * @param listener The listener function.
119
+ */
120
+ off<TKey extends keyof T>(event: TKey, listener: IVoidFn<any[]>): this;
121
+
122
+ /**
123
+ * Remove the given listener for the given event.
124
+ *
125
+ * > Alias for `removeListener()`.
126
+ *
127
+ * @param event The event name.
128
+ * @param listener The listener function.
129
+ */
130
+ off(event: string | symbol, listener: IVoidFn<any[]>): this;
131
+
132
+ /**
133
+ * Remove all listeners for the given event.
134
+ *
135
+ * @param event The event name.
136
+ */
137
+ removeAllListeners(event: keyof T): this;
138
+
139
+ /**
140
+ * Remove all listeners for the given event.
141
+ *
142
+ * @param event The event name.
143
+ */
144
+ removeAllListeners(event: string): this;
145
+
146
+ /**
147
+ * Return the number of listeners for the given event.
148
+ *
149
+ * @param event The event name.
150
+ */
151
+ listenerCount(event: keyof T): number;
152
+
153
+ /**
154
+ * Return the number of listeners for the given event.
155
+ *
156
+ * @param event The event name.
157
+ */
158
+ listenerCount(event: string): number;
159
+
160
+ /**
161
+ * Set the maximum number of listeners for the given event.
162
+ *
163
+ * @param n The new value of maximum listeners number.
164
+ */
165
+ setMaxListeners(n: number): this;
166
+ }
167
+
168
+ export interface IDefaultEvents {
169
+
170
+ error(error: unknown): void;
171
+ }
172
+
173
+ export interface ITransporter {
174
+
175
+ /**
176
+ * The transporting protocol.
177
+ */
178
+ readonly protocol: string;
179
+
180
+ readonly writable: boolean;
181
+
182
+ /**
183
+ * Get the names of all properties that are available on the transporter.
184
+ */
185
+ getPropertyNames(): readonly string[];
186
+
187
+ /**
188
+ * Get the value of a property.
189
+ *
190
+ * @param name The name of the property to get.
191
+ */
192
+ getProperty(name: string): unknown;
193
+
194
+ /**
195
+ * Get the values collection of all properties.
196
+ */
197
+ getAllProperties(): Record<string, unknown>;
198
+ }
199
+
200
+ export interface IBinaryReadStream extends Readable {
201
+
202
+ /**
203
+ * The unique id of binary stream.
204
+ */
205
+ readonly id: number;
206
+
207
+ /**
208
+ * Abort the binary stream before it's completed, and release the resource.
209
+ *
210
+ * > The `readableAborted` property will be set to `true` after calling this method.
211
+ *
212
+ * > A `stream_aborted` error will be emitted in event `error`.
213
+ *
214
+ * > **Note:** The binary stream will be closed immediately after calling this method,
215
+ * > whatever the stream is finished or not.
216
+ */
217
+ abort(): void;
218
+
219
+ /**
220
+ * Close the binary stream since it is completed, and release the resource.
221
+ *
222
+ * > **Note:** The binary stream will be closed immediately after calling this method,
223
+ * > whatever the stream is finished or not.
224
+ */
225
+ close(): void;
226
+
227
+ /**
228
+ * Set the timeout value of each chunk of this binary stream.
229
+ *
230
+ * > When the timeout is reached, the binary stream will be aborted and a `timeout` error will be emitted in event `error`.
231
+ *
232
+ * > Set to 0 to disable timeout.
233
+ *
234
+ * @param timeout The timeout value in milliseconds.
235
+ */
236
+ setTimeout(timeout: number): void;
237
+ }
238
+
239
+ export interface IStreamManager {
240
+
241
+ /**
242
+ * The default initial timeout value of each new binary stream.
243
+ *
244
+ * > Set to 0 to disable timeout.
245
+ *
246
+ * @type uint
247
+ */
248
+ defaultTimeout: number;
249
+
250
+ /**
251
+ * The maximum number of binary streams that can be opened at the same time.
252
+ *
253
+ * > Set to -1 to disable the limit.
254
+ * > Set to 0 to disable opening any new binary streams.
255
+ *
256
+ * @type int
257
+ * @default 10
258
+ */
259
+ maxStreams: number;
260
+
261
+ /**
262
+ * Open a binary `Readable` stream on this side, to accept the binary data chunks from the remote side.
263
+ *
264
+ * There is an `id` in the binary stream, which is used to identify the stream. The remote side could use it to invoke
265
+ * `sendBinaryChunk()` method to send the binary data chunks to this side.
266
+ */
267
+ create(): IBinaryReadStream;
268
+
269
+ /**
270
+ * Get the binary stream by stream id.
271
+ *
272
+ * @param id The `id` field in `IBinaryReadStream`.
273
+ */
274
+ get(id: number): IBinaryReadStream | null;
275
+
276
+ /**
277
+ * Close all binary streams in this manager, and destroy the manager.
278
+ */
279
+ close(): void;
280
+ }
281
+
282
+ export type IStreamManagerFactory = (channel: IChannelBase<any>) => IStreamManager;
283
+
284
+ export interface IChannelBase<TEvents extends IDefaultEvents> extends IEventListener<TEvents> {
285
+
286
+ /**
287
+ * The transporter object is used to send and receive data to and from the remote endpoint.
288
+ */
289
+ readonly transporter: ITransporter;
290
+
291
+ /**
292
+ * Tells whether this channel is closed on the local side or not.
293
+ */
294
+ readonly finished: boolean;
295
+
296
+ /**
297
+ * Tells whether the channel is closed on the remote side or not.
298
+ */
299
+ readonly ended: boolean;
300
+
301
+ /**
302
+ * Whether this channel is writable.
303
+ */
304
+ readonly writable: boolean;
305
+
306
+ /**
307
+ * The stream manager of the binary streams.
308
+ */
309
+ readonly streams: IStreamManager;
310
+
311
+ /**
312
+ * The context object is used to store data that is shared on the channel.
313
+ *
314
+ * > **Note:** The context object is only available for the lifetime of the channel.
315
+ */
316
+ readonly context: Record<string, any>;
317
+
318
+ /**
319
+ * Send a PING command to the remote endpoint.
320
+ *
321
+ * @param msg The message to send.
322
+ */
323
+ ping(msg?: Buffer | string): Promise<Buffer>;
324
+
325
+ /**
326
+ * Send a PUSH_MESSAGE command to the remote endpoint.
327
+ *
328
+ * @param msg The message to send.
329
+ */
330
+ sendMessage(msg: Buffer | string): Promise<void>;
331
+
332
+ /**
333
+ * Send a binary data chunk to an opened binary stream on the remote side.
334
+ *
335
+ * > **NOTE: It is not recommended to send a large binary data chunk at once. A large binary chunk should be split**
336
+ * > **into several small chunks, and then send them one by one, in order.**
337
+ *
338
+ * @param id The `id` field in `IBinaryReadStream`, opened by remote side.
339
+ * @param chunks The binary data chunks to be sent.
340
+ */
341
+ sendBinaryChunk(id: number, chunk: Buffer | null): Promise<void>;
342
+
343
+ /**
344
+ * Close the channel.
345
+ */
346
+ close(): void;
347
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright 2023 Angus.Fenying <fenying@litert.org>
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * Ensures that a function is only called once.
19
+ *
20
+ * @param fn The function to call.
21
+ * @returns The wrapped function.
22
+ */
23
+ export function once<T extends (...args: any[]) => any>(fn: T): T {
24
+
25
+ let called = false;
26
+ let result: any;
27
+
28
+ return function(...args: any[]) {
29
+
30
+ if (!called) {
31
+
32
+ called = true;
33
+ result = fn(...args);
34
+ }
35
+
36
+ return result;
37
+ } as T;
38
+ }
39
+
40
+ export function buffer2json(data: Buffer[]): unknown {
41
+
42
+ let str = '';
43
+ const td = new TextDecoder('utf-8', { fatal: true });
44
+
45
+ for (const seg of data) {
46
+
47
+ str += td.decode(seg, { stream: true });
48
+ }
49
+
50
+ return JSON.parse(str);
51
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright 2023 Angus.Fenying <fenying@litert.org>
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export type * from './Shared.decl';
18
+ export * from './Shared.decl';
19
+ export * from './Constants';
20
+ export * from './BinaryStream';
21
+ export * from './BinaryStreamManager';
22
+ export * from './Errors';
23
+ export * as Encodings from './Encodings';
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Copyright 2023 Angus.Fenying <fenying@litert.org>
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import type * as Shared from '../shared';
18
+
19
+ export interface IRouter {
20
+
21
+ readonly encoding: string;
22
+ }
23
+
24
+ export interface IServer {
25
+
26
+ readonly router: IRouter;
27
+
28
+ /**
29
+ * Register a transporter into the server, turning it into a channel.
30
+ *
31
+ * @param transporter The transporter object.
32
+ */
33
+ registerChannel(transporter: ITransporter): void;
34
+
35
+ /**
36
+ * Process api calls from legacy client.
37
+ *
38
+ * @param callback The callback function.
39
+ * @param name The api name.
40
+ * @param args The api arguments, decoded as JavaScript values.
41
+ * @param transporter The transporter object.
42
+ */
43
+ processLegacyApi(
44
+ callback: ILegacyApiResponseCallback,
45
+ name: string,
46
+ args: unknown,
47
+ transporter: Shared.ITransporter
48
+ ): void;
49
+ }
50
+
51
+ export interface IGateway extends Shared.IEventListener<Shared.IDefaultEvents> {
52
+
53
+ /**
54
+ * Whether the gateway is running.
55
+ */
56
+ readonly running: boolean;
57
+
58
+ /**
59
+ * Start the gateway.
60
+ */
61
+ start(): Promise<void>;
62
+
63
+ /**
64
+ * Stop the gateway.
65
+ */
66
+ stop(): Promise<void>;
67
+ }
68
+
69
+ export interface ITransporterEvents extends Shared.IDefaultEvents {
70
+
71
+ close(): void;
72
+
73
+ frame(frameChunks: Buffer[]): void;
74
+
75
+ end(): void;
76
+
77
+ finish(): void;
78
+ }
79
+
80
+ export interface ITransporter extends Shared.IEventListener<ITransporterEvents> {
81
+
82
+ /**
83
+ * Whether the transporter is writable.
84
+ */
85
+ readonly writable: boolean;
86
+
87
+ /**
88
+ * Ends writing through the transporter.
89
+ *
90
+ * @param lastFrame The last frame.
91
+ */
92
+ end(lastFrame?: Buffer | string | Array<Buffer | string>): void;
93
+
94
+ /**
95
+ * Destroy the transporter.
96
+ */
97
+ destroy(): void;
98
+
99
+ /**
100
+ * Write a frame through the transporter.
101
+ *
102
+ * @param frame The frame to write.
103
+ */
104
+ write(frame: Buffer | string | Array<Buffer | string>): void;
105
+ }
106
+
107
+ export interface IConnector {
108
+
109
+ /**
110
+ * Connect to the remote endpoint.
111
+ *
112
+ * The returned promise will be resolved with the transporter object.
113
+ */
114
+ connect(): Promise<ITransporter>;
115
+ }
116
+
117
+ export type ILegacyApiResponseCallback = (body: unknown) => void;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright 2023 Angus.Fenying <fenying@litert.org>
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import * as Http from 'node:http';
18
+ import * as dH from './Http.Decl';
19
+ import { EventEmitter } from 'node:events';
20
+
21
+ export abstract class AbstractHttpListener extends EventEmitter implements dH.IHttpListener {
22
+
23
+ protected _gateway: Http.Server | null = null;
24
+
25
+ public port: number = 0;
26
+
27
+ protected _upgradeProcessor: dH.IUpgradeProcessor = dH.DEFAULT_UPGRADE_PROCESSOR;
28
+
29
+ protected _apiProcessor: dH.ILegacyHttpApiProcessor = dH.DEFAULT_LEGACY_HTTP_API_PROCESSOR;
30
+
31
+ public setLegacyApiProcessor(processor: dH.ILegacyHttpApiProcessor | null): void {
32
+
33
+ this._apiProcessor = processor ?? dH.DEFAULT_LEGACY_HTTP_API_PROCESSOR;
34
+
35
+ this._gateway
36
+ ?.removeAllListeners('request')
37
+ .addListener('request', this._apiProcessor);
38
+ }
39
+
40
+ public setUpgradeProcessor(processor: dH.IUpgradeProcessor | null): void {
41
+
42
+ this._upgradeProcessor = processor ?? dH.DEFAULT_UPGRADE_PROCESSOR;
43
+
44
+ this._gateway
45
+ ?.removeAllListeners('upgrade')
46
+ .addListener('upgrade', this._upgradeProcessor);
47
+ }
48
+
49
+ public get running(): boolean {
50
+
51
+ return !!this._gateway;
52
+ }
53
+
54
+ public abstract start(): Promise<void>;
55
+
56
+ public abstract stop(): Promise<void>;
57
+ }