@celljs/rpc 4.2.0 → 4.4.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 (545) hide show
  1. package/README.md +117 -1
  2. package/cell.schema.json +100 -0
  3. package/cell.yml +12 -8
  4. package/esm/common/annotation/index.d.ts +2 -0
  5. package/esm/common/annotation/index.js +2 -0
  6. package/esm/common/annotation/index.js.map +1 -1
  7. package/esm/common/annotation/rpc-client.d.ts +7 -0
  8. package/esm/common/annotation/rpc-client.js +18 -0
  9. package/esm/common/annotation/rpc-client.js.map +1 -0
  10. package/esm/common/annotation/rpc-protocol.d.ts +7 -0
  11. package/esm/common/annotation/rpc-protocol.js +2 -0
  12. package/esm/common/annotation/rpc-protocol.js.map +1 -0
  13. package/esm/common/annotation/rpc.d.ts +4 -0
  14. package/esm/common/annotation/rpc.js +14 -18
  15. package/esm/common/annotation/rpc.js.map +1 -1
  16. package/esm/common/client/client-protocol.d.ts +6 -0
  17. package/esm/common/client/client-protocol.js +2 -0
  18. package/esm/common/client/client-protocol.js.map +1 -0
  19. package/esm/common/client/index.d.ts +2 -0
  20. package/esm/common/client/index.js +3 -0
  21. package/esm/common/client/index.js.map +1 -0
  22. package/esm/common/client/rpc-client-registry.d.ts +14 -0
  23. package/esm/common/client/rpc-client-registry.js +51 -0
  24. package/esm/common/client/rpc-client-registry.js.map +1 -0
  25. package/esm/common/constants.d.ts +3 -1
  26. package/esm/common/constants.js +3 -1
  27. package/esm/common/constants.js.map +1 -1
  28. package/esm/common/converter/converter-protocol.d.ts +6 -2
  29. package/esm/common/converter/converter-protocol.js +1 -0
  30. package/esm/common/converter/converter-protocol.js.map +1 -1
  31. package/esm/common/endpoint/endpoint-protocol.d.ts +3 -0
  32. package/esm/common/endpoint/endpoint-resolver.d.ts +2 -0
  33. package/esm/common/endpoint/endpoint-resolver.js +17 -3
  34. package/esm/common/endpoint/endpoint-resolver.js.map +1 -1
  35. package/esm/common/error/error.d.ts +23 -0
  36. package/esm/common/error/error.js +34 -2
  37. package/esm/common/error/error.js.map +1 -1
  38. package/esm/common/index.d.ts +6 -6
  39. package/esm/common/index.js +6 -6
  40. package/esm/common/index.js.map +1 -1
  41. package/esm/common/module.js +5 -4
  42. package/esm/common/module.js.map +1 -1
  43. package/esm/common/processor/client-config-processor.d.ts +2 -2
  44. package/esm/common/processor/client-config-processor.js.map +1 -1
  45. package/esm/common/processor/processor-protocol.d.ts +2 -2
  46. package/esm/common/protocol/index.d.ts +1 -0
  47. package/esm/common/protocol/index.js +2 -0
  48. package/esm/common/protocol/index.js.map +1 -0
  49. package/esm/common/protocol/json-rpc.d.ts +42 -0
  50. package/esm/common/protocol/json-rpc.js +48 -0
  51. package/esm/common/protocol/json-rpc.js.map +1 -0
  52. package/esm/common/proxy/index.d.ts +1 -4
  53. package/esm/common/proxy/index.js +1 -4
  54. package/esm/common/proxy/index.js.map +1 -1
  55. package/esm/common/proxy/rpc-proxy.d.ts +6 -0
  56. package/esm/common/proxy/rpc-proxy.js +40 -0
  57. package/esm/common/proxy/rpc-proxy.js.map +1 -0
  58. package/esm/common/transport/http-transport.d.ts +50 -0
  59. package/esm/common/transport/http-transport.js +98 -0
  60. package/esm/common/transport/http-transport.js.map +1 -0
  61. package/esm/common/transport/index.d.ts +4 -0
  62. package/esm/common/transport/index.js +5 -0
  63. package/esm/common/transport/index.js.map +1 -0
  64. package/esm/common/transport/transport-protocol.d.ts +12 -0
  65. package/esm/common/transport/transport-protocol.js +2 -0
  66. package/esm/common/transport/transport-protocol.js.map +1 -0
  67. package/esm/common/transport/transport-provider.d.ts +34 -0
  68. package/esm/common/transport/transport-provider.js +103 -0
  69. package/esm/common/transport/transport-provider.js.map +1 -0
  70. package/esm/common/transport/websocket-transport.d.ts +54 -0
  71. package/esm/common/transport/websocket-transport.js +144 -0
  72. package/esm/common/transport/websocket-transport.js.map +1 -0
  73. package/esm/common/utils/index.d.ts +1 -1
  74. package/esm/common/utils/index.js +1 -1
  75. package/esm/common/utils/index.js.map +1 -1
  76. package/esm/common/utils/rpc-method-util.d.ts +10 -0
  77. package/esm/common/utils/rpc-method-util.js +28 -0
  78. package/esm/common/utils/rpc-method-util.js.map +1 -0
  79. package/esm/common/utils/rpc-util.d.ts +9 -9
  80. package/esm/common/utils/rpc-util.js +24 -30
  81. package/esm/common/utils/rpc-util.js.map +1 -1
  82. package/esm/node/connection/connection-protocol.d.ts +26 -0
  83. package/esm/node/connection/connection-protocol.js +3 -0
  84. package/esm/node/connection/connection-protocol.js.map +1 -0
  85. package/esm/node/connection/index.d.ts +4 -0
  86. package/esm/node/connection/index.js +5 -0
  87. package/esm/node/connection/index.js.map +1 -0
  88. package/esm/node/connection/rpc-connection-manager.d.ts +10 -0
  89. package/esm/node/connection/rpc-connection-manager.js +35 -0
  90. package/esm/node/connection/rpc-connection-manager.js.map +1 -0
  91. package/esm/node/connection/rpc-connection.d.ts +33 -0
  92. package/esm/node/connection/rpc-connection.js +106 -0
  93. package/esm/node/connection/rpc-connection.js.map +1 -0
  94. package/esm/node/connection/rpc-context.d.ts +14 -0
  95. package/esm/node/connection/rpc-context.js +29 -0
  96. package/esm/node/connection/rpc-context.js.map +1 -0
  97. package/esm/node/index.d.ts +3 -2
  98. package/esm/node/index.js +3 -2
  99. package/esm/node/index.js.map +1 -1
  100. package/esm/node/server/index.d.ts +2 -0
  101. package/esm/node/server/index.js +3 -0
  102. package/esm/node/server/index.js.map +1 -0
  103. package/esm/node/server/rpc-handler-adapter.d.ts +15 -0
  104. package/esm/node/server/rpc-handler-adapter.js +74 -0
  105. package/esm/node/server/rpc-handler-adapter.js.map +1 -0
  106. package/esm/node/server/rpc-invoker.d.ts +28 -0
  107. package/esm/node/server/rpc-invoker.js +113 -0
  108. package/esm/node/server/rpc-invoker.js.map +1 -0
  109. package/esm/node/test/websocket-fixture-protocol.d.ts +36 -0
  110. package/esm/node/test/websocket-fixture-protocol.js +7 -0
  111. package/esm/node/test/websocket-fixture-protocol.js.map +1 -0
  112. package/esm/node/test/websocket-fixture.d.ts +40 -0
  113. package/esm/node/test/websocket-fixture.js +128 -0
  114. package/esm/node/test/websocket-fixture.js.map +1 -0
  115. package/esm/node/websocket/index.d.ts +4 -0
  116. package/esm/node/websocket/index.js +5 -0
  117. package/esm/node/websocket/index.js.map +1 -0
  118. package/esm/node/websocket/rpc-websocket-server.d.ts +45 -0
  119. package/esm/node/websocket/rpc-websocket-server.js +167 -0
  120. package/esm/node/websocket/rpc-websocket-server.js.map +1 -0
  121. package/esm/node/websocket/websocket-connection.d.ts +55 -0
  122. package/esm/node/websocket/websocket-connection.js +181 -0
  123. package/esm/node/websocket/websocket-connection.js.map +1 -0
  124. package/esm/node/websocket/websocket-exchange.d.ts +38 -0
  125. package/esm/node/websocket/websocket-exchange.js +124 -0
  126. package/esm/node/websocket/websocket-exchange.js.map +1 -0
  127. package/esm/node/websocket/websocket-frames.d.ts +31 -0
  128. package/esm/node/websocket/websocket-frames.js +119 -0
  129. package/esm/node/websocket/websocket-frames.js.map +1 -0
  130. package/lib/common/annotation/index.d.ts +2 -0
  131. package/lib/common/annotation/index.d.ts.map +1 -1
  132. package/lib/common/annotation/index.js +2 -0
  133. package/lib/common/annotation/index.js.map +1 -1
  134. package/lib/common/annotation/rpc-client.d.ts +8 -0
  135. package/lib/common/annotation/rpc-client.d.ts.map +1 -0
  136. package/lib/common/annotation/rpc-client.js +21 -0
  137. package/lib/common/annotation/rpc-client.js.map +1 -0
  138. package/lib/common/annotation/rpc-protocol.d.ts +8 -0
  139. package/lib/common/annotation/rpc-protocol.d.ts.map +1 -0
  140. package/lib/common/annotation/rpc-protocol.js +5 -0
  141. package/lib/common/annotation/rpc-protocol.js.map +1 -0
  142. package/lib/common/annotation/rpc.d.ts +4 -0
  143. package/lib/common/annotation/rpc.d.ts.map +1 -1
  144. package/lib/common/annotation/rpc.js +12 -16
  145. package/lib/common/annotation/rpc.js.map +1 -1
  146. package/lib/common/client/client-protocol.d.ts +7 -0
  147. package/lib/common/client/client-protocol.d.ts.map +1 -0
  148. package/lib/common/client/client-protocol.js +5 -0
  149. package/lib/common/client/client-protocol.js.map +1 -0
  150. package/lib/common/client/index.d.ts +3 -0
  151. package/lib/common/client/index.d.ts.map +1 -0
  152. package/lib/common/{handler → client}/index.js +2 -2
  153. package/lib/common/client/index.js.map +1 -0
  154. package/lib/common/client/rpc-client-registry.d.ts +15 -0
  155. package/lib/common/client/rpc-client-registry.d.ts.map +1 -0
  156. package/lib/common/client/rpc-client-registry.js +54 -0
  157. package/lib/common/client/rpc-client-registry.js.map +1 -0
  158. package/lib/common/constants.d.ts +3 -1
  159. package/lib/common/constants.d.ts.map +1 -1
  160. package/lib/common/constants.js +4 -2
  161. package/lib/common/constants.js.map +1 -1
  162. package/lib/common/converter/converter-protocol.d.ts +6 -2
  163. package/lib/common/converter/converter-protocol.d.ts.map +1 -1
  164. package/lib/common/converter/converter-protocol.js +1 -0
  165. package/lib/common/converter/converter-protocol.js.map +1 -1
  166. package/lib/common/endpoint/endpoint-protocol.d.ts +3 -0
  167. package/lib/common/endpoint/endpoint-protocol.d.ts.map +1 -1
  168. package/lib/common/endpoint/endpoint-resolver.d.ts +2 -0
  169. package/lib/common/endpoint/endpoint-resolver.d.ts.map +1 -1
  170. package/lib/common/endpoint/endpoint-resolver.js +16 -2
  171. package/lib/common/endpoint/endpoint-resolver.js.map +1 -1
  172. package/lib/common/error/error.d.ts +23 -0
  173. package/lib/common/error/error.d.ts.map +1 -1
  174. package/lib/common/error/error.js +35 -2
  175. package/lib/common/error/error.js.map +1 -1
  176. package/lib/common/index.d.ts +6 -6
  177. package/lib/common/index.d.ts.map +1 -1
  178. package/lib/common/index.js +6 -6
  179. package/lib/common/index.js.map +1 -1
  180. package/lib/common/module.d.ts.map +1 -1
  181. package/lib/common/module.js +4 -3
  182. package/lib/common/module.js.map +1 -1
  183. package/lib/common/processor/client-config-processor.d.ts +2 -2
  184. package/lib/common/processor/client-config-processor.d.ts.map +1 -1
  185. package/lib/common/processor/client-config-processor.js.map +1 -1
  186. package/lib/common/processor/processor-protocol.d.ts +2 -2
  187. package/lib/common/processor/processor-protocol.d.ts.map +1 -1
  188. package/lib/common/protocol/index.d.ts +2 -0
  189. package/lib/common/protocol/index.d.ts.map +1 -0
  190. package/lib/common/{channal → protocol}/index.js +1 -2
  191. package/lib/common/protocol/index.js.map +1 -0
  192. package/lib/common/protocol/json-rpc.d.ts +43 -0
  193. package/lib/common/protocol/json-rpc.d.ts.map +1 -0
  194. package/lib/common/protocol/json-rpc.js +51 -0
  195. package/lib/common/protocol/json-rpc.js.map +1 -0
  196. package/lib/common/proxy/index.d.ts +1 -4
  197. package/lib/common/proxy/index.d.ts.map +1 -1
  198. package/lib/common/proxy/index.js +1 -4
  199. package/lib/common/proxy/index.js.map +1 -1
  200. package/lib/common/proxy/rpc-proxy.d.ts +7 -0
  201. package/lib/common/proxy/rpc-proxy.d.ts.map +1 -0
  202. package/lib/common/proxy/rpc-proxy.js +43 -0
  203. package/lib/common/proxy/rpc-proxy.js.map +1 -0
  204. package/lib/common/transport/http-transport.d.ts +51 -0
  205. package/lib/common/transport/http-transport.d.ts.map +1 -0
  206. package/lib/common/transport/http-transport.js +102 -0
  207. package/lib/common/transport/http-transport.js.map +1 -0
  208. package/lib/common/transport/index.d.ts +5 -0
  209. package/lib/common/transport/index.d.ts.map +1 -0
  210. package/lib/common/{factory → transport}/index.js +4 -4
  211. package/lib/common/transport/index.js.map +1 -0
  212. package/lib/common/transport/transport-protocol.d.ts +13 -0
  213. package/lib/common/transport/transport-protocol.d.ts.map +1 -0
  214. package/lib/common/transport/transport-protocol.js +5 -0
  215. package/lib/common/transport/transport-protocol.js.map +1 -0
  216. package/lib/common/transport/transport-provider.d.ts +35 -0
  217. package/lib/common/transport/transport-provider.d.ts.map +1 -0
  218. package/lib/common/transport/transport-provider.js +106 -0
  219. package/lib/common/transport/transport-provider.js.map +1 -0
  220. package/lib/common/transport/websocket-transport.d.ts +55 -0
  221. package/lib/common/transport/websocket-transport.d.ts.map +1 -0
  222. package/lib/common/transport/websocket-transport.js +148 -0
  223. package/lib/common/transport/websocket-transport.js.map +1 -0
  224. package/lib/common/utils/index.d.ts +1 -1
  225. package/lib/common/utils/index.d.ts.map +1 -1
  226. package/lib/common/utils/index.js +1 -1
  227. package/lib/common/utils/index.js.map +1 -1
  228. package/lib/common/utils/rpc-method-util.d.ts +11 -0
  229. package/lib/common/utils/rpc-method-util.d.ts.map +1 -0
  230. package/lib/common/utils/rpc-method-util.js +31 -0
  231. package/lib/common/utils/rpc-method-util.js.map +1 -0
  232. package/lib/common/utils/rpc-util.d.ts +9 -9
  233. package/lib/common/utils/rpc-util.d.ts.map +1 -1
  234. package/lib/common/utils/rpc-util.js +24 -30
  235. package/lib/common/utils/rpc-util.js.map +1 -1
  236. package/lib/node/connection/connection-protocol.d.ts +27 -0
  237. package/lib/node/connection/connection-protocol.d.ts.map +1 -0
  238. package/lib/node/connection/connection-protocol.js +6 -0
  239. package/lib/node/connection/connection-protocol.js.map +1 -0
  240. package/lib/node/connection/index.d.ts +5 -0
  241. package/lib/node/connection/index.d.ts.map +1 -0
  242. package/lib/node/{channel → connection}/index.js +4 -4
  243. package/lib/node/connection/index.js.map +1 -0
  244. package/lib/node/connection/rpc-connection-manager.d.ts +11 -0
  245. package/lib/node/connection/rpc-connection-manager.d.ts.map +1 -0
  246. package/lib/node/connection/rpc-connection-manager.js +38 -0
  247. package/lib/node/connection/rpc-connection-manager.js.map +1 -0
  248. package/lib/node/connection/rpc-connection.d.ts +34 -0
  249. package/lib/node/connection/rpc-connection.d.ts.map +1 -0
  250. package/lib/node/connection/rpc-connection.js +110 -0
  251. package/lib/node/connection/rpc-connection.js.map +1 -0
  252. package/lib/node/connection/rpc-context.d.ts +15 -0
  253. package/lib/node/connection/rpc-context.d.ts.map +1 -0
  254. package/lib/node/connection/rpc-context.js +33 -0
  255. package/lib/node/connection/rpc-context.js.map +1 -0
  256. package/lib/node/index.d.ts +3 -2
  257. package/lib/node/index.d.ts.map +1 -1
  258. package/lib/node/index.js +3 -2
  259. package/lib/node/index.js.map +1 -1
  260. package/lib/node/rpc-http.spec.d.ts +2 -0
  261. package/lib/node/rpc-http.spec.d.ts.map +1 -0
  262. package/lib/node/rpc-http.spec.js +121 -0
  263. package/lib/node/rpc-http.spec.js.map +1 -0
  264. package/lib/node/rpc-websocket.spec.d.ts +6 -0
  265. package/lib/node/rpc-websocket.spec.d.ts.map +1 -0
  266. package/lib/node/rpc-websocket.spec.js +196 -0
  267. package/lib/node/rpc-websocket.spec.js.map +1 -0
  268. package/lib/node/server/index.d.ts +3 -0
  269. package/lib/node/server/index.d.ts.map +1 -0
  270. package/lib/node/{handler → server}/index.js +2 -2
  271. package/lib/node/server/index.js.map +1 -0
  272. package/lib/node/server/rpc-handler-adapter.d.ts +16 -0
  273. package/lib/node/server/rpc-handler-adapter.d.ts.map +1 -0
  274. package/lib/node/{handler/handler-adapter.js → server/rpc-handler-adapter.js} +40 -18
  275. package/lib/node/server/rpc-handler-adapter.js.map +1 -0
  276. package/lib/node/server/rpc-invoker.d.ts +29 -0
  277. package/lib/node/server/rpc-invoker.d.ts.map +1 -0
  278. package/lib/node/server/rpc-invoker.js +116 -0
  279. package/lib/node/server/rpc-invoker.js.map +1 -0
  280. package/lib/node/test/websocket-fixture-protocol.d.ts +37 -0
  281. package/lib/node/test/websocket-fixture-protocol.d.ts.map +1 -0
  282. package/lib/node/test/websocket-fixture-protocol.js +10 -0
  283. package/lib/node/test/websocket-fixture-protocol.js.map +1 -0
  284. package/lib/node/test/websocket-fixture.d.ts +41 -0
  285. package/lib/node/test/websocket-fixture.d.ts.map +1 -0
  286. package/lib/node/test/websocket-fixture.js +135 -0
  287. package/lib/node/test/websocket-fixture.js.map +1 -0
  288. package/lib/node/websocket/index.d.ts +5 -0
  289. package/lib/node/websocket/index.d.ts.map +1 -0
  290. package/lib/node/websocket/index.js +21 -0
  291. package/lib/node/websocket/index.js.map +1 -0
  292. package/lib/node/websocket/rpc-websocket-server.d.ts +46 -0
  293. package/lib/node/websocket/rpc-websocket-server.d.ts.map +1 -0
  294. package/lib/node/websocket/rpc-websocket-server.js +170 -0
  295. package/lib/node/websocket/rpc-websocket-server.js.map +1 -0
  296. package/lib/node/websocket/websocket-connection.d.ts +56 -0
  297. package/lib/node/websocket/websocket-connection.d.ts.map +1 -0
  298. package/lib/node/websocket/websocket-connection.js +185 -0
  299. package/lib/node/websocket/websocket-connection.js.map +1 -0
  300. package/lib/node/websocket/websocket-exchange.d.ts +39 -0
  301. package/lib/node/websocket/websocket-exchange.d.ts.map +1 -0
  302. package/lib/node/websocket/websocket-exchange.js +128 -0
  303. package/lib/node/websocket/websocket-exchange.js.map +1 -0
  304. package/lib/node/websocket/websocket-frames.d.ts +32 -0
  305. package/lib/node/websocket/websocket-frames.d.ts.map +1 -0
  306. package/lib/node/websocket/websocket-frames.js +124 -0
  307. package/lib/node/websocket/websocket-frames.js.map +1 -0
  308. package/lib/node/websocket/websocket-frames.spec.d.ts +2 -0
  309. package/lib/node/websocket/websocket-frames.spec.d.ts.map +1 -0
  310. package/lib/node/websocket/websocket-frames.spec.js +59 -0
  311. package/lib/node/websocket/websocket-frames.spec.js.map +1 -0
  312. package/package.json +28 -25
  313. package/src/common/annotation/index.ts +2 -0
  314. package/src/common/annotation/rpc-client.ts +17 -0
  315. package/src/common/annotation/rpc-protocol.ts +8 -0
  316. package/src/common/annotation/rpc.ts +13 -21
  317. package/src/common/client/client-protocol.ts +7 -0
  318. package/src/common/client/index.ts +2 -0
  319. package/src/common/client/rpc-client-registry.ts +42 -0
  320. package/src/common/constants.ts +4 -1
  321. package/src/common/converter/converter-protocol.ts +7 -2
  322. package/src/common/endpoint/endpoint-protocol.ts +3 -0
  323. package/src/common/endpoint/endpoint-resolver.ts +18 -4
  324. package/src/common/error/error.ts +41 -2
  325. package/src/common/index.ts +6 -6
  326. package/src/common/module.ts +7 -8
  327. package/src/common/processor/client-config-processor.ts +2 -2
  328. package/src/common/processor/processor-protocol.ts +2 -2
  329. package/src/common/protocol/index.ts +1 -0
  330. package/src/common/protocol/json-rpc.ts +74 -0
  331. package/src/common/proxy/index.ts +1 -5
  332. package/src/common/proxy/rpc-proxy.ts +42 -0
  333. package/src/common/transport/http-transport.ts +134 -0
  334. package/src/common/transport/index.ts +4 -0
  335. package/src/common/transport/transport-protocol.ts +16 -0
  336. package/src/common/transport/transport-provider.ts +86 -0
  337. package/src/common/transport/websocket-transport.ts +171 -0
  338. package/src/common/utils/index.ts +1 -1
  339. package/src/common/utils/rpc-method-util.ts +26 -0
  340. package/src/common/utils/rpc-util.ts +24 -35
  341. package/src/node/connection/connection-protocol.ts +30 -0
  342. package/src/node/connection/index.ts +3 -0
  343. package/src/node/connection/rpc-connection-manager.ts +29 -0
  344. package/src/node/connection/rpc-connection.ts +122 -0
  345. package/src/node/connection/rpc-context.ts +29 -0
  346. package/src/node/index.ts +3 -2
  347. package/src/node/rpc-http.spec.ts +126 -0
  348. package/src/node/rpc-websocket.spec.ts +196 -0
  349. package/src/node/server/index.ts +2 -0
  350. package/src/node/server/rpc-handler-adapter.ts +60 -0
  351. package/src/node/server/rpc-invoker.ts +104 -0
  352. package/src/node/test/websocket-fixture-protocol.ts +32 -0
  353. package/src/node/test/websocket-fixture.ts +122 -0
  354. package/src/node/websocket/index.ts +4 -0
  355. package/src/node/websocket/rpc-websocket-server.ts +163 -0
  356. package/src/node/websocket/websocket-connection.ts +198 -0
  357. package/src/node/websocket/websocket-exchange.ts +138 -0
  358. package/src/node/websocket/websocket-frames.spec.ts +62 -0
  359. package/src/node/websocket/websocket-frames.ts +122 -0
  360. package/esm/common/channal/channel-protocol.d.ts +0 -51
  361. package/esm/common/channal/channel-protocol.js +0 -34
  362. package/esm/common/channal/channel-protocol.js.map +0 -1
  363. package/esm/common/channal/http-channel.d.ts +0 -8
  364. package/esm/common/channal/http-channel.js +0 -22
  365. package/esm/common/channal/http-channel.js.map +0 -1
  366. package/esm/common/channal/index.d.ts +0 -2
  367. package/esm/common/channal/index.js +0 -3
  368. package/esm/common/channal/index.js.map +0 -1
  369. package/esm/common/factory/connection-factory.d.ts +0 -9
  370. package/esm/common/factory/connection-factory.js +0 -25
  371. package/esm/common/factory/connection-factory.js.map +0 -1
  372. package/esm/common/factory/index.d.ts +0 -4
  373. package/esm/common/factory/index.js +0 -5
  374. package/esm/common/factory/index.js.map +0 -1
  375. package/esm/common/factory/proxy-factory.d.ts +0 -56
  376. package/esm/common/factory/proxy-factory.js +0 -177
  377. package/esm/common/factory/proxy-factory.js.map +0 -1
  378. package/esm/common/factory/reader.d.ts +0 -15
  379. package/esm/common/factory/reader.js +0 -44
  380. package/esm/common/factory/reader.js.map +0 -1
  381. package/esm/common/factory/writer.d.ts +0 -9
  382. package/esm/common/factory/writer.js +0 -21
  383. package/esm/common/factory/writer.js.map +0 -1
  384. package/esm/common/handler/connection-handler.d.ts +0 -6
  385. package/esm/common/handler/connection-handler.js +0 -4
  386. package/esm/common/handler/connection-handler.js.map +0 -1
  387. package/esm/common/handler/handler-protocol.d.ts +0 -6
  388. package/esm/common/handler/handler-protocol.js +0 -2
  389. package/esm/common/handler/handler-protocol.js.map +0 -1
  390. package/esm/common/handler/index.d.ts +0 -2
  391. package/esm/common/handler/index.js +0 -3
  392. package/esm/common/handler/index.js.map +0 -1
  393. package/esm/common/proxy/delegating-http-proxy-creator.d.ts +0 -23
  394. package/esm/common/proxy/delegating-http-proxy-creator.js +0 -86
  395. package/esm/common/proxy/delegating-http-proxy-creator.js.map +0 -1
  396. package/esm/common/proxy/http-proxy-creator.d.ts +0 -42
  397. package/esm/common/proxy/http-proxy-creator.js +0 -139
  398. package/esm/common/proxy/http-proxy-creator.js.map +0 -1
  399. package/esm/common/proxy/proxy-protocol.d.ts +0 -20
  400. package/esm/common/proxy/proxy-protocol.js +0 -3
  401. package/esm/common/proxy/proxy-protocol.js.map +0 -1
  402. package/esm/common/proxy/proxy-provider.d.ts +0 -9
  403. package/esm/common/proxy/proxy-provider.js +0 -40
  404. package/esm/common/proxy/proxy-provider.js.map +0 -1
  405. package/esm/common/utils/logger.d.ts +0 -8
  406. package/esm/common/utils/logger.js +0 -18
  407. package/esm/common/utils/logger.js.map +0 -1
  408. package/esm/node/channel/channel-manager.d.ts +0 -9
  409. package/esm/node/channel/channel-manager.js +0 -56
  410. package/esm/node/channel/channel-manager.js.map +0 -1
  411. package/esm/node/channel/channel-middleware.d.ts +0 -7
  412. package/esm/node/channel/channel-middleware.js +0 -37
  413. package/esm/node/channel/channel-middleware.js.map +0 -1
  414. package/esm/node/channel/channel-protocol.d.ts +0 -12
  415. package/esm/node/channel/channel-protocol.js +0 -6
  416. package/esm/node/channel/channel-protocol.js.map +0 -1
  417. package/esm/node/channel/channel-strategy.d.ts +0 -9
  418. package/esm/node/channel/channel-strategy.js +0 -61
  419. package/esm/node/channel/channel-strategy.js.map +0 -1
  420. package/esm/node/channel/index.d.ts +0 -4
  421. package/esm/node/channel/index.js +0 -5
  422. package/esm/node/channel/index.js.map +0 -1
  423. package/esm/node/handler/handler-adapter.d.ts +0 -13
  424. package/esm/node/handler/handler-adapter.js +0 -52
  425. package/esm/node/handler/handler-adapter.js.map +0 -1
  426. package/esm/node/handler/handler-protocol.d.ts +0 -1
  427. package/esm/node/handler/handler-protocol.js +0 -2
  428. package/esm/node/handler/handler-protocol.js.map +0 -1
  429. package/esm/node/handler/index.d.ts +0 -2
  430. package/esm/node/handler/index.js +0 -3
  431. package/esm/node/handler/index.js.map +0 -1
  432. package/lib/common/channal/channel-protocol.d.ts +0 -52
  433. package/lib/common/channal/channel-protocol.d.ts.map +0 -1
  434. package/lib/common/channal/channel-protocol.js +0 -38
  435. package/lib/common/channal/channel-protocol.js.map +0 -1
  436. package/lib/common/channal/http-channel.d.ts +0 -9
  437. package/lib/common/channal/http-channel.d.ts.map +0 -1
  438. package/lib/common/channal/http-channel.js +0 -26
  439. package/lib/common/channal/http-channel.js.map +0 -1
  440. package/lib/common/channal/index.d.ts +0 -3
  441. package/lib/common/channal/index.d.ts.map +0 -1
  442. package/lib/common/channal/index.js.map +0 -1
  443. package/lib/common/factory/connection-factory.d.ts +0 -10
  444. package/lib/common/factory/connection-factory.d.ts.map +0 -1
  445. package/lib/common/factory/connection-factory.js +0 -28
  446. package/lib/common/factory/connection-factory.js.map +0 -1
  447. package/lib/common/factory/index.d.ts +0 -5
  448. package/lib/common/factory/index.d.ts.map +0 -1
  449. package/lib/common/factory/index.js.map +0 -1
  450. package/lib/common/factory/proxy-factory.d.ts +0 -57
  451. package/lib/common/factory/proxy-factory.d.ts.map +0 -1
  452. package/lib/common/factory/proxy-factory.js +0 -182
  453. package/lib/common/factory/proxy-factory.js.map +0 -1
  454. package/lib/common/factory/reader.d.ts +0 -16
  455. package/lib/common/factory/reader.d.ts.map +0 -1
  456. package/lib/common/factory/reader.js +0 -48
  457. package/lib/common/factory/reader.js.map +0 -1
  458. package/lib/common/factory/writer.d.ts +0 -10
  459. package/lib/common/factory/writer.d.ts.map +0 -1
  460. package/lib/common/factory/writer.js +0 -25
  461. package/lib/common/factory/writer.js.map +0 -1
  462. package/lib/common/handler/connection-handler.d.ts +0 -7
  463. package/lib/common/handler/connection-handler.d.ts.map +0 -1
  464. package/lib/common/handler/connection-handler.js +0 -8
  465. package/lib/common/handler/connection-handler.js.map +0 -1
  466. package/lib/common/handler/handler-protocol.d.ts +0 -7
  467. package/lib/common/handler/handler-protocol.d.ts.map +0 -1
  468. package/lib/common/handler/handler-protocol.js +0 -5
  469. package/lib/common/handler/handler-protocol.js.map +0 -1
  470. package/lib/common/handler/index.d.ts +0 -3
  471. package/lib/common/handler/index.d.ts.map +0 -1
  472. package/lib/common/handler/index.js.map +0 -1
  473. package/lib/common/proxy/delegating-http-proxy-creator.d.ts +0 -24
  474. package/lib/common/proxy/delegating-http-proxy-creator.d.ts.map +0 -1
  475. package/lib/common/proxy/delegating-http-proxy-creator.js +0 -89
  476. package/lib/common/proxy/delegating-http-proxy-creator.js.map +0 -1
  477. package/lib/common/proxy/http-proxy-creator.d.ts +0 -43
  478. package/lib/common/proxy/http-proxy-creator.d.ts.map +0 -1
  479. package/lib/common/proxy/http-proxy-creator.js +0 -143
  480. package/lib/common/proxy/http-proxy-creator.js.map +0 -1
  481. package/lib/common/proxy/proxy-protocol.d.ts +0 -21
  482. package/lib/common/proxy/proxy-protocol.d.ts.map +0 -1
  483. package/lib/common/proxy/proxy-protocol.js +0 -6
  484. package/lib/common/proxy/proxy-protocol.js.map +0 -1
  485. package/lib/common/proxy/proxy-provider.d.ts +0 -10
  486. package/lib/common/proxy/proxy-provider.d.ts.map +0 -1
  487. package/lib/common/proxy/proxy-provider.js +0 -43
  488. package/lib/common/proxy/proxy-provider.js.map +0 -1
  489. package/lib/common/utils/logger.d.ts +0 -9
  490. package/lib/common/utils/logger.d.ts.map +0 -1
  491. package/lib/common/utils/logger.js +0 -22
  492. package/lib/common/utils/logger.js.map +0 -1
  493. package/lib/node/channel/channel-manager.d.ts +0 -10
  494. package/lib/node/channel/channel-manager.d.ts.map +0 -1
  495. package/lib/node/channel/channel-manager.js +0 -59
  496. package/lib/node/channel/channel-manager.js.map +0 -1
  497. package/lib/node/channel/channel-middleware.d.ts +0 -8
  498. package/lib/node/channel/channel-middleware.d.ts.map +0 -1
  499. package/lib/node/channel/channel-middleware.js +0 -40
  500. package/lib/node/channel/channel-middleware.js.map +0 -1
  501. package/lib/node/channel/channel-protocol.d.ts +0 -13
  502. package/lib/node/channel/channel-protocol.d.ts.map +0 -1
  503. package/lib/node/channel/channel-protocol.js +0 -9
  504. package/lib/node/channel/channel-protocol.js.map +0 -1
  505. package/lib/node/channel/channel-strategy.d.ts +0 -10
  506. package/lib/node/channel/channel-strategy.d.ts.map +0 -1
  507. package/lib/node/channel/channel-strategy.js +0 -64
  508. package/lib/node/channel/channel-strategy.js.map +0 -1
  509. package/lib/node/channel/index.d.ts +0 -5
  510. package/lib/node/channel/index.d.ts.map +0 -1
  511. package/lib/node/channel/index.js.map +0 -1
  512. package/lib/node/handler/handler-adapter.d.ts +0 -14
  513. package/lib/node/handler/handler-adapter.d.ts.map +0 -1
  514. package/lib/node/handler/handler-adapter.js.map +0 -1
  515. package/lib/node/handler/handler-protocol.d.ts +0 -2
  516. package/lib/node/handler/handler-protocol.d.ts.map +0 -1
  517. package/lib/node/handler/handler-protocol.js +0 -5
  518. package/lib/node/handler/handler-protocol.js.map +0 -1
  519. package/lib/node/handler/index.d.ts +0 -3
  520. package/lib/node/handler/index.d.ts.map +0 -1
  521. package/lib/node/handler/index.js.map +0 -1
  522. package/src/common/channal/channel-protocol.ts +0 -82
  523. package/src/common/channal/http-channel.ts +0 -30
  524. package/src/common/channal/index.ts +0 -2
  525. package/src/common/factory/connection-factory.ts +0 -21
  526. package/src/common/factory/index.ts +0 -4
  527. package/src/common/factory/proxy-factory.ts +0 -219
  528. package/src/common/factory/reader.ts +0 -50
  529. package/src/common/factory/writer.ts +0 -26
  530. package/src/common/handler/connection-handler.ts +0 -7
  531. package/src/common/handler/handler-protocol.ts +0 -8
  532. package/src/common/handler/index.ts +0 -2
  533. package/src/common/proxy/delegating-http-proxy-creator.ts +0 -68
  534. package/src/common/proxy/http-proxy-creator.ts +0 -179
  535. package/src/common/proxy/proxy-protocol.ts +0 -26
  536. package/src/common/proxy/proxy-provider.ts +0 -29
  537. package/src/common/utils/logger.ts +0 -23
  538. package/src/node/channel/channel-manager.ts +0 -44
  539. package/src/node/channel/channel-middleware.ts +0 -27
  540. package/src/node/channel/channel-protocol.ts +0 -21
  541. package/src/node/channel/channel-strategy.ts +0 -56
  542. package/src/node/channel/index.ts +0 -4
  543. package/src/node/handler/handler-adapter.ts +0 -38
  544. package/src/node/handler/handler-protocol.ts +0 -1
  545. package/src/node/handler/index.ts +0 -2
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RpcInvokerImpl = exports.RpcInvoker = void 0;
13
+ const core_1 = require("@celljs/core");
14
+ const web_1 = require("@celljs/web");
15
+ const node_1 = require("@celljs/web/lib/node");
16
+ const common_1 = require("../../common");
17
+ exports.RpcInvoker = Symbol('RpcInvoker');
18
+ let RpcInvokerImpl = class RpcInvokerImpl {
19
+ constructor() {
20
+ this.metadata = [];
21
+ }
22
+ has(service) {
23
+ return this.byPath().has(service);
24
+ }
25
+ async invoke(service, body) {
26
+ if (Array.isArray(body)) {
27
+ if (body.length === 0) {
28
+ return common_1.JsonRpc.error(null, common_1.JsonRpc.INVALID_REQUEST, 'An empty batch.');
29
+ }
30
+ const responses = (await Promise.all(body.map(message => this.invokeOne(service, message)))).filter(r => r !== undefined);
31
+ return responses.length ? responses : undefined;
32
+ }
33
+ return this.invokeOne(service, body);
34
+ }
35
+ byPath() {
36
+ var _a;
37
+ (_a = this.services) !== null && _a !== void 0 ? _a : (this.services = new Map(this.metadata.map(m => [m.path, m])));
38
+ return this.services;
39
+ }
40
+ async invokeOne(service, message) {
41
+ if (!common_1.JsonRpc.isRequest(message)) {
42
+ const id = typeof message === 'object' && message !== null && 'id' in message ? message.id : null;
43
+ return common_1.JsonRpc.error(id !== null && id !== void 0 ? id : null, common_1.JsonRpc.INVALID_REQUEST, 'Not a JSON-RPC 2.0 request: { "jsonrpc": "2.0", "id": 1, "method": "name", "params": [] }.');
44
+ }
45
+ const { id, method, params = [] } = message;
46
+ const metadata = this.byPath().get(service);
47
+ const target = metadata === null || metadata === void 0 ? void 0 : metadata.get();
48
+ if (!target || !common_1.RpcMethodUtil.callable(target, method)) {
49
+ return id === undefined ? undefined : common_1.JsonRpc.error(id, common_1.JsonRpc.METHOD_NOT_FOUND, `${service} has no method ${method}.`);
50
+ }
51
+ const debug = this.logger.isEnabled('debug');
52
+ const start = debug ? Date.now() : 0;
53
+ try {
54
+ await this.pipeManager.apply({ target: target, method }, params);
55
+ const result = await target[method](...params);
56
+ return id === undefined ? undefined : common_1.JsonRpc.result(id, result);
57
+ }
58
+ catch (error) {
59
+ return id === undefined ? undefined : common_1.JsonRpc.error(id, ...this.toError(metadata, method, error));
60
+ }
61
+ finally {
62
+ if (debug) {
63
+ this.logger.debug(`rpc ${service}.${method} [${Date.now() - start}ms]`);
64
+ }
65
+ }
66
+ }
67
+ /**
68
+ * An `ApplicationError` keeps its code, message and data. Other errors answer like HTTP errors do
69
+ * (`ErrorMessageResolver`): the message of a 4xx `HttpError`, the status text of an internal error
70
+ * in production, which is logged. The stack never leaves the server.
71
+ */
72
+ toError(metadata, method, error) {
73
+ const service = metadata.path;
74
+ const own = common_1.ConverterUtil.getErrorConverters(metadata.id);
75
+ for (const converter of [...common_1.ConverterUtil.getGlobalErrorConverters(), ...(own ? [own] : [])]) {
76
+ const converted = converter.serialize(error);
77
+ if (converted) {
78
+ return [converted.code, converted.message, converted.data];
79
+ }
80
+ }
81
+ if (core_1.ApplicationError.is(error)) {
82
+ const application = error;
83
+ return [application.code, application.message, { kind: 'application', data: application.data }];
84
+ }
85
+ const { status, message } = this.errorMessageResolver.resolve(error);
86
+ if (status >= 500) {
87
+ this.logger.error(error instanceof Error ? error : `rpc ${service}.${method} failed: ${String(error)}`);
88
+ }
89
+ else {
90
+ this.logger.debug(`rpc ${service}.${method} refused: ${message}`);
91
+ }
92
+ return [common_1.JsonRpc.SERVER_ERROR, message, { status }];
93
+ }
94
+ };
95
+ exports.RpcInvokerImpl = RpcInvokerImpl;
96
+ __decorate([
97
+ (0, core_1.Autowired)(common_1.RPC_SERVICE),
98
+ (0, core_1.Optional)(),
99
+ __metadata("design:type", Array)
100
+ ], RpcInvokerImpl.prototype, "metadata", void 0);
101
+ __decorate([
102
+ (0, core_1.Autowired)(web_1.PipeManager),
103
+ __metadata("design:type", Object)
104
+ ], RpcInvokerImpl.prototype, "pipeManager", void 0);
105
+ __decorate([
106
+ (0, core_1.Autowired)(node_1.ErrorMessageResolver),
107
+ __metadata("design:type", Object)
108
+ ], RpcInvokerImpl.prototype, "errorMessageResolver", void 0);
109
+ __decorate([
110
+ (0, core_1.Autowired)(core_1.Logger),
111
+ __metadata("design:type", Object)
112
+ ], RpcInvokerImpl.prototype, "logger", void 0);
113
+ exports.RpcInvokerImpl = RpcInvokerImpl = __decorate([
114
+ (0, core_1.Component)(exports.RpcInvoker)
115
+ ], RpcInvokerImpl);
116
+ //# sourceMappingURL=rpc-invoker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-invoker.js","sourceRoot":"","sources":["../../../src/node/server/rpc-invoker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAwF;AACxF,qCAA0C;AAC1C,+CAA4D;AAC5D,yCAAsG;AAEzF,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAUxC,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QAGgB,aAAQ,GAAyB,EAAE,CAAC;IAqF3D,CAAC;IAxEG,GAAG,CAAC,OAAe;QACf,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,IAAa;QACvC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,OAAO,gBAAO,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAO,CAAC,eAAe,EAAE,iBAAi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AC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,IAAI,MAAM,YAAY,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5G,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,OAAO,IAAI,MAAM,aAAa,OAAO,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,CAAC,gBAAO,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;;AArFsB;IADlB,IAAA,gBAAS,EAAC,oBAAW,CAAC;IAAE,IAAA,eAAQ,GAAE;;gDACoB;AAGpC;IADlB,IAAA,gBAAS,EAAC,iBAAW,CAAC;;mDACqB;AAGzB;IADlB,IAAA,gBAAS,EAAC,2BAAoB,CAAC;;4DAC8B;AAG3C;IADlB,IAAA,gBAAS,EAAC,aAAM,CAAC;;8CACgB;yBAZzB,cAAc;IAD1B,IAAA,gBAAS,EAAC,QAAA,UAAU,CAAC;GACT,cAAc,CAwF1B"}
@@ -0,0 +1,37 @@
1
+ import { ApplicationError } from '@celljs/core';
2
+ /** Services of the WebSocket fixture server, shared by its tests. */
3
+ export declare const ChatServer: unique symbol;
4
+ export interface ChatServer {
5
+ echo(text: string): Promise<string>;
6
+ /** Remembers the connection of the call; its id. */
7
+ join(): Promise<string>;
8
+ /** Calls receive() of every connected client; their answers. */
9
+ broadcast(text: string): Promise<string[]>;
10
+ /** Calls receive() of the joined connection, and reports how it went. */
11
+ callJoined(text: string): Promise<{
12
+ code?: number;
13
+ result?: string;
14
+ }>;
15
+ /** The joined connection: closed, and how many times its onClose listener ran. */
16
+ joinedState(): Promise<{
17
+ closed: boolean;
18
+ closes: number;
19
+ }>;
20
+ connections(): Promise<number>;
21
+ fail(): Promise<void>;
22
+ refuse(): Promise<void>;
23
+ rejectApplication(): Promise<void>;
24
+ viaWebSocket(): Promise<boolean>;
25
+ }
26
+ export declare const ChatClient: unique symbol;
27
+ export interface ChatClient {
28
+ receive(text: string): Promise<string>;
29
+ }
30
+ export declare const Guarded: unique symbol;
31
+ export interface Guarded {
32
+ secret(): Promise<string>;
33
+ }
34
+ export declare const NotYours: ApplicationError.Constructor<-41001, {
35
+ id: string;
36
+ }>;
37
+ //# sourceMappingURL=websocket-fixture-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-fixture-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/test/websocket-fixture-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,qEAAqE;AACrE,eAAO,MAAM,UAAU,eAAuB,CAAC;AAC/C,MAAM,WAAW,UAAU;IACvB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,oDAAoD;IACpD,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,gEAAgE;IAChE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,yEAAyE;IACzE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtE,kFAAkF;IAClF,WAAW,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,UAAU,eAAuB,CAAC;AAC/C,MAAM,WAAW,UAAU;IACvB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,OAAO,eAAoB,CAAC;AACzC,MAAM,WAAW,OAAO;IACpB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,eAAO,MAAM,QAAQ;;EAA4G,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotYours = exports.Guarded = exports.ChatClient = exports.ChatServer = void 0;
4
+ const core_1 = require("@celljs/core");
5
+ /** Services of the WebSocket fixture server, shared by its tests. */
6
+ exports.ChatServer = Symbol('ChatServer');
7
+ exports.ChatClient = Symbol('ChatClient');
8
+ exports.Guarded = Symbol('Guarded');
9
+ exports.NotYours = core_1.ApplicationError.declare(-41001, (id) => ({ message: `Order ${id} is not yours`, data: { id } }));
10
+ //# sourceMappingURL=websocket-fixture-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-fixture-protocol.js","sourceRoot":"","sources":["../../../src/node/test/websocket-fixture-protocol.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAEhD,qEAAqE;AACxD,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAkBlC,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAKlC,QAAA,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAK5B,QAAA,QAAQ,GAAG,uBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Server } from 'node:http';
2
+ import { Container } from '@celljs/core/lib/common/container/container';
3
+ import { Context, Middleware } from '@celljs/web/lib/node';
4
+ import { RpcConnectionManager } from '../connection';
5
+ import { ChatServer, Guarded } from './websocket-fixture-protocol';
6
+ export declare class ChatServerImpl implements ChatServer {
7
+ protected readonly manager: RpcConnectionManager;
8
+ echo(text: string): Promise<string>;
9
+ join(): Promise<string>;
10
+ broadcast(text: string): Promise<string[]>;
11
+ callJoined(text: string): Promise<{
12
+ result: string;
13
+ code?: undefined;
14
+ } | {
15
+ result?: undefined;
16
+ code: number | undefined;
17
+ }>;
18
+ joinedState(): Promise<{
19
+ closed: boolean;
20
+ closes: number;
21
+ }>;
22
+ connections(): Promise<number>;
23
+ fail(): Promise<void>;
24
+ refuse(): Promise<void>;
25
+ rejectApplication(): Promise<void>;
26
+ viaWebSocket(): Promise<boolean>;
27
+ }
28
+ export declare class GuardedImpl implements Guarded {
29
+ secret(): Promise<string>;
30
+ }
31
+ /** Like a security middleware: calls over WebSocket pass it with the headers of the upgrade request. */
32
+ export declare class TokenMiddleware implements Middleware {
33
+ readonly priority = 1500;
34
+ handle(ctx: Context, next: () => Promise<void>): Promise<void>;
35
+ }
36
+ export declare function startFixtureServer(): Promise<{
37
+ port: number;
38
+ server: Server;
39
+ container: Container;
40
+ }>;
41
+ //# sourceMappingURL=websocket-fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-fixture.d.ts","sourceRoot":"","sources":["../../../src/node/test/websocket-fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAKxE,OAAO,EAAE,OAAO,EAA6B,UAAU,EAAgC,MAAM,sBAAsB,CAAC;AAIpH,OAAO,EAAiB,oBAAoB,EAAc,MAAM,eAAe,CAAC;AAChF,OAAO,EAAc,UAAU,EAAE,OAAO,EAAY,MAAM,8BAA8B,CAAC;AASzF,qBACa,cAAe,YAAW,UAAU;IAE7C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IAE3C,IAAI,CAAC,IAAI,EAAE,MAAM,mBAEtB;IAEK,IAAI,oBAIT;IAEK,SAAS,CAAC,IAAI,EAAE,MAAM,qBAE3B;IAEK,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;OAM5B;IAEK,WAAW;;;OAEhB;IAEK,WAAW,oBAEhB;IAEK,IAAI,kBAET;IAEK,MAAM,kBAEX;IAEK,iBAAiB,kBAEtB;IAEK,YAAY,qBAEjB;CACJ;AAED,qBACa,WAAY,YAAW,OAAO;IACjC,MAAM,oBAEX;CACJ;AAED,wGAAwG;AACxG,qBACa,eAAgB,YAAW,UAAU;IAC9C,QAAQ,CAAC,QAAQ,QAAQ;IAEnB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnE;CACJ;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC,CAoB1G"}
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.TokenMiddleware = exports.GuardedImpl = exports.ChatServerImpl = void 0;
16
+ exports.startFixtureServer = startFixtureServer;
17
+ const static_module_1 = __importDefault(require("@celljs/core/lib/common/static-module"));
18
+ const static_module_2 = __importDefault(require("@celljs/core/lib/node/static-module"));
19
+ const module_1 = __importDefault(require("@celljs/http/lib/common/module"));
20
+ const module_2 = __importDefault(require("@celljs/web/lib/common/module"));
21
+ const module_3 = __importDefault(require("@celljs/web/lib/node/module"));
22
+ const core_1 = require("@celljs/core");
23
+ const container_1 = require("@celljs/core/lib/common/container/container");
24
+ const container_provider_1 = require("@celljs/core/lib/common/container/container-provider");
25
+ const auto_bind_1 = require("@celljs/core/lib/common/container/auto-bind");
26
+ const utils_1 = require("@celljs/core/lib/common/utils");
27
+ const application_protocol_1 = require("@celljs/core/lib/common/application/application-protocol");
28
+ const node_1 = require("@celljs/web/lib/node");
29
+ const module_4 = __importDefault(require("../../common/module"));
30
+ const annotation_1 = require("../../common/annotation");
31
+ const module_5 = __importDefault(require("../module"));
32
+ const connection_1 = require("../connection");
33
+ const websocket_fixture_protocol_1 = require("./websocket-fixture-protocol");
34
+ /**
35
+ * A backend with `rpc.transport: websocket` for the tests of the WebSocket transport. They run it in
36
+ * Node.js: node:http of the Bun version the repository is tested with (< 1.4) cannot answer upgrades.
37
+ */
38
+ let joined;
39
+ let closes = 0;
40
+ let ChatServerImpl = class ChatServerImpl {
41
+ async echo(text) {
42
+ return text;
43
+ }
44
+ async join() {
45
+ joined = connection_1.RpcContext.requireConnection();
46
+ joined.onClose(() => closes++);
47
+ return joined.id;
48
+ }
49
+ async broadcast(text) {
50
+ return Promise.all(this.manager.connections.map(c => c.client(websocket_fixture_protocol_1.ChatClient).receive(text)));
51
+ }
52
+ async callJoined(text) {
53
+ try {
54
+ return { result: await joined.client(websocket_fixture_protocol_1.ChatClient).receive(text) };
55
+ }
56
+ catch (error) {
57
+ return { code: error.code };
58
+ }
59
+ }
60
+ async joinedState() {
61
+ return { closed: !!(joined === null || joined === void 0 ? void 0 : joined.closed), closes };
62
+ }
63
+ async connections() {
64
+ return this.manager.connections.length;
65
+ }
66
+ async fail() {
67
+ throw new Error('connect ECONNREFUSED db.internal:5432');
68
+ }
69
+ async refuse() {
70
+ throw new node_1.HttpError(403, 'not yours');
71
+ }
72
+ async rejectApplication() {
73
+ throw (0, websocket_fixture_protocol_1.NotYours)('42');
74
+ }
75
+ async viaWebSocket() {
76
+ return connection_1.RpcContext.connection() !== undefined;
77
+ }
78
+ };
79
+ exports.ChatServerImpl = ChatServerImpl;
80
+ __decorate([
81
+ (0, core_1.Autowired)(connection_1.RpcConnectionManager),
82
+ __metadata("design:type", Object)
83
+ ], ChatServerImpl.prototype, "manager", void 0);
84
+ exports.ChatServerImpl = ChatServerImpl = __decorate([
85
+ (0, annotation_1.Rpc)(websocket_fixture_protocol_1.ChatServer)
86
+ ], ChatServerImpl);
87
+ let GuardedImpl = class GuardedImpl {
88
+ async secret() {
89
+ return 'treasure';
90
+ }
91
+ };
92
+ exports.GuardedImpl = GuardedImpl;
93
+ exports.GuardedImpl = GuardedImpl = __decorate([
94
+ (0, annotation_1.Rpc)(websocket_fixture_protocol_1.Guarded)
95
+ ], GuardedImpl);
96
+ /** Like a security middleware: calls over WebSocket pass it with the headers of the upgrade request. */
97
+ let TokenMiddleware = class TokenMiddleware {
98
+ constructor() {
99
+ this.priority = 1500;
100
+ }
101
+ async handle(ctx, next) {
102
+ if (ctx.request.path.endsWith('/Guarded') && ctx.request.headers['x-token'] !== 'open sesame') {
103
+ ctx.response.statusCode = 401;
104
+ ctx.response.end('token required');
105
+ return;
106
+ }
107
+ return next();
108
+ }
109
+ };
110
+ exports.TokenMiddleware = TokenMiddleware;
111
+ exports.TokenMiddleware = TokenMiddleware = __decorate([
112
+ (0, core_1.Component)(node_1.Middleware)
113
+ ], TokenMiddleware);
114
+ async function startFixtureServer() {
115
+ let handler = (_req, res) => res.end();
116
+ const server = node_1.HttpServerUtil.createHttpServer((req, res) => handler(req, res));
117
+ await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
118
+ const port = server.address().port;
119
+ utils_1.currentThis.cellProps = {
120
+ component: { proxy: false }, aop: { enabled: true }, logger: { level: 'error' }, tenant: { enabled: false },
121
+ server: { path: '/', port, host: '127.0.0.1' },
122
+ web: { errors: { exposeMessages: false }, session: { autoCommit: true, maxAge: 86400000, sessionIdKey: 'cell:sessionId', sessionKey: 'cell:session' }, trace: { requestField: 'X-Cell-Trace-ID', responseField: 'X-Cell-Trace-ID' }, health: { url: '/health', method: 'GET' }, cookies: { keys: ['abcdef'] }, route: { cacheSize: 500 }, validationPipeOptions: { detailedOutputDisabled: false, transformEnabled: true } },
123
+ http: { client: { headers: {} } },
124
+ rpc: { path: 'api', transport: 'websocket', websocket: { maxPayload: 65536, heartbeat: 30000, callTimeout: 2000, allowedOrigins: ['https://app.example.com'] } },
125
+ };
126
+ const container = new container_1.Container(static_module_1.default, static_module_2.default, module_1.default, module_2.default, module_3.default, module_4.default, module_5.default, (0, auto_bind_1.autoBind)());
127
+ container_provider_1.ContainerProvider.set(container);
128
+ await container.get(application_protocol_1.Application).start();
129
+ handler = node_1.HttpServerUtil.createHandler(container);
130
+ for (const aware of container.getAll(node_1.ServerAware)) {
131
+ await aware.setServer(server);
132
+ }
133
+ return { port, server, container };
134
+ }
135
+ //# sourceMappingURL=websocket-fixture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-fixture.js","sourceRoot":"","sources":["../../../src/node/test/websocket-fixture.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,0FAAqE;AACrE,wFAAiE;AACjE,4EAA8D;AAC9D,2EAA4D;AAC5D,yEAAwD;AACxD,uCAAoD;AACpD,2EAAwE;AACxE,6FAAyF;AACzF,2E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AAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,qBAAqB,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE;QAC5Z,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE;QACjC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,yBAAyB,CAAC,EAAE,EAAE;KACnK,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,uBAAgB,EAAE,uBAAc,EAAE,gBAAgB,EAAE,gBAAe,EAAE,gBAAa,EAAE,gBAAe,EAAE,gBAAa,EAAE,IAAA,oBAAQ,GAAE,CAAC,CAAC;IAChK,sCAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,SAAS,CAAC,GAAG,CAAc,kCAAW,CAAC,CAAC,KAAK,EAAE,CAAC;IACtD,OAAO,GAAG,qBAAc,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAClD,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,MAAM,CAAc,kBAAW,CAAC,EAAE,CAAC;QAC7D,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './websocket-frames';
2
+ export * from './websocket-connection';
3
+ export * from './websocket-exchange';
4
+ export * from './rpc-websocket-server';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/websocket/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./websocket-frames"), exports);
18
+ __exportStar(require("./websocket-connection"), exports);
19
+ __exportStar(require("./websocket-exchange"), exports);
20
+ __exportStar(require("./rpc-websocket-server"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/websocket/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yDAAuC;AACvC,uDAAqC;AACrC,yDAAuC"}
@@ -0,0 +1,46 @@
1
+ import type { IncomingMessage, Server } from 'node:http';
2
+ import type { Duplex } from 'node:stream';
3
+ import { Application, ApplicationLifecycle, Logger } from '@celljs/core';
4
+ import { PathResolver } from '@celljs/web';
5
+ import { Context, Dispatcher, ServerAware } from '@celljs/web/lib/node';
6
+ import { JsonRpc, RpcTransportKind } from '../../common';
7
+ import { RpcConnectionManager } from '../connection/connection-protocol';
8
+ import { RpcConnectionImpl } from '../connection/rpc-connection';
9
+ export interface RpcWebSocketOptions {
10
+ /** Origins besides the server's own that may connect (`https://app.example.com`), or `*`. */
11
+ allowedOrigins?: string[];
12
+ /** Largest message in bytes. Default 1 MiB. */
13
+ maxPayload?: number;
14
+ /** Milliseconds between pings. Default 30000. */
15
+ heartbeat?: number;
16
+ /** Milliseconds a call to a client waits for its answer. Default 30000. */
17
+ callTimeout?: number;
18
+ }
19
+ /**
20
+ * With `rpc.transport: websocket`, accepts WebSocket connections at `/<rpc.path>/ws` of the HTTP
21
+ * server. Each call over a connection is dispatched like a POST to `/<rpc.path>/<service>` with the
22
+ * headers of the upgrade request, so middlewares and security apply as they do over HTTP.
23
+ */
24
+ export declare class RpcWebSocketServer implements ServerAware, ApplicationLifecycle<Application> {
25
+ protected readonly transport?: RpcTransportKind;
26
+ protected readonly options?: RpcWebSocketOptions;
27
+ protected readonly rpcPath: string;
28
+ protected readonly pathResolver: PathResolver;
29
+ protected readonly dispatcher: Dispatcher<Context>;
30
+ protected readonly connections: RpcConnectionManager;
31
+ protected readonly logger: Logger;
32
+ protected server?: Server;
33
+ protected path: string;
34
+ protected base: string;
35
+ protected listener?: (request: IncomingMessage, socket: Duplex, head: Buffer) => void;
36
+ setServer(server: Server): Promise<void>;
37
+ onStop(): void;
38
+ protected upgrade(request: IncomingMessage, socket: Duplex, head: Buffer): void;
39
+ /**
40
+ * Browsers send the cookies of the server with a WebSocket request from any page: only the page's
41
+ * own origin (and the configured ones) may connect. Clients other than browsers send no origin.
42
+ */
43
+ protected allowed(request: IncomingMessage): boolean;
44
+ protected dispatch(connection: RpcConnectionImpl, request: JsonRpc.Request): Promise<JsonRpc.Response | undefined>;
45
+ }
46
+ //# sourceMappingURL=rpc-websocket-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-websocket-server.d.ts","sourceRoot":"","sources":["../../../src/node/websocket/rpc-websocket-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAA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AAI,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhF,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAa7C;IAED,MAAM,IAAI,IAAI,CAKb;IAED,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAwB9E;IAED;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAcnD;IAED,UAAgB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAqCvH;CACJ"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RpcWebSocketServer = void 0;
13
+ const core_1 = require("@celljs/core");
14
+ const web_1 = require("@celljs/web");
15
+ const node_1 = require("@celljs/web/lib/node");
16
+ const common_1 = require("../../common");
17
+ const connection_protocol_1 = require("../connection/connection-protocol");
18
+ const rpc_connection_1 = require("../connection/rpc-connection");
19
+ const websocket_connection_1 = require("./websocket-connection");
20
+ const websocket_exchange_1 = require("./websocket-exchange");
21
+ /**
22
+ * With `rpc.transport: websocket`, accepts WebSocket connections at `/<rpc.path>/ws` of the HTTP
23
+ * server. Each call over a connection is dispatched like a POST to `/<rpc.path>/<service>` with the
24
+ * headers of the upgrade request, so middlewares and security apply as they do over HTTP.
25
+ */
26
+ let RpcWebSocketServer = class RpcWebSocketServer {
27
+ async setServer(server) {
28
+ if (this.transport !== 'websocket' || typeof (server === null || server === void 0 ? void 0 : server.on) !== 'function') {
29
+ return;
30
+ }
31
+ if (!websocket_connection_1.WebSocketConnection.runtimeSupported()) {
32
+ this.logger.warn('rpc: WebSocket connections need Bun 1.4 or later (node:http of older Bun versions cannot answer upgrades); the clients use HTTP.');
33
+ return;
34
+ }
35
+ this.base = (await this.pathResolver.resolve(this.rpcPath)).replace(/\/$/, '');
36
+ this.path = `${this.base}/${common_1.RPC_WEBSOCKET_PATH}`;
37
+ this.listener = (request, socket, head) => this.upgrade(request, socket, head);
38
+ this.server = server;
39
+ server.on('upgrade', this.listener);
40
+ }
41
+ onStop() {
42
+ if (this.server && this.listener) {
43
+ this.server.off('upgrade', this.listener);
44
+ }
45
+ this.connections.closeAll();
46
+ }
47
+ upgrade(request, socket, head) {
48
+ var _a, _b, _c;
49
+ var _d, _e, _f, _g;
50
+ if (((_d = request.url) !== null && _d !== void 0 ? _d : '').split('?')[0] !== this.path) {
51
+ // Another listener (the HMR socket of cell dev) may want it; nobody else would answer.
52
+ if (this.server.listenerCount('upgrade') === 1) {
53
+ socket.destroy();
54
+ }
55
+ return;
56
+ }
57
+ const checked = websocket_connection_1.WebSocketConnection.check(request);
58
+ if ('status' in checked) {
59
+ websocket_connection_1.WebSocketConnection.refuse(socket, checked.status, checked.message);
60
+ return;
61
+ }
62
+ if (!this.allowed(request)) {
63
+ this.logger.warn(`rpc: refused a WebSocket connection from origin ${request.headers.origin}`);
64
+ websocket_connection_1.WebSocketConnection.refuse(socket, 403, 'Origin not allowed; add it to rpc.websocket.allowedOrigins.');
65
+ return;
66
+ }
67
+ const socketConnection = websocket_connection_1.WebSocketConnection.open(socket, checked.key, head !== null && head !== void 0 ? head : Buffer.alloc(0), {
68
+ maxPayload: (_e = (_a = this.options) === null || _a === void 0 ? void 0 : _a.maxPayload) !== null && _e !== void 0 ? _e : 1048576,
69
+ heartbeat: (_f = (_b = this.options) === null || _b === void 0 ? void 0 : _b.heartbeat) !== null && _f !== void 0 ? _f : 30000,
70
+ });
71
+ const connection = new rpc_connection_1.RpcConnectionImpl(socketConnection, request, (c, r) => this.dispatch(c, r), (_g = (_c = this.options) === null || _c === void 0 ? void 0 : _c.callTimeout) !== null && _g !== void 0 ? _g : 30000);
72
+ this.connections.add(connection);
73
+ }
74
+ /**
75
+ * Browsers send the cookies of the server with a WebSocket request from any page: only the page's
76
+ * own origin (and the configured ones) may connect. Clients other than browsers send no origin.
77
+ */
78
+ allowed(request) {
79
+ var _a;
80
+ var _b;
81
+ const origin = request.headers.origin;
82
+ if (!origin) {
83
+ return true;
84
+ }
85
+ const allowed = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.allowedOrigins) !== null && _b !== void 0 ? _b : [];
86
+ if (allowed.includes('*') || allowed.includes(origin)) {
87
+ return true;
88
+ }
89
+ try {
90
+ return new URL(origin).host === request.headers.host;
91
+ }
92
+ catch (_c) {
93
+ return false;
94
+ }
95
+ }
96
+ async dispatch(connection, request) {
97
+ var _a, _b, _c;
98
+ const id = (_a = request.id) !== null && _a !== void 0 ? _a : null;
99
+ const parts = common_1.RpcMethodUtil.split(request.method);
100
+ if (!parts) {
101
+ return common_1.JsonRpc.error(id, common_1.JsonRpc.METHOD_NOT_FOUND, `Methods over the WebSocket connection are <service>/<method>, not ${request.method}.`);
102
+ }
103
+ const [service, method] = parts;
104
+ const body = request.id === undefined ? common_1.JsonRpc.request(undefined, method, (_b = request.params) !== null && _b !== void 0 ? _b : []) : common_1.JsonRpc.request(request.id, method, (_c = request.params) !== null && _c !== void 0 ? _c : []);
105
+ const req = websocket_exchange_1.WebSocketExchange.request(connection.request, `${this.base}/${encodeURIComponent(service)}`, body);
106
+ const res = websocket_exchange_1.WebSocketExchange.response();
107
+ const ctx = new node_1.Context(req, res.asResponse());
108
+ ctx[connection_protocol_1.RPC_CONNECTION_KEY] = connection;
109
+ try {
110
+ await node_1.Context.run(() => this.dispatcher.dispatch(ctx));
111
+ if (!res.writableEnded) {
112
+ res.end(res.body === undefined ? undefined : typeof res.body === 'string' ? res.body : JSON.stringify(res.body));
113
+ }
114
+ }
115
+ catch (error) {
116
+ this.logger.error(error instanceof Error ? error : `rpc ${request.method} failed: ${String(error)}`);
117
+ return common_1.JsonRpc.error(id, common_1.JsonRpc.INTERNAL_ERROR, 'Internal Server Error', { status: 500 });
118
+ }
119
+ if (request.id === undefined) {
120
+ return undefined;
121
+ }
122
+ const text = res.text;
123
+ let answer;
124
+ try {
125
+ answer = text ? JSON.parse(text) : undefined;
126
+ }
127
+ catch (_d) {
128
+ answer = undefined;
129
+ }
130
+ if (common_1.JsonRpc.isResponse(answer)) {
131
+ return answer;
132
+ }
133
+ // A middleware answered (401 of security, 404 of an unknown service): its status and text.
134
+ const status = res.statusCode;
135
+ return common_1.JsonRpc.error(id, status === 404 ? common_1.JsonRpc.METHOD_NOT_FOUND : common_1.JsonRpc.SERVER_ERROR, text && text.length < 500 ? text : `HTTP ${status}`, { status });
136
+ }
137
+ };
138
+ exports.RpcWebSocketServer = RpcWebSocketServer;
139
+ __decorate([
140
+ (0, core_1.Value)('rpc.transport'),
141
+ __metadata("design:type", String)
142
+ ], RpcWebSocketServer.prototype, "transport", void 0);
143
+ __decorate([
144
+ (0, core_1.Value)('rpc.websocket'),
145
+ __metadata("design:type", Object)
146
+ ], RpcWebSocketServer.prototype, "options", void 0);
147
+ __decorate([
148
+ (0, core_1.Value)(common_1.RPC_PATH),
149
+ __metadata("design:type", String)
150
+ ], RpcWebSocketServer.prototype, "rpcPath", void 0);
151
+ __decorate([
152
+ (0, core_1.Autowired)(web_1.PathResolver),
153
+ __metadata("design:type", Object)
154
+ ], RpcWebSocketServer.prototype, "pathResolver", void 0);
155
+ __decorate([
156
+ (0, core_1.Autowired)(node_1.Dispatcher),
157
+ __metadata("design:type", Object)
158
+ ], RpcWebSocketServer.prototype, "dispatcher", void 0);
159
+ __decorate([
160
+ (0, core_1.Autowired)(connection_protocol_1.RpcConnectionManager),
161
+ __metadata("design:type", Object)
162
+ ], RpcWebSocketServer.prototype, "connections", void 0);
163
+ __decorate([
164
+ (0, core_1.Autowired)(core_1.Logger),
165
+ __metadata("design:type", Object)
166
+ ], RpcWebSocketServer.prototype, "logger", void 0);
167
+ exports.RpcWebSocketServer = RpcWebSocketServer = __decorate([
168
+ (0, core_1.Component)([node_1.ServerAware, core_1.ApplicationLifecycle])
169
+ ], RpcWebSocketServer);
170
+ //# sourceMappingURL=rpc-websocket-server.js.map