@vforsh/argus-watcher 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/cdp/mouse.d.ts +19 -3
  3. package/dist/cdp/mouse.d.ts.map +1 -1
  4. package/dist/cdp/mouse.js +57 -9
  5. package/dist/cdp/mouse.js.map +1 -1
  6. package/dist/cdp/pageIndicator.d.ts +5 -0
  7. package/dist/cdp/pageIndicator.d.ts.map +1 -1
  8. package/dist/cdp/pageIndicator.js +22 -254
  9. package/dist/cdp/pageIndicator.js.map +1 -1
  10. package/dist/cdp/pageIndicatorScript.d.ts +20 -0
  11. package/dist/cdp/pageIndicatorScript.d.ts.map +1 -0
  12. package/dist/cdp/pageIndicatorScript.js +405 -0
  13. package/dist/cdp/pageIndicatorScript.js.map +1 -0
  14. package/dist/cdp/recording.d.ts +15 -0
  15. package/dist/cdp/recording.d.ts.map +1 -0
  16. package/dist/cdp/recording.js +389 -0
  17. package/dist/cdp/recording.js.map +1 -0
  18. package/dist/cdp/screenshot.d.ts.map +1 -1
  19. package/dist/cdp/screenshot.js +2 -133
  20. package/dist/cdp/screenshot.js.map +1 -1
  21. package/dist/cdp/visualCapture.d.ts +38 -0
  22. package/dist/cdp/visualCapture.d.ts.map +1 -0
  23. package/dist/cdp/visualCapture.js +156 -0
  24. package/dist/cdp/visualCapture.js.map +1 -0
  25. package/dist/events.d.ts +1 -1
  26. package/dist/events.d.ts.map +1 -1
  27. package/dist/http/routes/authCookies.d.ts +5 -10
  28. package/dist/http/routes/authCookies.d.ts.map +1 -1
  29. package/dist/http/routes/authCookies.js +17 -30
  30. package/dist/http/routes/authCookies.js.map +1 -1
  31. package/dist/http/routes/defineDomTargetRoute.d.ts +14 -5
  32. package/dist/http/routes/defineDomTargetRoute.d.ts.map +1 -1
  33. package/dist/http/routes/defineDomTargetRoute.js +27 -33
  34. package/dist/http/routes/defineDomTargetRoute.js.map +1 -1
  35. package/dist/http/routes/defineRoute.d.ts +9 -0
  36. package/dist/http/routes/defineRoute.d.ts.map +1 -1
  37. package/dist/http/routes/defineRoute.js +9 -9
  38. package/dist/http/routes/defineRoute.js.map +1 -1
  39. package/dist/http/routes/domSelectorRoute.d.ts +4 -11
  40. package/dist/http/routes/domSelectorRoute.d.ts.map +1 -1
  41. package/dist/http/routes/domSelectorRoute.js +9 -17
  42. package/dist/http/routes/domSelectorRoute.js.map +1 -1
  43. package/dist/http/routes/getAuthCookies.d.ts +1 -2
  44. package/dist/http/routes/getAuthCookies.d.ts.map +1 -1
  45. package/dist/http/routes/getAuthCookies.js +14 -14
  46. package/dist/http/routes/getAuthCookies.js.map +1 -1
  47. package/dist/http/routes/getAuthState.d.ts +1 -2
  48. package/dist/http/routes/getAuthState.d.ts.map +1 -1
  49. package/dist/http/routes/getAuthState.js +13 -13
  50. package/dist/http/routes/getAuthState.js.map +1 -1
  51. package/dist/http/routes/getDialog.d.ts +1 -2
  52. package/dist/http/routes/getDialog.d.ts.map +1 -1
  53. package/dist/http/routes/getDialog.js +7 -10
  54. package/dist/http/routes/getDialog.js.map +1 -1
  55. package/dist/http/routes/getEmulation.d.ts +1 -2
  56. package/dist/http/routes/getEmulation.d.ts.map +1 -1
  57. package/dist/http/routes/getEmulation.js +7 -7
  58. package/dist/http/routes/getEmulation.js.map +1 -1
  59. package/dist/http/routes/getExtensionDiagnostics.d.ts +2 -0
  60. package/dist/http/routes/getExtensionDiagnostics.d.ts.map +1 -0
  61. package/dist/http/routes/getExtensionDiagnostics.js +16 -0
  62. package/dist/http/routes/getExtensionDiagnostics.js.map +1 -0
  63. package/dist/http/routes/getExtensionTabs.d.ts +1 -2
  64. package/dist/http/routes/getExtensionTabs.d.ts.map +1 -1
  65. package/dist/http/routes/getExtensionTabs.js +18 -16
  66. package/dist/http/routes/getExtensionTabs.js.map +1 -1
  67. package/dist/http/routes/getLogs.d.ts +1 -2
  68. package/dist/http/routes/getLogs.d.ts.map +1 -1
  69. package/dist/http/routes/getLogs.js +31 -26
  70. package/dist/http/routes/getLogs.js.map +1 -1
  71. package/dist/http/routes/getNet.d.ts +1 -2
  72. package/dist/http/routes/getNet.d.ts.map +1 -1
  73. package/dist/http/routes/getNet.js +19 -21
  74. package/dist/http/routes/getNet.js.map +1 -1
  75. package/dist/http/routes/getNetRequest.d.ts +1 -2
  76. package/dist/http/routes/getNetRequest.d.ts.map +1 -1
  77. package/dist/http/routes/getNetRequest.js +22 -20
  78. package/dist/http/routes/getNetRequest.js.map +1 -1
  79. package/dist/http/routes/getNetRequestBody.d.ts +1 -2
  80. package/dist/http/routes/getNetRequestBody.d.ts.map +1 -1
  81. package/dist/http/routes/getNetRequestBody.js +53 -51
  82. package/dist/http/routes/getNetRequestBody.js.map +1 -1
  83. package/dist/http/routes/getNetRequests.d.ts +1 -2
  84. package/dist/http/routes/getNetRequests.d.ts.map +1 -1
  85. package/dist/http/routes/getNetRequests.js +19 -21
  86. package/dist/http/routes/getNetRequests.js.map +1 -1
  87. package/dist/http/routes/getNetSse.d.ts +1 -2
  88. package/dist/http/routes/getNetSse.d.ts.map +1 -1
  89. package/dist/http/routes/getNetSse.js +19 -21
  90. package/dist/http/routes/getNetSse.js.map +1 -1
  91. package/dist/http/routes/getNetTail.d.ts +1 -2
  92. package/dist/http/routes/getNetTail.d.ts.map +1 -1
  93. package/dist/http/routes/getNetTail.js +21 -30
  94. package/dist/http/routes/getNetTail.js.map +1 -1
  95. package/dist/http/routes/getNetWebSocketConnection.d.ts +1 -2
  96. package/dist/http/routes/getNetWebSocketConnection.d.ts.map +1 -1
  97. package/dist/http/routes/getNetWebSocketConnection.js +22 -17
  98. package/dist/http/routes/getNetWebSocketConnection.js.map +1 -1
  99. package/dist/http/routes/getNetWebSockets.d.ts +1 -2
  100. package/dist/http/routes/getNetWebSockets.d.ts.map +1 -1
  101. package/dist/http/routes/getNetWebSockets.js +19 -21
  102. package/dist/http/routes/getNetWebSockets.js.map +1 -1
  103. package/dist/http/routes/getStatus.d.ts +1 -2
  104. package/dist/http/routes/getStatus.d.ts.map +1 -1
  105. package/dist/http/routes/getStatus.js +6 -4
  106. package/dist/http/routes/getStatus.js.map +1 -1
  107. package/dist/http/routes/getTail.d.ts +1 -2
  108. package/dist/http/routes/getTail.d.ts.map +1 -1
  109. package/dist/http/routes/getTail.js +31 -26
  110. package/dist/http/routes/getTail.js.map +1 -1
  111. package/dist/http/routes/getTargets.d.ts +1 -2
  112. package/dist/http/routes/getTargets.d.ts.map +1 -1
  113. package/dist/http/routes/getTargets.js +14 -13
  114. package/dist/http/routes/getTargets.js.map +1 -1
  115. package/dist/http/routes/getThrottle.d.ts +1 -2
  116. package/dist/http/routes/getThrottle.d.ts.map +1 -1
  117. package/dist/http/routes/getThrottle.js +7 -7
  118. package/dist/http/routes/getThrottle.js.map +1 -1
  119. package/dist/http/routes/index.d.ts +5 -1
  120. package/dist/http/routes/index.d.ts.map +1 -1
  121. package/dist/http/routes/index.js +121 -114
  122. package/dist/http/routes/index.js.map +1 -1
  123. package/dist/http/routes/netFilters.d.ts +10 -0
  124. package/dist/http/routes/netFilters.d.ts.map +1 -1
  125. package/dist/http/routes/netFilters.js +23 -1
  126. package/dist/http/routes/netFilters.js.map +1 -1
  127. package/dist/http/routes/netMock.d.ts +3 -0
  128. package/dist/http/routes/netMock.d.ts.map +1 -0
  129. package/dist/http/routes/netMock.js +141 -0
  130. package/dist/http/routes/netMock.js.map +1 -0
  131. package/dist/http/routes/postAttach.d.ts +1 -2
  132. package/dist/http/routes/postAttach.d.ts.map +1 -1
  133. package/dist/http/routes/postAttach.js +23 -22
  134. package/dist/http/routes/postAttach.js.map +1 -1
  135. package/dist/http/routes/postAuthStateLoad.d.ts +1 -2
  136. package/dist/http/routes/postAuthStateLoad.d.ts.map +1 -1
  137. package/dist/http/routes/postAuthStateLoad.js +29 -34
  138. package/dist/http/routes/postAuthStateLoad.js.map +1 -1
  139. package/dist/http/routes/postCodeEdit.d.ts +1 -2
  140. package/dist/http/routes/postCodeEdit.d.ts.map +1 -1
  141. package/dist/http/routes/postCodeEdit.js +20 -25
  142. package/dist/http/routes/postCodeEdit.js.map +1 -1
  143. package/dist/http/routes/postCodeGrep.d.ts +1 -2
  144. package/dist/http/routes/postCodeGrep.d.ts.map +1 -1
  145. package/dist/http/routes/postCodeGrep.js +20 -25
  146. package/dist/http/routes/postCodeGrep.js.map +1 -1
  147. package/dist/http/routes/postCodeList.d.ts +1 -2
  148. package/dist/http/routes/postCodeList.d.ts.map +1 -1
  149. package/dist/http/routes/postCodeList.js +14 -19
  150. package/dist/http/routes/postCodeList.js.map +1 -1
  151. package/dist/http/routes/postCodeRead.d.ts +1 -2
  152. package/dist/http/routes/postCodeRead.d.ts.map +1 -1
  153. package/dist/http/routes/postCodeRead.js +24 -29
  154. package/dist/http/routes/postCodeRead.js.map +1 -1
  155. package/dist/http/routes/postDetach.d.ts +1 -2
  156. package/dist/http/routes/postDetach.d.ts.map +1 -1
  157. package/dist/http/routes/postDetach.js +23 -22
  158. package/dist/http/routes/postDetach.js.map +1 -1
  159. package/dist/http/routes/postDialog.d.ts +1 -2
  160. package/dist/http/routes/postDialog.d.ts.map +1 -1
  161. package/dist/http/routes/postDialog.js +30 -29
  162. package/dist/http/routes/postDialog.js.map +1 -1
  163. package/dist/http/routes/postDomAdd.d.ts +1 -2
  164. package/dist/http/routes/postDomAdd.d.ts.map +1 -1
  165. package/dist/http/routes/postDomAdd.js +44 -48
  166. package/dist/http/routes/postDomAdd.js.map +1 -1
  167. package/dist/http/routes/postDomClick.d.ts +0 -1
  168. package/dist/http/routes/postDomClick.d.ts.map +1 -1
  169. package/dist/http/routes/postDomClick.js +12 -21
  170. package/dist/http/routes/postDomClick.js.map +1 -1
  171. package/dist/http/routes/postDomDrag.d.ts +2 -0
  172. package/dist/http/routes/postDomDrag.d.ts.map +1 -0
  173. package/dist/http/routes/postDomDrag.js +54 -0
  174. package/dist/http/routes/postDomDrag.js.map +1 -0
  175. package/dist/http/routes/postDomFill.d.ts +1 -2
  176. package/dist/http/routes/postDomFill.d.ts.map +1 -1
  177. package/dist/http/routes/postDomFill.js +17 -49
  178. package/dist/http/routes/postDomFill.js.map +1 -1
  179. package/dist/http/routes/postDomInfo.d.ts +1 -2
  180. package/dist/http/routes/postDomInfo.d.ts.map +1 -1
  181. package/dist/http/routes/postDomInfo.js +14 -20
  182. package/dist/http/routes/postDomInfo.js.map +1 -1
  183. package/dist/http/routes/postDomKeydown.d.ts +1 -2
  184. package/dist/http/routes/postDomKeydown.d.ts.map +1 -1
  185. package/dist/http/routes/postDomKeydown.js +26 -30
  186. package/dist/http/routes/postDomKeydown.js.map +1 -1
  187. package/dist/http/routes/postDomModify.d.ts +1 -2
  188. package/dist/http/routes/postDomModify.d.ts.map +1 -1
  189. package/dist/http/routes/postDomModify.js +30 -41
  190. package/dist/http/routes/postDomModify.js.map +1 -1
  191. package/dist/http/routes/postDomRemove.d.ts +1 -2
  192. package/dist/http/routes/postDomRemove.d.ts.map +1 -1
  193. package/dist/http/routes/postDomRemove.js +13 -18
  194. package/dist/http/routes/postDomRemove.js.map +1 -1
  195. package/dist/http/routes/postDomScroll.d.ts +1 -2
  196. package/dist/http/routes/postDomScroll.d.ts.map +1 -1
  197. package/dist/http/routes/postDomScroll.js +37 -42
  198. package/dist/http/routes/postDomScroll.js.map +1 -1
  199. package/dist/http/routes/postDomScrollTo.d.ts +1 -2
  200. package/dist/http/routes/postDomScrollTo.d.ts.map +1 -1
  201. package/dist/http/routes/postDomScrollTo.js +42 -48
  202. package/dist/http/routes/postDomScrollTo.js.map +1 -1
  203. package/dist/http/routes/postDomSetFile.d.ts +1 -2
  204. package/dist/http/routes/postDomSetFile.d.ts.map +1 -1
  205. package/dist/http/routes/postDomSetFile.js +29 -32
  206. package/dist/http/routes/postDomSetFile.js.map +1 -1
  207. package/dist/http/routes/postDomTree.d.ts +1 -2
  208. package/dist/http/routes/postDomTree.d.ts.map +1 -1
  209. package/dist/http/routes/postDomTree.js +13 -17
  210. package/dist/http/routes/postDomTree.js.map +1 -1
  211. package/dist/http/routes/postEmulation.d.ts +1 -2
  212. package/dist/http/routes/postEmulation.d.ts.map +1 -1
  213. package/dist/http/routes/postEmulation.js +29 -39
  214. package/dist/http/routes/postEmulation.js.map +1 -1
  215. package/dist/http/routes/postEval.d.ts +1 -2
  216. package/dist/http/routes/postEval.d.ts.map +1 -1
  217. package/dist/http/routes/postEval.js +22 -26
  218. package/dist/http/routes/postEval.js.map +1 -1
  219. package/dist/http/routes/postLocate.d.ts +2 -4
  220. package/dist/http/routes/postLocate.d.ts.map +1 -1
  221. package/dist/http/routes/postLocate.js +40 -60
  222. package/dist/http/routes/postLocate.js.map +1 -1
  223. package/dist/http/routes/postNetClear.d.ts +1 -2
  224. package/dist/http/routes/postNetClear.d.ts.map +1 -1
  225. package/dist/http/routes/postNetClear.js +14 -13
  226. package/dist/http/routes/postNetClear.js.map +1 -1
  227. package/dist/http/routes/postRecord.d.ts +3 -0
  228. package/dist/http/routes/postRecord.d.ts.map +1 -0
  229. package/dist/http/routes/postRecord.js +88 -0
  230. package/dist/http/routes/postRecord.js.map +1 -0
  231. package/dist/http/routes/postReload.d.ts +1 -2
  232. package/dist/http/routes/postReload.d.ts.map +1 -1
  233. package/dist/http/routes/postReload.js +10 -16
  234. package/dist/http/routes/postReload.js.map +1 -1
  235. package/dist/http/routes/postScreenshot.d.ts +1 -2
  236. package/dist/http/routes/postScreenshot.d.ts.map +1 -1
  237. package/dist/http/routes/postScreenshot.js +11 -22
  238. package/dist/http/routes/postScreenshot.js.map +1 -1
  239. package/dist/http/routes/postShutdown.d.ts +1 -2
  240. package/dist/http/routes/postShutdown.d.ts.map +1 -1
  241. package/dist/http/routes/postShutdown.js +15 -11
  242. package/dist/http/routes/postShutdown.js.map +1 -1
  243. package/dist/http/routes/postSnapshot.d.ts +1 -2
  244. package/dist/http/routes/postSnapshot.d.ts.map +1 -1
  245. package/dist/http/routes/postSnapshot.js +21 -26
  246. package/dist/http/routes/postSnapshot.js.map +1 -1
  247. package/dist/http/routes/postThrottle.d.ts +1 -2
  248. package/dist/http/routes/postThrottle.d.ts.map +1 -1
  249. package/dist/http/routes/postThrottle.js +26 -35
  250. package/dist/http/routes/postThrottle.js.map +1 -1
  251. package/dist/http/routes/postTraceStart.d.ts +1 -2
  252. package/dist/http/routes/postTraceStart.d.ts.map +1 -1
  253. package/dist/http/routes/postTraceStart.js +8 -16
  254. package/dist/http/routes/postTraceStart.js.map +1 -1
  255. package/dist/http/routes/postTraceStop.d.ts +1 -2
  256. package/dist/http/routes/postTraceStop.d.ts.map +1 -1
  257. package/dist/http/routes/postTraceStop.js +8 -16
  258. package/dist/http/routes/postTraceStop.js.map +1 -1
  259. package/dist/http/routes/postVisibility.d.ts +1 -2
  260. package/dist/http/routes/postVisibility.d.ts.map +1 -1
  261. package/dist/http/routes/postVisibility.js +21 -27
  262. package/dist/http/routes/postVisibility.js.map +1 -1
  263. package/dist/http/routes/storage.d.ts +2 -4
  264. package/dist/http/routes/storage.d.ts.map +1 -1
  265. package/dist/http/routes/storage.js +13 -25
  266. package/dist/http/routes/storage.js.map +1 -1
  267. package/dist/http/server.d.ts +6 -1
  268. package/dist/http/server.d.ts.map +1 -1
  269. package/dist/http/server.js.map +1 -1
  270. package/dist/index.d.ts +5 -5
  271. package/dist/index.d.ts.map +1 -1
  272. package/dist/index.js.map +1 -1
  273. package/dist/native-messaging/control-session-manager.d.ts +36 -0
  274. package/dist/native-messaging/control-session-manager.d.ts.map +1 -0
  275. package/dist/native-messaging/control-session-manager.js +96 -0
  276. package/dist/native-messaging/control-session-manager.js.map +1 -0
  277. package/dist/native-messaging/messaging.d.ts +4 -4
  278. package/dist/native-messaging/messaging.d.ts.map +1 -1
  279. package/dist/native-messaging/messaging.js.map +1 -1
  280. package/dist/native-messaging/session-manager.d.ts +2 -15
  281. package/dist/native-messaging/session-manager.d.ts.map +1 -1
  282. package/dist/native-messaging/session-manager.js +0 -34
  283. package/dist/native-messaging/session-manager.js.map +1 -1
  284. package/dist/native-messaging/types.d.ts +78 -2
  285. package/dist/native-messaging/types.d.ts.map +1 -1
  286. package/dist/net/NetMockController.d.ts +26 -0
  287. package/dist/net/NetMockController.d.ts.map +1 -0
  288. package/dist/net/NetMockController.js +264 -0
  289. package/dist/net/NetMockController.js.map +1 -0
  290. package/dist/runtime/watcherServices.d.ts +3 -0
  291. package/dist/runtime/watcherServices.d.ts.map +1 -1
  292. package/dist/runtime/watcherServices.js +14 -1
  293. package/dist/runtime/watcherServices.js.map +1 -1
  294. package/dist/runtime/watcherSetup.d.ts +3 -0
  295. package/dist/runtime/watcherSetup.d.ts.map +1 -1
  296. package/dist/runtime/watcherSetup.js +4 -0
  297. package/dist/runtime/watcherSetup.js.map +1 -1
  298. package/dist/scripts/install-host.js +58 -54
  299. package/dist/scripts/install-host.js.map +1 -1
  300. package/dist/sources/extension-control-source.d.ts +9 -0
  301. package/dist/sources/extension-control-source.d.ts.map +1 -0
  302. package/dist/sources/extension-control-source.js +109 -0
  303. package/dist/sources/extension-control-source.js.map +1 -0
  304. package/dist/sources/extension-frame-state.d.ts +5 -0
  305. package/dist/sources/extension-frame-state.d.ts.map +1 -1
  306. package/dist/sources/extension-frame-state.js +7 -0
  307. package/dist/sources/extension-frame-state.js.map +1 -1
  308. package/dist/sources/extension-source.d.ts +3 -1
  309. package/dist/sources/extension-source.d.ts.map +1 -1
  310. package/dist/sources/extension-source.js +50 -137
  311. package/dist/sources/extension-source.js.map +1 -1
  312. package/dist/sources/extension-target-recovery.d.ts +32 -0
  313. package/dist/sources/extension-target-recovery.d.ts.map +1 -0
  314. package/dist/sources/extension-target-recovery.js +114 -0
  315. package/dist/sources/extension-target-recovery.js.map +1 -0
  316. package/dist/sources/types.d.ts +8 -3
  317. package/dist/sources/types.d.ts.map +1 -1
  318. package/dist/startWatcherRuntime.d.ts.map +1 -1
  319. package/dist/startWatcherRuntime.js +12 -2
  320. package/dist/startWatcherRuntime.js.map +1 -1
  321. package/package.json +1 -1
  322. package/dist/http/routes/postStorageLocal.d.ts +0 -2
  323. package/dist/http/routes/postStorageLocal.d.ts.map +0 -1
  324. package/dist/http/routes/postStorageLocal.js +0 -3
  325. package/dist/http/routes/postStorageLocal.js.map +0 -1
  326. package/dist/http/routes/postStorageSession.d.ts +0 -2
  327. package/dist/http/routes/postStorageSession.d.ts.map +0 -1
  328. package/dist/http/routes/postStorageSession.js +0 -3
  329. package/dist/http/routes/postStorageSession.js.map +0 -1
