@vforsh/argus-watcher 0.1.10 → 0.1.12

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 (346) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/buffer/RealtimeNetBuffer.d.ts +31 -0
  3. package/dist/buffer/RealtimeNetBuffer.d.ts.map +1 -0
  4. package/dist/buffer/RealtimeNetBuffer.js +190 -0
  5. package/dist/buffer/RealtimeNetBuffer.js.map +1 -0
  6. package/dist/cdp/editor.d.ts +5 -1
  7. package/dist/cdp/editor.d.ts.map +1 -1
  8. package/dist/cdp/editor.js +44 -0
  9. package/dist/cdp/editor.js.map +1 -1
  10. package/dist/cdp/eval.d.ts +1 -0
  11. package/dist/cdp/eval.d.ts.map +1 -1
  12. package/dist/cdp/eval.js +77 -29
  13. package/dist/cdp/eval.js.map +1 -1
  14. package/dist/cdp/mouse.d.ts +1 -1
  15. package/dist/cdp/mouse.d.ts.map +1 -1
  16. package/dist/cdp/mouse.js +1 -1
  17. package/dist/cdp/mouse.js.map +1 -1
  18. package/dist/cdp/networkCapture.d.ts +2 -0
  19. package/dist/cdp/networkCapture.d.ts.map +1 -1
  20. package/dist/cdp/networkCapture.js +8 -0
  21. package/dist/cdp/networkCapture.js.map +1 -1
  22. package/dist/cdp/networkRealtimeCapture.d.ts +23 -0
  23. package/dist/cdp/networkRealtimeCapture.d.ts.map +1 -0
  24. package/dist/cdp/networkRealtimeCapture.js +161 -0
  25. package/dist/cdp/networkRealtimeCapture.js.map +1 -0
  26. package/dist/cdp/pageIndicator.d.ts.map +1 -1
  27. package/dist/cdp/pageIndicator.js +1 -249
  28. package/dist/cdp/pageIndicator.js.map +1 -1
  29. package/dist/cdp/pageIndicatorScript.d.ts +19 -0
  30. package/dist/cdp/pageIndicatorScript.d.ts.map +1 -0
  31. package/dist/cdp/pageIndicatorScript.js +351 -0
  32. package/dist/cdp/pageIndicatorScript.js.map +1 -0
  33. package/dist/cdp/screenshot.d.ts.map +1 -1
  34. package/dist/cdp/screenshot.js +67 -19
  35. package/dist/cdp/screenshot.js.map +1 -1
  36. package/dist/events.d.ts +17 -2
  37. package/dist/events.d.ts.map +1 -1
  38. package/dist/http/routes/authCookies.d.ts +5 -10
  39. package/dist/http/routes/authCookies.d.ts.map +1 -1
  40. package/dist/http/routes/authCookies.js +17 -30
  41. package/dist/http/routes/authCookies.js.map +1 -1
  42. package/dist/http/routes/defineDomTargetRoute.d.ts +59 -0
  43. package/dist/http/routes/defineDomTargetRoute.d.ts.map +1 -0
  44. package/dist/http/routes/defineDomTargetRoute.js +39 -0
  45. package/dist/http/routes/defineDomTargetRoute.js.map +1 -0
  46. package/dist/http/routes/defineRoute.d.ts +39 -0
  47. package/dist/http/routes/defineRoute.d.ts.map +1 -0
  48. package/dist/http/routes/defineRoute.js +41 -0
  49. package/dist/http/routes/defineRoute.js.map +1 -0
  50. package/dist/http/routes/domSelectorRoute.d.ts +4 -11
  51. package/dist/http/routes/domSelectorRoute.d.ts.map +1 -1
  52. package/dist/http/routes/domSelectorRoute.js +9 -17
  53. package/dist/http/routes/domSelectorRoute.js.map +1 -1
  54. package/dist/http/routes/getAuthCookies.d.ts +1 -2
  55. package/dist/http/routes/getAuthCookies.d.ts.map +1 -1
  56. package/dist/http/routes/getAuthCookies.js +14 -14
  57. package/dist/http/routes/getAuthCookies.js.map +1 -1
  58. package/dist/http/routes/getAuthState.d.ts +1 -2
  59. package/dist/http/routes/getAuthState.d.ts.map +1 -1
  60. package/dist/http/routes/getAuthState.js +13 -13
  61. package/dist/http/routes/getAuthState.js.map +1 -1
  62. package/dist/http/routes/getDialog.d.ts +1 -2
  63. package/dist/http/routes/getDialog.d.ts.map +1 -1
  64. package/dist/http/routes/getDialog.js +7 -10
  65. package/dist/http/routes/getDialog.js.map +1 -1
  66. package/dist/http/routes/getEmulation.d.ts +1 -2
  67. package/dist/http/routes/getEmulation.d.ts.map +1 -1
  68. package/dist/http/routes/getEmulation.js +7 -7
  69. package/dist/http/routes/getEmulation.js.map +1 -1
  70. package/dist/http/routes/getExtensionTabs.d.ts +2 -0
  71. package/dist/http/routes/getExtensionTabs.d.ts.map +1 -0
  72. package/dist/http/routes/getExtensionTabs.js +24 -0
  73. package/dist/http/routes/getExtensionTabs.js.map +1 -0
  74. package/dist/http/routes/getLogs.d.ts +1 -2
  75. package/dist/http/routes/getLogs.d.ts.map +1 -1
  76. package/dist/http/routes/getLogs.js +31 -26
  77. package/dist/http/routes/getLogs.js.map +1 -1
  78. package/dist/http/routes/getNet.d.ts +1 -2
  79. package/dist/http/routes/getNet.d.ts.map +1 -1
  80. package/dist/http/routes/getNet.js +19 -21
  81. package/dist/http/routes/getNet.js.map +1 -1
  82. package/dist/http/routes/getNetRequest.d.ts +1 -2
  83. package/dist/http/routes/getNetRequest.d.ts.map +1 -1
  84. package/dist/http/routes/getNetRequest.js +22 -20
  85. package/dist/http/routes/getNetRequest.js.map +1 -1
  86. package/dist/http/routes/getNetRequestBody.d.ts +1 -2
  87. package/dist/http/routes/getNetRequestBody.d.ts.map +1 -1
  88. package/dist/http/routes/getNetRequestBody.js +53 -51
  89. package/dist/http/routes/getNetRequestBody.js.map +1 -1
  90. package/dist/http/routes/getNetRequests.d.ts +1 -2
  91. package/dist/http/routes/getNetRequests.d.ts.map +1 -1
  92. package/dist/http/routes/getNetRequests.js +19 -21
  93. package/dist/http/routes/getNetRequests.js.map +1 -1
  94. package/dist/http/routes/getNetSse.d.ts +2 -0
  95. package/dist/http/routes/getNetSse.d.ts.map +1 -0
  96. package/dist/http/routes/getNetSse.js +21 -0
  97. package/dist/http/routes/getNetSse.js.map +1 -0
  98. package/dist/http/routes/getNetTail.d.ts +1 -2
  99. package/dist/http/routes/getNetTail.d.ts.map +1 -1
  100. package/dist/http/routes/getNetTail.js +21 -30
  101. package/dist/http/routes/getNetTail.js.map +1 -1
  102. package/dist/http/routes/getNetWebSocketConnection.d.ts +2 -0
  103. package/dist/http/routes/getNetWebSocketConnection.d.ts.map +1 -0
  104. package/dist/http/routes/getNetWebSocketConnection.js +25 -0
  105. package/dist/http/routes/getNetWebSocketConnection.js.map +1 -0
  106. package/dist/http/routes/getNetWebSockets.d.ts +2 -0
  107. package/dist/http/routes/getNetWebSockets.d.ts.map +1 -0
  108. package/dist/http/routes/getNetWebSockets.js +21 -0
  109. package/dist/http/routes/getNetWebSockets.js.map +1 -0
  110. package/dist/http/routes/getStatus.d.ts +1 -2
  111. package/dist/http/routes/getStatus.d.ts.map +1 -1
  112. package/dist/http/routes/getStatus.js +7 -4
  113. package/dist/http/routes/getStatus.js.map +1 -1
  114. package/dist/http/routes/getTail.d.ts +1 -2
  115. package/dist/http/routes/getTail.d.ts.map +1 -1
  116. package/dist/http/routes/getTail.js +31 -26
  117. package/dist/http/routes/getTail.js.map +1 -1
  118. package/dist/http/routes/getTargets.d.ts +1 -2
  119. package/dist/http/routes/getTargets.d.ts.map +1 -1
  120. package/dist/http/routes/getTargets.js +14 -13
  121. package/dist/http/routes/getTargets.js.map +1 -1
  122. package/dist/http/routes/getThrottle.d.ts +1 -2
  123. package/dist/http/routes/getThrottle.d.ts.map +1 -1
  124. package/dist/http/routes/getThrottle.js +7 -7
  125. package/dist/http/routes/getThrottle.js.map +1 -1
  126. package/dist/http/routes/index.d.ts +6 -8
  127. package/dist/http/routes/index.d.ts.map +1 -1
  128. package/dist/http/routes/index.js +115 -102
  129. package/dist/http/routes/index.js.map +1 -1
  130. package/dist/http/routes/netFilters.d.ts +10 -0
  131. package/dist/http/routes/netFilters.d.ts.map +1 -1
  132. package/dist/http/routes/netFilters.js +26 -3
  133. package/dist/http/routes/netFilters.js.map +1 -1
  134. package/dist/http/routes/netMock.d.ts +3 -0
  135. package/dist/http/routes/netMock.d.ts.map +1 -0
  136. package/dist/http/routes/netMock.js +141 -0
  137. package/dist/http/routes/netMock.js.map +1 -0
  138. package/dist/http/routes/postAttach.d.ts +1 -2
  139. package/dist/http/routes/postAttach.d.ts.map +1 -1
  140. package/dist/http/routes/postAttach.js +19 -21
  141. package/dist/http/routes/postAttach.js.map +1 -1
  142. package/dist/http/routes/postAuthStateLoad.d.ts +1 -2
  143. package/dist/http/routes/postAuthStateLoad.d.ts.map +1 -1
  144. package/dist/http/routes/postAuthStateLoad.js +29 -34
  145. package/dist/http/routes/postAuthStateLoad.js.map +1 -1
  146. package/dist/http/routes/postCodeEdit.d.ts +2 -0
  147. package/dist/http/routes/postCodeEdit.d.ts.map +1 -0
  148. package/dist/http/routes/postCodeEdit.js +21 -0
  149. package/dist/http/routes/postCodeEdit.js.map +1 -0
  150. package/dist/http/routes/postCodeGrep.d.ts +1 -2
  151. package/dist/http/routes/postCodeGrep.d.ts.map +1 -1
  152. package/dist/http/routes/postCodeGrep.js +20 -25
  153. package/dist/http/routes/postCodeGrep.js.map +1 -1
  154. package/dist/http/routes/postCodeList.d.ts +1 -2
  155. package/dist/http/routes/postCodeList.d.ts.map +1 -1
  156. package/dist/http/routes/postCodeList.js +14 -19
  157. package/dist/http/routes/postCodeList.js.map +1 -1
  158. package/dist/http/routes/postCodeRead.d.ts +1 -2
  159. package/dist/http/routes/postCodeRead.d.ts.map +1 -1
  160. package/dist/http/routes/postCodeRead.js +24 -29
  161. package/dist/http/routes/postCodeRead.js.map +1 -1
  162. package/dist/http/routes/postDetach.d.ts +1 -2
  163. package/dist/http/routes/postDetach.d.ts.map +1 -1
  164. package/dist/http/routes/postDetach.js +19 -21
  165. package/dist/http/routes/postDetach.js.map +1 -1
  166. package/dist/http/routes/postDialog.d.ts +1 -2
  167. package/dist/http/routes/postDialog.d.ts.map +1 -1
  168. package/dist/http/routes/postDialog.js +30 -29
  169. package/dist/http/routes/postDialog.js.map +1 -1
  170. package/dist/http/routes/postDomAdd.d.ts +1 -2
  171. package/dist/http/routes/postDomAdd.d.ts.map +1 -1
  172. package/dist/http/routes/postDomAdd.js +44 -48
  173. package/dist/http/routes/postDomAdd.js.map +1 -1
  174. package/dist/http/routes/postDomClick.d.ts +1 -2
  175. package/dist/http/routes/postDomClick.d.ts.map +1 -1
  176. package/dist/http/routes/postDomClick.js +25 -57
  177. package/dist/http/routes/postDomClick.js.map +1 -1
  178. package/dist/http/routes/postDomFill.d.ts +1 -2
  179. package/dist/http/routes/postDomFill.d.ts.map +1 -1
  180. package/dist/http/routes/postDomFill.js +17 -49
  181. package/dist/http/routes/postDomFill.js.map +1 -1
  182. package/dist/http/routes/postDomFocus.d.ts +1 -2
  183. package/dist/http/routes/postDomFocus.d.ts.map +1 -1
  184. package/dist/http/routes/postDomFocus.js +9 -39
  185. package/dist/http/routes/postDomFocus.js.map +1 -1
  186. package/dist/http/routes/postDomHover.d.ts +1 -2
  187. package/dist/http/routes/postDomHover.d.ts.map +1 -1
  188. package/dist/http/routes/postDomHover.js +9 -39
  189. package/dist/http/routes/postDomHover.js.map +1 -1
  190. package/dist/http/routes/postDomInfo.d.ts +1 -2
  191. package/dist/http/routes/postDomInfo.d.ts.map +1 -1
  192. package/dist/http/routes/postDomInfo.js +14 -20
  193. package/dist/http/routes/postDomInfo.js.map +1 -1
  194. package/dist/http/routes/postDomKeydown.d.ts +1 -2
  195. package/dist/http/routes/postDomKeydown.d.ts.map +1 -1
  196. package/dist/http/routes/postDomKeydown.js +26 -30
  197. package/dist/http/routes/postDomKeydown.js.map +1 -1
  198. package/dist/http/routes/postDomModify.d.ts +1 -2
  199. package/dist/http/routes/postDomModify.d.ts.map +1 -1
  200. package/dist/http/routes/postDomModify.js +30 -41
  201. package/dist/http/routes/postDomModify.js.map +1 -1
  202. package/dist/http/routes/postDomRemove.d.ts +1 -2
  203. package/dist/http/routes/postDomRemove.d.ts.map +1 -1
  204. package/dist/http/routes/postDomRemove.js +13 -18
  205. package/dist/http/routes/postDomRemove.js.map +1 -1
  206. package/dist/http/routes/postDomScroll.d.ts +1 -2
  207. package/dist/http/routes/postDomScroll.d.ts.map +1 -1
  208. package/dist/http/routes/postDomScroll.js +37 -42
  209. package/dist/http/routes/postDomScroll.js.map +1 -1
  210. package/dist/http/routes/postDomScrollTo.d.ts +1 -2
  211. package/dist/http/routes/postDomScrollTo.d.ts.map +1 -1
  212. package/dist/http/routes/postDomScrollTo.js +42 -48
  213. package/dist/http/routes/postDomScrollTo.js.map +1 -1
  214. package/dist/http/routes/postDomSetFile.d.ts +1 -2
  215. package/dist/http/routes/postDomSetFile.d.ts.map +1 -1
  216. package/dist/http/routes/postDomSetFile.js +29 -32
  217. package/dist/http/routes/postDomSetFile.js.map +1 -1
  218. package/dist/http/routes/postDomTree.d.ts +1 -2
  219. package/dist/http/routes/postDomTree.d.ts.map +1 -1
  220. package/dist/http/routes/postDomTree.js +13 -17
  221. package/dist/http/routes/postDomTree.js.map +1 -1
  222. package/dist/http/routes/postEmulation.d.ts +1 -2
  223. package/dist/http/routes/postEmulation.d.ts.map +1 -1
  224. package/dist/http/routes/postEmulation.js +29 -39
  225. package/dist/http/routes/postEmulation.js.map +1 -1
  226. package/dist/http/routes/postEval.d.ts +1 -2
  227. package/dist/http/routes/postEval.d.ts.map +1 -1
  228. package/dist/http/routes/postEval.js +31 -22
  229. package/dist/http/routes/postEval.js.map +1 -1
  230. package/dist/http/routes/postLocate.d.ts +2 -4
  231. package/dist/http/routes/postLocate.d.ts.map +1 -1
  232. package/dist/http/routes/postLocate.js +40 -60
  233. package/dist/http/routes/postLocate.js.map +1 -1
  234. package/dist/http/routes/postNetClear.d.ts +1 -2
  235. package/dist/http/routes/postNetClear.d.ts.map +1 -1
  236. package/dist/http/routes/postNetClear.js +14 -12
  237. package/dist/http/routes/postNetClear.js.map +1 -1
  238. package/dist/http/routes/postReload.d.ts +1 -2
  239. package/dist/http/routes/postReload.d.ts.map +1 -1
  240. package/dist/http/routes/postReload.js +10 -16
  241. package/dist/http/routes/postReload.js.map +1 -1
  242. package/dist/http/routes/postScreenshot.d.ts +1 -2
  243. package/dist/http/routes/postScreenshot.d.ts.map +1 -1
  244. package/dist/http/routes/postScreenshot.js +35 -12
  245. package/dist/http/routes/postScreenshot.js.map +1 -1
  246. package/dist/http/routes/postShutdown.d.ts +1 -2
  247. package/dist/http/routes/postShutdown.d.ts.map +1 -1
  248. package/dist/http/routes/postShutdown.js +15 -11
  249. package/dist/http/routes/postShutdown.js.map +1 -1
  250. package/dist/http/routes/postSnapshot.d.ts +1 -2
  251. package/dist/http/routes/postSnapshot.d.ts.map +1 -1
  252. package/dist/http/routes/postSnapshot.js +21 -26
  253. package/dist/http/routes/postSnapshot.js.map +1 -1
  254. package/dist/http/routes/postThrottle.d.ts +1 -2
  255. package/dist/http/routes/postThrottle.d.ts.map +1 -1
  256. package/dist/http/routes/postThrottle.js +26 -35
  257. package/dist/http/routes/postThrottle.js.map +1 -1
  258. package/dist/http/routes/postTraceStart.d.ts +1 -2
  259. package/dist/http/routes/postTraceStart.d.ts.map +1 -1
  260. package/dist/http/routes/postTraceStart.js +8 -16
  261. package/dist/http/routes/postTraceStart.js.map +1 -1
  262. package/dist/http/routes/postTraceStop.d.ts +1 -2
  263. package/dist/http/routes/postTraceStop.d.ts.map +1 -1
  264. package/dist/http/routes/postTraceStop.js +8 -16
  265. package/dist/http/routes/postTraceStop.js.map +1 -1
  266. package/dist/http/routes/postVisibility.d.ts +2 -0
  267. package/dist/http/routes/postVisibility.d.ts.map +1 -0
  268. package/dist/http/routes/postVisibility.js +23 -0
  269. package/dist/http/routes/postVisibility.js.map +1 -0
  270. package/dist/http/routes/storage.d.ts +2 -4
  271. package/dist/http/routes/storage.d.ts.map +1 -1
  272. package/dist/http/routes/storage.js +13 -25
  273. package/dist/http/routes/storage.js.map +1 -1
  274. package/dist/http/server.d.ts +14 -9
  275. package/dist/http/server.d.ts.map +1 -1
  276. package/dist/http/server.js.map +1 -1
  277. package/dist/index.d.ts +5 -5
  278. package/dist/index.d.ts.map +1 -1
  279. package/dist/index.js.map +1 -1
  280. package/dist/native-messaging/control-session-manager.d.ts +16 -0
  281. package/dist/native-messaging/control-session-manager.d.ts.map +1 -0
  282. package/dist/native-messaging/control-session-manager.js +50 -0
  283. package/dist/native-messaging/control-session-manager.js.map +1 -0
  284. package/dist/native-messaging/messaging.d.ts +4 -4
  285. package/dist/native-messaging/messaging.d.ts.map +1 -1
  286. package/dist/native-messaging/messaging.js.map +1 -1
  287. package/dist/native-messaging/session-manager.d.ts +2 -15
  288. package/dist/native-messaging/session-manager.d.ts.map +1 -1
  289. package/dist/native-messaging/session-manager.js +0 -34
  290. package/dist/native-messaging/session-manager.js.map +1 -1
  291. package/dist/native-messaging/types.d.ts +19 -2
  292. package/dist/native-messaging/types.d.ts.map +1 -1
  293. package/dist/net/NetMockController.d.ts +26 -0
  294. package/dist/net/NetMockController.d.ts.map +1 -0
  295. package/dist/net/NetMockController.js +264 -0
  296. package/dist/net/NetMockController.js.map +1 -0
  297. package/dist/runtime/watcherServices.d.ts.map +1 -1
  298. package/dist/runtime/watcherServices.js +12 -3
  299. package/dist/runtime/watcherServices.js.map +1 -1
  300. package/dist/runtime/watcherSetup.d.ts +7 -0
  301. package/dist/runtime/watcherSetup.d.ts.map +1 -1
  302. package/dist/runtime/watcherSetup.js +9 -0
  303. package/dist/runtime/watcherSetup.js.map +1 -1
  304. package/dist/scripts/install-host.js +58 -54
  305. package/dist/scripts/install-host.js.map +1 -1
  306. package/dist/sources/extension-control-source.d.ts +9 -0
  307. package/dist/sources/extension-control-source.d.ts.map +1 -0
  308. package/dist/sources/extension-control-source.js +88 -0
  309. package/dist/sources/extension-control-source.js.map +1 -0
  310. package/dist/sources/extension-delegating-session.d.ts +15 -2
  311. package/dist/sources/extension-delegating-session.d.ts.map +1 -1
  312. package/dist/sources/extension-delegating-session.js +16 -4
  313. package/dist/sources/extension-delegating-session.js.map +1 -1
  314. package/dist/sources/extension-frame-runtime.d.ts.map +1 -1
  315. package/dist/sources/extension-frame-runtime.js +10 -2
  316. package/dist/sources/extension-frame-runtime.js.map +1 -1
  317. package/dist/sources/extension-frame-state.d.ts +23 -0
  318. package/dist/sources/extension-frame-state.d.ts.map +1 -1
  319. package/dist/sources/extension-frame-state.js +41 -0
  320. package/dist/sources/extension-frame-state.js.map +1 -1
  321. package/dist/sources/extension-source.d.ts +3 -1
  322. package/dist/sources/extension-source.d.ts.map +1 -1
  323. package/dist/sources/extension-source.js +51 -96
  324. package/dist/sources/extension-source.js.map +1 -1
  325. package/dist/sources/extension-target-recovery.d.ts +32 -0
  326. package/dist/sources/extension-target-recovery.d.ts.map +1 -0
  327. package/dist/sources/extension-target-recovery.js +114 -0
  328. package/dist/sources/extension-target-recovery.js.map +1 -0
  329. package/dist/sources/types.d.ts +15 -0
  330. package/dist/sources/types.d.ts.map +1 -1
  331. package/dist/startWatcherRuntime.d.ts.map +1 -1
  332. package/dist/startWatcherRuntime.js +11 -1
  333. package/dist/startWatcherRuntime.js.map +1 -1
  334. package/dist/visibility/VisibilityController.d.ts +27 -0
  335. package/dist/visibility/VisibilityController.d.ts.map +1 -0
  336. package/dist/visibility/VisibilityController.js +48 -0
  337. package/dist/visibility/VisibilityController.js.map +1 -0
  338. package/package.json +2 -2
  339. package/dist/http/routes/postStorageLocal.d.ts +0 -2
  340. package/dist/http/routes/postStorageLocal.d.ts.map +0 -1
  341. package/dist/http/routes/postStorageLocal.js +0 -3
  342. package/dist/http/routes/postStorageLocal.js.map +0 -1
  343. package/dist/http/routes/postStorageSession.d.ts +0 -2
  344. package/dist/http/routes/postStorageSession.d.ts.map +0 -1
  345. package/dist/http/routes/postStorageSession.js +0 -3
  346. package/dist/http/routes/postStorageSession.js.map +0 -1
