uws-react-native 0.0.1-alpha.1

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 (315) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +84 -0
  3. package/UwsReactNative.podspec +71 -0
  4. package/android/build.gradle.kts +138 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/id/sufeni/oss/uwsreactnative/UwsReactNativePackage.kt +18 -0
  7. package/apple/OnLoad.mm +17 -0
  8. package/cpp/CMakeLists.txt +154 -0
  9. package/cpp/UwsReactNativeModule.cpp +191 -0
  10. package/cpp/UwsReactNativeModule.h +30 -0
  11. package/cpp/app/AppHost.h +37 -0
  12. package/cpp/app/AppRunner.h +88 -0
  13. package/cpp/app/CMakeLists.txt +39 -0
  14. package/cpp/app/HttpRequestObject.h +173 -0
  15. package/cpp/app/HttpResponseObject.h +623 -0
  16. package/cpp/app/RecognizedString.h +71 -0
  17. package/cpp/app/TemplatedAppObject.h +472 -0
  18. package/cpp/bridging/ArrayBuffer.h +150 -0
  19. package/cpp/bridging/CMakeLists.txt +34 -0
  20. package/cpp/jsi/Buffer.h +91 -0
  21. package/cpp/jsi/CMakeLists.txt +34 -0
  22. package/cpp/uSockets/bsd.c +767 -0
  23. package/cpp/uSockets/context.c +524 -0
  24. package/cpp/uSockets/crypto/openssl.c +858 -0
  25. package/cpp/uSockets/crypto/sni_tree.cpp +218 -0
  26. package/cpp/uSockets/eventing/asio.cpp +475 -0
  27. package/cpp/uSockets/eventing/epoll_kqueue.c +458 -0
  28. package/cpp/uSockets/eventing/gcd.c +278 -0
  29. package/cpp/uSockets/eventing/libuv.c +305 -0
  30. package/cpp/uSockets/internal/eventing/asio.h +45 -0
  31. package/cpp/uSockets/internal/eventing/epoll_kqueue.h +67 -0
  32. package/cpp/uSockets/internal/eventing/gcd.h +40 -0
  33. package/cpp/uSockets/internal/eventing/libuv.h +45 -0
  34. package/cpp/uSockets/internal/internal.h +224 -0
  35. package/cpp/uSockets/internal/loop_data.h +38 -0
  36. package/cpp/uSockets/internal/networking/bsd.h +109 -0
  37. package/cpp/uSockets/io_uring/internal.h +98 -0
  38. package/cpp/uSockets/io_uring/io_context.c +302 -0
  39. package/cpp/uSockets/io_uring/io_loop.c +422 -0
  40. package/cpp/uSockets/io_uring/io_socket.c +139 -0
  41. package/cpp/uSockets/libusockets.h +350 -0
  42. package/cpp/uSockets/loop.c +396 -0
  43. package/cpp/uSockets/quic.c +1071 -0
  44. package/cpp/uSockets/quic.h +68 -0
  45. package/cpp/uSockets/socket.c +231 -0
  46. package/cpp/uSockets/udp.c +151 -0
  47. package/cpp/uWebSockets/uWebSockets/App.h +676 -0
  48. package/cpp/uWebSockets/uWebSockets/AsyncSocket.h +376 -0
  49. package/cpp/uWebSockets/uWebSockets/AsyncSocketData.h +94 -0
  50. package/cpp/uWebSockets/uWebSockets/BloomFilter.h +83 -0
  51. package/cpp/uWebSockets/uWebSockets/CachingApp.h +115 -0
  52. package/cpp/uWebSockets/uWebSockets/ChunkedEncoding.h +237 -0
  53. package/cpp/uWebSockets/uWebSockets/ClientApp.h +36 -0
  54. package/cpp/uWebSockets/uWebSockets/Http3App.h +140 -0
  55. package/cpp/uWebSockets/uWebSockets/Http3Context.h +157 -0
  56. package/cpp/uWebSockets/uWebSockets/Http3ContextData.h +21 -0
  57. package/cpp/uWebSockets/uWebSockets/Http3Request.h +22 -0
  58. package/cpp/uWebSockets/uWebSockets/Http3Response.h +120 -0
  59. package/cpp/uWebSockets/uWebSockets/Http3ResponseData.h +25 -0
  60. package/cpp/uWebSockets/uWebSockets/HttpContext.h +521 -0
  61. package/cpp/uWebSockets/uWebSockets/HttpContextData.h +60 -0
  62. package/cpp/uWebSockets/uWebSockets/HttpErrors.h +53 -0
  63. package/cpp/uWebSockets/uWebSockets/HttpParser.h +747 -0
  64. package/cpp/uWebSockets/uWebSockets/HttpResponse.h +605 -0
  65. package/cpp/uWebSockets/uWebSockets/HttpResponseData.h +123 -0
  66. package/cpp/uWebSockets/uWebSockets/HttpRouter.h +384 -0
  67. package/cpp/uWebSockets/uWebSockets/LocalCluster.h +64 -0
  68. package/cpp/uWebSockets/uWebSockets/Loop.h +238 -0
  69. package/cpp/uWebSockets/uWebSockets/LoopData.h +113 -0
  70. package/cpp/uWebSockets/uWebSockets/MessageParser.h +64 -0
  71. package/cpp/uWebSockets/uWebSockets/MoveOnlyFunction.h +389 -0
  72. package/cpp/uWebSockets/uWebSockets/Multipart.h +231 -0
  73. package/cpp/uWebSockets/uWebSockets/PerMessageDeflate.h +303 -0
  74. package/cpp/uWebSockets/uWebSockets/ProxyParser.h +187 -0
  75. package/cpp/uWebSockets/uWebSockets/QueryParser.h +120 -0
  76. package/cpp/uWebSockets/uWebSockets/TopicTree.h +364 -0
  77. package/cpp/uWebSockets/uWebSockets/Utilities.h +66 -0
  78. package/cpp/uWebSockets/uWebSockets/WebSocket.h +407 -0
  79. package/cpp/uWebSockets/uWebSockets/WebSocketContext.h +436 -0
  80. package/cpp/uWebSockets/uWebSockets/WebSocketContextData.h +109 -0
  81. package/cpp/uWebSockets/uWebSockets/WebSocketData.h +86 -0
  82. package/cpp/uWebSockets/uWebSockets/WebSocketExtensions.h +256 -0
  83. package/cpp/uWebSockets/uWebSockets/WebSocketHandshake.h +145 -0
  84. package/cpp/uWebSockets/uWebSockets/WebSocketProtocol.h +525 -0
  85. package/lib/commonjs/_internal/native-modules/NativeReactNativeUws.js +12 -0
  86. package/lib/commonjs/_internal/native-modules/NativeReactNativeUws.js.map +1 -0
  87. package/lib/commonjs/index.js +28 -0
  88. package/lib/commonjs/index.js.map +1 -0
  89. package/lib/commonjs/modules/App.js +17 -0
  90. package/lib/commonjs/modules/App.js.map +1 -0
  91. package/lib/commonjs/modules/CompressOptions.js +103 -0
  92. package/lib/commonjs/modules/CompressOptions.js.map +1 -0
  93. package/lib/commonjs/modules/EnvironmentVariables.js +17 -0
  94. package/lib/commonjs/modules/EnvironmentVariables.js.map +1 -0
  95. package/lib/commonjs/modules/ListenOptions.js +12 -0
  96. package/lib/commonjs/modules/ListenOptions.js.map +1 -0
  97. package/lib/commonjs/modules/SSLApp.js +15 -0
  98. package/lib/commonjs/modules/SSLApp.js.map +1 -0
  99. package/lib/commonjs/modules/getParts.js +28 -0
  100. package/lib/commonjs/modules/getParts.js.map +1 -0
  101. package/lib/commonjs/modules/index.js +61 -0
  102. package/lib/commonjs/modules/index.js.map +1 -0
  103. package/lib/commonjs/modules/us_listen_socket_close.js +21 -0
  104. package/lib/commonjs/modules/us_listen_socket_close.js.map +1 -0
  105. package/lib/commonjs/modules/us_socket_local_port.js +22 -0
  106. package/lib/commonjs/modules/us_socket_local_port.js.map +1 -0
  107. package/lib/commonjs/package.json +1 -0
  108. package/lib/commonjs/types/AppDescriptor.js +2 -0
  109. package/lib/commonjs/types/AppDescriptor.js.map +1 -0
  110. package/lib/commonjs/types/AppOptions.js +2 -0
  111. package/lib/commonjs/types/AppOptions.js.map +1 -0
  112. package/lib/commonjs/types/HttpRequest.js +6 -0
  113. package/lib/commonjs/types/HttpRequest.js.map +1 -0
  114. package/lib/commonjs/types/HttpResponse.js +6 -0
  115. package/lib/commonjs/types/HttpResponse.js.map +1 -0
  116. package/lib/commonjs/types/HttpRouterOptions.js +2 -0
  117. package/lib/commonjs/types/HttpRouterOptions.js.map +1 -0
  118. package/lib/commonjs/types/MultipartField.js +2 -0
  119. package/lib/commonjs/types/MultipartField.js.map +1 -0
  120. package/lib/commonjs/types/RecognizedString.js +2 -0
  121. package/lib/commonjs/types/RecognizedString.js.map +1 -0
  122. package/lib/commonjs/types/TemplatedApp.js +6 -0
  123. package/lib/commonjs/types/TemplatedApp.js.map +1 -0
  124. package/lib/commonjs/types/WebSocket.js +6 -0
  125. package/lib/commonjs/types/WebSocket.js.map +1 -0
  126. package/lib/commonjs/types/WebSocketBehaviour.js +139 -0
  127. package/lib/commonjs/types/WebSocketBehaviour.js.map +1 -0
  128. package/lib/commonjs/types/index.js +2 -0
  129. package/lib/commonjs/types/index.js.map +1 -0
  130. package/lib/commonjs/types/us_listen_socket.js +2 -0
  131. package/lib/commonjs/types/us_listen_socket.js.map +1 -0
  132. package/lib/commonjs/types/us_socket.js +2 -0
  133. package/lib/commonjs/types/us_socket.js.map +1 -0
  134. package/lib/commonjs/types/us_socket_context_t.js +2 -0
  135. package/lib/commonjs/types/us_socket_context_t.js.map +1 -0
  136. package/lib/module/_internal/native-modules/NativeReactNativeUws.js +10 -0
  137. package/lib/module/_internal/native-modules/NativeReactNativeUws.js.map +1 -0
  138. package/lib/module/index.js +5 -0
  139. package/lib/module/index.js.map +1 -0
  140. package/lib/module/modules/App.js +12 -0
  141. package/lib/module/modules/App.js.map +1 -0
  142. package/lib/module/modules/CompressOptions.js +103 -0
  143. package/lib/module/modules/CompressOptions.js.map +1 -0
  144. package/lib/module/modules/EnvironmentVariables.js +13 -0
  145. package/lib/module/modules/EnvironmentVariables.js.map +1 -0
  146. package/lib/module/modules/ListenOptions.js +8 -0
  147. package/lib/module/modules/ListenOptions.js.map +1 -0
  148. package/lib/module/modules/SSLApp.js +15 -0
  149. package/lib/module/modules/SSLApp.js.map +1 -0
  150. package/lib/module/modules/getParts.js +23 -0
  151. package/lib/module/modules/getParts.js.map +1 -0
  152. package/lib/module/modules/index.js +11 -0
  153. package/lib/module/modules/index.js.map +1 -0
  154. package/lib/module/modules/us_listen_socket_close.js +17 -0
  155. package/lib/module/modules/us_listen_socket_close.js.map +1 -0
  156. package/lib/module/modules/us_socket_local_port.js +18 -0
  157. package/lib/module/modules/us_socket_local_port.js.map +1 -0
  158. package/lib/module/package.json +1 -0
  159. package/lib/module/types/AppDescriptor.js +2 -0
  160. package/lib/module/types/AppDescriptor.js.map +1 -0
  161. package/lib/module/types/AppOptions.js +2 -0
  162. package/lib/module/types/AppOptions.js.map +1 -0
  163. package/lib/module/types/HttpRequest.js +4 -0
  164. package/lib/module/types/HttpRequest.js.map +1 -0
  165. package/lib/module/types/HttpResponse.js +4 -0
  166. package/lib/module/types/HttpResponse.js.map +1 -0
  167. package/lib/module/types/HttpRouterOptions.js +2 -0
  168. package/lib/module/types/HttpRouterOptions.js.map +1 -0
  169. package/lib/module/types/MultipartField.js +2 -0
  170. package/lib/module/types/MultipartField.js.map +1 -0
  171. package/lib/module/types/RecognizedString.js +2 -0
  172. package/lib/module/types/RecognizedString.js.map +1 -0
  173. package/lib/module/types/TemplatedApp.js +4 -0
  174. package/lib/module/types/TemplatedApp.js.map +1 -0
  175. package/lib/module/types/WebSocket.js +4 -0
  176. package/lib/module/types/WebSocket.js.map +1 -0
  177. package/lib/module/types/WebSocketBehaviour.js +139 -0
  178. package/lib/module/types/WebSocketBehaviour.js.map +1 -0
  179. package/lib/module/types/index.js +2 -0
  180. package/lib/module/types/index.js.map +1 -0
  181. package/lib/module/types/us_listen_socket.js +2 -0
  182. package/lib/module/types/us_listen_socket.js.map +1 -0
  183. package/lib/module/types/us_socket.js +2 -0
  184. package/lib/module/types/us_socket.js.map +1 -0
  185. package/lib/module/types/us_socket_context_t.js +2 -0
  186. package/lib/module/types/us_socket_context_t.js.map +1 -0
  187. package/lib/typescript/commonjs/_internal/native-modules/NativeReactNativeUws.d.ts +22 -0
  188. package/lib/typescript/commonjs/_internal/native-modules/NativeReactNativeUws.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/index.d.ts +3 -0
  190. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/modules/App.d.ts +7 -0
  192. package/lib/typescript/commonjs/modules/App.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/modules/CompressOptions.d.ts +1 -0
  194. package/lib/typescript/commonjs/modules/CompressOptions.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/modules/EnvironmentVariables.d.ts +16 -0
  196. package/lib/typescript/commonjs/modules/EnvironmentVariables.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/modules/ListenOptions.d.ts +5 -0
  198. package/lib/typescript/commonjs/modules/ListenOptions.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/modules/SSLApp.d.ts +1 -0
  200. package/lib/typescript/commonjs/modules/SSLApp.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/modules/getParts.d.ts +6 -0
  202. package/lib/typescript/commonjs/modules/getParts.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/modules/index.d.ts +6 -0
  204. package/lib/typescript/commonjs/modules/index.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/modules/us_listen_socket_close.d.ts +5 -0
  206. package/lib/typescript/commonjs/modules/us_listen_socket_close.d.ts.map +1 -0
  207. package/lib/typescript/commonjs/modules/us_socket_local_port.d.ts +5 -0
  208. package/lib/typescript/commonjs/modules/us_socket_local_port.d.ts.map +1 -0
  209. package/lib/typescript/commonjs/package.json +1 -0
  210. package/lib/typescript/commonjs/types/AppDescriptor.d.ts +8 -0
  211. package/lib/typescript/commonjs/types/AppDescriptor.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/types/AppOptions.d.ts +17 -0
  213. package/lib/typescript/commonjs/types/AppOptions.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/types/HttpRequest.d.ts +54 -0
  215. package/lib/typescript/commonjs/types/HttpRequest.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/types/HttpResponse.d.ts +169 -0
  217. package/lib/typescript/commonjs/types/HttpResponse.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/types/HttpRouterOptions.d.ts +24 -0
  219. package/lib/typescript/commonjs/types/HttpRouterOptions.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/types/MultipartField.d.ts +7 -0
  221. package/lib/typescript/commonjs/types/MultipartField.d.ts.map +1 -0
  222. package/lib/typescript/commonjs/types/RecognizedString.d.ts +10 -0
  223. package/lib/typescript/commonjs/types/RecognizedString.d.ts.map +1 -0
  224. package/lib/typescript/commonjs/types/TemplatedApp.d.ts +108 -0
  225. package/lib/typescript/commonjs/types/TemplatedApp.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/types/WebSocket.d.ts +96 -0
  227. package/lib/typescript/commonjs/types/WebSocket.d.ts.map +1 -0
  228. package/lib/typescript/commonjs/types/WebSocketBehaviour.d.ts +1 -0
  229. package/lib/typescript/commonjs/types/WebSocketBehaviour.d.ts.map +1 -0
  230. package/lib/typescript/commonjs/types/index.d.ts +6 -0
  231. package/lib/typescript/commonjs/types/index.d.ts.map +1 -0
  232. package/lib/typescript/commonjs/types/us_listen_socket.d.ts +7 -0
  233. package/lib/typescript/commonjs/types/us_listen_socket.d.ts.map +1 -0
  234. package/lib/typescript/commonjs/types/us_socket.d.ts +7 -0
  235. package/lib/typescript/commonjs/types/us_socket.d.ts.map +1 -0
  236. package/lib/typescript/commonjs/types/us_socket_context_t.d.ts +7 -0
  237. package/lib/typescript/commonjs/types/us_socket_context_t.d.ts.map +1 -0
  238. package/lib/typescript/module/_internal/native-modules/NativeReactNativeUws.d.ts +22 -0
  239. package/lib/typescript/module/_internal/native-modules/NativeReactNativeUws.d.ts.map +1 -0
  240. package/lib/typescript/module/index.d.ts +3 -0
  241. package/lib/typescript/module/index.d.ts.map +1 -0
  242. package/lib/typescript/module/modules/App.d.ts +7 -0
  243. package/lib/typescript/module/modules/App.d.ts.map +1 -0
  244. package/lib/typescript/module/modules/CompressOptions.d.ts +1 -0
  245. package/lib/typescript/module/modules/CompressOptions.d.ts.map +1 -0
  246. package/lib/typescript/module/modules/EnvironmentVariables.d.ts +16 -0
  247. package/lib/typescript/module/modules/EnvironmentVariables.d.ts.map +1 -0
  248. package/lib/typescript/module/modules/ListenOptions.d.ts +5 -0
  249. package/lib/typescript/module/modules/ListenOptions.d.ts.map +1 -0
  250. package/lib/typescript/module/modules/SSLApp.d.ts +1 -0
  251. package/lib/typescript/module/modules/SSLApp.d.ts.map +1 -0
  252. package/lib/typescript/module/modules/getParts.d.ts +6 -0
  253. package/lib/typescript/module/modules/getParts.d.ts.map +1 -0
  254. package/lib/typescript/module/modules/index.d.ts +6 -0
  255. package/lib/typescript/module/modules/index.d.ts.map +1 -0
  256. package/lib/typescript/module/modules/us_listen_socket_close.d.ts +5 -0
  257. package/lib/typescript/module/modules/us_listen_socket_close.d.ts.map +1 -0
  258. package/lib/typescript/module/modules/us_socket_local_port.d.ts +5 -0
  259. package/lib/typescript/module/modules/us_socket_local_port.d.ts.map +1 -0
  260. package/lib/typescript/module/package.json +1 -0
  261. package/lib/typescript/module/types/AppDescriptor.d.ts +8 -0
  262. package/lib/typescript/module/types/AppDescriptor.d.ts.map +1 -0
  263. package/lib/typescript/module/types/AppOptions.d.ts +17 -0
  264. package/lib/typescript/module/types/AppOptions.d.ts.map +1 -0
  265. package/lib/typescript/module/types/HttpRequest.d.ts +54 -0
  266. package/lib/typescript/module/types/HttpRequest.d.ts.map +1 -0
  267. package/lib/typescript/module/types/HttpResponse.d.ts +169 -0
  268. package/lib/typescript/module/types/HttpResponse.d.ts.map +1 -0
  269. package/lib/typescript/module/types/HttpRouterOptions.d.ts +24 -0
  270. package/lib/typescript/module/types/HttpRouterOptions.d.ts.map +1 -0
  271. package/lib/typescript/module/types/MultipartField.d.ts +7 -0
  272. package/lib/typescript/module/types/MultipartField.d.ts.map +1 -0
  273. package/lib/typescript/module/types/RecognizedString.d.ts +10 -0
  274. package/lib/typescript/module/types/RecognizedString.d.ts.map +1 -0
  275. package/lib/typescript/module/types/TemplatedApp.d.ts +108 -0
  276. package/lib/typescript/module/types/TemplatedApp.d.ts.map +1 -0
  277. package/lib/typescript/module/types/WebSocket.d.ts +96 -0
  278. package/lib/typescript/module/types/WebSocket.d.ts.map +1 -0
  279. package/lib/typescript/module/types/WebSocketBehaviour.d.ts +1 -0
  280. package/lib/typescript/module/types/WebSocketBehaviour.d.ts.map +1 -0
  281. package/lib/typescript/module/types/index.d.ts +6 -0
  282. package/lib/typescript/module/types/index.d.ts.map +1 -0
  283. package/lib/typescript/module/types/us_listen_socket.d.ts +7 -0
  284. package/lib/typescript/module/types/us_listen_socket.d.ts.map +1 -0
  285. package/lib/typescript/module/types/us_socket.d.ts +7 -0
  286. package/lib/typescript/module/types/us_socket.d.ts.map +1 -0
  287. package/lib/typescript/module/types/us_socket_context_t.d.ts +7 -0
  288. package/lib/typescript/module/types/us_socket_context_t.d.ts.map +1 -0
  289. package/lib/typescript/tsconfig.tsbuildinfo +1 -0
  290. package/package.json +62 -0
  291. package/src/_internal/native-modules/NativeUwsReactNative.ts +40 -0
  292. package/src/index.ts +2 -0
  293. package/src/modules/App.ts +14 -0
  294. package/src/modules/CompressOptions.ts +101 -0
  295. package/src/modules/EnvironmentVariables.ts +16 -0
  296. package/src/modules/ListenOptions.ts +4 -0
  297. package/src/modules/SSLApp.ts +13 -0
  298. package/src/modules/getParts.ts +29 -0
  299. package/src/modules/index.ts +8 -0
  300. package/src/modules/us_listen_socket_close.ts +15 -0
  301. package/src/modules/us_socket_local_port.ts +16 -0
  302. package/src/types/AppDescriptor.ts +7 -0
  303. package/src/types/AppOptions.ts +22 -0
  304. package/src/types/HttpRequest.ts +74 -0
  305. package/src/types/HttpResponse.ts +309 -0
  306. package/src/types/HttpRouterOptions.ts +24 -0
  307. package/src/types/MultipartField.ts +6 -0
  308. package/src/types/RecognizedString.ts +11 -0
  309. package/src/types/TemplatedApp.ts +285 -0
  310. package/src/types/WebSocket.ts +147 -0
  311. package/src/types/WebSocketBehaviour.ts +137 -0
  312. package/src/types/index.ts +12 -0
  313. package/src/types/us_listen_socket.ts +6 -0
  314. package/src/types/us_socket.ts +6 -0
  315. package/src/types/us_socket_context_t.ts +6 -0
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Closes a uSockets listen socket.
3
+ */
4
+ export declare function us_listen_socket_close(token: number): void;
5
+ //# sourceMappingURL=us_listen_socket_close.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"us_listen_socket_close.d.ts","sourceRoot":"","sources":["../../../../src/modules/us_listen_socket_close.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,MAAM,QAIb"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Gets local port of socket (or listenSocket) or -1.
3
+ */
4
+ export declare function us_socket_local_port(token: number): number;
5
+ //# sourceMappingURL=us_socket_local_port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"us_socket_local_port.d.ts","sourceRoot":"","sources":["../../../../src/modules/us_socket_local_port.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,MAAM,GAEV,MAAM,CAET"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Native type representing a raw uWebSockets struct AppDescriptor.
3
+ * Used internally for worker thread distribution.
4
+ * Careful with this one, it is entirely unchecked and native so invalid usage will blow up.
5
+ */
6
+ export interface AppDescriptor {
7
+ }
8
+ //# sourceMappingURL=AppDescriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppDescriptor.d.ts","sourceRoot":"","sources":["../../../../src/types/AppDescriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;CAC7B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Options used when constructing an app. Especially for SSLApp.
3
+ * These are options passed directly to uSockets, C layer.
4
+ */
5
+ export interface AppOptions {
6
+ key_file_name?: string;
7
+ cert_file_name?: string;
8
+ ca_file_name?: string;
9
+ passphrase?: string;
10
+ dh_params_file_name?: string;
11
+ ssl_ciphers?: string;
12
+ /**
13
+ * This translates to SSL_MODE_RELEASE_BUFFERS
14
+ */
15
+ ssl_prefer_low_memory_usage?: boolean;
16
+ }
17
+ //# sourceMappingURL=AppOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppOptions.d.ts","sourceRoot":"","sources":["../../../../src/types/AppOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACtC"}
@@ -0,0 +1,54 @@
1
+ import type { RecognizedString } from "./RecognizedString";
2
+ /**
3
+ * An HttpRequest is stack allocated and only accessible during the callback invocation.
4
+ */
5
+ export interface HttpRequest {
6
+ /**
7
+ * Loops over all headers.
8
+ */
9
+ forEach(cb: (key: string, value: string) => void): void;
10
+ /**
11
+ * Returns the HTTP method as-is.
12
+ */
13
+ getCaseSensitiveMethod(): string;
14
+ /**
15
+ * Returns the lowercased header value or empty string.
16
+ */
17
+ getHeader(lowerCaseKey: RecognizedString): string;
18
+ /**
19
+ * Returns the lowercased HTTP method, useful for "any" routes.
20
+ */
21
+ getMethod(): string;
22
+ /**
23
+ * Returns the parsed parameter at index. Corresponds to route. Can also take the name of the parameter.
24
+ *
25
+ * @example
26
+ * ```js
27
+ * app.get("/profile/:userID/:type", (res, req) => {
28
+ * // get userID
29
+ * console.log("userID", req.getParameter(0), req.getParameter("userID"))
30
+ *
31
+ * // get type
32
+ * console.log("type", req.getParameter(1), req.getParameter("type"))
33
+ * })
34
+ * ```
35
+ */
36
+ getParameter(index: number | RecognizedString): string | undefined;
37
+ /**
38
+ * Returns the raw querystring (the part of URL after ? sign) or empty string.
39
+ */
40
+ getQuery(): string;
41
+ /**
42
+ * Returns a decoded query parameter value or undefined.
43
+ */
44
+ getQuery(key: string): string | undefined;
45
+ /**
46
+ * Returns the URL including initial /slash
47
+ */
48
+ getUrl(): string;
49
+ /**
50
+ * Setting yield to true is to say that this route handler did not handle the route, causing the router to continue looking for a matching route handler, or fail.
51
+ */
52
+ setYield(_yield: boolean): HttpRequest;
53
+ }
54
+ //# sourceMappingURL=HttpRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpRequest.d.ts","sourceRoot":"","sources":["../../../../src/types/HttpRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,MAAM,oBAAoB,CAAA;AAE3B;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,OAAO,CACN,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GACrC,IAAI,CAAC;IAET;;OAEG;IACH,sBAAsB,IAAK,MAAM,CAAC;IAElC;;OAEG;IACH,SAAS,CACR,YAAY,EAAE,gBAAgB,GAC3B,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,IAAK,MAAM,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,YAAY,CACX,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAC7B,MAAM,GAAG,SAAS,CAAC;IAEvB;;OAEG;IACH,QAAQ,IAAK,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CACP,GAAG,EAAE,MAAM,GACR,MAAM,GAAG,SAAS,CAAC;IAEvB;;OAEG;IACH,MAAM,IAAK,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CACP,MAAM,EAAE,OAAO,GACZ,WAAW,CAAC;CAChB"}
@@ -0,0 +1,169 @@
1
+ import type { RecognizedString } from "./RecognizedString";
2
+ /**
3
+ * An HttpResponse is valid until either onAborted callback or any of the .end/.tryEnd calls succeed. You may attach user data to this object.
4
+ */
5
+ export interface HttpResponse {
6
+ /**
7
+ * Immediately force closes the connection. Any onAborted callback will run.
8
+ */
9
+ close(): HttpResponse;
10
+ /**
11
+ * Corking a response is a performance improvement in both CPU and network, as you ready the IO system for writing multiple chunks at once.
12
+ *
13
+ * By default, you're corked in the immediately executing top portion of the route handler. In all other cases, such as when returning from
14
+ * await, or when being called back from an async database request or anything that isn't directly executing in the route handler, you'll want
15
+ * to cork before calling writeStatus, writeHeader or just write. Corking takes a callback in which you execute the writeHeader, writeStatus and
16
+ * such calls, in one atomic IO operation. This is important, not only for TCP but definitely for TLS where each write would otherwise result
17
+ * in one TLS block being sent off, each with one send syscall.
18
+ *
19
+ * Example usage:
20
+ *
21
+ * ```
22
+ * res.cork(() => {
23
+ * res.writeStatus("200 OK").writeHeader("Some", "Value").write("Hello world!"),
24
+ * }),
25
+ * ```
26
+ */
27
+ cork(cb: () => void): HttpResponse;
28
+ /**
29
+ * Ends this response by copying the contents of body.
30
+ */
31
+ end(body?: RecognizedString, closeConnection?: boolean): HttpResponse;
32
+ /**
33
+ * Ends this response without a body.
34
+ */
35
+ endWithoutBody(reportedContentLength?: number, closeConnection?: boolean): HttpResponse;
36
+ /**
37
+ * Returns the remote IP address as text.
38
+ */
39
+ getRemoteAddressAsText(): string;
40
+ /**
41
+ * Returns the remote port number.
42
+ */
43
+ getRemotePort(): number;
44
+ /**
45
+ * Returns the global byte write offset for this response. Use with onWritable.
46
+ */
47
+ getWriteOffset(): number;
48
+ /**
49
+ * Every HttpResponse MUST have an attached abort handler.
50
+ * If you do not respond to it immediately inside of the callback.
51
+ * Returning from an Http request handler without attaching
52
+ * (by calling onAborted) an abort handler is ill-use and will terminate.
53
+ * When this event emits, the response has been aborted and may not be used.
54
+ */
55
+ onAborted(handler: () => void): HttpResponse;
56
+ /**
57
+ * Handler for reading HTTP request body data.
58
+ * Must be attached before performing any asynchronous operation, otherwise data may be lost.
59
+ * You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making them zero length.
60
+ *
61
+ * ---
62
+ *
63
+ * **Note**
64
+ *
65
+ * If you have ever used uWebSockets or uWebSockets.js for Node.js,
66
+ * this handler/callback might be called lesser amount of times than normal uWebSockets due to predefined `onDataV2`
67
+ * that we already passed earlier in C++ side, and it might already finished before JS does an assignment or attachment to `onData`.
68
+ *
69
+ * We have to pass the `onDataV2` lambda in C++ early because doing late assignment to the `onDataV2` handler will do nothing or our handler is never getting called. This is also due to uWebSockets run at different thread, and make any JS calls always late (asynchronously), and that is also by design to prevent Main/UI thread blocking.
70
+ */
71
+ onData(handler: (chunk: ArrayBuffer, isLast: boolean) => void): void;
72
+ /**
73
+ * Handler for reading HTTP request body data. V2.
74
+ *
75
+ * Must be attached before performing any asynchronous operation, otherwise data may be lost.
76
+ * You MUST copy the data of chunk if maxRemainingBodyLength is not 0n. We Neuter ArrayBuffers on return, making them zero length.
77
+ *
78
+ * maxRemainingBodyLength is the known maximum of the remaining body length. Can be used to preallocate a receive buffer.
79
+ *
80
+ * ---
81
+ *
82
+ * **Note**
83
+ *
84
+ * If you have ever used uWebSockets or uWebSockets.js for Node.js,
85
+ * this handler/callback might be called lesser amount of times than normal uWebSockets due to predefined `onDataV2`
86
+ * that we already passed earlier in C++ side, and it might already finished before JS does an assignment or attachment to `onDataV2`.
87
+ *
88
+ * We have to pass the `onDataV2` lambda in C++ early because doing late assignment to the `onDataV2` handler will do nothing or our handler is never getting called. This is also due to uWebSockets run at different thread, and make any JS calls always late (asynchronously), and that is also by design to prevent Main/UI thread blocking.
89
+ */
90
+ onDataV2(handler: (chunk: ArrayBuffer, maxRemainingBodyLength: bigint) => void): void;
91
+ /**
92
+ * Handler for reading HTTP request body data only when all the body data has been retrieved,
93
+ * or the body size has reached the `maxBodySize` limit from your route handler options.
94
+ * A good case for a simple route handler that only needs to read complete body data.
95
+ *
96
+ * Not like the `onData` and `onDataV2`, this is a good option to save a bit of operation cost
97
+ * because uws-react-native passes an ArrayBuffer from C++ to JS only once when it is finished.
98
+ *
99
+ * This is an equivalent of `res.collectBody()` method from uWebSockets.js for Node.js,
100
+ * but to set max byte of body size, you have to set it through router options at the third arguments.
101
+ *
102
+ * @example
103
+ * ```
104
+ * app.post("/create", (res, req) => {
105
+ * let isAborted = false
106
+ * res.onAborted(() => {
107
+ * isAborted = true
108
+ * })
109
+ *
110
+ * if(!isAborted) {
111
+ * res.onFullData(chunk => {
112
+ * if(!isAborted) {
113
+ * res.end(`Body size is ${chunk.byteLength}`)
114
+ * }
115
+ * })
116
+ * }
117
+ * }, {
118
+ * maxBodySize: 1024 * 1024, // 1MB in byte
119
+ * })
120
+ * ```
121
+ */
122
+ onFullData(handler: (chunk: ArrayBuffer) => void): void;
123
+ /**
124
+ * Similar to `onFullData`, but it is for reading HTTP request body data in raw text.
125
+ *
126
+ * This is an alternative method to read ArrayBuffer chunk in string because the TextDecoder is
127
+ * missing in React Native 0.84 and older.
128
+ */
129
+ onFullDataText(handler: (chunk: string) => void): void;
130
+ /**
131
+ * Pause HTTP request body streaming (throttle).
132
+ * Some buffered data may still be sent to onData.
133
+ */
134
+ pause(): void;
135
+ /**
136
+ * Resume HTTP request body streaming (unthrottle).
137
+ */
138
+ resume(): void;
139
+ /**
140
+ * Ends this response, or tries to, by streaming appropriately sized chunks of body. Use in conjunction with onWritable. Returns tuple [ok, hasResponded].
141
+ */
142
+ tryEnd(fullBodyOrChunk: RecognizedString, totalSize: number): [boolean, boolean];
143
+ /**
144
+ * Enters or continues chunked encoding mode. Writes part of the response. End with zero length write. Returns true if no backpressure was added.
145
+ */
146
+ write(chunk: RecognizedString): boolean;
147
+ /**
148
+ * Writes key and value to HTTP response.
149
+ * See writeStatus and corking.
150
+ */
151
+ writeHeader(key: RecognizedString, value: RecognizedString): HttpResponse;
152
+ /**
153
+ * Writes the HTTP status message such as "200 OK".
154
+ * This has to be called first in any response, otherwise
155
+ * it will be called automatically with "200 OK".
156
+ *
157
+ * If you want to send custom headers in a WebSocket
158
+ * upgrade response, you have to call writeStatus with
159
+ * "101 Switching Protocols" before you call writeHeader,
160
+ * otherwise your first call to writeHeader will call
161
+ * writeStatus with "200 OK" and the upgrade will fail.
162
+ *
163
+ * As you can imagine, we format outgoing responses in a linear
164
+ * buffer, not in a hash table. You can read about this in
165
+ * the user manual under "corking".
166
+ */
167
+ writeStatus(status: RecognizedString): HttpResponse;
168
+ }
169
+ //# sourceMappingURL=HttpResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpRespon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AI,CAAC;IAEf;;OAEG;IACH,MAAM,IAAK,IAAI,CAAC;IAEhB;;OAEG;IACH,MAAM,CACL,eAAe,EAAE,gBAAgB,EACjC,SAAS,EAAE,MAAM,GACd,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAoBvB;;OAEG;IACH,KAAK,CACJ,KAAK,EAAE,gBAAgB,GACpB,OAAO,CAAC;IAEZ;;;OAGG;IACH,WAAW,CACV,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,gBAAgB,GACpB,YAAY,CAAC;IAEjB;;;;;;;;;;;;;;OAcG;IACH,WAAW,CACV,MAAM,EAAE,gBAAgB,GACrB,YAAY,CAAC;CAUjB"}
@@ -0,0 +1,24 @@
1
+ export interface HttpRouterOptions {
2
+ /**
3
+ * Optimize specific route handler by disable body reading.
4
+ * The `onData`, `onDataV2`, and `onFullData` method from response object will do nothing
5
+ * if the body read is disabled.
6
+ *
7
+ * This is an actual optimization, because uws-react-native has to predefined the body read
8
+ * (the res->onDataV2) internally from C++ side by default. So if you disable body reading
9
+ * in a specific route handler, uws-react-native will not do the predefined res->onDataV2 from C++ side at all.
10
+ *
11
+ * The reason why uws-react-native has to predefined the res->onDataV2 from C++ side, it is because we cannot do a sync call from uWebSockets C++ which run in arbitrary thread to JS, and late onDataV2 assignment will losing the body data. It is also by design that we run uWebSockets in another thread to prevent Main/UI thread blocking.
12
+ */
13
+ disableBodyRead?: boolean;
14
+ /**
15
+ * Limit max body data size reading in byte after it is accumulated with the next chunk. 1 mega bytes maxBodySize doesn't mean you will get 1 mega bytes data.
16
+ *
17
+ * This is useful to help the method from `HttpResponse` object
18
+ * like `onData`, `onDataV2`, and `onFullData` to limit the chunk you need to read from a request.
19
+ *
20
+ * This option does nothing if `disableBodyRead` option is true.
21
+ */
22
+ maxBodySize?: number;
23
+ }
24
+ //# sourceMappingURL=HttpRouterOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpRouterOptions.d.ts","sourceRoot":"","sources":["../../../../src/types/HttpRouterOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,7 @@
1
+ export interface MultipartField {
2
+ data: ArrayBuffer;
3
+ name: string;
4
+ type?: string;
5
+ filename?: string;
6
+ }
7
+ //# sourceMappingURL=MultipartField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartField.d.ts","sourceRoot":"","sources":["../../../../src/types/MultipartField.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Recognized string types, things C++ can read and understand as strings.
3
+ * "String" does not have to mean "text", it can also be "binary".
4
+ *
5
+ * Ironically, JavaScript strings are the least performant of all options, to pass or receive to/from C++.
6
+ * This because we expect UTF-8. JavaScript strings are Latin-1 or UTF-16 internally meaning extra copies and reinterpretation are required.
7
+ * That's why all events pass data by ArrayBuffer and not JavaScript strings, as they allow zero-copy data passing.
8
+ */
9
+ export type RecognizedString = string | ArrayBuffer;
10
+ //# sourceMappingURL=RecognizedString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecognizedString.d.ts","sourceRoot":"","sources":["../../../../src/types/RecognizedString.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,WAAW,CAAA"}
@@ -0,0 +1,108 @@
1
+ import type { ListenOptions } from "../modules/ListenOptions";
2
+ import type { HttpRequest } from "./HttpRequest";
3
+ import type { HttpResponse } from "./HttpResponse";
4
+ import type { HttpRouterOptions } from "./HttpRouterOptions";
5
+ import type { RecognizedString } from "./RecognizedString";
6
+ /**
7
+ * Definitions of the `App` and `SSLApp`. This is entirely copied from uWebSockets.js
8
+ */
9
+ export interface TemplatedApp {
10
+ /**
11
+ * Add a child app descriptor for worker thread distribution.
12
+ */
13
+ /**
14
+ * Adds a server name.
15
+ */
16
+ /**
17
+ * Closes all sockets including listen sockets. This will forcefully terminate all connections.
18
+ */
19
+ close(): void;
20
+ /**
21
+ * Browse to SNI domain. Used together with .get, .post and similar to attach routes under SNI domains.
22
+ */
23
+ domain(domain: string): TemplatedApp;
24
+ /**
25
+ * Attaches a "filter" function to track socket connections / disconnections.
26
+ */
27
+ filter(cb: (res: HttpResponse, count: number) => void | Promise<void>): TemplatedApp;
28
+ /**
29
+ * Returns the app descriptor for worker thread distribution.
30
+ */
31
+ /**
32
+ * Listens to hostname & port and sets Listen Options. Callback hands either false or a listen socket.
33
+ */
34
+ listen(host: RecognizedString, port: number, options: ListenOptions, cb: (id: number) => void | Promise<void>): TemplatedApp;
35
+ /**
36
+ * Listens to hostname & port. Callback hands either false or a listen socket.
37
+ */
38
+ listen(host: RecognizedString, port: number, cb: (token: number) => void | Promise<void>): TemplatedApp;
39
+ /**
40
+ * Listens to port and sets Listen Options. Callback hands either false or a listen socket.
41
+ */
42
+ listen(port: number, options: ListenOptions, cb: (token: number) => void | Promise<void>): TemplatedApp;
43
+ /**
44
+ * Listens to port. Callback hands either false or a listen socket.
45
+ */
46
+ listen(port: number, cb: (token: number) => void | Promise<void>): TemplatedApp;
47
+ /**
48
+ * Registers a synchronous callback on missing server names. See /examples/ServerName.js.
49
+ */
50
+ /**
51
+ * Returns number of subscribers for this topic.
52
+ */
53
+ numSubscribers(topic: RecognizedString): number;
54
+ /**
55
+ * Publishes a message under topic, for all WebSockets under this app. See WebSocket.publish.
56
+ */
57
+ publish(topic: RecognizedString, message: RecognizedString, isBinary?: boolean, compress?: boolean): boolean;
58
+ /**
59
+ * Remove a child app descriptor.
60
+ */
61
+ /**
62
+ * Removes a server name.
63
+ */
64
+ /**
65
+ * Listens to unix socket. Callback hands either false or a listen socket.
66
+ */
67
+ /**
68
+ * Registers an HTTP handler matching specified URL pattern on any HTTP method.
69
+ */
70
+ any(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
71
+ /**
72
+ * Registers an HTTP CONNECT handler matching specified URL pattern.
73
+ */
74
+ connect(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
75
+ /**
76
+ * Registers an HTTP DELETE handler matching specified URL pattern.
77
+ */
78
+ del(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
79
+ /**
80
+ * Registers an HTTP GET handler matching specified URL pattern.
81
+ */
82
+ get(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
83
+ /**
84
+ * Registers an HTTP HEAD handler matching specified URL pattern.
85
+ */
86
+ head(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
87
+ /**
88
+ * Registers an HTTP OPTIONS handler matching specified URL pattern.
89
+ */
90
+ options(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
91
+ /**
92
+ * Registers an HTTP PATCH handler matching specified URL pattern.
93
+ */
94
+ patch(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
95
+ /**
96
+ * Registers an HTTP POST handler matching specified URL pattern.
97
+ */
98
+ post(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
99
+ /**
100
+ * Registers an HTTP PUT handler matching specified URL pattern.
101
+ */
102
+ put(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
103
+ /**
104
+ * Registers an HTTP TRACE handler matching specified URL pattern.
105
+ */
106
+ trace(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void | Promise<void>, options?: HttpRouterOptions): TemplatedApp;
107
+ }
108
+ //# sourceMappingURL=TemplatedApp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplatedApp.d.ts","sourceRoot":"","sources":["../../../../src/types/TemplatedApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,MAAM,0BAA0B,CAAA;AAUjC,OAAO,KAAK,EACX,WAAW,EACX,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EACX,YAAY,EACZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EACX,iBAAiB,EACjB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EACX,gBAAgB,EAChB,MAAM,oBAAoB,CAAA;AAU3B;;GAEG;AACH,MAAM,WAAW,YAAY;IAE5B;;OAEG;IAOH;;OAEG;IAMH;;OAEG;IACH,KAAK,IAAK,IAAI,CAAC;IAEf;;OAEG;IACH,MAAM,CACL,MAAM,EAAE,MAAM,GACX,YAAY,CAAC;IAEjB;;OAEG;IACH,MAAM,CACL,EAAE,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAC3D,YAAY,CAAC;IAGjB;;OAEG;IAGH;;OAEG;IACH,MAAM,CACL,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,EACtB,EAAE,EAAE,CACH,EAAE,EAAE,MAAM,KAEN,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACtB,YAAY,CAAC;IAEjB;;OAEG;IACH,MAAM,CACL,IAAI,EAAE,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AO,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACtE,OAAO,CAAC,EAAE,iBAAiB,GACxB,YAAY,CAAC;IAEjB;;OAEG;IACH,KAAK,CACJ,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACtE,OAAO,CAAC,EAAE,iBAAiB,GACxB,YAAY,CAAC;CAGjB"}
@@ -0,0 +1,96 @@
1
+ import type { RecognizedString } from "./RecognizedString";
2
+ /**
3
+ * A WebSocket connection that is valid from open to close event.
4
+ * Read more about this in the user manual.
5
+ */
6
+ export interface WebSocket {
7
+ /**
8
+ * Sends a message. Returns 1 for success, 2 for dropped due to backpressure limit, and 0 for built up backpressure that will drain over time. You can check backpressure before or after sending by calling getBufferedAmount().
9
+ *
10
+ * Make sure you properly understand the concept of backpressure. Check the backpressure example file.
11
+ */
12
+ send(message: RecognizedString, isBinary?: boolean, compress?: boolean): number;
13
+ /**
14
+ * Returns the bytes buffered in backpressure. This is similar to the bufferedAmount property in the browser counterpart.
15
+ * Check backpressure example.
16
+ */
17
+ getBufferedAmount(): number;
18
+ /**
19
+ * Gracefully closes this WebSocket. Immediately calls the close handler.
20
+ * A WebSocket close message is sent with code and shortMessage.
21
+ */
22
+ end(code?: number, shortMessage?: RecognizedString): void;
23
+ /**
24
+ * Forcefully closes this WebSocket. Immediately calls the close handler.
25
+ * No WebSocket close message is sent.
26
+ */
27
+ close(): void;
28
+ /**
29
+ * Sends a ping control message. Returns sendStatus similar to WebSocket.send (regarding backpressure). This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...) in C++.
30
+ */
31
+ ping(message?: RecognizedString): number;
32
+ /**
33
+ * Subscribe to a topic.
34
+ */
35
+ subscribe(topic: RecognizedString): boolean;
36
+ /**
37
+ * Unsubscribe from a topic. Returns true on success, if the WebSocket was subscribed.
38
+ */
39
+ unsubscribe(topic: RecognizedString): boolean;
40
+ /**
41
+ * Returns whether this websocket is subscribed to topic.
42
+ */
43
+ isSubscribed(topic: RecognizedString): boolean;
44
+ /**
45
+ * Returns a list of topics this websocket is subscribed to.
46
+ */
47
+ getTopics(): string[];
48
+ /**
49
+ * Publish a message under topic. Backpressure is managed according to maxBackpressure, closeOnBackpressureLimit settings.
50
+ * Order is guaranteed since v20.
51
+ */
52
+ publish(topic: RecognizedString, message: RecognizedString, isBinary?: boolean, compress?: boolean): boolean;
53
+ /**
54
+ * See `HttpResponse.cork`. Takes a function in which the socket is corked (packing many sends into one single syscall/SSL block)
55
+ */
56
+ cork(cb: () => void): WebSocket;
57
+ /**
58
+ * Returns the remote IP address. Note that the returned IP is binary, not text.
59
+ *
60
+ * IPv4 is 4 byte long and can be converted to text by printing every byte as a digit between 0 and 255.
61
+ * IPv6 is 16 byte long and can be converted to text in similar ways, but you typically print digits in HEX.
62
+ *
63
+ * See getRemoteAddressAsText() for a text version.
64
+ *
65
+ * @experimental It's an experimental due to unstable of ArrayBuffer support from React Native.
66
+ */
67
+ getRemoteAddress(): ArrayBuffer;
68
+ /**
69
+ * Returns the remote IP address as text.
70
+ */
71
+ getRemoteAddressAsText(): string;
72
+ /**
73
+ * Returns the remote port number.
74
+ */
75
+ getRemotePort(): number;
76
+ /**
77
+ * Returns the UserData ~object~ string.
78
+ */
79
+ getUserData(): string;
80
+ /**
81
+ * Sends the first fragment of a fragmented message. Use for sending large messages in chunks.
82
+ * Returns 1 for success, 2 for dropped due to backpressure limit, and 0 for built up backpressure.
83
+ */
84
+ sendFirstFragment(message: RecognizedString, isBinary?: boolean, compress?: boolean): number;
85
+ /**
86
+ * Sends a middle fragment of a fragmented message.
87
+ * Returns 1 for success, 2 for dropped due to backpressure limit, and 0 for built up backpressure.
88
+ */
89
+ sendFragment(message: RecognizedString, compress?: boolean): number;
90
+ /**
91
+ * Sends the last fragment of a fragmented message.
92
+ * Returns 1 for success, 2 for dropped due to backpressure limit, and 0 for built up backpressure.
93
+ */
94
+ sendLastFragment(message: RecognizedString, compress?: boolean): number;
95
+ }
96
+ //# sourceMappingURL=WebSocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocket.d.ts","sourceRoot":"","sources":["../../../../src/types/WebSocket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,MAAM,oBAAoB,CAAA;AAE3B;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB;;;;OAIM;IACN,IAAI,CACH,OAAO,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,OAAO,EAClB,QAAQ,CAAC,EAAE,OAAO,GACf,MAAM,CAAC;IAEX;;;OAGM;IACN,iBAAiB,IAAK,MAAM,CAAC;IAE7B;;;OAGM;IACN,GAAG,CACF,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,gBAAgB,GAC5B,IAAI,CAAC;IAET;;;OAGM;IACN,KAAK,IAAK,IAAI,CAAC;IAEf;;OAEG;IACH,IAAI,CACH,OAAO,CAAC,EAAE,gBAAgB,GACvB,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,CACR,KAAK,EAAE,gBAAgB,GACpB,OAAO,CAAC;IAEZ;;OAEG;IACH,WAAW,CACV,KAAK,EAAE,gBAAgB,GACpB,OAAO,CAAC;IAEZ;;OAEG;IACH,YAAY,CACX,KAAK,EAAE,gBAAgB,GACpB,OAAO,CAAC;IAEZ;;OAEG;IACH,SAAS,IAAK,MAAM,EAAE,CAAC;IAEvB;;;OAGM;IACN,OAAO,CACN,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,OAAO,EAClB,QAAQ,CAAC,EAAE,OAAO,GACf,OAAO,CAAC;IAEZ;;OAEG;IACH,IAAI,CACH,EAAE,EAAE,MAAM,IAAI,GACX,SAAS,CAAiB;IAE9B;;;;;;;;;OASM;IACN,gBAAgB,IAAK,WAAW,CAAC;IAEjC;;OAEG;IACH,sBAAsB,IAAsB,MAAM,CAAC;IAEnD;;OAEG;IACH,aAAa,IAAK,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,IAAmB,MAAM,CAAC;IAErC;;;OAGM;IACN,iBAAiB,CAChB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,OAAO,EAClB,QAAQ,CAAC,EAAE,OAAO,GACf,MAAM,CAAC;IAEX;;;OAGM;IACN,YAAY,CACX,OAAO,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,OAAO,GACf,MAAM,CAAC;IAEX;;;OAGM;IACN,gBAAgB,CACf,OAAO,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,OAAO,GACf,MAAM,CAAC;CACX"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=WebSocketBehaviour.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketBehaviour.d.ts","sourceRoot":"","sources":["../../../../src/types/WebSocketBehaviour.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export type * from "./HttpRequest";
2
+ export type * from "./HttpResponse";
3
+ export type * from "./MultipartField";
4
+ export type * from "./RecognizedString";
5
+ export type * from "./TemplatedApp";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAEA,mBAAmB,eAAe,CAAA;AAClC,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,gBAAgB,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Native type representing a raw uSockets struct us_listen_socket_t.
3
+ * Careful with this one, it is entirely unchecked and native so invalid usage will blow up.
4
+ */
5
+ export interface us_listen_socket {
6
+ }
7
+ //# sourceMappingURL=us_listen_socket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"us_listen_socket.d.ts","sourceRoot":"","sources":["../../../../src/types/us_listen_socket.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;CAChC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Native type representing a raw uSockets struct us_socket_t.
3
+ * Careful with this one, it is entirely unchecked and native so invalid usage will blow up.
4
+ */
5
+ export interface us_socket {
6
+ }
7
+ //# sourceMappingURL=us_socket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"us_socket.d.ts","sourceRoot":"","sources":["../../../../src/types/us_socket.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;CACzB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Native type representing a raw uSockets struct us_socket_context_t.
3
+ * Used while upgrading a WebSocket manually.
4
+ */
5
+ export interface us_socket_context_t {
6
+ }
7
+ //# sourceMappingURL=us_socket_context_t.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"us_socket_context_t.d.ts","sourceRoot":"","sources":["../../../../src/types/us_socket_context_t.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;CACnC"}