@@ -1,58 +1,60 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { respondError, respondJson } from '../httpUtils.js';
3
3
  import { normalizeNetBodyError, readNetworkBody } from '../../cdp/networkBody.js';
4
+ import { respondNetDisabled } from './netFilters.js';
4
5
  import { parseNetRequestLookup, resolveNetRequestLookupRecord } from './netRequestLookup.js';
5
- export const handle = async (_req, res, url, ctx) => {
6
- if (!ctx.netBuffer) {
7
- return respondJson(res, { ok: false, error: { code: 'net_disabled', message: 'Network capture is disabled for this watcher' } }, 400);
8
- }
9
- const lookup = parseNetRequestLookup(url.searchParams);
10
- if (!lookup) {
11
- return respondJson(res, { ok: false, error: { code: 'invalid_request', message: 'Either id or requestId is required' } }, 400);
12
- }
13
- const part = parseBodyPart(url.searchParams.get('part'));
14
- if (!part) {
15
- return respondJson(res, { ok: false, error: { code: 'invalid_request', message: 'part must be "request" or "response"' } }, 400);
16
- }
17
- emitRequest(ctx, res, 'net/request/body', {
18
- id: lookup.id,
19
- requestId: lookup.requestId,
20
- part,
21
- });
22
- const record = resolveNetRequestLookupRecord(ctx.netBuffer, lookup);
23
- if (!record) {
24
- return respondJson(res, { ok: false, error: { code: 'not_found', message: 'Network request not found' } }, 404);
25
- }
26
- const { detail: request, bodySessionId } = record;
27
- if (!request.body[part]) {
28
- return respondJson(res, { ok: false, error: { code: 'body_not_available', message: `${capitalizePart(part)} body not available for this request` } }, 404);
29
- }
30
- try {
31
- const body = await readNetworkBody({
32
- session: ctx.pageCdpSession,
33
- request,
34
- sessionId: resolveBodySessionId(ctx, request.frameId, bodySessionId),
35
- part,
36
- });
37
- const response = {
38
- ok: true,
39
- id: request.id,
40
- requestId: request.requestId,
41
- part,
42
- mimeType: body.mimeType,
43
- body: body.body,
44
- base64Encoded: body.base64Encoded,
45
- };
46
- respondJson(res, response);
47
- }
48
- catch (error) {
49
- const normalizedError = normalizeNetBodyError(error, part);
50
- if (normalizedError.code === 'body_not_available') {
51
- return respondJson(res, { ok: false, error: { code: 'body_not_available', message: normalizedError.message } }, 404);
6
+ import { respondJson } from '../httpUtils.js';
7
+ export const route = defineJsonRoute({
8
+ method: 'GET',
9
+ path: '/net/request/body',
10
+ handle: async ({ res, url, ctx }) => {
11
+ if (!ctx.netBuffer) {
12
+ return respondNetDisabled(res);
52
13
  }
53
- respondError(res, normalizedError);
54
- }
55
- };
14
+ const lookup = parseNetRequestLookup(url.searchParams);
15
+ if (!lookup) {
16
+ return respondJson(res, { ok: false, error: { code: 'invalid_request', message: 'Either id or requestId is required' } }, 400);
17
+ }
18
+ const part = parseBodyPart(url.searchParams.get('part'));
19
+ if (!part) {
20
+ return respondJson(res, { ok: false, error: { code: 'invalid_request', message: 'part must be "request" or "response"' } }, 400);
21
+ }
22
+ emitRequest(ctx, res, 'net/request/body', { id: lookup.id, requestId: lookup.requestId, part });
23
+ const record = resolveNetRequestLookupRecord(ctx.netBuffer, lookup);
24
+ if (!record) {
25
+ return respondJson(res, { ok: false, error: { code: 'not_found', message: 'Network request not found' } }, 404);
26
+ }
27
+ const { detail: request, bodySessionId } = record;
28
+ if (!request.body[part]) {
29
+ return respondJson(res, { ok: false, error: { code: 'body_not_available', message: `${capitalizePart(part)} body not available for this request` } }, 404);
30
+ }
31
+ try {
32
+ const body = await readNetworkBody({
33
+ session: ctx.pageCdpSession,
34
+ request,
35
+ sessionId: resolveBodySessionId(ctx, request.frameId, bodySessionId),
36
+ part,
37
+ });
38
+ return {
39
+ ok: true,
40
+ id: request.id,
41
+ requestId: request.requestId,
42
+ part,
43
+ mimeType: body.mimeType,
44
+ body: body.body,
45
+ base64Encoded: body.base64Encoded,
46
+ };
47
+ }
48
+ catch (error) {
49
+ // normalizeNetBodyError maps CDP failures onto stable codes; body_not_available stays a 404.
50
+ const normalizedError = normalizeNetBodyError(error, part);
51
+ if (normalizedError.code === 'body_not_available') {
52
+ return respondJson(res, { ok: false, error: { code: 'body_not_available', message: normalizedError.message } }, 404);
53
+ }
54
+ throw normalizedError;
55
+ }
56
+ },
57
+ });
56
58
  const parseBodyPart = (value) => {
57
59
  if (!value || value === 'response') {
58
60
  return 'response';
@@ -1 +1 @@
1
- {"version":3,"file":"getNetRequestBody.js","sourceRoot":"","sources":["../../../src/http/routes/getNetRequestBody.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAE5F,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IACjE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,8CAA8C,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACtI,CAAC;IAED,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IACtD,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KA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O,SAAS,CAAA;IACjB,CAAC;IACD,OAAO,IAAI,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,IAAwB,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AAEhH;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,CAAC,GAAiB,EAAE,OAAsB,EAAE,eAA8B,EAAiB,EAAE;IACzH,IAAI,eAAe,EAAE,CAAC;QACrB,OAAO,eAAe,CAAA;IACvB,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,OAAO,GAAG,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAA;AAC9D,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNetRequests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetRequests.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetRequests.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YAqBpB,CAAA"}
1
+ {"version":3,"file":"getNetRequests.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetRequests.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,mDAmBhB,CAAA"}
@@ -1,23 +1,21 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { parseNetRequestFilters, toNetRequestEventQuery } from './netFilters.js';
3
- import { respondJson, clampNumber } from '../httpUtils.js';
4
- export const handle = (_req, res, url, ctx) => {
5
- if (!ctx.netBuffer) {
6
- return respondJson(res, { ok: false, error: { code: 'net_disabled', message: 'Network capture is disabled for this watcher' } }, 400);
7
- }
8
- const filters = parseNetRequestFilters(url.searchParams, {
9
- after: clampNumber(url.searchParams.get('after'), 0),
10
- limit: clampNumber(url.searchParams.get('limit'), 500, 1, 5000),
11
- sinceTs: clampNumber(url.searchParams.get('sinceTs'), undefined),
12
- context: ctx.getNetFilterContext?.() ?? null,
13
- });
14
- if (filters.error || !filters.value) {
15
- return respondJson(res, { ok: false, error: { code: 'invalid_net_filter', message: filters.error ?? 'Invalid network filter' } }, 400);
16
- }
17
- emitRequest(ctx, res, 'net/requests', toNetRequestEventQuery(filters.value));
18
- const requests = ctx.netBuffer.listDetailsAfter(filters.value.after, filters.value, filters.value.limit);
19
- const nextAfter = requests.length > 0 ? (requests[requests.length - 1]?.id ?? filters.value.after) : filters.value.after;
20
- const response = { ok: true, requests, nextAfter };
21
- respondJson(res, response);
22
- };
3
+ import { readNetFiltersFromUrl, respondNetDisabled, toNetRequestEventQuery } from './netFilters.js';
4
+ export const route = defineJsonRoute({
5
+ method: 'GET',
6
+ path: '/net/requests',
7
+ handle: ({ res, url, ctx }) => {
8
+ if (!ctx.netBuffer) {
9
+ return respondNetDisabled(res);
10
+ }
11
+ const filters = readNetFiltersFromUrl(url, ctx, res);
12
+ if (!filters) {
13
+ return;
14
+ }
15
+ emitRequest(ctx, res, 'net/requests', toNetRequestEventQuery(filters));
16
+ const requests = ctx.netBuffer.listDetailsAfter(filters.after, filters, filters.limit);
17
+ const nextAfter = requests.length > 0 ? (requests[requests.length - 1]?.id ?? filters.after) : filters.after;
18
+ return { ok: true, requests, nextAfter };
19
+ },
20
+ });
23
21
  //# sourceMappingURL=getNetRequests.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetRequests.js","sourceRoot":"","sources":["../../../src/http/routes/getNetRequests.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAA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AG,CAAC,CAAA;QACpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAM;QACP,CAAC;QAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAA;QAEtE,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QACtF,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAA;QAC5G,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;IACzC,CAAC;CACD,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNetSse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetSse.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetSse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YAqBpB,CAAA"}
1
+ {"version":3,"file":"getNetSse.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetSse.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,mDAmBhB,CAAA"}
@@ -1,23 +1,21 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { parseNetRequestFilters, toNetRequestEventQuery } from './netFilters.js';
3
- import { clampNumber, respondJson } from '../httpUtils.js';
4
- export const handle = (_req, res, url, ctx) => {
5
- if (!ctx.realtimeNetBuffer) {
6
- return respondJson(res, { ok: false, error: { code: 'net_disabled', message: 'Network capture is disabled for this watcher' } }, 400);
7
- }
8
- const filters = parseNetRequestFilters(url.searchParams, {
9
- after: clampNumber(url.searchParams.get('after'), 0),
10
- limit: clampNumber(url.searchParams.get('limit'), 500, 1, 5000),
11
- sinceTs: clampNumber(url.searchParams.get('sinceTs'), undefined),
12
- context: ctx.getNetFilterContext?.() ?? null,
13
- });
14
- if (filters.error || !filters.value) {
15
- return respondJson(res, { ok: false, error: { code: 'invalid_net_filter', message: filters.error ?? 'Invalid network filter' } }, 400);
16
- }
17
- emitRequest(ctx, res, 'net/sse', toNetRequestEventQuery(filters.value));
18
- const streams = ctx.realtimeNetBuffer.listSseAfter(filters.value.after, filters.value, filters.value.limit);
19
- const nextAfter = streams.length > 0 ? (streams[streams.length - 1]?.id ?? filters.value.after) : filters.value.after;
20
- const response = { ok: true, streams, nextAfter };
21
- respondJson(res, response);
22
- };
3
+ import { readNetFiltersFromUrl, respondNetDisabled, toNetRequestEventQuery } from './netFilters.js';
4
+ export const route = defineJsonRoute({
5
+ method: 'GET',
6
+ path: '/net/sse',
7
+ handle: ({ res, url, ctx }) => {
8
+ if (!ctx.realtimeNetBuffer) {
9
+ return respondNetDisabled(res);
10
+ }
11
+ const filters = readNetFiltersFromUrl(url, ctx, res);
12
+ if (!filters) {
13
+ return;
14
+ }
15
+ emitRequest(ctx, res, 'net/sse', toNetRequestEventQuery(filters));
16
+ const streams = ctx.realtimeNetBuffer.listSseAfter(filters.after, filters, filters.limit);
17
+ const nextAfter = streams.length > 0 ? (streams[streams.length - 1]?.id ?? filters.after) : filters.after;
18
+ return { ok: true, streams, nextAfter };
19
+ },
20
+ });
23
21
  //# sourceMappingURL=getNetSse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetSse.js","sourceRoot":"","sources":["../../../src/http/routes/getNetSse.ts"],"names":[],"mappings":"AAEA,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qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QACpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAM;QACP,CAAC;QAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAA;QAEjE,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QACzF,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAA;QACzG,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;IACxC,CAAC;CACD,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNetTail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetTail.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetTail.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAM9C,eAAO,MAAM,MAAM,EAAE,YAiBpB,CAAA"}
1
+ {"version":3,"file":"getNetTail.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetTail.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,KAAK,mDAoBhB,CAAA"}
@@ -1,34 +1,25 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { parseNetRequestFilters, toNetRequestEventQuery } from './netFilters.js';
3
- import { respondJson, clampNumber } from '../httpUtils.js';
4
- export const handle = async (_req, res, url, ctx) => {
5
- if (!ctx.netBuffer) {
6
- return respondJson(res, { ok: false, error: { code: 'net_disabled', message: 'Network capture is disabled for this watcher' } }, 400);
7
- }
8
- const parsed = parseTailRequest(url, ctx);
9
- if (parsed.error || !parsed.value) {
10
- return respondJson(res, { ok: false, error: { code: 'invalid_net_filter', message: parsed.error ?? 'Invalid network filter' } }, 400);
11
- }
12
- const { filters, timeoutMs } = parsed.value;
13
- emitRequest(ctx, res, 'net/tail', toNetRequestEventQuery(filters, { timeoutMs }));
14
- const requests = await pollNetBuffer(ctx.netBuffer, filters.after, filters, filters.limit, timeoutMs);
15
- const nextAfter = requests.length > 0 ? (requests[requests.length - 1]?.id ?? filters.after) : filters.after;
16
- const response = { ok: true, requests, nextAfter, timedOut: requests.length === 0 };
17
- respondJson(res, response);
18
- };
19
- const parseTailRequest = (url, ctx) => {
20
- const filters = parseNetRequestFilters(url.searchParams, {
21
- after: clampNumber(url.searchParams.get('after'), 0),
22
- limit: clampNumber(url.searchParams.get('limit'), 500, 1, 5000),
23
- sinceTs: clampNumber(url.searchParams.get('sinceTs'), undefined),
24
- context: ctx.getNetFilterContext?.() ?? null,
25
- });
26
- if (filters.error || !filters.value) {
27
- return { error: filters.error ?? 'Invalid network filter' };
28
- }
29
- const timeoutMs = clampNumber(url.searchParams.get('timeoutMs'), 25_000, 1000, 120_000);
30
- return { value: { filters: filters.value, timeoutMs } };
31
- };
3
+ import { readNetFiltersFromUrl, respondNetDisabled, toNetRequestEventQuery } from './netFilters.js';
4
+ import { clampNumber } from '../httpUtils.js';
5
+ export const route = defineJsonRoute({
6
+ method: 'GET',
7
+ path: '/net/tail',
8
+ handle: async ({ res, url, ctx }) => {
9
+ if (!ctx.netBuffer) {
10
+ return respondNetDisabled(res);
11
+ }
12
+ const filters = readNetFiltersFromUrl(url, ctx, res);
13
+ if (!filters) {
14
+ return;
15
+ }
16
+ const timeoutMs = clampNumber(url.searchParams.get('timeoutMs'), 25_000, 1000, 120_000);
17
+ emitRequest(ctx, res, 'net/tail', toNetRequestEventQuery(filters, { timeoutMs }));
18
+ const requests = await pollNetBuffer(ctx.netBuffer, filters.after, filters, filters.limit, timeoutMs);
19
+ const nextAfter = requests.length > 0 ? (requests[requests.length - 1]?.id ?? filters.after) : filters.after;
20
+ return { ok: true, requests, nextAfter, timedOut: requests.length === 0 };
21
+ },
22
+ });
32
23
  const NET_TAIL_POLL_INTERVAL_MS = 100;
33
24
  /**
34
25
  * Poll the in-memory buffer until matching requests appear or the timeout expires.
@@ -1 +1 @@
1
- {"version":3,"file":"getNetTail.js","sourceRoot":"","sources":["../../../src/http/routes/getNetTail.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAyB,MAAM,iBAAiB,CAAA;AACvG,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG1D,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IACjE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,8CAA8C,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACtI,CAAC;IAED,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACzC,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACnC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM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AAE,SAAS,CAAC,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNetWebSocketConnection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetWebSocketConnection.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetWebSocketConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAoBpB,CAAA"}
1
+ {"version":3,"file":"getNetWebSocketConnection.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetWebSocketConnection.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,KAAK,mDAuBhB,CAAA"}
@@ -1,20 +1,25 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
3
+ import { respondNetDisabled } from './netFilters.js';
2
4
  import { clampNumber, normalizeQueryValue, respondJson } from '../httpUtils.js';
3
- export const handle = (_req, res, url, ctx) => {
4
- if (!ctx.realtimeNetBuffer) {
5
- return respondJson(res, { ok: false, error: { code: 'net_disabled', message: 'Network capture is disabled for this watcher' } }, 400);
6
- }
7
- const id = clampNumber(url.searchParams.get('id'), undefined, 1);
8
- const requestId = normalizeQueryValue(url.searchParams.get('requestId'));
9
- if (id == null && !requestId) {
10
- return respondJson(res, { ok: false, error: { code: 'invalid_net_request', message: 'Missing WebSocket connection id' } }, 400);
11
- }
12
- emitRequest(ctx, res, 'net/ws/connection', { id, requestId: requestId ?? undefined });
13
- const connection = id != null ? ctx.realtimeNetBuffer.getWebSocketById(id) : ctx.realtimeNetBuffer.getWebSocketByRequestId(requestId);
14
- if (!connection) {
15
- return respondJson(res, { ok: false, error: { code: 'net_request_not_found', message: 'WebSocket connection not found' } }, 404);
16
- }
17
- const response = { ok: true, connection };
18
- respondJson(res, response);
19
- };
5
+ export const route = defineJsonRoute({
6
+ method: 'GET',
7
+ path: '/net/ws/connection',
8
+ handle: ({ res, url, ctx }) => {
9
+ if (!ctx.realtimeNetBuffer) {
10
+ return respondNetDisabled(res);
11
+ }
12
+ const id = clampNumber(url.searchParams.get('id'), undefined, 1);
13
+ const requestId = normalizeQueryValue(url.searchParams.get('requestId'));
14
+ if (id == null && !requestId) {
15
+ return respondJson(res, { ok: false, error: { code: 'invalid_net_request', message: 'Missing WebSocket connection id' } }, 400);
16
+ }
17
+ emitRequest(ctx, res, 'net/ws/connection', { id, requestId: requestId ?? undefined });
18
+ const connection = id != null ? ctx.realtimeNetBuffer.getWebSocketById(id) : ctx.realtimeNetBuffer.getWebSocketByRequestId(requestId);
19
+ if (!connection) {
20
+ return respondJson(res, { ok: false, error: { code: 'net_request_not_found', message: 'WebSocket connection not found' } }, 404);
21
+ }
22
+ return { ok: true, connection };
23
+ },
24
+ });
20
25
  //# sourceMappingURL=getNetWebSocketConnection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetWebSocketConnection.js","sourceRoot":"","sources":["../../../src/http/routes/getNetWebSocketConnection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE/E,MAAM,CAAC,MAAM,MAAM,GAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3D,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;QAC5B,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,8CAA8C,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACtI,CAAC;IAED,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY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I,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,gCAAgC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;QACjI,CAAC;QAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;IAChC,CAAC;CACD,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNetWebSockets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetWebSockets.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetWebSockets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YAqBpB,CAAA"}
1
+ {"version":3,"file":"getNetWebSockets.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetWebSockets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,mDAmBhB,CAAA"}
@@ -1,23 +1,21 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { parseNetRequestFilters, toNetRequestEventQuery } from './netFilters.js';
3
- import { clampNumber, respondJson } from '../httpUtils.js';
4
- export const handle = (_req, res, url, ctx) => {
5
- if (!ctx.realtimeNetBuffer) {
6
- return respondJson(res, { ok: false, error: { code: 'net_disabled', message: 'Network capture is disabled for this watcher' } }, 400);
7
- }
8
- const filters = parseNetRequestFilters(url.searchParams, {
9
- after: clampNumber(url.searchParams.get('after'), 0),
10
- limit: clampNumber(url.searchParams.get('limit'), 500, 1, 5000),
11
- sinceTs: clampNumber(url.searchParams.get('sinceTs'), undefined),
12
- context: ctx.getNetFilterContext?.() ?? null,
13
- });
14
- if (filters.error || !filters.value) {
15
- return respondJson(res, { ok: false, error: { code: 'invalid_net_filter', message: filters.error ?? 'Invalid network filter' } }, 400);
16
- }
17
- emitRequest(ctx, res, 'net/ws', toNetRequestEventQuery(filters.value));
18
- const connections = ctx.realtimeNetBuffer.listWebSocketsAfter(filters.value.after, filters.value, filters.value.limit);
19
- const nextAfter = connections.length > 0 ? (connections[connections.length - 1]?.id ?? filters.value.after) : filters.value.after;
20
- const response = { ok: true, connections, nextAfter };
21
- respondJson(res, response);
22
- };
3
+ import { readNetFiltersFromUrl, respondNetDisabled, toNetRequestEventQuery } from './netFilters.js';
4
+ export const route = defineJsonRoute({
5
+ method: 'GET',
6
+ path: '/net/ws',
7
+ handle: ({ res, url, ctx }) => {
8
+ if (!ctx.realtimeNetBuffer) {
9
+ return respondNetDisabled(res);
10
+ }
11
+ const filters = readNetFiltersFromUrl(url, ctx, res);
12
+ if (!filters) {
13
+ return;
14
+ }
15
+ emitRequest(ctx, res, 'net/ws', toNetRequestEventQuery(filters));
16
+ const connections = ctx.realtimeNetBuffer.listWebSocketsAfter(filters.after, filters, filters.limit);
17
+ const nextAfter = connections.length > 0 ? (connections[connections.length - 1]?.id ?? filters.after) : filters.after;
18
+ return { ok: true, connections, nextAfter };
19
+ },
20
+ });
23
21
  //# sourceMappingURL=getNetWebSockets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetWebSockets.js","sourceRoot":"","sources":["../../../src/http/routes/getNetWebSockets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE1D,MAAM,CAAC,MAAM,MAAM,GAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3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CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QACpG,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAA;QACrH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;IAC5C,CAAC;CACD,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getStatus.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getStatus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAG5D,eAAO,MAAM,MAAM,EAAE,YAEpB,CAAA"}
1
+ {"version":3,"file":"getStatus.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getStatus.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,mDAIhB,CAAA"}
@@ -1,8 +1,10 @@
1
1
  import { ARGUS_PROTOCOL_VERSION } from '@vforsh/argus-core';
2
- import { respondJson } from '../httpUtils.js';
3
- export const handle = (_req, res, _url, ctx) => {
4
- respondJson(res, buildStatus(ctx));
5
- };
2
+ import { defineJsonRoute } from './defineRoute.js';
3
+ export const route = defineJsonRoute({
4
+ method: 'GET',
5
+ path: '/status',
6
+ handle: ({ ctx }) => buildStatus(ctx),
7
+ });
6
8
  const buildStatus = (ctx) => {
7
9
  const watcher = ctx.getWatcher();
8
10
  const buffer = ctx.buffer.getStats();
@@ -1 +1 @@
1
- {"version":3,"file":"getStatus.js","sourceRoot":"","sources":["../../../src/http/routes/getStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAC5D,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,GAAiB,EAAkB,EAAE;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;IAChC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;IACpC,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,EAAE,CAAA;IAEpC,OAAO;QACN,EAAE,EAAE,IAAI;QACR,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,IAAI;QAC1C,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE;QACvB,MAAM;QACN,OAAO;QACP,eAAe,EAAE,sBAAsB;KACvC,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"getStatus.js","sourceRoot":"","sources":["../../../src/http/routes/getStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAA4B;IAC/D,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC;CACrC,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,CAAC,GAAiB,EAAkB,EAAE;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;IAChC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;IACpC,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,EAAE,CAAA;IAEpC,OAAO;QACN,EAAE,EAAE,IAAI;QACR,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,IAAI;QAC1C,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE;QACvB,MAAM;QACN,OAAO;QACP,eAAe,EAAE,sBAAsB;KACvC,CAAA;AACF,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { RouteHandler } from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getTail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getTail.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getTail.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAc9C,eAAO,MAAM,MAAM,EAAE,YA2BpB,CAAA"}
1
+ {"version":3,"file":"getTail.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getTail.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,KAAK,mDA+BhB,CAAA"}