@@ -0,0 +1,24 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
2
+ import { normalizeQueryValue, respondJson } from '../httpUtils.js';
3
+ import { emitRequest } from './types.js';
4
+ export const route = defineJsonRoute({
5
+ method: 'GET',
6
+ path: '/tabs',
7
+ extensionOnly: true,
8
+ handle: async ({ res, url, ctx }) => {
9
+ if (!ctx.sourceHandle?.listTabs) {
10
+ return respondJson(res, { ok: false, error: { message: 'Not available', code: 'not_available' } }, 400);
11
+ }
12
+ // Emitted manually to include query metadata in the request event.
13
+ emitRequest(ctx, res, 'tabs', {
14
+ url: url.searchParams.get('url') ?? undefined,
15
+ title: url.searchParams.get('title') ?? undefined,
16
+ });
17
+ const tabs = await ctx.sourceHandle.listTabs({
18
+ url: normalizeQueryValue(url.searchParams.get('url')),
19
+ title: normalizeQueryValue(url.searchParams.get('title')),
20
+ });
21
+ return { ok: true, tabs };
22
+ },
23
+ });
24
+ //# sourceMappingURL=getExtensionTabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExtensionTabs.js","sourceRoot":"","sources":["../../../src/http/routes/getExtensionTabs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAmC;IACtE,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,OAAO;IACb,aAAa,EAAE,IAAI;IACnB,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE;QACnC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC;YACjC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;QACxG,CAAC;QAED,mEAAmE;QACnE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE;YAC7B,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,SAAS;YAC7C,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,SAAS;SACjD,CAAC,CAAA;QAEF,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC;YAC5C,GAAG,EAAE,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrD,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACzD,CAAC,CAAA;QACF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IAC1B,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=getLogs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getLogs.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getLogs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAc9C,eAAO,MAAM,MAAM,EAAE,YA2BpB,CAAA"}
1
+ {"version":3,"file":"getLogs.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getLogs.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,KAAK,mDA+BhB,CAAA"}
@@ -1,28 +1,33 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { respondJson, respondInvalidMatch, respondInvalidMatchCase, clampNumber, parseLevels, resolveMatchCase, normalizeMatchPatterns, compileMatchPatterns, normalizeQueryValue, } from '../httpUtils.js';
3
- export const handle = (_req, res, url, ctx) => {
4
- const after = clampNumber(url.searchParams.get('after'), 0);
5
- const limit = clampNumber(url.searchParams.get('limit'), 500, 1, 5000);
6
- const levels = parseLevels(url.searchParams.get('levels'));
7
- const match = url.searchParams.getAll('match');
8
- const matchCase = resolveMatchCase(url.searchParams.get('matchCase'));
9
- if (!matchCase) {
10
- return respondInvalidMatchCase(res);
11
- }
12
- const source = normalizeQueryValue(url.searchParams.get('source'));
13
- const sinceTs = clampNumber(url.searchParams.get('sinceTs'), undefined);
14
- const matchPatterns = normalizeMatchPatterns(match);
15
- if (matchPatterns.error) {
16
- return respondInvalidMatch(res, matchPatterns.error);
17
- }
18
- const compiledMatch = compileMatchPatterns(matchPatterns.patterns, matchCase);
19
- if (compiledMatch.error) {
20
- return respondInvalidMatch(res, compiledMatch.error);
21
- }
22
- emitRequest(ctx, res, 'logs', { after, limit, levels, match: matchPatterns.patterns, matchCase, source, sinceTs });
23
- const events = ctx.buffer.listAfter(after, { levels, match: compiledMatch.match, source, sinceTs }, limit);
24
- const nextAfter = events.length > 0 ? (events[events.length - 1]?.id ?? after) : after;
25
- const response = { ok: true, events, nextAfter };
26
- respondJson(res, response);
27
- };
3
+ import { respondInvalidMatch, respondInvalidMatchCase, clampNumber, parseLevels, resolveMatchCase, normalizeMatchPatterns, compileMatchPatterns, normalizeQueryValue, } from '../httpUtils.js';
4
+ export const route = defineJsonRoute({
5
+ method: 'GET',
6
+ path: '/logs',
7
+ handle: ({ res, url, ctx }) => {
8
+ const after = clampNumber(url.searchParams.get('after'), 0);
9
+ const limit = clampNumber(url.searchParams.get('limit'), 500, 1, 5000);
10
+ const levels = parseLevels(url.searchParams.get('levels'));
11
+ const match = url.searchParams.getAll('match');
12
+ const matchCase = resolveMatchCase(url.searchParams.get('matchCase'));
13
+ if (!matchCase) {
14
+ return respondInvalidMatchCase(res);
15
+ }
16
+ const source = normalizeQueryValue(url.searchParams.get('source'));
17
+ const sinceTs = clampNumber(url.searchParams.get('sinceTs'), undefined);
18
+ const matchPatterns = normalizeMatchPatterns(match);
19
+ if (matchPatterns.error) {
20
+ return respondInvalidMatch(res, matchPatterns.error);
21
+ }
22
+ const compiledMatch = compileMatchPatterns(matchPatterns.patterns, matchCase);
23
+ if (compiledMatch.error) {
24
+ return respondInvalidMatch(res, compiledMatch.error);
25
+ }
26
+ // Emitted manually to include query metadata in the request event.
27
+ emitRequest(ctx, res, 'logs', { after, limit, levels, match: matchPatterns.patterns, matchCase, source, sinceTs });
28
+ const events = ctx.buffer.listAfter(after, { levels, match: compiledMatch.match, source, sinceTs }, limit);
29
+ const nextAfter = events.length > 0 ? (events[events.length - 1]?.id ?? after) : after;
30
+ return { ok: true, events, nextAfter };
31
+ },
32
+ });
28
33
  //# sourceMappingURL=getLogs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getLogs.js","sourceRoot":"","sources":["../../../src/http/routes/getLogs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,iBAAiB,CAAA;AAExB,MAAM,CAAC,MAAM,MAAM,GAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3D,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;IACtE,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC1D,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAA;IACrE,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAA;IACp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from './types.js';
2
- export declare const handle: RouteHandler;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNet.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YAqBpB,CAAA"}
1
+ {"version":3,"file":"getNet.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNet.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', toNetRequestEventQuery(filters.value));
18
- const requests = ctx.netBuffer.listAfter(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',
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', toNetRequestEventQuery(filters));
16
+ const requests = ctx.netBuffer.listAfter(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=getNet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNet.js","sourceRoot":"","sources":["../../../src/http/routes/getNet.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;IAC3D,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,OAAO,GAAG,sBAAsB,CAAC,GAAG,CAAC,YAAY,EAAE;QACxD,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpD,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,G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;
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
3
2
  //# sourceMappingURL=getNetRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetRequest.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YAsBpB,CAAA"}
1
+ {"version":3,"file":"getNetRequest.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetRequest.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,KAAK,mDAsBhB,CAAA"}
@@ -1,23 +1,25 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
1
2
  import { emitRequest } from './types.js';
2
- import { respondJson } from '../httpUtils.js';
3
+ import { respondNetDisabled } from './netFilters.js';
3
4
  import { parseNetRequestLookup, resolveNetRequestLookup } from './netRequestLookup.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 lookup = parseNetRequestLookup(url.searchParams);
9
- if (!lookup) {
10
- return respondJson(res, { ok: false, error: { code: 'invalid_request', message: 'Either id or requestId is required' } }, 400);
11
- }
12
- emitRequest(ctx, res, 'net/request', {
13
- id: lookup.id,
14
- requestId: lookup.requestId,
15
- });
16
- const request = resolveNetRequestLookup(ctx.netBuffer, lookup);
17
- if (!request) {
18
- return respondJson(res, { ok: false, error: { code: 'not_found', message: 'Network request not found' } }, 404);
19
- }
20
- const response = { ok: true, request };
21
- respondJson(res, response);
22
- };
5
+ import { respondJson } from '../httpUtils.js';
6
+ export const route = defineJsonRoute({
7
+ method: 'GET',
8
+ path: '/net/request',
9
+ handle: ({ res, url, ctx }) => {
10
+ if (!ctx.netBuffer) {
11
+ return respondNetDisabled(res);
12
+ }
13
+ const lookup = parseNetRequestLookup(url.searchParams);
14
+ if (!lookup) {
15
+ return respondJson(res, { ok: false, error: { code: 'invalid_request', message: 'Either id or requestId is required' } }, 400);
16
+ }
17
+ emitRequest(ctx, res, 'net/request', { id: lookup.id, requestId: lookup.requestId });
18
+ const request = resolveNetRequestLookup(ctx.netBuffer, lookup);
19
+ if (!request) {
20
+ return respondJson(res, { ok: false, error: { code: 'not_found', message: 'Network request not found' } }, 404);
21
+ }
22
+ return { ok: true, request };
23
+ },
24
+ });
23
25
  //# sourceMappingURL=getNetRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetRequest.js","sourceRoot":"","sources":["../../../src/http/routes/getNetRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEtF,MAAM,CAAC,MAAM,MAAM,GAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3D,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,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,oCAAoC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IAC/H,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,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AC,CAAA;QACtD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,oCAAoC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;QAC/H,CAAC;QAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;QAEpF,MAAM,OAAO,GAAG,uBAAuB,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAC9D,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,2BAA2B,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;QAChH,CAAC;QAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IAC7B,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=getNetRequestBody.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNetRequestBody.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetRequestBody.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,YAAY,CAAA;AAM5D,eAAO,MAAM,MAAM,EAAE,YA4DpB,CAAA"}
1
+ {"version":3,"file":"getNetRequestBody.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetRequestBody.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,KAAK,mDA4DhB,CAAA"}
@@ -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,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,oCAAoC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IAC/H,CAAC;IAED,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,K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AAiB,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,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;IAC3D,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,WAAW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ACtF,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"}
@@ -0,0 +1,2 @@
1
+ export declare const route: import("./defineRoute.js").WatcherRouteDefinition;
2
+ //# sourceMappingURL=getNetSse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNetSse.d.ts","sourceRoot":"","sources":["../../../src/http/routes/getNetSse.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,mDAmBhB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { defineJsonRoute } from './defineRoute.js';
2
+ import { emitRequest } from './types.js';
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
+ });
21
+ //# sourceMappingURL=getNetSse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNetSse.js","sourceRoot":"","sources":["../../../src/http/routes/getNetSse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAEnG,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAA4B;IAC/D,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE;QAC7B,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;YAC5B,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAA;QAC/B,CAAC;QAED,MAAM,OAAO,GAAG,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,CAA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